Class BasicLineIterator
- java.lang.Object
-
- org.deeplearning4j.text.sentenceiterator.BasicLineIterator
-
- All Implemented Interfaces:
Iterable<String>
,SentenceIterator
public class BasicLineIterator extends Object implements SentenceIterator, Iterable<String>
-
-
Constructor Summary
Constructors Constructor Description BasicLineIterator(@NonNull File file)
BasicLineIterator(@NonNull InputStream stream)
BasicLineIterator(@NonNull String filePath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
finalize()
void
finish()
Allows for any finishing (closing of input streams or the like)SentencePreProcessor
getPreProcessor()
boolean
hasNext()
Same idea asIterator
Iterator<String>
iterator()
Implentation for Iterable interface.String
nextSentence()
Gets the next sentence or null if there's nothing left (Do yourself a favor and check hasNext() )void
reset()
Resets the iterator to the beginningvoid
setPreProcessor(SentencePreProcessor preProcessor)
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
BasicLineIterator
public BasicLineIterator(@NonNull @NonNull File file) throws FileNotFoundException
- Throws:
FileNotFoundException
-
BasicLineIterator
public BasicLineIterator(@NonNull @NonNull InputStream stream)
-
BasicLineIterator
public BasicLineIterator(@NonNull @NonNull String filePath) throws FileNotFoundException
- Throws:
FileNotFoundException
-
-
Method Detail
-
nextSentence
public String nextSentence()
Description copied from interface:SentenceIterator
Gets the next sentence or null if there's nothing left (Do yourself a favor and check hasNext() )- Specified by:
nextSentence
in interfaceSentenceIterator
- Returns:
- the next sentence in the iterator
-
hasNext
public boolean hasNext()
Description copied from interface:SentenceIterator
Same idea asIterator
- Specified by:
hasNext
in interfaceSentenceIterator
- Returns:
- whether there's anymore sentences left
-
reset
public void reset()
Description copied from interface:SentenceIterator
Resets the iterator to the beginning- Specified by:
reset
in interfaceSentenceIterator
-
finish
public void finish()
Description copied from interface:SentenceIterator
Allows for any finishing (closing of input streams or the like)- Specified by:
finish
in interfaceSentenceIterator
-
getPreProcessor
public SentencePreProcessor getPreProcessor()
- Specified by:
getPreProcessor
in interfaceSentenceIterator
-
setPreProcessor
public void setPreProcessor(SentencePreProcessor preProcessor)
- Specified by:
setPreProcessor
in interfaceSentenceIterator
-
finalize
protected void finalize() throws Throwable
-
-