public class TaggedConcordanceIterator extends java.lang.Object implements java.util.Iterator<IConcordanceSentence>
remove()
operation. Each tagged sentence must be on its
own line, in the following format:
concordanceName/contextID/sentNumber [tok_tag_stems_num_part]+
ConcordanceTagger
Modifier and Type | Field and Description |
---|---|
protected IConcordanceSentence |
next |
protected java.io.BufferedReader |
source |
Constructor and Description |
---|
TaggedConcordanceIterator(java.io.File file)
Constructs the iterator form the given source file.
|
TaggedConcordanceIterator(java.io.Reader r)
Constructs the iterator from a reader.
|
TaggedConcordanceIterator(java.net.URL url)
Constructs the iterator from a
URL pointing to a list of tagged
semcor sentences. |
Modifier and Type | Method and Description |
---|---|
protected void |
advance()
Internal method used to advance the iterator to the next element in the
list.
|
boolean |
hasNext() |
protected boolean |
ignoreLine(java.lang.String line)
Indicates whether the specified line is to be ignored.
|
IConcordanceSentence |
next() |
void |
remove() |
protected final java.io.BufferedReader source
protected IConcordanceSentence next
public TaggedConcordanceIterator(java.io.File file) throws java.io.IOException
file
- the source file of tagged sentences in the proper format.java.io.IOException
- if an IOException occurs when opening or reading from the
file.public TaggedConcordanceIterator(java.net.URL url) throws java.io.IOException
URL
pointing to a list of tagged
semcor sentences.url
- a url pointing to a list of tagged semcor sentences, may not
be null
java.lang.NullPointerException
- if source is null
java.io.IOException
- if an IOException occurs when opening or reading from the
file.public TaggedConcordanceIterator(java.io.Reader r) throws java.io.IOException
r
- the reader from which the data is readjava.io.IOException
- if there is an exception reading from the readerjava.lang.NullPointerException
- if the reader is null
public IConcordanceSentence next()
next
in interface java.util.Iterator<IConcordanceSentence>
protected void advance() throws java.io.IOException
java.io.IOException
- if the reader reaches the end of the file (there are no
elements left)protected boolean ignoreLine(java.lang.String line)
true
. Lines consisting of all whitespace will also
cause this method to return true
. Otherwise, the method
returns false
.line
- the line being consideredpublic boolean hasNext()
hasNext
in interface java.util.Iterator<IConcordanceSentence>
public void remove()
remove
in interface java.util.Iterator<IConcordanceSentence>
Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.