|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdanbikel.parser.constraints.UnlexTreeConstraint
public class UnlexTreeConstraint
An implementation of a constraint to sit in a tree structure of constraints that represents a particular, unlexicalized tree, constraining a decoder to only pursue derivations consistent with that unlexicalized tree.
Field Summary | |
---|---|
protected List |
children
The children of this constraint. |
protected int |
end
The end index of the span associated with this constraint. |
protected Symbol |
label
The nonterminal label associated with this constraint. |
protected UnlexTreeConstraint |
parent
The parent of this constraint. |
protected boolean |
satisfied
Contains whether this constraint has been satisfied at least once during the bottom-up decoding process. |
protected int |
start
The start index of the span associated with this constraint. |
Constructor Summary | |
---|---|
protected |
UnlexTreeConstraint()
Constructs an empty constraint. |
|
UnlexTreeConstraint(Sexp tree)
Constructs the root constraint of a tree of constraints isomorphic to the specified unlexicalized tree. |
protected |
UnlexTreeConstraint(UnlexTreeConstraint parent,
Sexp tree,
IntCounter currWordIdx)
Constructs a tree of constraints isomorphic to the specified unlexicalized syntactic tree. |
Method Summary | |
---|---|
int |
end()
Returns the end index of the span covered by this constraint. |
protected List |
getChildren()
Returns the children of this constraint. |
Constraint |
getParent()
Returns the parent of this constraint. |
boolean |
hasBeenSatisfied()
Returns whether this constraint has been satisfied by at least one chart item. |
boolean |
isLeaf()
Returns whether this constraint corresponds to a leaf (a preterminal). |
boolean |
isLocallySatisfiedBy(Item item)
Returns whether the specified chart item satisfies the local information contained in this constraint (span and nonterminal label). |
boolean |
isSatisfiedBy(Item item)
Returns true if this constraint is satisfied by its local
information and either
the specified item represents a preterminal or
the constraints of the specified item's children are identical
to the children of this constraint, and are in the same order
More formally, let us define the term nuclear family of a node
in a tree to refer to the node itself and its (immediately dominated)
sequence of children. |
protected boolean |
isSatisfiedByPreterminal(CKYItem item)
Simply returns true and sets this constraint's satisfaction bit to be true. |
boolean |
isViolatedBy(Item item)
Throws an UnsupportedOperationException . |
boolean |
isViolatedByChild(Item childItem)
Returns whether this constraint is violated by the specified child chart item. |
Symbol |
label()
Returns the nonterminal label associated with this constraint. |
protected boolean |
spanMatches(Item item)
Returns whether the specified item's span matches that of this constraint. |
int |
start()
Returns the start index of the span covered by this constraint. |
Sexp |
toSexp()
Returns a symbolic expression version of the constraint tree rooted at this constraint. |
String |
toString()
Returns a human-readable string representation of the local information of this constraint (for debugging purposes). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected UnlexTreeConstraint parent
protected List children
protected Symbol label
protected int start
protected int end
protected boolean satisfied
Constructor Detail |
---|
public UnlexTreeConstraint(Sexp tree)
tree
- the unlexicalized syntactic tree with which to construct
this constraint and all its constraint subtreesprotected UnlexTreeConstraint()
protected UnlexTreeConstraint(UnlexTreeConstraint parent, Sexp tree, IntCounter currWordIdx)
parent
- the parent of the constraint subtree to be constructedtree
- the unlexicalized syntactic tree for which an isomorphic
constraint tree is to be constructedcurrWordIdx
- the index of the leftmost word, threaded throughout the
recursive calls to this constructorMethod Detail |
---|
public boolean isLeaf()
isLeaf
in interface Constraint
ConstraintSet.hasTreeStructure()
public boolean isViolatedByChild(Item childItem)
isViolatedByChild
in interface Constraint
childItem
- the child chart item item to be tested against this
constraint
ConstraintSet.hasTreeStructure()
public Constraint getParent()
getParent
in interface Constraint
ConstraintSet.hasTreeStructure()
protected List getChildren()
public Symbol label()
public int start()
public int end()
public boolean isViolatedBy(Item item)
UnsupportedOperationException
.
isViolatedBy
in interface Constraint
item
- the item to test
protected boolean isSatisfiedByPreterminal(CKYItem item)
item
- the preterminal item to be tested against this constraint
public boolean isSatisfiedBy(Item item)
true
if this constraint is satisfied by its local
information and either
true
if
this constraint is satisfied by its local information and if c
is identical to t.
isSatisfiedBy
in interface Constraint
item
- the item to test for satisfaction by this constraint
isLocallySatisfiedBy(Item)
public boolean hasBeenSatisfied()
hasBeenSatisfied
in interface Constraint
public boolean isLocallySatisfiedBy(Item item)
isLocallySatisfiedBy
in interface Constraint
item
- the chart item to be tested against this constraint
protected boolean spanMatches(Item item)
item
- the chart item whose span is to be compared to that of
this constraint
public Sexp toSexp()
toSexp
in interface SexpConvertible
public String toString()
toString
in class Object
|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |