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 orderboolean
hasNext()
Are there more sentences/documents available?org.nd4j.common.primitives.Triple<String,String,String>
nextSentencePair()
int
numLabelClasses()
Equivalent to allLabels().size()void
reset()
Reset the iterator - including shuffling the order, if necessary/appropriateint
totalNumSentences()
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:LabeledPairSentenceProvider
Are there more sentences/documents available?- Specified by:
hasNext
in interfaceLabeledPairSentenceProvider
-
nextSentencePair
public org.nd4j.common.primitives.Triple<String,String,String> nextSentencePair()
- Specified by:
nextSentencePair
in interfaceLabeledPairSentenceProvider
- Returns:
- Triple: two sentence/document texts and label
-
reset
public void reset()
Description copied from interface:LabeledPairSentenceProvider
Reset the iterator - including shuffling the order, if necessary/appropriate- Specified by:
reset
in interfaceLabeledPairSentenceProvider
-
totalNumSentences
public int totalNumSentences()
Description copied from interface:LabeledPairSentenceProvider
Return the total number of sentences, or -1 if not available- Specified by:
totalNumSentences
in interfaceLabeledPairSentenceProvider
-
allLabels
public List<String> allLabels()
Description copied from interface:LabeledPairSentenceProvider
Return the list of labels - this also defines the class/integer label assignment order- Specified by:
allLabels
in interfaceLabeledPairSentenceProvider
-
numLabelClasses
public int numLabelClasses()
Description copied from interface:LabeledPairSentenceProvider
Equivalent to allLabels().size()- Specified by:
numLabelClasses
in interfaceLabeledPairSentenceProvider
-
-