Parsing Engine

danbikel.parser
Class EMItem

java.lang.Object
  extended by danbikel.parser.Item
      extended by danbikel.parser.CKYItem
          extended by danbikel.parser.CKYItem.MappedPrevModBaseNPAware
              extended by danbikel.parser.EMItem
All Implemented Interfaces:
SexpConvertible, Serializable, Comparable

public class EMItem
extends CKYItem.MappedPrevModBaseNPAware

Class to represent a chart item when performing the Inside-Outside algorithm.

See Also:
Serialized Form

Nested Class Summary
static class EMItem.AntecedentPair
          Holds references to the one or two antecedents that yielded a particular consequent, along with the one or more events that generated the consequent.
 
Nested classes/interfaces inherited from class danbikel.parser.CKYItem
CKYItem.BaseNPAware, CKYItem.KBestHack, CKYItem.MappedPrevModBaseNPAware, CKYItem.PrevModIsStart
 
Field Summary
protected  EMItem.AntecedentPair antecedentPairs
          A list of antecedent pairs for this item.
protected  int unaryLevel
          The unary production level for this item.
 
Fields inherited from class danbikel.parser.CKYItem
baseNPsCannotContainVerbs, constraint, containsVerb, containsVerbFalse, containsVerbTrue, containsVerbUndefined, end, garbage, headChild, headWord, label, leftChildren, leftPrevMods, leftSubcat, leftVerb, logPrior, logTreeProb, nonTreebankDelimiter, nonTreebankLeftBracket, nonTreebankRightBracket, numParses, numPrevMods, numPrevWords, outputInsideProbs, outputLexLabels, rightChildren, rightPrevMods, rightSubcat, rightVerb, start, stop, stopWord, topSym
 
Fields inherited from class danbikel.parser.Item
logProb
 
Constructor Summary
EMItem()
          Constructs a new EM (Inside-Outside) chart item, with all data members set to default values.
 
Method Summary
 EMItem.AntecedentPair antecedentPairs()
          Gets the antecedent pairs for this item.
 Item clear()
          Clears all chart-related data in this item (most of the data members do not need to be cleared, as they are expressly set by the decoder).
 boolean equals(Object obj)
          Returns whether this item is equal to the specified object, which must also be an instance of EMItem.
 void increaseInsideProb(double amount)
          Increases the inside probability of the derivations represented by this item by the specified amount.
 void increaseOutsideProb(double amount)
          Increases the outside probability of this item by the specified amount.
 double insideProb()
          Gets the total inside probability of the derivations represented by this item.
 double logPrior()
          Throws an UnsupportedOperationException.
 double logProb()
          Throws an UnsupportedOperationException.
 double logTreeProb()
          Throws an UnsupportedOperationException.
 double outsideProb()
          Gets the outside probability of this item.
 void set(Symbol label, Word headWord, Subcat leftSubcat, Subcat rightSubcat, CKYItem headChild, SLNode leftChildren, SLNode rightChildren, SexpList leftPrevMods, SexpList rightPrevMods, int start, int end, boolean leftVerb, boolean rightVerb, boolean stop, double logTreeProb, double logPrior, double logProb)
          This method simply throws an UnsupportedOperationException, as the log probabilities of the superclass are not used by this class.
 void set(Symbol label, Word headWord, Subcat leftSubcat, Subcat rightSubcat, CKYItem headChild, SLNode leftChildren, SLNode rightChildren, SexpList leftPrevMods, SexpList rightPrevMods, int start, int end, boolean leftVerb, boolean rightVerb, boolean stop, int unaryLevel, double insideProb)
          Sets all the data for this EM chart item.
 void setAntecedentPairs(EMItem.AntecedentPair pair)
          Sets the antecedent pairs for this item.
 CKYItem setDataFrom(CKYItem other)
          Sets all the data in this item from the specified item.
 void setInsideProb(double insideProb)
          Sets the total inside probability of the derivations represented by this item.
 void setLogPrior(double logPrior)
          Throws an UnsupportedOperationException.
 void setLogProb(double logProb)
          Throws an UnsupportedOperationException.
 void setLogTreeProb(double logTreeProb)
          Throws an UnsupportedOperationException.
 void setOutsideProb(double outsideProb)
          Sets the outside probability of this item
 void setUnaryLevel(int unaryLevel)
          Sets the unary productions level of this item.
 String toString()
          Returns a human-readable string representation of the information in this item.
 int unaryLevel()
          Gets the unary production level of this item.
 
