public abstract class AbstractDependencyGrammar extends java.lang.Object implements DependencyGrammar
| Modifier and Type | Field and Description |
|---|---|
protected int[] |
coarseDistanceBins |
protected boolean |
directional |
protected java.util.Map<IntDependency,IntDependency> |
expandDependencyMap |
protected Interner<IntTaggedWord> |
itwInterner |
protected Lexicon |
lex |
protected int |
numTagBins |
protected Options |
op |
protected int[] |
regDistanceBins |
protected IntTaggedWord |
stopTW |
protected int[] |
tagBin |
protected Index<java.lang.String> |
tagIndex |
protected TagProjection |
tagProjection |
protected TreebankLanguagePack |
tlp |
protected boolean |
useCoarseDistance |
protected boolean |
useDistance |
protected IntTaggedWord |
wildTW |
protected Index<java.lang.String> |
wordIndex |
| Constructor and Description |
|---|
AbstractDependencyGrammar(TreebankLanguagePack tlp,
TagProjection tagProjection,
boolean directional,
boolean useDistance,
boolean useCoarseDistance,
Options op,
Index<java.lang.String> wordIndex,
Index<java.lang.String> tagIndex) |
| Modifier and Type | Method and Description |
|---|---|
short |
coarseDistanceBin(int distance) |
short |
distanceBin(int distance) |
protected void |
initTagBins() |
protected IntDependency |
intern(IntTaggedWord headTW,
IntTaggedWord argTW,
boolean leftHeaded,
short dist)
This is a custom interner that simultaneously creates and interns
an IntDependency.
|
int |
numDistBins() |
int |
numTagBins() |
void |
readData(java.io.BufferedReader in)
Default is to throw exception.
|
short |
regDistanceBin(int distance) |
boolean |
rootTW(IntTaggedWord rTW) |
double |
score(IntDependency dependency)
Score a IntDependency 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(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.
|
void |
setLexicon(Lexicon lexicon)
Set the Lexicon, which the DependencyGrammar may use in scoring P(w|t).
|
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(java.util.Collection<Tree> trees)
Default is no-op.
|
protected short |
valenceBin(int distance) |
void |
writeData(java.io.PrintWriter out)
Default is to throw exception.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitscoreTBprotected TagProjection tagProjection
protected final Index<java.lang.String> tagIndex
protected final Index<java.lang.String> wordIndex
protected int numTagBins
protected int[] tagBin
protected TreebankLanguagePack tlp
protected boolean directional
protected boolean useDistance
protected boolean useCoarseDistance
protected Lexicon lex
protected final IntTaggedWord stopTW
protected final IntTaggedWord wildTW
protected transient java.util.Map<IntDependency,IntDependency> expandDependencyMap
protected int[] coarseDistanceBins
protected int[] regDistanceBins
protected final Options op
protected transient Interner<IntTaggedWord> itwInterner
public AbstractDependencyGrammar(TreebankLanguagePack tlp, TagProjection tagProjection, boolean directional, boolean useDistance, boolean useCoarseDistance, Options op, Index<java.lang.String> wordIndex, Index<java.lang.String> tagIndex)
public void setLexicon(Lexicon lexicon)
DependencyGrammarsetLexicon in interface DependencyGrammarpublic void tune(java.util.Collection<Tree> trees)
tune in interface DependencyGrammartrees - A Collection of Trees for use as a tuning data setpublic int numTagBins()
numTagBins in interface DependencyGrammarpublic int tagBin(int tag)
DependencyGrammartagBin in interface DependencyGrammartag - An int encoding a tag (in the "tags" Numberer)public boolean rootTW(IntTaggedWord rTW)
protected short valenceBin(int distance)
public int numDistBins()
numDistBins in interface DependencyGrammarpublic short distanceBin(int distance)
distanceBin in interface DependencyGrammardistance - A distance in intervening words between head and argpublic short regDistanceBin(int distance)
public short coarseDistanceBin(int distance)
protected void initTagBins()
public double score(IntDependency dependency)
DependencyGrammarscore in interface DependencyGrammardependency - The dependency object to be scored, in normal form.public double score(int headWord,
int headTag,
int argWord,
int argTag,
boolean leftHeaded,
int dist)
DependencyGrammarscore in interface DependencyGrammarpublic double scoreTB(int headWord,
int headTag,
int argWord,
int argTag,
boolean leftHeaded,
int dist)
DependencyGrammarscoreTB in interface DependencyGrammarpublic void readData(java.io.BufferedReader in)
throws java.io.IOException
readData in interface DependencyGrammarjava.io.IOExceptionpublic void writeData(java.io.PrintWriter out)
throws java.io.IOException
writeData in interface DependencyGrammarjava.io.IOExceptionprotected IntDependency intern(IntTaggedWord headTW, IntTaggedWord argTW, boolean leftHeaded, short dist)