public class Indexer extends Abstracter
COLLECTION_FILE, docCollection, INCLUDE_BOW, INCLUDE_CNG, INCLUDE_COG, INCLUDE_WNG, index, INDEX_FILE, indexPath, locale, repType
Constructor and Description |
---|
Indexer(java.io.File indexDir,
RepresentationType[] representation)
Default invocation where files are in English
|
Indexer(java.util.Locale lan,
java.io.File indexDir,
RepresentationType[] repr)
Invocation where the documents' language is given and the directory
for the index is provided.
|
Modifier and Type | Method and Description |
---|---|
void |
addDocument(java.io.File file,
java.lang.String id)
Add a new document file to the index
|
void |
addDocument(java.lang.String text,
java.lang.String id)
Add a new document to the index.
|
static void |
main(java.lang.String[] args) |
void |
removeDocument(int id)
Remove document id from the index and documents' collection
|
void |
saveIndex()
Saves the documents into the provided output directory
|
loadIndex
public Indexer(java.util.Locale lan, java.io.File indexDir, RepresentationType[] repr)
lan
- language for the indexed documentsindexDir
- path to the index (or where it should be saved)repr
- representation (to be) indexedpublic Indexer(java.io.File indexDir, RepresentationType[] representation)
indexDir
- path to the index (or where it should be saved)representation
- representation (to be) indexedpublic void addDocument(java.io.File file, java.lang.String id) throws java.io.IOException
file
- id
- java.io.IOException
public void addDocument(java.lang.String text, java.lang.String id)
text
- id
- public void removeDocument(int id)
id
- public void saveIndex()
dir
- public static void main(java.lang.String[] args)