public interface InvertedIndex<T extends SequenceElement> extends Serializable
Modifier and Type | Method and Description |
---|---|
void |
addLabelForDoc(int doc,
String label)
Adds words to the given document
|
void |
addLabelForDoc(int doc,
T word)
Add word to a document
|
void |
addLabelsForDoc(int doc,
Collection<String> label)
Adds words to the given document
|
void |
addLabelsForDoc(int doc,
List<T> word)
Add word to a document
|
void |
addWordsToDoc(int doc,
List<T> words)
Adds words to the given document
|
void |
addWordsToDoc(int doc,
List<T> words,
Collection<String> label)
Adds words to the given document
|
void |
addWordsToDoc(int doc,
List<T> words,
String label)
Adds words to the given document
|
void |
addWordsToDoc(int doc,
List<T> words,
T label)
Adds words to the given document
|
void |
addWordsToDocVocabWord(int doc,
List<T> words,
Collection<T> label)
Adds words to the given document
|
void |
addWordToDoc(int doc,
T word)
Add word to a document
|
int[] |
allDocs()
Returns a list of all documents
|
Iterator<List<List<T>>> |
batchIter(int batchSize)
Iterate over batches
|
int |
batchSize()
For word vectors, this is the batch size for which to train on
|
void |
cleanup()
Cleanup any resources used
|
Iterator<List<T>> |
docs()
Iterate over documents
|
List<T> |
document(int index)
Returns a list of words for a document
|
int[] |
documents(T vocabWord)
Returns the list of documents a vocab word is in
|
Pair<List<T>,String> |
documentWithLabel(int index)
Returns a list of words for a document
and the associated label
|
Pair<List<T>,Collection<String>> |
documentWithLabels(int index)
Returns a list of words associated with the document
and the associated labels
|
void |
eachDoc(com.google.common.base.Function<List<T>,Void> func,
ExecutorService exec)
Iterate over each document
|
void |
eachDocWithLabel(com.google.common.base.Function<Pair<List<T>,String>,Void> func,
ExecutorService exec)
Iterate over each document with a label
|
void |
eachDocWithLabels(com.google.common.base.Function<Pair<List<T>,Collection<String>>,Void> func,
ExecutorService exec)
Iterate over each document with a label
|
void |
finish()
Finishes saving data
|
Iterator<List<T>> |
miniBatches()
Iterates over mini batches
|
int |
numDocuments()
Returns the number of documents
|
double |
sample()
Sampling for creating mini batches
|
long |
totalWords()
Total number of words in the index
|
void |
unlock()
Unlock the index
|
Iterator<List<List<T>>> batchIter(int batchSize)
void unlock()
void cleanup()
double sample()
Iterator<List<T>> miniBatches()
List<T> document(int index)
index
- Pair<List<T>,String> documentWithLabel(int index)
index
- Pair<List<T>,Collection<String>> documentWithLabels(int index)
index
- int[] documents(T vocabWord)
vocabWord
- the vocab word to get documents forint numDocuments()
int[] allDocs()
void addWordToDoc(int doc, T word)
doc
- the document to add toword
- the word to addvoid addWordsToDoc(int doc, List<T> words)
doc
- the document to add towords
- the words to addvoid addLabelForDoc(int doc, T word)
doc
- the document to add toword
- the word to addvoid addLabelForDoc(int doc, String label)
doc
- the document to add tovoid addWordsToDoc(int doc, List<T> words, String label)
doc
- the document to add towords
- the words to addlabel
- the label for the documentvoid addWordsToDoc(int doc, List<T> words, T label)
doc
- the document to add towords
- the words to addlabel
- the label for the documentvoid addLabelsForDoc(int doc, List<T> word)
doc
- the document to add toword
- the word to addvoid addLabelsForDoc(int doc, Collection<String> label)
doc
- the document to add tolabel
- the labels to addvoid addWordsToDoc(int doc, List<T> words, Collection<String> label)
doc
- the document to add towords
- the words to addlabel
- the label for the documentvoid addWordsToDocVocabWord(int doc, List<T> words, Collection<T> label)
doc
- the document to add towords
- the words to addlabel
- the label for the documentvoid finish()
long totalWords()
int batchSize()
void eachDocWithLabels(com.google.common.base.Function<Pair<List<T>,Collection<String>>,Void> func, ExecutorService exec)
func
- the function to applyexec
- executor service for executionvoid eachDocWithLabel(com.google.common.base.Function<Pair<List<T>,String>,Void> func, ExecutorService exec)
func
- the function to applyexec
- executor service for executionvoid eachDoc(com.google.common.base.Function<List<T>,Void> func, ExecutorService exec)
func
- the function to applyexec
- executor service for executionCopyright © 2016. All Rights Reserved.