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>
currentIterator
protected LabelsSource
labels
protected 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 LabelsSource
getLabelsSource()
This method returns LabelsSource instance, containing all labels derived from this iteratorboolean
hasNext()
boolean
hasNextDocument()
This method checks, if there's more LabelledDocuments in underlying iteratorLabelledDocument
next()
LabelledDocument
nextDocument()
This method returns next LabelledDocument from underlying iteratorvoid
remove()
void
reset()
This methods resets LabelAwareIterator by creating new Iterator from Iterable internallyvoid
shutdown()
-
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:
hasNextDocument
in interfaceLabelAwareIterator
- Returns:
-
nextDocument
public LabelledDocument nextDocument()
This method returns next LabelledDocument from underlying iterator- Specified by:
nextDocument
in interfaceLabelAwareIterator
- Returns:
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfaceIterator<LabelledDocument>
-
next
public LabelledDocument next()
- Specified by:
next
in interfaceIterator<LabelledDocument>
-
remove
public void remove()
- Specified by:
remove
in interfaceIterator<LabelledDocument>
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfaceLabelAwareIterator
-
reset
public void reset()
This methods resets LabelAwareIterator by creating new Iterator from Iterable internally- Specified by:
reset
in interfaceLabelAwareIterator
-
getLabelsSource
public LabelsSource getLabelsSource()
This method returns LabelsSource instance, containing all labels derived from this iterator- Specified by:
getLabelsSource
in interfaceLabelAwareIterator
- Returns:
-
-