public class MLEDependencyGrammar extends AbstractDependencyGrammar
Modifier and Type | Field and Description |
---|---|
protected ClassicCounter<IntDependency> |
argCounter
Stores all the counts for dependencies (with and without the word
being a wildcard) in the reduced tag space.
|
double |
interp
Interpolation between model that directly predicts aTW and model
that predicts aT and then aW given aT.
|
protected static double |
MIN_PROBABILITY |
protected int |
numWordTokens |
double |
smooth_aPTW_aPT |
double |
smooth_aT_hTd |
double |
smooth_aT_hTWd
Bayesian m-estimate prior for aT given hTWd against base distribution
of aT given hTd.
|
double |
smooth_aTW_aT |
double |
smooth_aTW_hTd |
double |
smooth_aTW_hTWd
Bayesian m-estimate prior for aTW given hTWd against base distribution
of aTW given hTd.
|
double |
smooth_stop |
protected ClassicCounter<IntDependency> |
stopCounter |
protected java.util.List<IntTaggedWord> |
tagITWList
The indices of this list are in the tag binned space.
|
coarseDistanceBins, directional, expandDependencyMap, itwInterner, lex, numTagBins, op, regDistanceBins, stopTW, tagBin, tagIndex, tagProjection, tlp, useCoarseDistance, useDistance, wildTW, wordIndex
Constructor and Description |
---|
MLEDependencyGrammar(TagProjection tagProjection,
TreebankLangParserParams tlpParams,
boolean directional,
boolean useDistance,
boolean useCoarseDistance,
Options op,
Index<java.lang.String> wordIndex,
Index<java.lang.String> tagIndex) |
MLEDependencyGrammar(TreebankLangParserParams tlpParams,
boolean directional,
boolean distance,
boolean coarseDistance,
boolean basicCategoryTagsInDependencyGrammar,
Options op,
Index<java.lang.String> wordIndex,
Index<java.lang.String> tagIndex) |
Modifier and Type | Method and Description |
---|---|
void |
addRule(IntDependency dependency,
double count)
Add this dependency with the given count to the grammar.
|
double |
countHistory(IntDependency dependency) |
void |
dumpSizes() |
protected void |
expandDependency(IntDependency dependency,
double count)
The dependency arg is still in the full tag space.
|
protected double |
getStopProb(IntDependency dependency)
Return the probability (as a real number between 0 and 1) of stopping
rather than generating another argument at this position.
|
protected double |
probTB(IntDependency dependency)
Calculate the probability of a dependency as a real probability between
0 and 1 inclusive.
|
boolean |
pruneTW(IntTaggedWord argTW) |
void |
readData(java.io.BufferedReader in)
Populates data in this DependencyGrammar from the character stream
given by the Reader r.
|
double |
scoreAll(java.util.Collection<IntDependency> deps) |
double |
scoreTB(IntDependency dependency)
Score a tag binned dependency.
|
java.lang.String |
toString() |
protected static edu.stanford.nlp.parser.lexparser.MLEDependencyGrammar.EndHead |
treeToDependencyHelper(Tree tree,
java.util.List<IntDependency> depList,
int loc,
Index<java.lang.String> wordIndex,
Index<java.lang.String> tagIndex)
Adds dependencies to list depList.
|
static java.util.List<IntDependency> |
treeToDependencyList(Tree tree,
Index<java.lang.String> wordIndex,
Index<java.lang.String> tagIndex)
Returns the List of dependencies for a binarized Tree.
|
void |
tune(java.util.Collection<Tree> trees)
Tune the smoothing and interpolation parameters of the dependency
grammar based on a tuning treebank.
|
void |
writeData(java.io.PrintWriter out)
Writes out data from this Object to the Writer w.
|
coarseDistanceBin, distanceBin, initTagBins, intern, numDistBins, numTagBins, regDistanceBin, rootTW, score, score, scoreTB, setLexicon, tagBin, valenceBin
protected int numWordTokens
protected ClassicCounter<IntDependency> argCounter
protected ClassicCounter<IntDependency> stopCounter
public double smooth_aT_hTWd
public double smooth_aTW_hTWd
public double smooth_stop
public double interp
public double smooth_aTW_aT
public double smooth_aTW_hTd
public double smooth_aT_hTd
public double smooth_aPTW_aPT
protected transient java.util.List<IntTaggedWord> tagITWList
protected static final double MIN_PROBABILITY
public MLEDependencyGrammar(TreebankLangParserParams tlpParams, boolean directional, boolean distance, boolean coarseDistance, boolean basicCategoryTagsInDependencyGrammar, Options op, Index<java.lang.String> wordIndex, Index<java.lang.String> tagIndex)
public MLEDependencyGrammar(TagProjection tagProjection, TreebankLangParserParams tlpParams, boolean directional, boolean useDistance, boolean useCoarseDistance, Options op, Index<java.lang.String> wordIndex, Index<java.lang.String> tagIndex)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean pruneTW(IntTaggedWord argTW)
protected static edu.stanford.nlp.parser.lexparser.MLEDependencyGrammar.EndHead treeToDependencyHelper(Tree tree, java.util.List<IntDependency> depList, int loc, Index<java.lang.String> wordIndex, Index<java.lang.String> tagIndex)
public void dumpSizes()
public static java.util.List<IntDependency> treeToDependencyList(Tree tree, Index<java.lang.String> wordIndex, Index<java.lang.String> tagIndex)
tree
- A tree to be analyzed as dependenciespublic double scoreAll(java.util.Collection<IntDependency> deps)
public void tune(java.util.Collection<Tree> trees)
tune
in interface DependencyGrammar
tune
in class AbstractDependencyGrammar
trees
- A Collection of Trees for setting parameterspublic void addRule(IntDependency dependency, double count)
protected void expandDependency(IntDependency dependency, double count)
dependency
- An opbserved dependencycount
- The weight of the dependencypublic double countHistory(IntDependency dependency)
public double scoreTB(IntDependency dependency)
dependency
- The dependency object to be scored, where the tags in
the dependency have already been mapped to a reduced space by a
tagProjection function.protected double probTB(IntDependency dependency)
dependency
- The dependency for which the probability is to be
calculated. The tags in this dependency are in the reduced
TagProjection space.protected double getStopProb(IntDependency dependency)
dependency
- The dependency used as the basis for stopping on.
Tags are assumed to be in the TagProjection space.public void readData(java.io.BufferedReader in) throws java.io.IOException
readData
in interface DependencyGrammar
readData
in class AbstractDependencyGrammar
java.io.IOException
public void writeData(java.io.PrintWriter out) throws java.io.IOException
writeData
in interface DependencyGrammar
writeData
in class AbstractDependencyGrammar
java.io.IOException