|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.parser.lexparser.FastFactoredParser
public class FastFactoredParser
Provides a much faster way to realize the factored parsing idea, including easily returning "k good" results at the expense of optimality. Exploiting the k best functionality of the ExhaustivePCFGParser, this model simply gets more than k best PCFG parsers, scores them according to the dependency grammar, and returns them in terms of their product score. No actual parsing is done.
Field Summary | |
---|---|
protected MLEDependencyGrammar |
dg
|
protected Options |
op
|
protected ExhaustivePCFGParser |
pparser
|
protected GrammarProjection |
projection
|
protected static boolean |
VERBOSE
|
Method Summary | |
---|---|
Tree |
getBestParse()
Return the best parse of the sentence most recently parsed. |
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)
Return the list of N "good" parses of the sentence most recently parsed. |
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 |
parse(List<? extends HasWord> words)
Parse a Sentence. |
boolean |
parse(List<? extends HasWord> sentence,
String goal)
Parse a Sentence. |
protected int |
project(int state)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final boolean VERBOSE
protected ExhaustivePCFGParser pparser
protected GrammarProjection projection
protected MLEDependencyGrammar dg
protected Options op
Method Detail |
---|
protected int project(int state)
public Tree getBestParse()
getBestParse
in interface ViterbiParser
public double getBestScore()
KBestViterbiParser
getBestScore
in interface KBestViterbiParser
public boolean hasParse()
KBestViterbiParser
hasParse
in interface KBestViterbiParser
public List<ScoredObject<Tree>> getKGoodParses(int k)
getKGoodParses
in interface KBestViterbiParser
k
- The number of good parses to return
public boolean parse(List<? extends HasWord> sentence, String goal)
parse
in interface Parser
sentence
- A Sentence
to be parsedgoal
- The category to parse the sentence as (e.g., NP, S)
public boolean parse(List<? extends HasWord> words)
parse
in interface Parser
words
- The list of words to parse.
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>> 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 |