ABL4J (Alignment Based Learning for Java) - 0.9.7

org.schwiebert.abl4j.io
Class TreebankReader

java.lang.Object
  extended by org.schwiebert.abl4j.io.TreebankReader
All Implemented Interfaces:
IConfigurable, ITreebankReader

public class TreebankReader
extends Object
implements ITreebankReader

Helper class for IO Operations.

Author:
Stephan Schwiebert (sschwieb@spinfo.uni-koeln.de)

Field Summary
private  boolean doClose
           
private  boolean ignoreAnnotations
           
private  int indexInCurrentLine
           
private  Reader reader
           
 
Constructor Summary
TreebankReader()
           
 
Method Summary
 void configure(PropertiesMap pm)
           
private  void readProbability(IConstituent cons, String prob)
           
private  void readSentence(ITree t, String currentLine)
          Parses the words of a sentence from String currentLine and adds the information to ITree t.
private  void readSequenceScore(ITree t, String line)
           
private  void readStructure(ITree t, String line)
          Parses the structure of a ITree from String line.
private  ITree readTree(BufferedReader is)
          Parses a ITree from content provided by a reader.
 void readTreebank(ITreeBank tb)
          Fills a ITreeBank from content provided by a Reader.
private  IWord readWord(String currentLine)
          Parses a single IWord from String currentLine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

indexInCurrentLine

private int indexInCurrentLine

reader

private Reader reader

doClose

private boolean doClose

ignoreAnnotations

private boolean ignoreAnnotations
Constructor Detail

TreebankReader

public TreebankReader()
Method Detail

configure

public void configure(PropertiesMap pm)
               throws InvalidConfigurationException
Specified by:
configure in interface IConfigurable
Throws:
InvalidConfigurationException

readTreebank

public void readTreebank(ITreeBank tb)
                  throws IOException
Fills a ITreeBank from content provided by a Reader.

Specified by:
readTreebank in interface ITreebankReader
Parameters:
tb -
Throws:
IOException

readTree

private ITree readTree(BufferedReader is)
                throws IOException
Parses a ITree from content provided by a reader. The content must be formatted in ABL- or ABL4J-syntax.

Parameters:
is - the reader
Returns:
the tree, or null if the current line's length is 0.
Throws:
IOException - if an IO-Error occurs while reading from is.

readSequenceScore

private void readSequenceScore(ITree t,
                               String line)

readStructure

private void readStructure(ITree t,
                           String line)
Parses the structure of a ITree from String line. The (constituent-) structure must be formatted in ABL- or ABL4J-syntax.

Parameters:
t - The tree that will be enriched with structural information
line - The structural information to parse

readProbability

private void readProbability(IConstituent cons,
                             String prob)

readSentence

private void readSentence(ITree t,
                          String currentLine)
Parses the words of a sentence from String currentLine and adds the information to ITree t.

Parameters:
t - the tree
currentLine -

readWord

private IWord readWord(String currentLine)
Parses a single IWord from String currentLine. The parsed Word is registered within an instance of WordMapping.

Parameters:
currentLine - the String which contains the ISentence.
Returns:
the Word, or null if the current line is empty or already parsed, or if the sentence delimiter @@@ was found.
See Also:
for details.

ABL4J (Alignment Based Learning for Java) - 0.9.7

© 2007 Stephan Schwiebert