|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.parser.lexparser.BiLexPCFGParser
public class BiLexPCFGParser
Implements Eisner and Satta style algorithms for bilexical PCFG parsing. The basic class provides O(n4) parsing, with the passed in PCFG and dependency parsers providing outside scores in an efficient A* search.
Nested Class Summary | |
---|---|
static class |
BiLexPCFGParser.N5BiLexPCFGParser
|
Field Summary | |
---|---|
protected Heap<edu.stanford.nlp.parser.lexparser.Item> |
agenda
|
protected BinaryGrammar |
bg
|
protected long |
builtEdges
|
protected long |
builtHooks
|
protected edu.stanford.nlp.parser.lexparser.HookChart |
chart
|
protected DependencyGrammar |
dg
|
protected ExhaustiveDependencyParser |
dparser
|
protected long |
extractedEdges
|
protected long |
extractedHooks
|
protected ExhaustivePCFGParser |
fscorer
|
protected Edge |
goal
|
protected Interner |
interner
|
protected Edge |
iTemp
|
protected int |
length
|
protected Lexicon |
lex
|
protected List<Edge> |
nGoodTrees
|
protected Options |
op
|
protected Edge |
oTemp
|
protected GrammarProjection |
projection
|
protected long |
relaxHook1
|
protected long |
relaxHook2
|
protected long |
relaxHook3
|
protected long |
relaxHook4
|
protected Scorer |
scorer
|
protected Numberer |
stateNumberer
|
protected List<IntTaggedWord>[] |
taggedWordList
|
protected Numberer |
tagNumberer
|
protected Edge |
tempEdge
|
protected Hook |
tempHook
|
protected TreeFactory |
tf
|
protected UnaryGrammar |
ug
|
protected static boolean |
VERBOSE
|
protected static boolean |
VERY_VERBOSE
|
protected Numberer |
wordNumberer
|
protected int[] |
words
|
Method Summary | |
---|---|
protected static boolean |
better(double x,
double y)
|
protected double |
buildOScore(Hook hook)
|
protected void |
combine(Edge edge,
Hook hook)
|
protected void |
discoverEdge(Edge edge)
|
protected void |
discoverHook(Hook hook)
|
protected void |
discoverItem(edu.stanford.nlp.parser.lexparser.Item item)
|
protected Tree |
extractParse(Edge edge)
|
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 k "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. |
protected void |
initialize(List words)
|
protected edu.stanford.nlp.parser.lexparser.Item |
makeInitialItem(int pos,
int tag,
int state,
double iScore)
|
protected List<edu.stanford.nlp.parser.lexparser.Item> |
makeInitialItems(List wordList)
|
boolean |
parse(List<? extends HasWord> words)
Parse a Sentence. |
boolean |
parse(List<? extends HasWord> sentence,
String goal)
Parse a Sentence. |
protected void |
postMortem()
|
protected void |
processEdge(Edge edge)
|
protected void |
processHook(Hook hook)
|
protected void |
processItem(edu.stanford.nlp.parser.lexparser.Item item)
|
protected int |
project(int state)
|
protected void |
projectHooks(Edge edge)
|
protected void |
projectUnaries(Edge edge)
|
protected void |
registerReal(Edge real)
|
protected void |
relaxTempEdge()
|
protected void |
relaxTempHook()
|
protected void |
scoreDependencies()
|
protected void |
setGoal(int length)
|
protected void |
triggerAllHooks(Edge edge)
|
protected void |
triggerHooks(Edge edge)
|
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 static final boolean VERY_VERBOSE
protected edu.stanford.nlp.parser.lexparser.HookChart chart
protected Heap<edu.stanford.nlp.parser.lexparser.Item> agenda
protected int length
protected int[] words
protected Edge goal
protected Interner interner
protected Scorer scorer
protected ExhaustivePCFGParser fscorer
protected ExhaustiveDependencyParser dparser
protected GrammarProjection projection
protected BinaryGrammar bg
protected UnaryGrammar ug
protected DependencyGrammar dg
protected Lexicon lex
protected Options op
protected List<IntTaggedWord>[] taggedWordList
protected Numberer wordNumberer
protected Numberer tagNumberer
protected Numberer stateNumberer
protected TreeFactory tf
protected long relaxHook1
protected long relaxHook2
protected long relaxHook3
protected long relaxHook4
protected long builtHooks
protected long builtEdges
protected long extractedHooks
protected long extractedEdges
protected List<Edge> nGoodTrees
protected Edge tempEdge
protected Edge iTemp
protected Edge oTemp
protected Hook tempHook
Method Detail |
---|
protected static boolean better(double x, double y)
public double getBestScore()
KBestViterbiParser
getBestScore
in interface KBestViterbiParser
protected Tree extractParse(Edge edge)
public Tree getBestParse()
getBestParse
in interface ViterbiParser
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 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
protected void combine(Edge edge, Hook hook)
protected void relaxTempEdge()
protected void discoverEdge(Edge edge)
protected void discoverHook(Hook hook)
protected double buildOScore(Hook hook)
protected void projectHooks(Edge edge)
protected void registerReal(Edge real)
protected void triggerHooks(Edge edge)
protected void triggerAllHooks(Edge edge)
protected void relaxTempHook()
protected void projectUnaries(Edge edge)
protected void processEdge(Edge edge)
protected void processHook(Hook hook)
protected void processItem(edu.stanford.nlp.parser.lexparser.Item item)
protected void discoverItem(edu.stanford.nlp.parser.lexparser.Item item)
protected edu.stanford.nlp.parser.lexparser.Item makeInitialItem(int pos, int tag, int state, double iScore)
protected List<edu.stanford.nlp.parser.lexparser.Item> makeInitialItems(List wordList)
protected void scoreDependencies()
protected void setGoal(int length)
protected void initialize(List words)
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
- A List<HasWord>
to be parsed
protected void postMortem()
protected int project(int state)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |