|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdanbikel.parser.Item
public abstract class Item
Skeletal class to represent items in a parsing chart. Items implement the comparable interface, so as to be sorted by their probability.
Chart
,
Serialized FormField Summary | |
---|---|
protected double |
logProb
The log-probability of this chart item. |
Constructor Summary | |
---|---|
protected |
Item()
Constructs this item to have an initial log-probability of Constants.logOfZero . |
protected |
Item(double logProb)
Constructs a chart item with the specified log-probability score. |
Method Summary | |
---|---|
Item |
clear()
Clears data members of this item before reclamation (called by Chart.reclaimItem(Item) ). |
int |
compareTo(Object o)
Compares this item's log-probability score with that of the specified object, which must also be an instance of Item . |
abstract boolean |
garbage()
Returns whether this item has been eliminated from the chart because another, equivalent item was added (meaning that this item could not be immediately reclaimed, since the caller of Chart.add may have a handle onto this item). |
abstract Constraint |
getConstraint()
Returns the constraint associated with this chart item, or null if this item has no associated constraint. |
void |
hasEquivalentItem(Item equivalentItem)
Indicates that the specified item that was produced during decoding is equivalent to this item. |
abstract Object |
label()
Returns the label of this chart item. |
double |
logProb()
Gets the log probability of this chart item. |
abstract void |
setConstraint(Constraint constraint)
Sets the constraint for this item. |
abstract void |
setGarbage(boolean garbage)
Sets the value of this item's garbage status. |
abstract void |
setLabel(Object label)
Sets the label of this chart item. |
void |
setLogProb(double logProb)
Sets the log probability of this chart item. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected double logProb
Constructor Detail |
---|
protected Item()
Constants.logOfZero
. This constructor will be called,
often implicitly, by the constructor of a subclass.
Constants.logOfZero
protected Item(double logProb)
logProb
- the log probability of this chart item, also known as its
scoreMethod Detail |
---|
public abstract Object label()
public abstract void setLabel(Object label)
public double logProb()
public void setLogProb(double logProb)
public abstract boolean garbage()
Chart.add
may have a handle onto this item).
Chart.add(int,int,Item)
public abstract Constraint getConstraint()
null
if this item has no associated constraint.
public abstract void setConstraint(Constraint constraint)
constraint
- the constraint to be associated with this item.public abstract void setGarbage(boolean garbage)
garbage()
,
Chart.add(int,int,Item)
public void hasEquivalentItem(Item equivalentItem)
equivalentItem
- a chart item equivalent to this onepublic Item clear()
Chart.reclaimItem(Item)
). The default implementation here does
nothing.
public int compareTo(Object o)
Item
. Returns -1, 0 or 1, depending on whether this item's score is less
than, equal to or greater than, respectively, the specified item's score.
By implementing the Comparable
interface, instances of Item
may be used in collections and with algorithms in the Java Collections
Framework that perform sorting.
compareTo
in interface Comparable
o
- the Item
instance whose score is to be compared with the
score of this item
logProb()
|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |