edu.stanford.nlp.parser.lexparser
Interface DependencyGrammar

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractDependencyGrammar, ChineseSimWordAvgDepGrammar, MLEDependencyGrammar

public interface DependencyGrammar
extends Serializable

An interface for DependencyGrammars.

Author:
Galen Andrew, Christopher Manning

Method Summary
 short distanceBin(int distance)
           
 int numDistBins()
           
 int numTagBins()
           
 void readData(BufferedReader in)
          Read from text grammar.
 double score(edu.stanford.nlp.parser.lexparser.Dependency dependency)
          Score a Dependency according to the grammar.
 double score(int headWord, int headTag, int argWord, int argTag, boolean leftHeaded, int dist)
          Score a dependency according to the grammar, where the elements of the dependency are represented in separate paramters.
 double scoreTB(edu.stanford.nlp.parser.lexparser.Dependency dependency)
          Score a Dependency according to the grammar.
 double scoreTB(int headWord, int headTag, int argWord, int argTag, boolean leftHeaded, int dist)
          Score a dependency according to the grammar, where the elements of the dependency are represented in separate paramters.
 int tagBin(int tag)
          Converts a tag (coded as an integer via a Numberer) from its representation in the full tag space to the reduced (projected) tag space used in the DependencyGrammar.
 void tune(Collection<Tree> trees)
          Tune free parameters on these trees.
 void writeData(PrintWriter w)
          Write to text grammar.
 

Method Detail

numTagBins

int numTagBins()
Returns:
The number of tags recognized in the reduced (projected) tag space used in the DependencyGrammar.

tagBin

int tagBin(int tag)
Converts a tag (coded as an integer via a Numberer) from its representation in the full tag space to the reduced (projected) tag space used in the DependencyGrammar.

Parameters:
tag - An int encoding a tag (in the "tags" Numberer)
Returns:
An int representing the tag in the reduced binTag space

numDistBins

int numDistBins()
Returns:
The number of distance buckets (measured between the head and the nearest corner of the argument) used in calculating attachment probabilities by the DependencyGrammar

distanceBin

short distanceBin(int distance)
Returns:
The distance bucket corresponding the the original distance (measured between the head and the nearest corner of the argument) used in calculating attachment probabilities by the DependencyGrammar. Bucket numbers are small integers [0, ..., numDistBins - 1].

tune

void tune(Collection<Tree> trees)
Tune free parameters on these trees. A substantive implementation is optional.

Parameters:
trees -

score

double score(edu.stanford.nlp.parser.lexparser.Dependency dependency)
Score a Dependency according to the grammar.

Parameters:
dependency - The dependency object to be scored, in normal form.
Returns:
The negative log probability given to the dependency by the grammar. This may be Double.NEGATIVE_INFINITY for "impossible".

scoreTB

double scoreTB(edu.stanford.nlp.parser.lexparser.Dependency dependency)
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".

score

double score(int headWord,
             int headTag,
             int argWord,
             int argTag,
             boolean leftHeaded,
             int dist)
Score a dependency according to the grammar, where the elements of the dependency are represented in separate paramters.

Returns:
The negative log probability given to the dependency by the grammar. This may be Double.NEGATIVE_INFINITY for "impossible".

scoreTB

double scoreTB(int headWord,
               int headTag,
               int argWord,
               int argTag,
               boolean leftHeaded,
               int dist)
Score a dependency according to the grammar, where the elements of the dependency are represented in separate paramters. 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".

readData

void readData(BufferedReader in)
              throws IOException
Read from text grammar. Optional.

Parameters:
in -
Throws:
IOException

writeData

void writeData(PrintWriter w)
               throws IOException
Write to text grammar. Optional.

Parameters:
w -
Throws:
IOException


Stanford NLP Group