Package jazzparser :: Package parsers :: Package cky :: Module parser :: Class DirectedCkyParser
[hide private]
[frames] | no frames]

Class DirectedCkyParser

source code

        object --+    
                 |    
base.parser.Parser --+
                     |
                    DirectedCkyParser

DirectedCkyParser is a special version of the CKY parser that tries to produce a parse according to a pre-built derivation tree.

Why? Canonical trees are stored implicitly in the Jazz corpus. We can build the explicit structure of the trees, in accordance with the implicit manual annotations, but this will not contain any signs on internal nodes. The structure does not produce a parse in itself or even verify that the sequence can be parsed with that structure.

The purpose of the DirectedCkyParser is to take a description of this annotated structure and actually perform the parse, packing the chart with only those signs that the derivation structure produces.

The parser should be used with a tagger that assigns only those signs that were annotated. Use the PretaggedTagger to do this.

Instance Methods [hide private]
 
__init__(self, grammar, tagger, derivation_tree=None, *args, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_create_chart(self, *args, **kwargs) source code
 
parse(self, derivations=False, summaries=False)
Run the parser on the input, using the specified tagger.
source code

Inherited from base.parser.Parser: run_backoff

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

Class Methods [hide private]

Inherited from base.parser.Parser: check_options

Class Variables [hide private]
  PARSER_OPTIONS = Parser.PARSER_OPTIONS+ [ModuleOption('derivat...

Inherited from base.parser.Parser: shell_tools

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, grammar, tagger, derivation_tree=None, *args, **kwargs)
(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 - a logger to which all progress information during parsing will be written. By default, outputs to stderr.
Overrides: object.__init__
(inherited documentation)

parse(self, derivations=False, summaries=False)

source code 

Run the parser on the input, using the specified tagger. Runs the CKY parsing algorithm to do chart parsing. For details of chart parsing, see Chart class.

Overrides: base.parser.Parser.parse

Class Variable Details [hide private]

PARSER_OPTIONS

Value:
Parser.PARSER_OPTIONS+ [ModuleOption('derivations', filter= bool, help\
_text= "Store derivation traces along with the results", usage= "deriv\
ations=X, where X is 'True' or 'False'.", default= None,),]