edu.stanford.nlp.parser.lexparser
Class ExhaustivePCFGParser

java.lang.Object
  extended by edu.stanford.nlp.parser.lexparser.ExhaustivePCFGParser
Direct Known Subclasses:
IterativeCKYPCFGParser

public class ExhaustivePCFGParser
extends Object

An exhaustive generalized CKY PCFG parser. Fairly carefully optimized to be fast.

Author:
Dan Klein

Field Summary
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  LatticeReader lr
           
protected  int[][] narrowLExtent
           
protected  int[][] narrowRExtent
           
protected  int numStates
           
protected  boolean[][] oFilteredEnd
           
protected  boolean[][] oFilteredStart
           
protected  Options op
           
protected  boolean[][] oPossibleByL
           
protected  boolean[][] oPossibleByR
           
protected  edu.stanford.nlp.parser.lexparser.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 static long time
           
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  Tree extractBestParse(int goal, int start, int end)
           
protected  List extractBestParses(int goal, int start, int end)
          Return all best parses (except no ties allowed on POS tags?).
 Tree getBestParse()
           
 List getBestParses()
          Return the set of trees that are tied best parses for a sentences.
 double getLogScore()
           
 boolean hasParse()
           
 boolean iPossible(edu.stanford.nlp.parser.lexparser.Hook hook)
           
 boolean iPossibleL(int state, int start)
           
 boolean iPossibleR(int state, int end)
           
 double iScore(edu.stanford.nlp.parser.lexparser.Edge edge)
           
protected static boolean matches(double x, double y)
           
 boolean oPossible(edu.stanford.nlp.parser.lexparser.Hook hook)
           
 boolean oPossibleL(int state, int start)
           
 boolean oPossibleR(int state, int end)
           
 double oScore(edu.stanford.nlp.parser.lexparser.Edge edge)
           
 boolean parse(LatticeReader lr)
           
 boolean parse(List sentence)
           
protected  void restoreUnaries(Tree t)
           
 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

goalStr

protected String goalStr

stateSpace

protected String stateSpace

stateNumberer

protected Numberer stateNumberer

wordNumberer

protected Numberer wordNumberer

tagNumberer

protected Numberer tagNumberer

tf

protected TreeFactory tf

bg

protected BinaryGrammar bg

ug

protected UnaryGrammar ug

lex

protected Lexicon lex

op

protected Options op

tlp

protected TreebankLanguagePack tlp

orf

protected edu.stanford.nlp.parser.lexparser.OutsideRuleFilter orf

iScore

protected float[][][] iScore

oScore

protected float[][][] oScore

bestScore

protected float bestScore

wordsInSpan

protected int[][][] wordsInSpan

oFilteredStart

protected boolean[][] oFilteredStart

oFilteredEnd

protected boolean[][] oFilteredEnd

iPossibleByL

protected boolean[][] iPossibleByL

iPossibleByR

protected boolean[][] iPossibleByR

oPossibleByL

protected boolean[][] oPossibleByL

oPossibleByR

protected boolean[][] oPossibleByR

words

protected int[] words

length

protected int length

tags

protected boolean[][] tags

numStates

protected int numStates

spillGuts

protected static final boolean spillGuts
See Also:
Constant Field Values

dumpTagging

protected static boolean dumpTagging

time

protected static long time

floodTags

protected boolean floodTags

sentence

protected List sentence

lr

protected LatticeReader lr

narrowLExtent

protected int[][] narrowLExtent

wideLExtent

protected int[][] wideLExtent

narrowRExtent

protected int[][] narrowRExtent

wideRExtent

protected int[][] wideRExtent

isTag

protected boolean[] isTag
Constructor Detail

ExhaustivePCFGParser

public ExhaustivePCFGParser(BinaryGrammar bg,
                            UnaryGrammar ug,
                            Lexicon lex,
                            Options op)
Method Detail

setGoalString

public void setGoalString(String goalStr)

oScore

public double oScore(edu.stanford.nlp.parser.lexparser.Edge edge)

iScore

public double iScore(edu.stanford.nlp.parser.lexparser.Edge edge)

oPossible

public boolean oPossible(edu.stanford.nlp.parser.lexparser.Hook hook)

iPossible

public boolean iPossible(edu.stanford.nlp.parser.lexparser.Hook hook)

oPossibleL

public boolean oPossibleL(int state,
                          int start)

oPossibleR

public boolean oPossibleR(int state,
                          int end)

iPossibleL

public boolean iPossibleL(int state,
                          int start)

iPossibleR

public boolean iPossibleR(int state,
                          int end)

buildOFilter

protected void buildOFilter()

validateBinarizedTree

public double validateBinarizedTree(Tree tree,
                                    int start)

scoreNonBinarizedTree

public Tree scoreNonBinarizedTree(Tree tree)

scoreBinarizedTree

public double scoreBinarizedTree(Tree tree,
                                 int start)

tick

protected static void tick(String str)

parse

public boolean parse(List sentence)

parse

public boolean parse(LatticeReader lr)

hasParse

public boolean hasParse()

getLogScore

public double getLogScore()

matches

protected static boolean matches(double x,
                                 double y)

extractBestParse

protected Tree extractBestParse(int goal,
                                int start,
                                int end)

restoreUnaries

protected void restoreUnaries(Tree t)

getBestParse

public Tree getBestParse()

extractBestParses

protected List extractBestParses(int goal,
                                 int start,
                                 int end)
Return all best parses (except no ties allowed on POS tags?). Note that the returned tree may be missing intermediate nodes in a unary chain because it parses with a unary-closed grammar.


getBestParses

public List getBestParses()
Return the set of trees that are tied best parses for a sentences.



Stanford NLP Group