edu.mit.jmwe.data.concordance
Class TaggedConcordanceIterator

java.lang.Object
  extended by edu.mit.jmwe.data.concordance.TaggedConcordanceIterator
All Implemented Interfaces:
Iterator<IConcordanceSentence>

public class TaggedConcordanceIterator
extends Object
implements Iterator<IConcordanceSentence>

An iterator over a list of tagged concodrance sentences. This iterator does not support the remove() operation. Each tagged sentence must be on its own line, in the following format:

 concordanceName/contextID/sentNumber [tok_tag_stems_num_part]+
 

Since:
jMWE 1.0.0
Version:
$Id: TaggedConcordanceIterator.java 620 2011-05-08 21:13:58Z markaf $
Author:
M.A. Finlayson
See Also:
ConcordanceTagger

Field Summary
protected  IConcordanceSentence next
           
protected  BufferedReader source
           
 
Constructor Summary
TaggedConcordanceIterator(File file)
          Constructs the iterator form the given source file.
TaggedConcordanceIterator(Reader r)
          Constructs the iterator from a reader.
TaggedConcordanceIterator(URL url)
          Constructs the iterator from a URL pointing to a list of tagged semcor sentences.
 
Method Summary
protected  void advance()
          Internal method used to advance the iterator to the next element in the list.
 boolean hasNext()
           
protected  boolean ignoreLine(String line)
          Indicates whether the specified line is to be ignored.
 IConcordanceSentence next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

protected final BufferedReader source

next

protected IConcordanceSentence next
Constructor Detail

TaggedConcordanceIterator

public TaggedConcordanceIterator(File file)
                          throws IOException
Constructs the iterator form the given source file.

Parameters:
file - the source file of tagged sentences in the proper format.
Throws:
IOException - if an IOException occurs when opening or reading from the file.
Since:
jMWE 1.0.0

TaggedConcordanceIterator

public TaggedConcordanceIterator(URL url)
                          throws IOException
Constructs the iterator from a URL pointing to a list of tagged semcor sentences.

Parameters:
url - a url pointing to a list of tagged semcor sentences, may not be null
Throws:
NullPointerException - if source is null
IOException
Since:
jMWE 1.0.0

TaggedConcordanceIterator

public TaggedConcordanceIterator(Reader r)
                          throws IOException
Constructs the iterator from a reader.

Parameters:
r - the reader from which the data is read
Throws:
IOException - if there is an exception reading from the reader
NullPointerException - if the reader is null
Since:
jMWE 1.0.0
Method Detail

next

public IConcordanceSentence next()
Specified by:
next in interface Iterator<IConcordanceSentence>

advance

protected void advance()
                throws IOException
Internal method used to advance the iterator to the next element in the list.

Throws:
IOException - if the reader reaches the end of the file (there are no elements left)
Since:
jMWE 1.0.0

ignoreLine

protected boolean ignoreLine(String line)
Indicates whether the specified line is to be ignored. Lines where the first non-whitespace character is a double slash ('//') or double semicolon (';;') are considered comment lines, and will cause this method to return true. Lines consisting of all whitespace will also cause this method to return true. Otherwise, the method returns false.

Parameters:
line - the line being considered
Returns:
true if the line begins with a double slash, double semicolon or is all whitespace.
Since:
jMWE 1.0.0

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<IConcordanceSentence>

remove

public void remove()
Specified by:
remove in interface Iterator<IConcordanceSentence>


Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.