up
Class MyParser

java.lang.Object
  extended by up.MyParser
All Implemented Interfaces:
Parser

public class MyParser
extends java.lang.Object
implements Parser

Skeleton class for your own implementation of a Viterbi parser.


Constructor Summary
MyParser(Grammar grammar)
          Constructs a new parser for the specified grammar.
 
Method Summary
 Tree getBestParse(java.util.List<java.lang.String> words)
          Returns a best parse tree for the specified word sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MyParser

public MyParser(Grammar grammar)
Constructs a new parser for the specified grammar.

Parameters:
grammar - the grammar for which to construct the parser
Method Detail

getBestParse

public Tree getBestParse(java.util.List<java.lang.String> words)
Returns a best parse tree for the specified word sequence. (A best parse tree is a highest-scoring parse tree for this sentence given the underlying grammar.)

Specified by:
getBestParse in interface Parser
Parameters:
words - a sequence of words
Returns:
a best parse tree for the specified word sequence, or null if this parser cannot parse the specified sequence