Class CollectionLabeledPairSentenceProvider
- java.lang.Object
-
- org.deeplearning4j.iterator.provider.CollectionLabeledPairSentenceProvider
-
- All Implemented Interfaces:
LabeledPairSentenceProvider
public class CollectionLabeledPairSentenceProvider extends Object implements LabeledPairSentenceProvider
-
-
Constructor Summary
Constructors Constructor Description CollectionLabeledPairSentenceProvider(@NonNull List<String> sentenceL, @NonNull List<String> sentenceR, @NonNull List<String> labelsForSentences)Lists containing sentences to iterate over with a third for labels Sentences in the same position in the first two lists are considered a pairCollectionLabeledPairSentenceProvider(@NonNull List<String> sentenceL, List<String> sentenceR, @NonNull List<String> labelsForSentences, Random rng)Lists containing sentences to iterate over with a third for labels Sentences in the same position in the first two lists are considered a pair
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>allLabels()Return the list of labels - this also defines the class/integer label assignment orderbooleanhasNext()Are there more sentences/documents available?org.nd4j.common.primitives.Triple<String,String,String>nextSentencePair()intnumLabelClasses()Equivalent to allLabels().size()voidreset()Reset the iterator - including shuffling the order, if necessary/appropriateinttotalNumSentences()Return the total number of sentences, or -1 if not available
-
-
-
Constructor Detail
-
CollectionLabeledPairSentenceProvider
public CollectionLabeledPairSentenceProvider(@NonNull @NonNull List<String> sentenceL, @NonNull @NonNull List<String> sentenceR, @NonNull @NonNull List<String> labelsForSentences)Lists containing sentences to iterate over with a third for labels Sentences in the same position in the first two lists are considered a pair- Parameters:
sentenceL-sentenceR-labelsForSentences-
-
CollectionLabeledPairSentenceProvider
public CollectionLabeledPairSentenceProvider(@NonNull @NonNull List<String> sentenceL, List<String> sentenceR, @NonNull @NonNull List<String> labelsForSentences, Random rng)Lists containing sentences to iterate over with a third for labels Sentences in the same position in the first two lists are considered a pair- Parameters:
sentenceL-sentenceR-labelsForSentences-rng- If null, list order is not shuffled
-
-
Method Detail
-
hasNext
public boolean hasNext()
Description copied from interface:LabeledPairSentenceProviderAre there more sentences/documents available?- Specified by:
hasNextin interfaceLabeledPairSentenceProvider
-
nextSentencePair
public org.nd4j.common.primitives.Triple<String,String,String> nextSentencePair()
- Specified by:
nextSentencePairin interfaceLabeledPairSentenceProvider- Returns:
- Triple: two sentence/document texts and label
-
reset
public void reset()
Description copied from interface:LabeledPairSentenceProviderReset the iterator - including shuffling the order, if necessary/appropriate- Specified by:
resetin interfaceLabeledPairSentenceProvider
-
totalNumSentences
public int totalNumSentences()
Description copied from interface:LabeledPairSentenceProviderReturn the total number of sentences, or -1 if not available- Specified by:
totalNumSentencesin interfaceLabeledPairSentenceProvider
-
allLabels
public List<String> allLabels()
Description copied from interface:LabeledPairSentenceProviderReturn the list of labels - this also defines the class/integer label assignment order- Specified by:
allLabelsin interfaceLabeledPairSentenceProvider
-
numLabelClasses
public int numLabelClasses()
Description copied from interface:LabeledPairSentenceProviderEquivalent to allLabels().size()- Specified by:
numLabelClassesin interfaceLabeledPairSentenceProvider
-
-