Class SimpleLabelAwareIterator
- java.lang.Object
-
- org.deeplearning4j.text.documentiterator.SimpleLabelAwareIterator
-
- All Implemented Interfaces:
Iterator<LabelledDocument>,LabelAwareIterator
public class SimpleLabelAwareIterator extends Object implements LabelAwareIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected Iterator<LabelledDocument>currentIteratorprotected LabelsSourcelabelsprotected Iterable<LabelledDocument>underlyingIterable
-
Constructor Summary
Constructors Constructor Description SimpleLabelAwareIterator(@NonNull Iterable<LabelledDocument> iterable)Builds LabelAwareIterator instance using Iterable objectSimpleLabelAwareIterator(@NonNull Iterator<LabelledDocument> iterator)Builds LabelAwareIterator instance using Iterator object PLEASE NOTE: If instance is built using Iterator object, reset() method becomes unavailable
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LabelsSourcegetLabelsSource()This method returns LabelsSource instance, containing all labels derived from this iteratorbooleanhasNext()booleanhasNextDocument()This method checks, if there's more LabelledDocuments in underlying iteratorLabelledDocumentnext()LabelledDocumentnextDocument()This method returns next LabelledDocument from underlying iteratorvoidremove()voidreset()This methods resets LabelAwareIterator by creating new Iterator from Iterable internallyvoidshutdown()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Field Detail
-
underlyingIterable
protected transient Iterable<LabelledDocument> underlyingIterable
-
currentIterator
protected transient Iterator<LabelledDocument> currentIterator
-
labels
protected LabelsSource labels
-
-
Constructor Detail
-
SimpleLabelAwareIterator
public SimpleLabelAwareIterator(@NonNull @NonNull Iterable<LabelledDocument> iterable)Builds LabelAwareIterator instance using Iterable object- Parameters:
iterable-
-
SimpleLabelAwareIterator
public SimpleLabelAwareIterator(@NonNull @NonNull Iterator<LabelledDocument> iterator)Builds LabelAwareIterator instance using Iterator object PLEASE NOTE: If instance is built using Iterator object, reset() method becomes unavailable- Parameters:
iterator-
-
-
Method Detail
-
hasNextDocument
public boolean hasNextDocument()
This method checks, if there's more LabelledDocuments in underlying iterator- Specified by:
hasNextDocumentin interfaceLabelAwareIterator- Returns:
-
nextDocument
public LabelledDocument nextDocument()
This method returns next LabelledDocument from underlying iterator- Specified by:
nextDocumentin interfaceLabelAwareIterator- Returns:
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfaceIterator<LabelledDocument>
-
next
public LabelledDocument next()
- Specified by:
nextin interfaceIterator<LabelledDocument>
-
remove
public void remove()
- Specified by:
removein interfaceIterator<LabelledDocument>
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceLabelAwareIterator
-
reset
public void reset()
This methods resets LabelAwareIterator by creating new Iterator from Iterable internally- Specified by:
resetin interfaceLabelAwareIterator
-
getLabelsSource
public LabelsSource getLabelsSource()
This method returns LabelsSource instance, containing all labels derived from this iterator- Specified by:
getLabelsSourcein interfaceLabelAwareIterator- Returns:
-
-