Class Parser

java.lang.Object
  |
  +--Parser

public class Parser
extends java.lang.Object

And the Lord spoke to Moses, saying, "Of Java code shall ye make the parser, and the parser shall have Arcs of Java code, and a chart of data. And ye shall attempt to correctly match a constituent containing all of the words of thy input string. And thou shalt consult the book of Natural Language Understanding, of James Allen, and thou shalt build the parser. Thus thou wilt understand a small subset of English strings with reference to a woefully inadequate context-free grammar."


Constructor Summary
Parser(java.lang.String ruleFile, java.lang.String preprocessFile, java.lang.String[] lexFiles, java.lang.String[] prologFiles)
          Create a parser, which reads a rule file for a CFG.
 
Method Summary
 Constituent parse(java.lang.String sent)
          Parse a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser(java.lang.String ruleFile,
              java.lang.String preprocessFile,
              java.lang.String[] lexFiles,
              java.lang.String[] prologFiles)
Create a parser, which reads a rule file for a CFG. If the rule file is messed up, you may well fail to find out until you actually parse something. If this is a problem, parse something as a check when you create.

Parameters:
ruleFile - the file to read-- see speech/domain/grammar for example.
preprocessFile - the preprocessor file-- see speech/domain/preprocessor.
prologFiles - a list of prolog files for the prolog engine to read.
Throws:
java.lang.RuntimeException - if something goes wrong in the io, or if no lexicon file is specified.
Method Detail

parse

public Constituent parse(java.lang.String sent)
Parse a string. Find a constituent that covers the string by using a chart parse bottom-up algorithm. (Since not all utterances will fill the same top-level categories, bottom-up seems best.)

Parameters:
sent - the sentence.
Returns:
a constituent covering the sentence, if possible.