public class BiLexPCFGParser extends Object implements KBestViterbiParser
Modifier and Type | Class and Description |
---|---|
static class |
BiLexPCFGParser.N5BiLexPCFGParser |
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
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) |
Modifier and Type | Method and Description |
---|---|
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) |
protected static final boolean VERBOSE
protected static final boolean VERY_VERBOSE
protected edu.stanford.nlp.parser.lexparser.HookChart chart
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 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 Edge tempEdge
protected Hook tempHook
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)
protected static boolean better(double x, double y)
public double getBestScore()
KBestViterbiParser
getBestScore
in interface KBestViterbiParser
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 returnpublic 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>> getKSampledParses(int k)
getKSampledParses
in interface KBestViterbiParser
k
- The number of sampled parses to returnprotected 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 void scoreDependencies()
protected void setGoal(int length)
protected void postMortem()
protected int project(int state)