Package jazzparser :: Package parsers :: Package base :: Module parser :: Class Parser
[hide private]
[frames] | no frames]

Class Parser

source code

object --+
         |
        Parser
Known Subclasses:

Base class for all parsers.

Instance Methods [hide private]
 
__init__(self, grammar, tagger, options={}, backoff=None, backoff_options={}, logger=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
parse(self, derivations=False, summaries=False)
Should be implemented by subclasses.
source code
 
run_backoff(self)
Convenience method.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
check_options(cls, options)
In normal parser usage, the options dictionary is checked for validity when the parser is instantiated.
source code
Class Variables [hide private]
  shell_tools = []
  PARSER_OPTIONS = []
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, grammar, tagger, options={}, backoff=None, backoff_options={}, logger=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • grammar - the jazzparser.grammar.Grammar instance to use for parsing
  • tagger - the jazzparser.taggers.tagger.Tagger subclass instance to use to tag the input
  • backoff - an optional jazzparser.backoff.base.BackoffBuilder class to use as a fallback if the parser returns no parses. Whether this is used and in what circumstances depends on the type of parser.
  • backoff_options - dictionary of options to pass to the backoff model if it gets used.
  • logger (logging.Logger) - a logger to which all progress information during parsing will be written. By default, outputs to stderr.
Overrides: object.__init__

run_backoff(self)

source code 

Convenience method. Uses the backoff model on the input supplied to the tagger and returns the results. If no backoff model has been given, returns an empty list.

check_options(cls, options)
Class Method

source code 

In normal parser usage, the options dictionary is checked for validity when the parser is instantiated. In this interface, you may want to check the options before this point using this method.