Package jazzparser :: Package parsers :: Package pcfg :: Module parser :: Class PcfgParser
[hide private]
[frames] | no frames]

Class PcfgParser

source code

        object --+        
                 |        
base.parser.Parser --+    
                     |    
  cky.parser.CkyParser --+
                         |
                        PcfgParser

Instance Methods [hide private]
 
_create_chart(self, *args, **kwargs) source code
list of tuples
_add_signs(self, offset)
Adds new signs to the chart from the supertagger, using the given offset when requesting them from the tagger.
source code
 
__init__(self, *args, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
parse(self, *args, **kwargs)
Performs a full parse and returns the results ranked by probability.
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

Static Methods [hide private]
 
partition_model_name(model_name, partition_number)
The model name to use when the given partition number is requested.
source code
Class Variables [hide private]
  shell_tools = CkyParser.shell_tools+ [ProbabilisticResultListT...
  PARSER_OPTIONS = CkyParser.PARSER_OPTIONS+ [ModuleOption('thre...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

_create_chart(self, *args, **kwargs)

source code 
Overrides: cky.parser.CkyParser._create_chart

_add_signs(self, offset)

source code 

Adds new signs to the chart from the supertagger, using the given offset when requesting them from the tagger.

Returns: list of tuples
all the signs that were actually added. Each is represented by a tuple (start_node, end_node, sign)
Overrides: cky.parser.CkyParser._add_signs
(inherited documentation)

__init__(self, *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)

partition_model_name(model_name, partition_number)
Static Method

source code 

The model name to use when the given partition number is requested. The default implementation simply appends the number to the model name. Subclasses may override this if they want to do something different.

parse(self, *args, **kwargs)

source code 

Performs a full parse and returns the results ranked by probability.

Parameters:
  • derivations - store derivation traces, which can subsequently be used to trace all the derivations that led to any given sign in the chart. Overridden by the module option if it's given
  • summaries - output chart summary information to stderr during parsing to track progress. Set to 2 to output some info, but not the full chart.
  • inspect - launch a graphical chart inspector during the parse to display interactive chart information.
Returns:
a list of signs that span the full input.
Overrides: base.parser.Parser.parse

Class Variable Details [hide private]

shell_tools

Value:
CkyParser.shell_tools+ [ProbabilisticResultListTool(), ProbabilityTool\
(), ProbabilisticChartTool(), ProbabilisticDerivationTraceTool(),]

PARSER_OPTIONS

Value:
CkyParser.PARSER_OPTIONS+ [ModuleOption('threshold', filter= zero_to_o\
ne_float, help_text= "Ratio between the highest probability on an arc \
" "and the probability of a new sign below which the new " "sign will \
be ignored. (Lower throws away more and runs faster.)", usage= "thresh\
old=X, where X is a float between 0 and 1 (default %s)." % settings.PC\
FG_PARSER.DEFAULT_THRESHOLD, default= settings.PCFG_PARSER.DEFAULT_THR\
ESHOLD), ModuleOption('maxarc', filter= int, help_text= "An absolute m\
aximum on the number of signs on an " "arc. If an arc gets more signs \
...