se.chalmers.cs.gf.parse.chart
Class ChartParser

java.lang.Object
  extended by se.chalmers.cs.gf.parse.chart.ChartParser
All Implemented Interfaces:
Parser

public class ChartParser
extends java.lang.Object
implements Parser

Combines lexing, kilbury parsing and tree building.


Constructor Summary
ChartParser(Lexer lexer, CFGrammar grammar, boolean robust)
           
 
Method Summary
 java.lang.String getName()
          Get the name of this parser.
 java.util.Collection<Tree> parse(java.util.List<Token> tokens)
          Parse the given list of tokens in the start category of the grammar.
 java.util.Collection<Tree> parse(java.util.List<Token> tokens, Category cat)
          Parse the given list of tokens.
 java.util.Collection<Tree> parse(java.lang.String str)
          Parse the given string in the start category of the grammar.
 java.util.Collection<Tree> parse(java.lang.String str, Category cat)
          Parse the given string in the given category.
 java.util.Collection<Tree> parse(java.lang.String str, java.lang.String cat)
          Parse the given string in the given category.
 boolean tryThisOne()
          Whether this parser should be used when trying to parse a string with different parsers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChartParser

public ChartParser(Lexer lexer,
                   CFGrammar grammar,
                   boolean robust)
Method Detail

parse

public java.util.Collection<Tree> parse(java.lang.String str)
Parse the given string in the start category of the grammar. Uses the lexer given to the constructor.

Specified by:
parse in interface Parser

parse

public java.util.Collection<Tree> parse(java.util.List<Token> tokens)
Parse the given list of tokens in the start category of the grammar.


parse

public java.util.Collection<Tree> parse(java.lang.String str,
                                        java.lang.String cat)
Parse the given string in the given category. Uses the lexer given to the constructor.

Specified by:
parse in interface Parser
cat - The category to parse in. Note that the category name given here might not be identical to the one in the GF grammar, as the conversion to a context-free grammar can change the category name. Typically, for non-dependent categories, the GF source category "C" is translated to "C{}.s".

parse

public java.util.Collection<Tree> parse(java.lang.String str,
                                        Category cat)
Parse the given string in the given category. Uses the lexer given to the constructor.


parse

public java.util.Collection<Tree> parse(java.util.List<Token> tokens,
                                        Category cat)
Parse the given list of tokens. This does not use the lexer given to the constructor.


getName

public java.lang.String getName()
Description copied from interface: Parser
Get the name of this parser.

Specified by:
getName in interface Parser

tryThisOne

public boolean tryThisOne()
Description copied from interface: Parser
Whether this parser should be used when trying to parse a string with different parsers. This can be used to exclude special parsers from such attempts.

Specified by:
tryThisOne in interface Parser