Methods inherited from class danbikel.parser.CKYItem.MappedPrevModBaseNPAware
hashCode, mappedPrevModsEqual
 
Methods inherited from class danbikel.parser.CKYItem
children, containsVerb, containsVerbRecursive, edgeIndex, end, garbage, getConstraint, getLabel, hasAntecedent, hasEquivalentItem, headChild, headLabel, headWord, headWordIdx, isPreterminal, label, leftChildren, leftPrevMods, leftSubcat, leftVerb, numLeftChildren, numParses, numRightChildren, prevMods, prevWordsEqual, prevWordsEqual, rightChildren, rightPrevMods, rightSubcat, rightVerb, setChildren, setConstraint, setEdgeIndex, setGarbage, setLabel, setLeftSubcat, setPrevMods, setRightSubcat, setSideInfo, setSubcat, setVerb, shortBool, shortContainsVerb, start, stop, subcat, toSexp, toSexpInternal, verb
 
Methods inherited from class danbikel.parser.Item
compareTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

antecedentPairs

protected EMItem.AntecedentPair antecedentPairs
A list of antecedent pairs for this item.


unaryLevel

protected int unaryLevel
The unary production level for this item.

See Also:
Decoder.addUnaries(CKYItem, java.util.List)
Constructor Detail

EMItem

public EMItem()
Constructs a new EM (Inside-Outside) chart item, with all data members set to default values.

See Also:
set(Symbol, Word, Subcat, Subcat, CKYItem, SLNode, SLNode, SexpList, SexpList, int, int, boolean, boolean, boolean, int, double)
Method Detail

set

public void set(Symbol label,
                Word headWord,
                Subcat leftSubcat,
                Subcat rightSubcat,
                CKYItem headChild,
                SLNode leftChildren,
                SLNode rightChildren,
                SexpList leftPrevMods,
                SexpList rightPrevMods,
                int start,
                int end,
                boolean leftVerb,
                boolean rightVerb,
                boolean stop,
                double logTreeProb,
                double logPrior,
                double logProb)
This method simply throws an UnsupportedOperationException, as the log probabilities of the superclass are not used by this class.

Overrides:
set in class CKYItem
Parameters:
label - the unlexicalized root label of this chart item
headWord - the head word of this chart item
leftSubcat - the subcat on the left side of this item's head child
rightSubcat - the subcat on the right side of this item's head child
headChild - the head child item of this chart item
leftChildren - the modifiers on the left side of this item's head child
rightChildren - the modifiers on the right side of this item's head child
leftPrevMods - a list of the previous modifiers on the left side of this item's head child
rightPrevMods - a list of the previous modifiers on the right side of this item's head child
start - the index of the first word spanned by this item
end - the index of the last word spanned by this item
leftVerb - whether a verb has been generated anywhere in the surface string of the modifiers on the left side of this item's head child
rightVerb - whether a verb has been generated anywhere in the surface string of the modifiers on the right side of this item's head child
stop - whether this item has received its stop probabilities
logTreeProb - the log of the probability of generating all of this item's child items (head child and left and right modifier children)
logPrior - the log of the marginal probability of this item's lexicalized root label
logProb - the log of the probability of this chart item (its score)

set

public void set(Symbol label,
                Word headWord,
                Subcat leftSubcat,
                Subcat rightSubcat,
                CKYItem headChild,
                SLNode leftChildren,
                SLNode rightChildren,
                SexpList leftPrevMods,
                SexpList rightPrevMods,
                int start,
                int end,
                boolean leftVerb,
                boolean rightVerb,
                boolean stop,
                int unaryLevel,
                double insideProb)
Sets all the data for this EM chart item.

Parameters:
label - the unlexicalized root label of this chart item
headWord - the head word of this chart item
leftSubcat - the subcat on the left side of this item's head child
rightSubcat - the subcat on the right side of this item's head child
headChild - the head child item of this chart item
leftChildren - the modifiers on the left side of this item's head child
rightChildren - the modifiers on the right side of this item's head child
leftPrevMods - a list of the previous modifiers on the left side of this item's head child
rightPrevMods - a list of the previous modifiers on the right side of this item's head child
start - the index of the first word spanned by this item
end - the index of the last word spanned by this item
leftVerb - whether a verb has been generated anywhere in the surface string of the modifiers on the left side of this item's head child
rightVerb - whether a verb has been generated anywhere in the surface string of the modifiers on the right side of this item's head child
stop - whether this item has received its stop probabilities
unaryLevel - the unary production level of this item
insideProb - the total inside probability of the derivations represented by this item

