de.saar.chorus.domgraph.codec.basic
Class Chain
Object
InputCodec
Chain
public class Chain
- extends InputCodec
An input codec that generates pure chains. Pure chains
are normal dominance graphs in which upper and lower fragments
alternate in a zig-zag shape (see e.g.
Koller's Ph.D. thesis, Chapter 6.4). They correspond to
the predicate-argument structure of (possibly nested) NPs
and (possibly transitive) verbs, and as such are a convenient
type of graphs for benchmarks.
- Author:
- Alexander Koller
Constructor Summary |
Chain()
|
Method Summary |
void |
decode(Reader inputStream,
DomGraph graph,
NodeLabels labels)
Reads an USR representation from a Reader . |
Reader |
getReaderForSpecification(String spec)
Determines a Reader from which the USR specified
by the spec will be read. |
Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ERROR_CHAIN_LENGTH
public static int ERROR_CHAIN_LENGTH
Chain
public Chain()
decode
public void decode(Reader inputStream,
DomGraph graph,
NodeLabels labels)
throws IOException,
ParserException,
MalformedDomgraphException
- Description copied from class:
InputCodec
- Reads an USR representation from a
Reader
. This method
converts the USR into an equivalent labelled dominance graph and
stores this graph in a DomGraph
and the labels in
a NodeLabels
object. You must implement this
method in every concrete input codec.
The graph and labels objects passed to this method need not be
empty; it is the responsibility of this method to clear them first.
- Specified by:
decode
in class InputCodec
- Parameters:
inputStream
- the reader from which the USR is readgraph
- the dominance graph into which the USR is convertedlabels
- the node labels of the labelled dominance graph
- Throws:
IOException
- if an I/O error occurred while reading from reader
ParserException
- if a syntactic error occurred while parsing the USR
MalformedDomgraphException
- if a semantic error occurred, i.e. the USR
cannot be converted into a dominance graph
getReaderForSpecification
public Reader getReaderForSpecification(String spec)
- Determines a
Reader
from which the USR specified
by the spec
will be read. In the context of the
Chain
input codec, the spec
must be
a string representing a number, which is taken to specify
the length of the chain to generate. (This is different than
the implementation in InputCodec
,
where spec
is read as a filename.)
- Overrides:
getReaderForSpecification
in class InputCodec
- Parameters:
spec
- a string specifying the length of the chain
- Returns:
- a
StringReader
for the given string