edu.stanford.nlp.parser.lexparser
Class LexicalizedParser

java.lang.Object
  |
  +--edu.stanford.nlp.parser.lexparser.LexicalizedParser
All Implemented Interfaces:
Parser, ViterbiParser

public class LexicalizedParser
extends Object
implements Parser, ViterbiParser

A reasonably good lexicalized pcfg parser. It does a combination of plain PCFG parsing, and lexicalized dependency parsing, unless asked otherwise. Note that this requires a lot of memory to run. Try -mx1500m.


Constructor Summary
LexicalizedParser(String treebankPath)
          Construct a new LexicalizedParser.
LexicalizedParser(String treebankPath, FileFilter filt)
          Construct a new LexicalizedParser.
LexicalizedParser(String treebankPath, FileFilter filt, int maxLeng)
          Construct a new LexicalizedParser.
 
Method Summary
 Tree getBestParse()
          Returns a best parse of the last sentence on which parse was called, or null if none exist.
static void main(String[] args)
          A simple test main program.
 void parse(List sentence)
          Parse a sentence
 boolean parse(Sentence sentence)
          Parses the given sentence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LexicalizedParser

public LexicalizedParser(String treebankPath)
Construct a new LexicalizedParser.

Parameters:
treebankPath - a String value

LexicalizedParser

public LexicalizedParser(String treebankPath,
                         FileFilter filt)
Construct a new LexicalizedParser.

Parameters:
treebankPath - a String value
filt - a FileFilter value

LexicalizedParser

public LexicalizedParser(String treebankPath,
                         FileFilter filt,
                         int maxLeng)
Construct a new LexicalizedParser.

Parameters:
treebankPath - a String value
filt - a FileFilter value
maxLeng - The maximum length sentences to be able to parser. A large value for this requires a great deal of memory (and time) for parsing, but allows parsing longer sentences.
Method Detail

parse

public boolean parse(Sentence sentence)
Description copied from interface: Parser
Parses the given sentence. For any words in the sentence which implement HasTag, the tag will be beleived. The return value will be false if the sentence is not parseable.

Specified by:
parse in interface Parser
Parameters:
sentence - a Sentence value
Returns:
true iff the sentence is recognized

parse

public void parse(List sentence)
Parse a sentence

Throws:
IllegalArgumentException

getBestParse

public Tree getBestParse()
Description copied from interface: ViterbiParser
Returns a best parse of the last sentence on which parse was called, or null if none exist.

Specified by:
getBestParse in interface ViterbiParser

main

public static void main(String[] args)
A simple test main program. Usage: java edu.stanford.nlp.parser.lexparser.LexicalizedParser trainFilesPath [start stop [testFilePath [start stop [maxLeng]]]]



Stanford NLP Group