setDataFrom

public CKYItem setDataFrom(CKYItem other)
Sets all the data in this item from the specified item.

Overrides:
setDataFrom in class CKYItem
Parameters:
other - the item whose data is to be transfered to this item.
Returns:
this item

logProb

public double logProb()
Throws an UnsupportedOperationException.

Overrides:
logProb in class CKYItem
Returns:
the log probability, or score, of this chart item.
See Also:
CKYItem.logTreeProb(), CKYItem.logPrior()

setLogProb

public void setLogProb(double logProb)
Throws an UnsupportedOperationException.

Overrides:
setLogProb in class CKYItem
Parameters:
logProb - the log of the probability of this chart item (its score)
See Also:
CKYItem.logProb()

logPrior

public double logPrior()
Throws an UnsupportedOperationException.

Overrides:
logPrior in class CKYItem
Returns:
the marginal probability of generating the lexicalized root label of this item's set of derivations
See Also:
CKYItem.logProb(), CKYItem.logTreeProb()

setLogPrior

public void setLogPrior(double logPrior)
Throws an UnsupportedOperationException.

Overrides:
setLogPrior in class CKYItem
Parameters:
logPrior - the log of the marginal probability of the lexicalized root nonterminal label of this chart item
See Also:
CKYItem.logPrior()

logTreeProb

public double logTreeProb()
Throws an UnsupportedOperationException.

Overrides:
logTreeProb in class CKYItem
Returns:
the probability of generating all the children of this chart item (head child and left and right modifier children).
See Also:
CKYItem.logProb(), CKYItem.logPrior()

setLogTreeProb

public void setLogTreeProb(double logTreeProb)
Throws an UnsupportedOperationException.

Overrides:
setLogTreeProb in class CKYItem
Parameters:
logTreeProb - the log of the probability of generating all of this item's children the log of the probability of generating all of this item's children
See Also:
CKYItem.logTreeProb()

outsideProb

public double outsideProb()
Gets the outside probability of this item.

Returns:
the outside probability of this item.

setOutsideProb

public void setOutsideProb(double outsideProb)
Sets the outside probability of this item

Parameters:
outsideProb - the outside probability to be set for this item

increaseOutsideProb

public void increaseOutsideProb(double amount)
Increases the outside probability of this item by the specified amount.

Parameters:
amount - the amount to increase the outside probability of this item

insideProb

public double insideProb()
Gets the total inside probability of the derivations represented by this item.

Returns:
the total inside probability of the derivations represented by this item

setInsideProb

public void setInsideProb(double insideProb)
Sets the total inside probability of the derivations represented by this item.

Parameters:
insideProb - the inside probability to set for this item

increaseInsideProb

public void increaseInsideProb(double amount)
Increases the inside probability of the derivations represented by this item by the specified amount.

Parameters:
amount - the amount by which to increase the inside probability of the derivations represented by this item

antecedentPairs

public EMItem.AntecedentPair antecedentPairs()
Gets the antecedent pairs for this item.


setAntecedentPairs

public void setAntecedentPairs(EMItem.AntecedentPair pair)
Sets the antecedent pairs for this item.

Parameters:
pair - the list of antecedent pairs for this item

unaryLevel

public int unaryLevel()
Gets the unary production level of this item.


setUnaryLevel

public void setUnaryLevel(int unaryLevel)
Sets the unary productions level of this item.

Parameters:
unaryLevel - the unary production level to be set for this item

clear

public Item clear()
Clears all chart-related data in this item (most of the data members do not need to be cleared, as they are expressly set by the decoder).

Overrides:
clear in class CKYItem
Returns:
this item

equals

public boolean equals(Object obj)
Returns whether this item is equal to the specified object, which must also be an instance of EMItem.

Overrides:
equals in class CKYItem.MappedPrevModBaseNPAware
Parameters:
obj - the object to compare with this item
Returns:
whether this item is equal to the specified object, which must also be an instance of EMItem

toString

public String toString()
Returns a human-readable string representation of the information in this item.

Overrides:
toString in class CKYItem
Returns:
a human-readable string representation of the information in this item.

Parsing Engine

Author: Dan Bikel.