edu.stanford.nlp.parser.lexparser
Class MLEDependencyGrammar

java.lang.Object
  extended by edu.stanford.nlp.parser.lexparser.AbstractDependencyGrammar
      extended by edu.stanford.nlp.parser.lexparser.MLEDependencyGrammar
All Implemented Interfaces:
DependencyGrammar, Serializable
Direct Known Subclasses:
ChineseSimWordAvgDepGrammar

public class MLEDependencyGrammar
extends AbstractDependencyGrammar

See Also:
Serialized Form

Field Summary
protected  Counter argCounter
           
 double interp
           
protected static double MIN_PROBABILITY
           
protected  int numWords
           
 double smooth_aT_hTWd
           
 double smooth_aTW_hTWd
           
 double smooth_stop
           
protected  Counter stopCounter
           
protected  List<IntTaggedWord> tagITWList
           
 
Fields inherited from class edu.stanford.nlp.parser.lexparser.AbstractDependencyGrammar
directional, expandDependencyMap, numTagBins, stopTW, tagBin, tagProjection, tlp, useCoarseDistance, useDistance, wildTW
 
Constructor Summary
MLEDependencyGrammar(edu.stanford.nlp.parser.lexparser.TagProjection tagProjection, TreebankLangParserParams tlpParams, boolean directional, boolean useDistance, boolean useCoarseDistance)
           
MLEDependencyGrammar(TreebankLangParserParams tlpParams, boolean directional, boolean distance, boolean coarseDistance)
           
 
Method Summary
 void addRule(edu.stanford.nlp.parser.lexparser.Dependency dependency, double count)
          Add this dependency with the given count to the grammar.
 double countHistory(edu.stanford.nlp.parser.lexparser.Dependency dependency)
           
 void dumpSizes()
           
protected  void expandDependency(edu.stanford.nlp.parser.lexparser.Dependency dependency, double count)
           
protected  double getStopProb(edu.stanford.nlp.parser.lexparser.Dependency 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(edu.stanford.nlp.parser.lexparser.Dependency dependency)
          Calculate the probability of a dependency as a real probability between 0 and 1 inclusive.
 boolean pruneTW(IntTaggedWord argTW)
           
 void readData(BufferedReader in)
          Populates data in this DependencyGrammar from the character stream given by the Reader r.
protected  double scoreAll(Collection deps)
           
 double scoreTB(edu.stanford.nlp.parser.lexparser.Dependency dependency)
          Score a Dependency according to the grammar.
 String toString()
           
protected static edu.stanford.nlp.parser.lexparser.MLEDependencyGrammar.EndHead treeToDependencyHelper(Tree tree, List<edu.stanford.nlp.parser.lexparser.Dependency> depList, int loc)
          Adds dependencies to list depList.
static List<edu.stanford.nlp.parser.lexparser.Dependency> treeToDependencyList(Tree tree)
          Returns the List of dependencies for a Tree.
 void tune(Collection<Tree> trees)
          Default is no-op.
 void writeData(PrintWriter out)
          Writes out data from this Object to the Writer w.
 
Methods inherited from class edu.stanford.nlp.parser.lexparser.AbstractDependencyGrammar
courseDistanceBin, distanceBin, intern, numDistBins, numTagBins, regDistanceBin, rootTW, score, score, scoreTB, tagBin, tagNumberer, valenceBin, wordNumberer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numWords

protected int numWords

argCounter

protected Counter argCounter

stopCounter

protected Counter stopCounter

smooth_aT_hTWd

public double smooth_aT_hTWd

smooth_aTW_hTWd

public double smooth_aTW_hTWd

smooth_stop

public double smooth_stop

interp

public double interp

tagITWList

protected transient List<IntTaggedWord> tagITWList

MIN_PROBABILITY

protected static final double MIN_PROBABILITY
Constructor Detail

MLEDependencyGrammar

public MLEDependencyGrammar(TreebankLangParserParams tlpParams,
                            boolean directional,
                            boolean distance,
                            boolean coarseDistance)

MLEDependencyGrammar

public MLEDependencyGrammar(edu.stanford.nlp.parser.lexparser.TagProjection tagProjection,
                            TreebankLangParserParams tlpParams,
                            boolean directional,
                            boolean useDistance,
                            boolean useCoarseDistance)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

pruneTW

public boolean pruneTW(IntTaggedWord argTW)

treeToDependencyHelper

protected static edu.stanford.nlp.parser.lexparser.MLEDependencyGrammar.EndHead treeToDependencyHelper(Tree tree,
                                                                                                       List<edu.stanford.nlp.parser.lexparser.Dependency> depList,
                                                                                                       int loc)
Adds dependencies to list depList. These are in terms of the original tag set not the reduced (projected) tag set.


dumpSizes

public void dumpSizes()

treeToDependencyList

public static List<edu.stanford.nlp.parser.lexparser.Dependency> treeToDependencyList(Tree tree)
Returns the List of dependencies for a Tree. These are in terms of the original tag set not the reduced (projected) tag set.


scoreAll

protected double scoreAll(Collection deps)

tune

public void tune(Collection<Tree> trees)
Description copied from class: AbstractDependencyGrammar
Default is no-op.

Specified by:
tune in interface DependencyGrammar
Overrides:
tune in class AbstractDependencyGrammar

addRule

public void addRule(edu.stanford.nlp.parser.lexparser.Dependency dependency,
                    double count)
Add this dependency with the given count to the grammar. This is a dependency represented in the full tag space.


expandDependency

protected void expandDependency(edu.stanford.nlp.parser.lexparser.Dependency dependency,
                                double count)

countHistory

public double countHistory(edu.stanford.nlp.parser.lexparser.Dependency dependency)

scoreTB

public double scoreTB(edu.stanford.nlp.parser.lexparser.Dependency dependency)
Description copied from interface: DependencyGrammar
Score a Dependency according to the grammar.

Parameters:
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.
Returns:
The negative log probability given to the dependency by the grammar. This may be Double.NEGATIVE_INFINITY for "impossible".

probTB

protected double probTB(edu.stanford.nlp.parser.lexparser.Dependency dependency)
Calculate the probability of a dependency as a real probability between 0 and 1 inclusive.

Parameters:
dependency - The dependency for which the probability is to be calculated. The tags in this dependency are in the reduced TagProjection space.
Returns:
The probability of the dependency

getStopProb

protected double getStopProb(edu.stanford.nlp.parser.lexparser.Dependency dependency)
Return the probability (as a real number between 0 and 1) of stopping rather than generating another argument at this position.

Parameters:
dependency - The dependency used as the basis for stopping on. Tags are assumed in the TagProjection space

readData

public void readData(BufferedReader in)
              throws IOException
Populates data in this DependencyGrammar from the character stream given by the Reader r.

Specified by:
readData in interface DependencyGrammar
Overrides:
readData in class AbstractDependencyGrammar
Throws:
IOException

writeData

public void writeData(PrintWriter out)
               throws IOException
Writes out data from this Object to the Writer w.

Specified by:
writeData in interface DependencyGrammar
Overrides:
writeData in class AbstractDependencyGrammar
Throws:
IOException


Stanford NLP Group