Class FileSentenceIterator
- java.lang.Object
-
- org.deeplearning4j.text.sentenceiterator.BaseSentenceIterator
-
- org.deeplearning4j.text.sentenceiterator.FileSentenceIterator
-
- All Implemented Interfaces:
SentenceIterator
- Direct Known Subclasses:
LabelAwareFileSentenceIterator
public class FileSentenceIterator extends BaseSentenceIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected Queue<String>cacheprotected FilecurrentFileprotected org.apache.commons.io.LineIteratorcurrLineIteratorprotected Filefileprotected Iterator<File>fileIterator-
Fields inherited from class org.deeplearning4j.text.sentenceiterator.BaseSentenceIterator
preProcessor
-
-
Constructor Summary
Constructors Constructor Description FileSentenceIterator(File dir)FileSentenceIterator(SentencePreProcessor preProcessor, File file)Takes a single file or directory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasNext()Same idea asIteratorStringnextSentence()Gets the next sentence or null if there's nothing left (Do yourself a favor and check hasNext() )voidreset()Resets the iterator to the beginning-
Methods inherited from class org.deeplearning4j.text.sentenceiterator.BaseSentenceIterator
finish, getPreProcessor, setPreProcessor
-
-
-
-
Constructor Detail
-
FileSentenceIterator
public FileSentenceIterator(SentencePreProcessor preProcessor, File file)
Takes a single file or directory- Parameters:
preProcessor- the sentence pre processorfile- the file or folder to iterate over
-
FileSentenceIterator
public FileSentenceIterator(File dir)
-
-
Method Detail
-
nextSentence
public String nextSentence()
Description copied from interface:SentenceIteratorGets the next sentence or null if there's nothing left (Do yourself a favor and check hasNext() )- Returns:
- the next sentence in the iterator
-
hasNext
public boolean hasNext()
Description copied from interface:SentenceIteratorSame idea asIterator- Returns:
- whether there's anymore sentences left
-
reset
public void reset()
Description copied from interface:SentenceIteratorResets the iterator to the beginning
-
-