de.saar.chorus.domgraph.codec.holesem
Class HolesemComsemInputCodec

Object
  extended by InputCodec
      extended by 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 Summary
static int ERROR_GRAPH_NOT_HNC
           
static int ERROR_GRAPH_NOT_LEAF_LABELLED
           
static int ERROR_GRAPH_NOT_NORMAL
           
static int ERROR_MULTIPLE_PARENTS
           
 Token jj_nt
           
 boolean lookingAhead
           
 Token token
           
 HolesemComsemInputCodecTokenManager token_source
           
 
Fields inherited from interface HolesemComsemInputCodecConstants
ALL, AND, DEFAULT, EOF, EQ, HOLE, IMP, LABEL, LEQ, NOT, OR, PERCENT_COMMENT, PLATOM, PLVAR, PRED1, PRED2, QUE, SOME, tokenImage
 
Constructor Summary
HolesemComsemInputCodec()
           
HolesemComsemInputCodec(HolesemComsemInputCodecTokenManager tm)
           
HolesemComsemInputCodec(InputStream stream)
           
HolesemComsemInputCodec(InputStream stream, String encoding)
           
HolesemComsemInputCodec(Reader stream)
           
 
Method Summary
 void decode(Reader reader, DomGraph graph, NodeLabels labels)
          Reads an USR representation from a Reader.
 void disable_tracing()
           
 void enable_tracing()
           
 ParseException generateParseException()
           
 Token getNextToken()
           
 Token getToken(int index)
           
 void Input()
           
 String LogicalConstant()
           
 String PrologAtom()
           
 void ReInit(HolesemComsemInputCodecTokenManager tm)
           
 void ReInit(InputStream stream)
           
 void ReInit(InputStream stream, String encoding)
           
 void ReInit(Reader stream)
           
 void Term()
           
 String Variable()
           
 String VariableAsHole()
           
 String VariableAsLabel()
           
 String VariableOrAtom()
           
 void Varlist()
           
 
Methods inherited from class InputCodec
getReaderForSpecification
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_GRAPH_NOT_NORMAL

public static final int ERROR_GRAPH_NOT_NORMAL
See Also:
Constant Field Values

ERROR_GRAPH_NOT_HNC

public static final int ERROR_GRAPH_NOT_HNC
See Also:
Constant Field Values

ERROR_GRAPH_NOT_LEAF_LABELLED

public static final int ERROR_GRAPH_NOT_LEAF_LABELLED
See Also:
Constant Field Values

ERROR_MULTIPLE_PARENTS

public static final int ERROR_MULTIPLE_PARENTS
See Also:
Constant Field Values

token_source

public HolesemComsemInputCodecTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead
Constructor Detail

HolesemComsemInputCodec

public HolesemComsemInputCodec()

HolesemComsemInputCodec

public HolesemComsemInputCodec(InputStream stream)

HolesemComsemInputCodec

public HolesemComsemInputCodec(InputStream stream,
                               String encoding)

HolesemComsemInputCodec

public HolesemComsemInputCodec(Reader stream)

HolesemComsemInputCodec

public HolesemComsemInputCodec(HolesemComsemInputCodecTokenManager tm)
Method Detail

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)

ReInit

public void ReInit(InputStream stream,
                   String encoding)

ReInit

public void ReInit(Reader stream)

ReInit

public void ReInit(HolesemComsemInputCodecTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()