Class Chain
java.lang.Object
de.saar.chorus.domgraph.codec.InputCodec
de.saar.chorus.domgraph.codec.basic.Chain
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
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddecode(Reader inputStream, DomGraph graph, NodeLabels labels) Reads an USR representation from aReader.Determines aReaderfrom which the USR specified by thespecwill be read.
-
Field Details
-
ERROR_CHAIN_LENGTH
public static int ERROR_CHAIN_LENGTH
-
-
Constructor Details
-
Chain
public Chain()
-
-
Method Details
-
decode
public void decode(Reader inputStream, DomGraph graph, NodeLabels labels) throws IOException, ParserException, MalformedDomgraphException Description copied from class:InputCodecReads an USR representation from aReader. This method converts the USR into an equivalent labelled dominance graph and stores this graph in aDomGraphand the labels in aNodeLabelsobject. 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:
decodein classInputCodec- 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 fromreaderParserException- if a syntactic error occurred while parsing the USRMalformedDomgraphException- if a semantic error occurred, i.e. the USR cannot be converted into a dominance graph
-
getReaderForSpecification
Determines aReaderfrom which the USR specified by thespecwill be read. In the context of theChaininput codec, thespecmust be a string representing a number, which is taken to specify the length of the chain to generate. (This is different than the implementation inInputCodec, wherespecis read as a filename.)- Overrides:
getReaderForSpecificationin classInputCodec- Parameters:
spec- a string specifying the length of the chain- Returns:
- a
StringReaderfor the given string
-