public class DefaultInvertedIndex extends Object implements InvertedIndex
Constructor and Description |
---|
DefaultInvertedIndex() |
Modifier and Type | Method and Description |
---|---|
void |
addWordsToDoc(int doc,
List<VocabWord> words)
Adds words to the given document
|
void |
addWordToDoc(int doc,
VocabWord word)
Add word to a document
|
Collection<Integer> |
allDocs()
Returns a list of all documents
|
List<VocabWord> |
document(int index)
Returns a list of words for a document
|
List<Integer> |
documents(VocabWord vocabWord)
Returns the list of documents a vocab word is in
|
void |
finish()
Finishes saving data
|
int |
numDocuments()
Returns the number of documents
|
public List<VocabWord> document(int index)
InvertedIndex
document
in interface InvertedIndex
public List<Integer> documents(VocabWord vocabWord)
InvertedIndex
documents
in interface InvertedIndex
vocabWord
- the vocab word to get documents forpublic int numDocuments()
InvertedIndex
numDocuments
in interface InvertedIndex
public Collection<Integer> allDocs()
InvertedIndex
allDocs
in interface InvertedIndex
public void addWordToDoc(int doc, VocabWord word)
InvertedIndex
addWordToDoc
in interface InvertedIndex
doc
- the document to add toword
- the word to addpublic void addWordsToDoc(int doc, List<VocabWord> words)
InvertedIndex
addWordsToDoc
in interface InvertedIndex
doc
- the document to add towords
- the words to addpublic void finish()
InvertedIndex
finish
in interface InvertedIndex
Copyright © 2014. All rights reserved.