|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.parser.lexparser.ExhaustivePCFGParser
public class ExhaustivePCFGParser
An exhaustive generalized CKY PCFG parser. Fairly carefully optimized to be fast.
Field Summary | |
---|---|
protected int |
arraySize
|
protected float |
bestScore
|
protected BinaryGrammar |
bg
|
protected static boolean |
dumpTagging
|
protected boolean |
floodTags
|
protected String |
goalStr
|
protected boolean[][] |
iPossibleByL
|
protected boolean[][] |
iPossibleByR
|
protected float[][][] |
iScore
|
protected boolean[] |
isTag
|
protected int |
length
|
protected Lexicon |
lex
|
protected Lattice |
lr
|
protected int |
myMaxLength
|
protected int[][] |
narrowLExtent
|
protected int[][] |
narrowRExtent
|
protected int |
numStates
|
protected IntPair[] |
offsets
|
protected boolean[][] |
oFilteredEnd
|
protected boolean[][] |
oFilteredStart
|
protected Options |
op
|
protected boolean[][] |
oPossibleByL
|
protected boolean[][] |
oPossibleByR
|
protected OutsideRuleFilter |
orf
|
protected float[][][] |
oScore
|
protected List |
sentence
|
protected static boolean |
spillGuts
|
protected Numberer |
stateNumberer
|
protected String |
stateSpace
|
protected Numberer |
tagNumberer
|
protected boolean[][] |
tags
|
protected TreeFactory |
tf
|
protected TreebankLanguagePack |
tlp
|
protected UnaryGrammar |
ug
|
protected int[][] |
wideLExtent
|
protected int[][] |
wideRExtent
|
protected Numberer |
wordNumberer
|
protected int[] |
words
|
protected int[][][] |
wordsInSpan
|
Constructor Summary | |
---|---|
ExhaustivePCFGParser(BinaryGrammar bg,
UnaryGrammar ug,
Lexicon lex,
Options op)
|
Method Summary | |
---|---|
protected void |
buildOFilter()
|
protected void |
createArrays(int length)
|
protected Tree |
extractBestParse(int goal,
int start,
int end)
|
protected List<Tree> |
extractBestParses(int goal,
int start,
int end)
Return all best parses (except no ties allowed on POS tags?). |
Tree |
getBestParse()
Returns a best parse of the last sentence on which parse was
called, or null if none exists. |
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. |
double |
getBestScore(String stateName)
|
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)
|
boolean |
iPossibleL(int state,
int start)
|
boolean |
iPossibleR(int state,
int end)
|
double |
iScore(Edge edge)
|
protected static boolean |
matches(double x,
double y)
|
void |
nudgeDownArraySize()
|
boolean |
oPossible(Hook hook)
|
boolean |
oPossibleL(int state,
int start)
|
boolean |
oPossibleR(int state,
int end)
|
double |
oScore(Edge edge)
|
boolean |
parse(HTKLatticeReader lr)
|
boolean |
parse(Lattice lr)
|
boolean |
parse(List<? extends HasWord> sentence)
Parses the given sentence. |
boolean |
parse(List<? extends HasWord> sentence,
String goal)
Just for Parser interface. |
double |
scoreBinarizedTree(Tree tree,
int start)
|
Tree |
scoreNonBinarizedTree(Tree tree)
|
void |
setGoalString(String goalStr)
|
protected static void |
tick(String str)
|
double |
validateBinarizedTree(Tree tree,
int start)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String goalStr
protected String stateSpace
protected Numberer stateNumberer
protected Numberer wordNumberer
protected Numberer tagNumberer
protected TreeFactory tf
protected BinaryGrammar bg
protected UnaryGrammar ug
protected Lexicon lex
protected Options op
protected TreebankLanguagePack tlp
protected OutsideRuleFilter orf
protected float[][][] iScore
protected float[][][] oScore
protected float bestScore
protected int[][][] wordsInSpan
protected boolean[][] oFilteredStart
protected boolean[][] oFilteredEnd
protected boolean[][] iPossibleByL
protected boolean[][] iPossibleByR
protected boolean[][] oPossibleByL
protected boolean[][] oPossibleByR
protected int[] words
protected IntPair[] offsets
protected int length
protected boolean[][] tags
protected int myMaxLength
protected int numStates
protected int arraySize
protected static final boolean spillGuts
protected static final boolean dumpTagging
protected boolean floodTags
protected List sentence
protected Lattice lr
protected int[][] narrowLExtent
protected int[][] wideLExtent
protected int[][] narrowRExtent
protected int[][] wideRExtent
protected boolean[] isTag
Constructor Detail |
---|
public ExhaustivePCFGParser(BinaryGrammar bg, UnaryGrammar ug, Lexicon lex, Options op)
Method Detail |
---|
public void setGoalString(String goalStr)
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 oPossibleL(int state, int start)
public boolean oPossibleR(int state, int end)
public boolean iPossibleL(int state, int start)
public boolean iPossibleR(int state, int end)
protected void buildOFilter()
public double validateBinarizedTree(Tree tree, int start)
public Tree scoreNonBinarizedTree(Tree tree)
public double scoreBinarizedTree(Tree tree, int start)
protected static void tick(String str)
public boolean parse(List<? extends HasWord> sentence, String goal)
parse
in interface Parser
sentence
- The sentence to parsegoal
- The goal, presently ignored
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 parse(HTKLatticeReader lr)
public boolean parse(Lattice lr)
public boolean hasParse()
KBestViterbiParser
hasParse
in interface KBestViterbiParser
protected static boolean matches(double x, double y)
public double getBestScore()
KBestViterbiParser
getBestScore
in interface KBestViterbiParser
public double getBestScore(String stateName)
public Tree getBestParse()
ViterbiParser
parse
was
called, or null if none exists.
getBestParse
in interface ViterbiParser
protected Tree extractBestParse(int goal, int start, int end)
protected List<Tree> extractBestParses(int goal, int start, int end)
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
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 void nudgeDownArraySize()
protected void createArrays(int length)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |