|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.parser.lexparser.ExhaustiveDependencyParser
public class ExhaustiveDependencyParser
An exhaustive O(n4t2) time and O(n2t) space dependency parser. This follows the general picture of the Eisner and Satta dependency parsing papers, but without the tricks in defining items that they use to get an O(n3) dependency parser. The parser is as described in:
Dan Klein and Christopher D. Manning. 2003. Fast Exact Inference with a Factored Model for Natural Language Parsing. In Suzanna Becker, Sebastian Thrun, and Klaus Obermayer (eds), Advances in Neural Information Processing Systems 15 (NIPS 2002). Cambridge, MA: MIT Press, pp. 3-10. http://nlp.stanford.edu/pubs/lex-parser.pdf
Constructor Summary | |
---|---|
ExhaustiveDependencyParser(DependencyGrammar dg,
Lexicon lex,
Options op)
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExhaustiveDependencyParser(DependencyGrammar dg, Lexicon lex, Options op)
Method Detail |
---|
public double oScore(Edge edge)
oScore
in interface Scorer
public double iScore(Edge edge)
iScore
in interface Scorer
public boolean oPossible(Hook hook)
oPossible
in interface Scorer
public boolean iPossible(Hook hook)
iPossible
in interface Scorer
public boolean parse(List<? extends HasWord> sentence)
Parser
S
).
parse
in interface Scorer
parse
in interface Parser
sentence
- A List<HasWord>
to be parsed
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 return
public 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 return
public List<ScoredObject<Tree>> getKSampledParses(int k)
getKSampledParses
in interface KBestViterbiParser
k
- The number of sampled parses to return
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |