public class FileLabeledSentenceProvider extends java.lang.Object implements LabeledSentenceProvider
Constructor and Description |
---|
FileLabeledSentenceProvider(java.util.Map<java.lang.String,java.util.List<java.io.File>> filesByLabel) |
FileLabeledSentenceProvider(java.util.Map<java.lang.String,java.util.List<java.io.File>> filesByLabel,
java.util.Random rng) |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
allLabels()
Return the list of labels - this also defines the class/integer label assignment order
|
boolean |
hasNext()
Are there more sentences/documents available?
|
Pair<java.lang.String,java.lang.String> |
nextSentence() |
int |
numLabelClasses()
Equivalent to allLabels().size()
|
void |
reset()
Reset the iterator - including shuffling the order, if necessary/appropriate
|
int |
totalNumSentences()
Return the total number of sentences, or -1 if not available
|
public FileLabeledSentenceProvider(java.util.Map<java.lang.String,java.util.List<java.io.File>> filesByLabel)
filesByLabel
- Key: label. Value: list of files for that labelpublic FileLabeledSentenceProvider(@NonNull java.util.Map<java.lang.String,java.util.List<java.io.File>> filesByLabel, java.util.Random rng)
filesByLabel
- Key: label. Value: list of files for that labelrng
- Random number generator. May be null.public boolean hasNext()
LabeledSentenceProvider
hasNext
in interface LabeledSentenceProvider
public Pair<java.lang.String,java.lang.String> nextSentence()
nextSentence
in interface LabeledSentenceProvider
public void reset()
LabeledSentenceProvider
reset
in interface LabeledSentenceProvider
public int totalNumSentences()
LabeledSentenceProvider
totalNumSentences
in interface LabeledSentenceProvider
public java.util.List<java.lang.String> allLabels()
LabeledSentenceProvider
allLabels
in interface LabeledSentenceProvider
public int numLabelClasses()
LabeledSentenceProvider
numLabelClasses
in interface LabeledSentenceProvider