|
|||||||||
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<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 edu.stanford.nlp.parser.lexparser.Interner |
interner
|
protected int |
length
|
protected Lexicon |
lex
|
protected List<Edge> |
nGoodTrees
|
protected Options |
op
|
protected CoreLabel[] |
originalLabels
|
protected GrammarProjection |
projection
|
protected long |
relaxHook1
|
protected long |
relaxHook2
|
protected long |
relaxHook3
|
protected long |
relaxHook4
|
protected Scorer |
scorer
|
protected Index<String> |
stateIndex
|
protected List<IntTaggedWord>[] |
taggedWordList
|
protected Index<String> |
tagIndex
|
protected Edge |
tempEdge
|
protected Hook |
tempHook
|
protected TreeFactory |
tf
|
protected UnaryGrammar |
ug
|
protected static boolean |
VERBOSE
|
protected static boolean |
VERY_VERBOSE
|
protected Index<String> |
wordIndex
|
protected int[] |
words
|
Constructor Summary | |
---|---|
BiLexPCFGParser(Scorer scorer,
ExhaustivePCFGParser fscorer,
ExhaustiveDependencyParser dparser,
BinaryGrammar bg,
UnaryGrammar ug,
DependencyGrammar dg,
Lexicon lex,
Options op,
Index<String> stateIndex,
Index<String> wordIndex,
Index<String> tagIndex)
|
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(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<? extends HasWord> words)
|
protected Item |
makeInitialItem(int pos,
int tag,
int state,
double iScore)
|
protected List<Item> |
makeInitialItems(List<? extends HasWord> wordList)
|
boolean |
parse(List<? extends HasWord> words)
Parse a Sentence. |
protected void |
postMortem()
|
protected void |
processEdge(Edge edge)
|
protected void |
processHook(Hook hook)
|
protected void |
processItem(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<Item> agenda
protected int length
protected int[] words
protected Edge goal
protected edu.stanford.nlp.parser.lexparser.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 final Index<String> wordIndex
protected final Index<String> tagIndex
protected final Index<String> stateIndex
protected CoreLabel[] originalLabels
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 Hook tempHook
Constructor Detail |
---|
public BiLexPCFGParser(Scorer scorer, ExhaustivePCFGParser fscorer, ExhaustiveDependencyParser dparser, BinaryGrammar bg, UnaryGrammar ug, DependencyGrammar dg, Lexicon lex, Options op, Index<String> stateIndex, Index<String> wordIndex, Index<String> tagIndex)
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(Item item)
protected void discoverItem(Item item)
protected Item makeInitialItem(int pos, int tag, int state, double iScore)
protected List<Item> makeInitialItems(List<? extends HasWord> wordList)
protected void scoreDependencies()
protected void setGoal(int length)
protected void initialize(List<? extends HasWord> words)
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 |