ch.uzh.ifi.attempto.chartparser
Class ParseTree

java.lang.Object
  extended by ch.uzh.ifi.attempto.chartparser.ParseTree

public class ParseTree
extends java.lang.Object

This class represents the parse tree of a successfully parsed text.

Author:
Tobias Kuhn

Method Summary
 java.lang.String getAsciiLambdaSemTree()
          Returns an ASCII representation of the semantics tree under lambda interpretation.
 java.lang.String getAsciiSemTree()
          Returns an ASCII representation of the semantics tree.
 java.lang.String getAsciiSynTree()
          Returns an ASCII representation of the syntax tree.
 int getEndPos()
          Returns the end position of this tree.
 java.lang.Object getLambdaSemTree()
          Returns the semantics tree, interpreted as a lambda expression.
 java.lang.Object getSemTree()
          Returns the semantics tree.
 java.lang.String getSerializedLambdaSemTree()
          Returns a serialization of the semantics tree under lambda interpretation.
 java.lang.String getSerializedSemTree()
          Returns a serialization of the semantics tree.
 java.lang.String getSerializedSynTree()
          Returns a serialization of the syntax tree.
 int getStartPos()
          Returns the start position of this tree.
 java.util.List<ParseTree> getSubTrees(java.lang.String categoryName)
          Returns all subtrees that have the given category name as their top node.
 java.lang.Object getSynTree()
          Returns the syntax tree.
 java.util.List<Terminal> getTerminals()
          Returns the list of terminals of this tree.
 ParseTreeNode getTopNode()
          Returns the top node of the parse tree.
 void setApplicationFunctor(java.lang.String appFunctor)
          Sets the functor of the application function for the calculation of lambda semantics.
 void setConcatFunctor(java.lang.String concatFunctor)
          Sets the functor of the concatenation function for the calculation of semantics.
 void setLambdaFunctor(java.lang.String lamFunctor)
          Sets the functor of the lambda function for the calculation of lambda semantics.
 void setSemanticsLabel(java.lang.String semLabel)
          Sets the name of the annotation item that contains the semantics information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getStartPos

public int getStartPos()
Returns the start position of this tree. This can be relevant for subtrees.

Returns:
The start position.

getEndPos

public int getEndPos()
Returns the end position of this tree. This can be relevant for subtrees.

Returns:
The end position.

setSemanticsLabel

public void setSemanticsLabel(java.lang.String semLabel)
Sets the name of the annotation item that contains the semantics information. The default is "sem".

Parameters:
semLabel - The name of the annotation item containing the semantics.

setLambdaFunctor

public void setLambdaFunctor(java.lang.String lamFunctor)
Sets the functor of the lambda function for the calculation of lambda semantics. The default is "lam".

Parameters:
lamFunctor - The lambda functor.

setApplicationFunctor

public void setApplicationFunctor(java.lang.String appFunctor)
Sets the functor of the application function for the calculation of lambda semantics. The default is "app".

Parameters:
appFunctor - The application functor.

setConcatFunctor

public void setConcatFunctor(java.lang.String concatFunctor)
Sets the functor of the concatenation function for the calculation of semantics. The default is "+". Terms using the concatenation functor are flattened. The functor can be set to null to avoid flattening.

Parameters:
concatFunctor - The concatentation functor.

getTopNode

public ParseTreeNode getTopNode()
Returns the top node of the parse tree.

Returns:
The top node of the parse tree.

getSynTree

public java.lang.Object getSynTree()
Returns the syntax tree. The leaves of the tree are objects of Category. All other nodes are arrays of Object containing the child nodes.

Returns:
The syntax tree.

getSerializedSynTree

public java.lang.String getSerializedSynTree()
Returns a serialization of the syntax tree.

Returns:
A serialization of the syntax tree.

getAsciiSynTree

public java.lang.String getAsciiSynTree()
Returns an ASCII representation of the syntax tree.

Returns:
An ASCII representation of the syntax tree.

getSemTree

public java.lang.Object getSemTree()
Returns the semantics tree. The semantics are retrieved from the annotations of the grammar rules. The leaves of the tree are objects of String or StringRef. All other nodes are arrays of Object containing the child nodes.

Returns:
The semantics tree.

getSerializedSemTree

public java.lang.String getSerializedSemTree()
Returns a serialization of the semantics tree.

Returns:
A serialization of the semantics tree.

getAsciiSemTree

public java.lang.String getAsciiSemTree()
Returns an ASCII representation of the semantics tree.

Returns:
An ASCII representation of the semantics tree.

getLambdaSemTree

public java.lang.Object getLambdaSemTree()
Returns the semantics tree, interpreted as a lambda expression. The returned tree is beta- reduced. The semantics are retrieved from the annotations of the grammar rules. The leaves of the tree are objects of String or StringRef. All other nodes are arrays of Object containing the child nodes.

Returns:
The beta-reduced semantics tree.

getSerializedLambdaSemTree

public java.lang.String getSerializedLambdaSemTree()
Returns a serialization of the semantics tree under lambda interpretation.

Returns:
A serialization of the lambda semantics tree.

getAsciiLambdaSemTree

public java.lang.String getAsciiLambdaSemTree()
Returns an ASCII representation of the semantics tree under lambda interpretation.

Returns:
An ASCII representation of the lambda semantics tree.

getSubTrees

public java.util.List<ParseTree> getSubTrees(java.lang.String categoryName)
Returns all subtrees that have the given category name as their top node. In the case of nested nodes with the given category, only the top-most subtree (containing all other potential subtrees) is returned.

Parameters:
categoryName - The category name.
Returns:
A list of all matching subtrees.

getTerminals

public java.util.List<Terminal> getTerminals()
Returns the list of terminals of this tree.

Returns:
The list of terminals.


Copyright 2008-2012, AceWiki developers