|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection
danbikel.parser.constraints.UnlexTreeConstraintSet
public class UnlexTreeConstraintSet
Represents a set of constraints that correspond to a specific unlexicalized parse tree, for use when the bottom-up parsing algorithm needs to generate only the analyses that are consistent with a particular unlexicalized tree. Accordingly, the individual Constraint objects in this set form an isomorphic tree structure.
Field Summary | |
---|---|
protected ArrayList |
leaves
The leaves of this tree of constraints in their correct order as they correspond to single words (technically, preterminals) of a sentence. |
protected ArrayList |
list
A list of all the constraints in this set, for making iteration easy. |
protected UnlexTreeConstraint |
root
The root of this tree of constraints. |
protected int |
size
The number of constraints in this set. |
Constructor Summary | |
---|---|
UnlexTreeConstraintSet()
Constructs an empty set of constraints. |
|
UnlexTreeConstraintSet(Sexp tree)
Constructs a constraint set derived from the specified unlexicalized syntactic tree. |
Method Summary | |
---|---|
protected void |
buildConstraintSet(Sexp tree)
Builds the constraint tree from the specified unlexicalized parse tree. |
protected void |
collectNodes(UnlexTreeConstraint tree)
A helper method to collect all of the constraints in the specified cosntraint tree. |
Constraint |
constraintSatisfying(Item item)
Returns the first constraint in this set that is found that the specified item satisfies. |
boolean |
findAtLeastOneSatisfying()
Returns true , since a satisfying constraint must be found
for every chart item. |
boolean |
findNoViolations()
Returns false , since this type of constraint set guarantees
consistency among its constraints, meaning that, since every chart item
must have an assigned, satisfying constraint, there cannot be any
constraint violations, and therefore no such violation-checking needs
to occur during decoding. |
boolean |
hasTreeStructure()
Returns true , since this type of constraint set does,
indeed, have a tree structure. |
boolean |
isViolatedBy(Item item)
Simply throws an UnsupportedOperationException , since
violations do not need to be checked for this type of constraint set. |
Iterator |
iterator()
Returns an iterator over the constraints in this set. |
List |
leaves()
Returns the leaves of the constraint tree contained by this object. |
static void |
main(String[] args)
Test driver for this class. |
Constraint |
root()
Returns the root of the constraint tree contained by this object. |
int |
size()
Returns the number of constraints in this constraint set. |
String |
toString()
Returns a string representation of the constraint tree encapsulated by this constraint set object. |
Methods inherited from class java.util.AbstractCollection |
---|
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray |
Field Detail |
---|
protected UnlexTreeConstraint root
protected int size
protected ArrayList list
protected ArrayList leaves
Constructor Detail |
---|
public UnlexTreeConstraintSet()
public UnlexTreeConstraintSet(Sexp tree)
tree
- the unlexicalized syntactic tree from which to construct a set
of constraintsMethod Detail |
---|
protected void buildConstraintSet(Sexp tree)
root
and leaves
data
members will be set/populated by this method.
tree
- the tree from which to build this constraint setprotected void collectNodes(UnlexTreeConstraint tree)
tree
- the root of a tree of constraints to be collectedpublic boolean hasTreeStructure()
true
, since this type of constraint set does,
indeed, have a tree structure.
hasTreeStructure
in interface ConstraintSet
true
public boolean findAtLeastOneSatisfying()
true
, since a satisfying constraint must be found
for every chart item.
findAtLeastOneSatisfying
in interface ConstraintSet
true
ConstraintSet.constraintSatisfying(Item)
public boolean findNoViolations()
false
, since this type of constraint set guarantees
consistency among its constraints, meaning that, since every chart item
must have an assigned, satisfying constraint, there cannot be any
constraint violations, and therefore no such violation-checking needs
to occur during decoding.
findNoViolations
in interface ConstraintSet
false
findAtLeastOneSatisfying()
public Constraint root()
root
in interface ConstraintSet
ConstraintSet.hasTreeStructure()
public List leaves()
leaves
in interface ConstraintSet
ConstraintSet.hasTreeStructure()
public boolean isViolatedBy(Item item)
UnsupportedOperationException
, since
violations do not need to be checked for this type of constraint set.
isViolatedBy
in interface ConstraintSet
item
- the item to be checked for violations
true
if the specified item violates a constraint
in this set, false
otherwisefindNoViolations()
public Constraint constraintSatisfying(Item item)
ConstraintSet
constraintSatisfying
in interface ConstraintSet
item
- the item for which a satisfying constraint is to be found
public String toString()
toString
in class AbstractCollection
public int size()
size
in interface Collection
size
in class AbstractCollection
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in class AbstractCollection
public static void main(String[] args)
args
-
|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |