public class ExhaustiveDependencyParser extends Object implements Scorer, KBestViterbiParser
Constructor and Description |
---|
ExhaustiveDependencyParser(DependencyGrammar dg,
Lexicon lex,
Options op,
Index<String> wordIndex,
Index<String> tagIndex) |
Modifier and Type | Method and Description |
---|---|
void |
displayHeadScores()
This displays a headScore matrix, which will be valid after parsing
a sentence.
|
Tree |
getBestParse()
Return the best dependency parse for a sentence.
|
List<ScoredObject<Tree>> |
getBestParses()
Get a complete set of the maximally scoring parses for a sentence,
rather than one chosen at random.
|
double |
getBestScore()
Gets the score (typically a log probability) of the best
parse of a sentence.
|
List<ScoredObject<Tree>> |
getKBestParses(int k)
Get the exact k best parses for the sentence.
|
List<ScoredObject<Tree>> |
getKGoodParses(int k)
Get k good parses for the sentence.
|
List<ScoredObject<Tree>> |
getKSampledParses(int k)
Get k parse samples for the sentence.
|
boolean |
hasParse()
Does the sentence in the last call to parse() have a parse?
In theory this method shouldn't be here, but it seemed a
convenient place to put it for our more general parser interface.
|
boolean |
iPossible(Hook hook) |
double |
iScore(Edge edge) |
boolean |
oPossible(Hook hook) |
double |
oScore(Edge edge) |
boolean |
parse(List<? extends HasWord> sentence)
Parses the given sentence.
|
public boolean parse(List<? extends HasWord> sentence)
Parser
S
).public boolean hasParse()
KBestViterbiParser
hasParse
in interface KBestViterbiParser
public double getBestScore()
KBestViterbiParser
getBestScore
in interface KBestViterbiParser
public void displayHeadScores()
public Tree getBestParse()
parse()
before a call to this method.
Implementation note: the best parse is recalculated from the chart each time this method is called. It isn't cached.
getBestParse
in interface ViterbiParser
null
.
The returned tree will begin with a binary branching node, the
left branch of which is the dependency tree proper, and the right
side of which contains a boundary word .$. which heads the
sentence.public List<ScoredObject<Tree>> getKBestParses(int k)
getKBestParses
in interface KBestViterbiParser
k
- The number of best parses to returnpublic List<ScoredObject<Tree>> getBestParses()
getBestParses
in interface KBestViterbiParser
public List<ScoredObject<Tree>> getKGoodParses(int k)
getKGoodParses
in interface KBestViterbiParser
k
- The number of good parses to returnpublic List<ScoredObject<Tree>> getKSampledParses(int k)
getKSampledParses
in interface KBestViterbiParser
k
- The number of sampled parses to return