public class LabelAwareListSentenceIterator extends java.lang.Object implements LabelAwareSentenceIterator
Constructor and Description |
---|
LabelAwareListSentenceIterator(java.io.InputStream is)
Same as calling (is,\t,0,1)
|
LabelAwareListSentenceIterator(java.io.InputStream is,
java.lang.String sep)
Same as calling (is,\t,0,1)
|
LabelAwareListSentenceIterator(java.io.InputStream is,
java.lang.String delimiter,
int labelPosition,
int textPosition)
Initializes the sentence iterator with the given args, note that this will close the input stream for you
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
currentLabel()
Returns the current label for nextSentence()
|
java.util.List<java.lang.String> |
currentLabels()
For multi label problems
|
void |
finish()
Allows for any finishing (closing of input streams or the like)
|
SentencePreProcessor |
getPreProcessor() |
boolean |
hasNext()
Same idea as
Iterator |
java.lang.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 beginning
|
void |
setPreProcessor(SentencePreProcessor preProcessor) |
public LabelAwareListSentenceIterator(java.io.InputStream is, java.lang.String delimiter, int labelPosition, int textPosition) throws java.io.IOException
is
- the input stream (this will be closed)delimiter
- the delimiter (tab comma,...)labelPosition
- the position of the label on each linetextPosition
- the position of the text on each linejava.io.IOException
public LabelAwareListSentenceIterator(java.io.InputStream is) throws java.io.IOException
is
- the input stream to read lines fromjava.io.IOException
public LabelAwareListSentenceIterator(java.io.InputStream is, java.lang.String sep) throws java.io.IOException
is
- the input stream to read lines fromsep
- the separator for the filejava.io.IOException
public java.lang.String currentLabel()
currentLabel
in interface LabelAwareSentenceIterator
public java.util.List<java.lang.String> currentLabels()
LabelAwareSentenceIterator
currentLabels
in interface LabelAwareSentenceIterator
public java.lang.String nextSentence()
nextSentence
in interface SentenceIterator
public boolean hasNext()
Iterator
hasNext
in interface SentenceIterator
public void reset()
reset
in interface SentenceIterator
public void finish()
finish
in interface SentenceIterator
public SentencePreProcessor getPreProcessor()
getPreProcessor
in interface SentenceIterator
public void setPreProcessor(SentencePreProcessor preProcessor)
setPreProcessor
in interface SentenceIterator