Parsers and Grammar


action name
parse
resources required
grammar
properties
Grammar.fileName
annotations required
constit (for lexical items)
annotations added
constit

The Jet parser, in combination with a grammar, can be used to generate a syntactic analysis of input sentences.  The parser supports only context-free grammars without feature constraints or probabilities, and so is intended for relatively simple grammars.  For broad-coverage analysis of arbitrary sentence input, the statistical parser (statParser) should be used.

If a parse is obtained, parse adds an annotation of the form <constit cat=category children=[child1 child2 ...]> for each non-terminal constituent in the parse tree.  Here category is the non-terminal grammar category and child1 child2 ... are the annotations of the immediate constituent nodes.  (If multple parses are obtained, separate sets of annotations are added for each parse.)

Format of the grammar:

The grammar consists of a set of definitions, where each definition has the form

     symbol := element element ... | element element ... | ... ;

and each element is either a non-terminal symbol (defined elsewhere in the grammar), a pre-terminal symbol (defined in the lexicon), or a string
(enclose in double quotes).  For example,

     sentence :=  np vp;
   np       :=  n | art n | art adj n;
   vp       :=  v | v np | v np "to" np;

The grammar file is free format:  spaces, tabs, and newlines may be used freely.  Definitions in the grammar and lexicon must end with semicolons (;).  Java-style comments (both // and /* ... */) are allowed.

Types of parsers

The Parser menu on the Jet console allows you to select the parser to be used: This menu allows you to turn a parser trace on or off (the trace is displayed in the console).  It also allows you to display a parse as a tree diagram.

Parser traces

The top-down parser operates with a goal stack.  It produces the message "looking for x" when it removes x (a symbol or string) from the goal stack (and then tries to satisfy this goal, by either looking for an instance of x as the next word in the sentence, or by expanding x using its definition), and the message "found x" when it is has succeeded in building a node of type x.  The bottom-up parser produces the message "adding node x" when it has succeeded in building a node of type x.