edu.stanford.nlp.parser
Interface Parser

All Known Subinterfaces:
ViterbiParser
All Known Implementing Classes:
LexicalizedParser

public interface Parser

The interface for parser objects. The only responsibility of a parser is to return the parsability of input sentences. That is, parsers need only actually be recognizers/acceptors.

Specification of the grammar or model parameters is meant to be done by implementing classes' constructors. If there is no specification of a goal, then this will also be determined by the grammar or implementing class.

Author:
Dan Klein, Christopher Manning

Method Summary
 boolean parse(Sentence sentence)
          Parses the given sentence.
 boolean parse(Sentence sentence, String goal)
          Parses the given sentence.
 

Method Detail

parse

boolean parse(Sentence sentence)
Parses the given sentence. For any words in the sentence which implement HasTag, the tag will be believed. The return value will be false if the sentence is not parseable. Acceptance is with respect to some goal category, which may be specified by the grammar, or may be a parser default (for instance, S).

Parameters:
sentence - A Sentence to be parsed
Returns:
true iff the sentence is recognized
Throws:
UnsupportedOperationException - This will be thrown if for any reason the parser can't complete parsing this sentence, for example if the sentence is too long

parse

boolean parse(Sentence sentence,
              String goal)
Parses the given sentence. For any words in the sentence which implement HasTag, the tag will be believed. The return value will be false if the sentence is not parseable. Acceptance is with respect to the given goal category. (Successfully using this method thus depends on having a good understanding of the categories used by the grammar.)

Parameters:
sentence - A Sentence to be parsed
goal - The category to parse the sentence as (e.g., NP, S)
Returns:
true iff the sentence is recognized
Throws:
UnsupportedOperationException - This will be thrown if for any reason the parser can't complete parsing this sentence, for example if the sentence is too long


Stanford NLP Group