edu.umn.cs.nlp.parser
Interface GrammarInterface

All Known Implementing Classes:
CNFGrammar, Grammar, PCNFGrammar, PGrammar

public interface GrammarInterface

Generic grammar interface.

Version:
$LastChangedDate: 2007-07-02 14:23:03 -0500 (Mon, 02 Jul 2007) $
Author:
Lane Schwartz

Method Summary
 ParseTree parse(String... token)
          Attempts to parse the given series of tokens using this grammar.
 ParseTree parse(String sentence)
          Attempts to parse the given sentence using this grammar.
 Collection<ParseTree> parseAll(String... sentences)
          Attempts to parse each of the given sentences using parse(String sentence).
 boolean parses(String... token)
          Determines if the given series of tokens can be successfully parsed by this grammar.
 boolean parses(String sentence)
          Determines if the given sentence can be successfully parsed by this grammar.
 

Method Detail

parses

boolean parses(String sentence)
Determines if the given sentence can be successfully parsed by this grammar.

Parameters:
sentence - The sentence to be parsed. Will be lowercased using the current locale and then tokenized prior to parsing.
Returns:
true if this grammar can parse the given sentence; false otherwise.

parses

boolean parses(String... token)
Determines if the given series of tokens can be successfully parsed by this grammar.

Parameters:
token - Array of tokens specifying the sentence to be parsed. No lowercasing will be performed by this method.
Returns:
true if this grammar can parse the given sentence; false otherwise.

parse

ParseTree parse(String sentence)
Attempts to parse the given sentence using this grammar. Uses the CKY parsing algorithm.

Parameters:
sentence - The sentence to be parsed. Will be lowercased using the current locale and then tokenized prior to parsing.
Returns:
a valid parse tree representing the most likely parse if this grammar can parse the given sentence; ParseTree.NULL_PARSE otherwise.

parse

ParseTree parse(String... token)
Attempts to parse the given series of tokens using this grammar. Uses the CKY parsing algorithm.

Parameters:
token - Array of tokens specifying the sentence to be parsed. No lowercasing will be performed by this method.
Returns:
a valid parse tree if this grammar can parse the given sentence; ParseTree.NULL_PARSE otherwise.

parseAll

Collection<ParseTree> parseAll(String... sentences)
Attempts to parse each of the given sentences using parse(String sentence).

Parameters:
sentences - the sentences to be parsed.
Returns:
one ParseTree per sentence