|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.parser.lexparser.AbstractDependencyGrammar
public abstract class AbstractDependencyGrammar
An abstract base class for dependency grammars. The only thing you have to implement in a subclass is scoreTB. A subclass also has to either call super() in its constructor, or otherwise initialize the tagBin array. The call to initTagBins() (in the constructor) must be made after all keys have been entered into Numberer.getGlobalNumberer("tags").
Field Summary | |
---|---|
protected boolean |
directional
|
protected Map |
expandDependencyMap
|
protected int |
numTagBins
|
protected static IntTaggedWord |
stopTW
|
protected int[] |
tagBin
|
protected edu.stanford.nlp.parser.lexparser.TagProjection |
tagProjection
|
protected TreebankLanguagePack |
tlp
|
protected boolean |
useCoarseDistance
|
protected boolean |
useDistance
|
protected static IntTaggedWord |
wildTW
|
Constructor Summary | |
---|---|
AbstractDependencyGrammar(TreebankLanguagePack tlp,
edu.stanford.nlp.parser.lexparser.TagProjection tagProjection,
boolean directional,
boolean useDistance,
boolean useCoarseDistance)
|
Method Summary | |
---|---|
static short |
courseDistanceBin(int distance)
|
short |
distanceBin(int distance)
|
protected edu.stanford.nlp.parser.lexparser.Dependency |
intern(IntTaggedWord headTW,
IntTaggedWord argTW,
boolean leftHeaded,
int dist)
|
int |
numDistBins()
|
int |
numTagBins()
|
void |
readData(BufferedReader in)
Default is to throw exception. |
static short |
regDistanceBin(int distance)
|
static boolean |
rootTW(IntTaggedWord rTW)
|
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)
cdm: this seems to fail to do the tagbin'ing you'd expect ... |
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. |
protected static Numberer |
tagNumberer()
|
void |
tune(Collection<Tree> trees)
Default is no-op. |
protected short |
valenceBin(int distance)
|
protected static Numberer |
wordNumberer()
|
void |
writeData(PrintWriter out)
Default is to throw exception. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface edu.stanford.nlp.parser.lexparser.DependencyGrammar |
---|
scoreTB |
Field Detail |
---|
protected edu.stanford.nlp.parser.lexparser.TagProjection tagProjection
protected int numTagBins
protected int[] tagBin
protected TreebankLanguagePack tlp
protected boolean directional
protected boolean useDistance
protected boolean useCoarseDistance
protected static final IntTaggedWord stopTW
protected static final IntTaggedWord wildTW
protected transient Map expandDependencyMap
Constructor Detail |
---|
public AbstractDependencyGrammar(TreebankLanguagePack tlp, edu.stanford.nlp.parser.lexparser.TagProjection tagProjection, boolean directional, boolean useDistance, boolean useCoarseDistance)
Method Detail |
---|
protected static Numberer tagNumberer()
protected static Numberer wordNumberer()
public void tune(Collection<Tree> trees)
tune
in interface DependencyGrammar
trees
- public int numTagBins()
numTagBins
in interface DependencyGrammar
public int tagBin(int tag)
DependencyGrammar
tagBin
in interface DependencyGrammar
tag
- An int encoding a tag (in the "tags" Numberer)
public static boolean rootTW(IntTaggedWord rTW)
protected short valenceBin(int distance)
public int numDistBins()
numDistBins
in interface DependencyGrammar
public short distanceBin(int distance)
distanceBin
in interface DependencyGrammar
public static short regDistanceBin(int distance)
public static short courseDistanceBin(int distance)
public double score(edu.stanford.nlp.parser.lexparser.Dependency dependency)
DependencyGrammar
score
in interface DependencyGrammar
dependency
- The dependency object to be scored, in normal form.
public double score(int headWord, int headTag, int argWord, int argTag, boolean leftHeaded, int dist)
score
in interface DependencyGrammar
public double scoreTB(int headWord, int headTag, int argWord, int argTag, boolean leftHeaded, int dist)
DependencyGrammar
scoreTB
in interface DependencyGrammar
public void readData(BufferedReader in) throws IOException
readData
in interface DependencyGrammar
in
-
IOException
public void writeData(PrintWriter out) throws IOException
writeData
in interface DependencyGrammar
out
-
IOException
protected edu.stanford.nlp.parser.lexparser.Dependency intern(IntTaggedWord headTW, IntTaggedWord argTW, boolean leftHeaded, int dist)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |