Parsing Engine

danbikel.parser.constraints
Class PartialLexTreeConstraint

java.lang.Object
  extended by danbikel.parser.constraints.UnlexTreeConstraint
      extended by danbikel.parser.constraints.PartialLexTreeConstraint
All Implemented Interfaces:
SexpConvertible, Constraint, Serializable

public class PartialLexTreeConstraint
extends UnlexTreeConstraint

Represents a node in a parsing constraint tree, that requires an associated chart item to have the same label, head word and head tag. The crucial difference between this type of constraint and LexTreeConstraint is that the latter uses the Word.equals(java.lang.Object) method to determine lexicalized node equality, whereas this constraint explicitly compares only the corresponding Word.word() and Word.tag() fields of head words, making this type of constraint suitable when the head word objects are subclasses of Word that include more information (such as, for example, WordNet synsets).

See Also:
Serialized Form

Field Summary
protected  Word headWord
          The head word associated with this constraint.
 
Fields inherited from class danbikel.parser.constraints.UnlexTreeConstraint
children, end, label, parent, satisfied, start
 
Constructor Summary
protected PartialLexTreeConstraint(PartialLexTreeConstraint parent, Sexp tree, IntCounter currWordIdx, HeadFinder headFinder)
          A helper constructor used by PartialLexTreeConstraint(Sexp) to construct an entire tree of constraints.
  PartialLexTreeConstraint(Sexp tree)
          Constructs a tree of constraints given the specified parse tree.
 
Method Summary
 boolean isLocallySatisfiedBy(Item item)
          Returns whether the specified chart item satisfies the local information contained in this constraint (span and nonterminal label).
protected  boolean isSatisfiedByPreterminal(CKYItem item)
          Returns true if this constraint is locally satisfied by the specified item and if this constraint's span matches that of the specified item.
 Sexp toSexp()
          Returns a symbolic expression version of the constraint tree rooted at this constraint.
 String toString()
          Returns a human-readable string representation of this constraint for debugging.
 
Methods inherited from class danbikel.parser.constraints.UnlexTreeConstraint
end, getChildren, getParent, hasBeenSatisfied, isLeaf, isSatisfiedBy, isViolatedBy, isViolatedByChild, label, spanMatches, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

headWord

protected Word headWord
The head word associated with this constraint.

Constructor Detail

PartialLexTreeConstraint

public PartialLexTreeConstraint(Sexp tree)
Constructs a tree of constraints given the specified parse tree.

Parameters:
tree -

PartialLexTreeConstraint

protected PartialLexTreeConstraint(PartialLexTreeConstraint parent,
                                   Sexp tree,
                                   IntCounter currWordIdx,
                                   HeadFinder headFinder)
A helper constructor used by PartialLexTreeConstraint(Sexp) to construct an entire tree of constraints.

Parameters:
parent - the parent of this constraint being constructed, or null if this constraint is the root of a tree of constraints
tree - the root of the subtree for which to construct a constraint
currWordIdx - the current 0-based word index of the left-most word of the specified subtree (tree)
headFinder - the head finder to be used for lexicalizing the specified tree (typically Language.headFinder())
Method Detail

isSatisfiedByPreterminal

protected boolean isSatisfiedByPreterminal(CKYItem item)
Returns true if this constraint is locally satisfied by the specified item and if this constraint's span matches that of the specified item. This overridden definition is in stark contrast to that of UnlexTreeConstraint, where preterminals are always satisfied by preterminal constraints, meaning that parts of speech are not constrained.

Overrides:
isSatisfiedByPreterminal in class UnlexTreeConstraint
Parameters:
item - the item to be tested
Returns:
true if this constraint is locally satisfied by the specified item and if this constraint's span matches that of the specified item.

isLocallySatisfiedBy

public boolean isLocallySatisfiedBy(Item item)
Description copied from class: UnlexTreeConstraint
Returns whether the specified chart item satisfies the local information contained in this constraint (span and nonterminal label).

Specified by:
isLocallySatisfiedBy in interface Constraint
Overrides:
isLocallySatisfiedBy in class UnlexTreeConstraint
Parameters:
item - the chart item to be tested against this constraint
Returns:
whether the specified chart item satisfies the local information contained in this constraint (span and nonterminal label)

toSexp

public Sexp toSexp()
Description copied from class: UnlexTreeConstraint
Returns a symbolic expression version of the constraint tree rooted at this constraint.

Specified by:
toSexp in interface SexpConvertible
Overrides:
toSexp in class UnlexTreeConstraint
Returns:
a symbolic expression version of the constraint tree rooted at this constraint

toString

public String toString()
Returns a human-readable string representation of this constraint for debugging.

Overrides:
toString in class UnlexTreeConstraint
Returns:
a human-readable string representation of this constraint for debugging

Parsing Engine

Author: Dan Bikel.