Jet.Parser
Class Parsers

java.lang.Object
  extended byJet.Parser.Parsers

public class Parsers
extends java.lang.Object

contains static methods for various types of recognizers and parsers.


Field Summary
static int BUPARSE
          a constant indicating that the bottom-up parser, BUParse, should be used to analyze the text
static int CHARTPARSE
          a constant indicating that the top-down active chart parser, chartParse, should be used to analyze the text
static boolean parserTrace
          if true, causes each parser to write trace messages to the Console.
static int parserType
          determines which analyzer will be applied by method parse
static int RECOGNIZE
          a constant indicating that the top-down recognizer, recognize, should be used to analyze the text
static int TDPARSE
          a constant indicating that the top-down parser, TDParse, should be used to analyze the text
 
Constructor Summary
Parsers()
           
 
Method Summary
static java.util.Vector BUParse(Document doc, int posn, int end, Grammar gram)
          apply a bottom-up ('immediate constituent') parser to characters posn to end of Document using grammar gram.
static java.util.Vector chartParse(Document doc, int posn, int end, Grammar gram)
          apply a top-down active chart parser to characters posn to end of Document doc using grammar gram.
static java.util.Vector parse(Document doc, int posn, int end, Grammar gram)
          parse characters posn to end of Document using grammar gram.
static javax.swing.JMenu parserMenu()
          returns a menu for controlling the parser (part of the Console menu bar).
static boolean recognize(Document doc, int posn, int end, Grammar gram)
          apply a top-down recognizer to characters posn to end of Document using grammar gram.
static java.util.Vector TDParse(Document doc, int posn, int end, Grammar gram)
          apply a top-down backtracking parser to characters posn to end of Document using grammar gram.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RECOGNIZE

public static final int RECOGNIZE
a constant indicating that the top-down recognizer, recognize, should be used to analyze the text

See Also:
Constant Field Values

TDPARSE

public static final int TDPARSE
a constant indicating that the top-down parser, TDParse, should be used to analyze the text

See Also:
Constant Field Values

BUPARSE

public static final int BUPARSE
a constant indicating that the bottom-up parser, BUParse, should be used to analyze the text

See Also:
Constant Field Values

CHARTPARSE

public static final int CHARTPARSE
a constant indicating that the top-down active chart parser, chartParse, should be used to analyze the text

See Also:
Constant Field Values

parserType

public static int parserType
determines which analyzer will be applied by method parse


parserTrace

public static boolean parserTrace
if true, causes each parser to write trace messages to the Console.

Constructor Detail

Parsers

public Parsers()
Method Detail

parse

public static java.util.Vector parse(Document doc,
                                     int posn,
                                     int end,
                                     Grammar gram)
parse characters posn to end of Document using grammar gram. The type of recognizer / parser used is determined by the value of parserType.

Returns:
a Vector of parses, where each parse is a ParseTreeNode (the root of the parse tree. If no parses are found, an empty Vector is returned.

recognize

public static boolean recognize(Document doc,
                                int posn,
                                int end,
                                Grammar gram)
apply a top-down recognizer to characters posn to end of Document using grammar gram.

Returns:
true if these characters can be recognized as a SENTENCE.

TDParse

public static java.util.Vector TDParse(Document doc,
                                       int posn,
                                       int end,
                                       Grammar gram)
apply a top-down backtracking parser to characters posn to end of Document using grammar gram.

Returns:
a Vector of the parses for these characters

BUParse

public static java.util.Vector BUParse(Document doc,
                                       int posn,
                                       int end,
                                       Grammar gram)
apply a bottom-up ('immediate constituent') parser to characters posn to end of Document using grammar gram.


chartParse

public static java.util.Vector chartParse(Document doc,
                                          int posn,
                                          int end,
                                          Grammar gram)
apply a top-down active chart parser to characters posn to end of Document doc using grammar gram.


parserMenu

public static javax.swing.JMenu parserMenu()
returns a menu for controlling the parser (part of the Console menu bar). Includes menu items for selecting the parserType, controlling the parserTrace, and drawing a parse tree.