Class HolesemComsemInputCodec

java.lang.Object
de.saar.chorus.domgraph.codec.InputCodec
de.saar.chorus.domgraph.codec.holesem.HolesemComsemInputCodec
All Implemented Interfaces:
HolesemComsemInputCodecConstants

public class HolesemComsemInputCodec extends InputCodec implements HolesemComsemInputCodecConstants
An input codec for Hole Semantics. We use the concrete syntax of the Blackburn & Bos (2005) textbook on computational semantics. The codec is thus able to process the USRs generated by the software described in that book.

The codec implements the translation of Hole Semantics to normal dominance graphs described in Koller et al., EACL 2003. See decode(Reader,DomGraph,NodeLabels) for details.

An example input for this codec looks as follows:
some(_A,some(_B,some(_C,and(label(_A),and(hole(_B),
  and(label(_C),and(some(_A,X,_B),and(pred1(_C,foo,X),leq(_C,_B)))))))))

Author:
Alexander Koller
  • Field Details

  • Constructor Details

    • HolesemComsemInputCodec

      public HolesemComsemInputCodec()
    • HolesemComsemInputCodec

      public HolesemComsemInputCodec(InputStream stream)
      Constructor with InputStream.
    • HolesemComsemInputCodec

      public HolesemComsemInputCodec(InputStream stream, String encoding)
      Constructor with InputStream and supplied encoding
    • HolesemComsemInputCodec

      public HolesemComsemInputCodec(Reader stream)
      Constructor.
    • HolesemComsemInputCodec

      public HolesemComsemInputCodec(HolesemComsemInputCodecTokenManager tm)
      Constructor with generated Token Manager.
  • Method Details

    • decode

      public void decode(Reader reader, DomGraph graph, NodeLabels labels) throws IOException, ParserException, MalformedDomgraphException
      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.

      This method converts a Hole Semantics USR into a dominance graph. It will then normalise this graph by moving the lower ends of dominance edges up to the respective roots. The resulting graph is guaranteed to be a correct encoding of the original USR (in that the pluggings of the USR correspond to the solved forms of the dominance graph) if the normalised dominance graph is hypernormally connected. If it isn't, then the method throws a MalformedDomgraphException.

      Specified by:
      decode in class InputCodec
      Parameters:
      reader - the reader from which the USR is read
      graph - the dominance graph into which the USR is converted
      labels - 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 the graph cannot be normalised, or the result is not hypernormally connected.
    • Input

      public final void Input() throws ParseException
      Throws:
      ParseException
    • Term

      public final void Term() throws ParseException
      Throws:
      ParseException
    • LogicalConstant

      public final String LogicalConstant() throws ParseException
      Throws:
      ParseException
    • PrologAtom

      public final String PrologAtom() throws ParseException
      Throws:
      ParseException
    • Varlist

      public final void Varlist() throws ParseException
      Throws:
      ParseException
    • VariableOrAtom

      public final String VariableOrAtom() throws ParseException
      Throws:
      ParseException
    • Variable

      public final String Variable() throws ParseException
      Throws:
      ParseException
    • VariableAsHole

      public final String VariableAsHole() throws ParseException
      Throws:
      ParseException
    • VariableAsLabel

      public final String VariableAsLabel() throws ParseException
      Throws:
      ParseException
    • ReInit

      public void ReInit(InputStream stream)
      Reinitialise.
    • ReInit

      public void ReInit(InputStream stream, String encoding)
      Reinitialise.
    • ReInit

      public void ReInit(Reader stream)
      Reinitialise.
    • ReInit

      public void ReInit(HolesemComsemInputCodecTokenManager tm)
      Reinitialise.
    • getNextToken

      public final Token getNextToken()
      Get the next Token.
    • getToken

      public final Token getToken(int index)
      Get the specific Token.
    • generateParseException

      public ParseException generateParseException()
      Generate ParseException.
    • enable_tracing

      public final void enable_tracing()
      Enable tracing.
    • disable_tracing

      public final void disable_tracing()
      Disable tracing.