Parsing Engine

danbikel.parser
Class Nonterminal

java.lang.Object
  extended bydanbikel.parser.Nonterminal
All Implemented Interfaces:
Serializable

public class Nonterminal
extends Object
implements Serializable

Representation of all possible data present in a complex nonterminal annotation: the base label, any augmentations and any index. Not following the traditional object-oriented design principles, this class is used strictly for representing the data present in a complex nonterminal, but that data is easily manipulated by several methods of Treebank, such as Treebank.parseNonterminal and Treebank.addAugmentation.

See Also:
Treebank.parseNonterminal(Symbol,Nonterminal), Treebank.addAugmentation(Nonterminal,Symbol), Treebank.removeAugmentation(Nonterminal,Symbol), Treebank.containsAugmentation(Symbol,Symbol), Treebank.getTraceIndex(Sexp,Nonterminal), Treebank.stripAllButIndex(Symbol,Nonterminal), Treebank.stripIndex(Symbol,Nonterminal), Serialized Form

Field Summary
 SexpList augmentations
          A list of symbols representing any augmentations and delimiters.
 Symbol base
          The unaugmented base nonterminal.
 int index
          The index of the augmented nonterminal, or -1 if none was present.
 
Constructor Summary
Nonterminal()
          Default constructor sets the base data member to be null, the augmentations data member to be a list with no elements and the index data member to be -1.
Nonterminal(Symbol base, SexpList augmentations, int index)
          Sets the data members of this new object to the specified values
 
Method Summary
 boolean subsumes(Nonterminal other)
          Returns whether this nonterminal subsumes the specified nonterminal.
 String toString()
          Returns a string representation of the nonterminal, identical the original nonterminal that was parsed to create this object.
 Symbol toSymbol()
          Returns the symbol representing this complex nonterminal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

base

public Symbol base
The unaugmented base nonterminal.


augmentations

public SexpList augmentations
A list of symbols representing any augmentations and delimiters.


index

public int index
The index of the augmented nonterminal, or -1 if none was present.

Constructor Detail

Nonterminal

public Nonterminal()
Default constructor sets the base data member to be null, the augmentations data member to be a list with no elements and the index data member to be -1.


Nonterminal

public Nonterminal(Symbol base,
                   SexpList augmentations,
                   int index)
Sets the data members of this new object to the specified values

Method Detail

subsumes

public boolean subsumes(Nonterminal other)
Returns whether this nonterminal subsumes the specified nonterminal. A nonterminal X subsumes another nonterminal Y if the base (unaugmented) nonterminal labels are identical and if X contains a subset of the nonterminal augmentations of Y. For example, NP subsumes NP-SBJ and NP-TMP subsumes NP-TMP-CLR-1.

Parameters:
other - the nonterminal to test for subsumption with this nonterminal
Returns:
whether this nonterminal subsumes the specified nonterminal

toString

public String toString()
Returns a string representation of the nonterminal, identical the original nonterminal that was parsed to create this object.


toSymbol

public Symbol toSymbol()
Returns the symbol representing this complex nonterminal.


Parsing Engine

Author: Dan Bikel.