|
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.PartialTreeConstraintSet
public class PartialTreeConstraintSet
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 a tree structure isomorphic to the (possibly partial) syntactic tree with which they are constructed.
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 PartialTreeConstraint |
root
The root of this tree of constraints. |
protected int |
size
The number of constraints in this set. |
Constructor Summary | |
---|---|
PartialTreeConstraintSet()
Returns an empty set of constraints. |
|
PartialTreeConstraintSet(Sexp tree)
Returns a set of partial tree constraints whose tree structure is isomorphic to the specified (possibly partial) syntactic tree. |
Method Summary | |
---|---|
protected void |
buildConstraintSet(Sexp tree)
Builds the constraint tree from the specified unlexicalized parse tree. |
protected void |
collectNodes(PartialTreeConstraint tree)
Collects the constraints in the specified tree of constraint objects. |
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 a list of the leaves in this tree of constraints. |
static void |
main(String[] args)
Test driver for this class. |
Constraint |
root()
Returns the root of this tree of constraints. |
int |
size()
Returns the number of constraints in this set. |
String |
toString()
Returns a human-readable string representation of this tree of constraints. |
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 PartialTreeConstraint root
protected int size
protected ArrayList list
protected ArrayList leaves
Constructor Detail |
---|
public PartialTreeConstraintSet()
public PartialTreeConstraintSet(Sexp tree)
tree
- a possibly partial syntatic tree whose node labels and spans
are to be represented in any derivation pursued by the decoderMethod 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(PartialTreeConstraint tree)
tree
- the tree of constraint objects 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 |