|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdanbikel.parser.Chart
danbikel.parser.CKYChart
danbikel.parser.EMChart
public class EMChart
Implementation of a chart for performing constrained CKY parsing so as to perform the E-step of the Inside-Outside algorithm.
Nested Class Summary | |
---|---|
protected static class |
EMChart.Entry
Contains all information and items covering a particular span. |
Field Summary |
---|
Fields inherited from class danbikel.parser.Chart |
---|
cellLimit, chart, debugNumItemsGenerated, debugNumPrunedItems, itemPool, numPrePruned, numPruned, pruneFact, pruning, relax, size, totalItems, totalItemsGenerated |
Constructor Summary | |
---|---|
EMChart()
Constructs a new chart with the default chart size. |
|
EMChart(int size)
Constructs a new chart with the specified chart size. |
Method Summary | |
---|---|
boolean |
add(int start,
int end,
EMItem item)
Adds this item that has no antecedents to the chart. |
boolean |
add(int start,
int end,
EMItem item,
EMItem ante1,
EMItem ante2,
TrainerEvent[] events,
double[] probs)
Adds this item to the chart, recording its antecedents and the events and their probabilities that allowed this item (consequent) to be produced. |
boolean |
add(int start,
int end,
EMItem item,
EMItem ante1,
EMItem ante2,
TrainerEvent event,
double prob)
Adds this item to the chart, recording its antecedents and the events and their probabilities that allowed this item (consequent) to be produced. |
void |
clear()
Checks every map of the chart covering a span less than or equal to size and clears it; if a chart entry is null , then a
new map is created. |
void |
doPruning()
This method has been overloaded so that it simply throws an UnsupportedOperationException , since pruning is
inappropriate when performing the E-step of the Inside-Outside
algorithm. |
EMItem |
getNewEMItem()
Returns a new EMItem . |
int |
numUnaryLevels(int start,
int end)
Returns the number of unary levels for the chart entry at the specified span. |
protected boolean |
outsideBeam(Item item,
double topProb)
Returns whether the specified chart item is outside the beam given the specified top log prob. |
void |
setSize(int size)
Ensures that the size of the chart is at least as large as the specified size. |
protected void |
setUpItemPool()
Sets up the item object pools. |
protected boolean |
toPrune(int start,
int end,
Item item)
Returns true if the specified chart item should not
be added to the specified set of items because its probability is not
within Chart.pruneFact of the highest-ranked item. |
int[] |
unaryLevelCounts(int start,
int end)
Returns an array of integers containing the number of chart items at each of the unary levels of the specified span. |
Methods inherited from class danbikel.parser.CKYChart |
---|
cellLimitShouldApplyTo, clearNonPreterminals, getNewItem, reclaimItemCollection |
Methods inherited from class danbikel.parser.Chart |
---|
add, dontDoPruning, dontRelax, get, getTopItem, getTopLogProb, numItems, postParseCleanup, prune, reclaimItem, reclaimItemsInChart, relax, resetTopLogProb, setPruneFactor, setSizeAndClear |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EMChart()
public EMChart(int size)
size
- the initial size of this chartMethod Detail |
---|
public void setSize(int size)
setSize
in class Chart
size
- the size to be set for this chartpublic void clear()
null
, then a
new map is created.
clear
in class Chart
protected boolean outsideBeam(Item item, double topProb)
Chart
outsideBeam
in class CKYChart
item
- the item to be tested for inclusion within the beamtopProb
- the log prob of the top-ranked item for the specified item's
span
protected boolean toPrune(int start, int end, Item item)
Chart
true
if the specified chart item should not
be added to the specified set of items because its probability is not
within Chart.pruneFact
of the highest-ranked item. This method is
guaranteed to be called by Chart.add(int,int,Item)
when a sorted set
of chart items already exists (and hence contains at least one chart
item).
toPrune
in class Chart
start
- the start of the span for the specified itemend
- the end of the span for the specified itemitem
- the item being added to items
true
if the specified chart item should not
be added to the set of items covering the specified spanpublic void doPruning()
UnsupportedOperationException
, since pruning is
inappropriate when performing the E-step of the Inside-Outside
algorithm.
doPruning
in class Chart
public boolean add(int start, int end, EMItem item)
start
- the start of the span of this itemend
- the end of the span of this itemitem
- the item to be added
public boolean add(int start, int end, EMItem item, EMItem ante1, EMItem ante2, TrainerEvent event, double prob)
start
- the start of the span of the item to be addedend
- the end of the span of the item to be addeditem
- the item to be addedante1
- the first of two possible antecedents of the item to be addedante2
- the second of two possible antecedents of the item to be
added; if the item has only one antecedent, the value of this parameter
should be null
event
- the single event that allowed this item (consequent) to be
produced from its antecedent(s)prob
- the probability of the specified event
public boolean add(int start, int end, EMItem item, EMItem ante1, EMItem ante2, TrainerEvent[] events, double[] probs)
start
- the start of the span of the item to be addedend
- the end of the span of the item to be addeditem
- the item to be addedante1
- the first of two possible antecedents of the item to be addedante2
- the second of two possible antecedents of the item to be
added; if the item has only one antecedent, the value of this parameter
should be null
events
- the events that allowed this item (consequent) to be
produced from its antecedent(s)probs
- an array of probabilities of the same size and coindexed
with the specified array of events, where each probability
is that for its coindexed event
protected void setUpItemPool()
Chart
setUpItemPool
in class CKYChart
public EMItem getNewEMItem()
EMItem
.
EMItem
public int numUnaryLevels(int start, int end)
start
- the start of the span for which to retrieve the number of
unary levelsend
- the end of the span for which to retrieve the number of unary
levels
public int[] unaryLevelCounts(int start, int end)
numUnaryLevels(int, int)
for the same span.
start
- the start of the span for which to retrieve the unary level
countsend
- the start of the span for which to retrieve the unary level
counts
|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |