Parsing Engine

danbikel.parser.constraints
Interface Constraint

All Known Implementing Classes:
AbstractConstraint, LexTreeConstraint, PartialLexTreeConstraint, PartialTreeConstraint, UnlexTreeConstraint

public interface Constraint

Specifies methods to check a chart item's satisfaction or violation of a parsing constraint. A simple type of constraint, for example, might only allow a chart item that is consistent with a particular bracketing. More specific constraints might impose a specific derivation when decoding, for example, so as to guarantee that the tree that gets built is homologous to a particular labeled, bracketed tree.

Author:
Dan Bikel
See Also:
ConstraintSet, Item

Method Summary
 Constraint getParent()
          Gets the parent constraint of this constraint (optional operation).
 boolean hasBeenSatisfied()
          Returns whether this constraint has been satisfied (optional operation).
 boolean isLeaf()
          Returns true if this constraint is part of a tree structure of constraints and is a leaf (optional operation).
 boolean isLocallySatisfiedBy(Item item)
          Returns whether the specified item satisfies the local information of the constraint node, regardless of its place in a tree structure of constraints (optional operation).
 boolean isSatisfiedBy(Item item)
          Returns whether the specified item satisfies this constraint (optional operation).
 boolean isViolatedBy(Item item)
          Returns whether the specified item violates this constraint (optional operation).
 boolean isViolatedByChild(Item childItem)
          Returns whether the specified child item violates this constraint (optional operation).
 

Method Detail

isLeaf

boolean isLeaf()
Returns true if this constraint is part of a tree structure of constraints and is a leaf (optional operation).

Returns:
true if this constraint is part of a tree structure of constraints and is a leaf.
See Also:
ConstraintSet.hasTreeStructure()

getParent

Constraint getParent()
Gets the parent constraint of this constraint (optional operation).

Returns:
the parent of this constraint
See Also:
ConstraintSet.hasTreeStructure()

isSatisfiedBy

boolean isSatisfiedBy(Item item)
Returns whether the specified item satisfies this constraint (optional operation). If this constraint is part of a tree structure of constraints, then this method should typically only return true if and only if the entire subtree represented by the specified item satisfies the homologous subtree of this constraint and its descendants.

Parameters:
item - the item to test
Returns:
whether the specified item satisfies this constraint.

hasBeenSatisfied

boolean hasBeenSatisfied()
Returns whether this constraint has been satisfied (optional operation).

Returns:
true if this constraint has been satisfied, false if it has not

isLocallySatisfiedBy

boolean isLocallySatisfiedBy(Item item)
Returns whether the specified item satisfies the local information of the constraint node, regardless of its place in a tree structure of constraints (optional operation). When bottom-up parsing and building a parse theory from some child item c, this method may be used to determine if some proposed parent item p locally satisfies the information contained in c.getConstraint().getParent(). That is, if
c.getConstraint().getParent().isLocallySatisfiedBy(p)
returns true, then theories building on the proposed parent item p should be pursued. Local constraint information may include, for example, a nonterminal label or span information.

Parameters:
item -
Returns:
whether the specified item satisfies the local information of this constraint node

isViolatedBy

boolean isViolatedBy(Item item)
Returns whether the specified item violates this constraint (optional operation).

Parameters:
item - the item to test
Returns:
whether the specified item violates this constraint.

isViolatedByChild

boolean isViolatedByChild(Item childItem)
Returns whether the specified child item violates this constraint (optional operation). For implementations that do not implement a recursive notion of constraint satisfaction, this method should simply return true regardless of the value of the argument.

Parameters:
childItem - the child item to test
Returns:
true if the specified child item violates this constraint, false otherwise
See Also:
ConstraintSet.hasTreeStructure()

Parsing Engine

Author: Dan Bikel.