sem.graphreader
Class TSVGraphReader

java.lang.Object
  extended by sem.graphreader.TSVGraphReader
All Implemented Interfaces:
GraphReader

public class TSVGraphReader
extends java.lang.Object
implements GraphReader

Class for reading graphs in the "column" format.

The section separators are on individual lines, every node and edge has a line with tab-separated values. Sentences are marked by <s>, graphs are marked by <g>, lemmas by <lem>, and edges by <gr>.

Each lemma line has the following format: ID LEMMA POS

Each GR line has the following format: LABEL HEAD_ID DEP_ID

Ellipes are represented by [[ellip]], null nodes by [[null]]. They can be either in the lemma list or the directly in the graph. If they are in the graph, then corresponding nodes are added to the graph. Take a look at the example files for better understanding of the format.

If a sentence has no graphs for some reason, it will return a single empty graph (with no edges). This is to facilitate retrieval by sentence and by single graphs.


Constructor Summary
TSVGraphReader(java.lang.String inputPath, boolean getAllParses)
           
 
Method Summary
 void close()
           
 boolean hasNext()
          Check whether there are more graphs available.
 Graph next()
          Get the next graph from the corpus.
 java.util.ArrayList<Graph> nextSentence()
          Read a sentence from the corpus.
 void reset()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TSVGraphReader

public TSVGraphReader(java.lang.String inputPath,
                      boolean getAllParses)
               throws GraphFormatException
Throws:
GraphFormatException
Method Detail

reset

public void reset()
           throws GraphFormatException
Specified by:
reset in interface GraphReader
Throws:
GraphFormatException

next

public Graph next()
           throws GraphFormatException
Get the next graph from the corpus.

Specified by:
next in interface GraphReader
Throws:
GraphFormatException

hasNext

public boolean hasNext()
Check whether there are more graphs available.

Specified by:
hasNext in interface GraphReader

close

public void close()
Specified by:
close in interface GraphReader

nextSentence

public java.util.ArrayList<Graph> nextSentence()
                                        throws GraphFormatException
Read a sentence from the corpus. This returns a list of graphs. If there are alternative parses for this sentence, they will all be included in the list.

Specified by:
nextSentence in interface GraphReader
Returns:
Throws:
GraphFormatException