Package nltk :: Package parse :: Module featurechart
[hide private]
[frames] | no frames]

Module featurechart

source code

Extension of chart parsing implementation to handle grammars with feature structures as nodes.

Classes [hide private]
  FeatureTreeEdge
A specialized tree edge that allows shared variable bindings between nonterminals on the left-hand side and right-hand side.
  FeatureFundamentalRule
A specialized version of the fundamental rule that operates on nonterminals whose symbols are FeatStructNonterminals.
  FeatureTopDownExpandRule
A specialized version of the top down expand rule that operates on nonterminals whose symbols are FeatStructNonterminals.
  FeatureCompleterRule
A specialized version of the completer rule that operates on nonterminals whose symbols are FeatStructNonterminals.
  FeatureScannerRule
  FeaturePredictorRule
  EarleyChartParser
A chart parser implementing the Earley parsing algorithm:
  FeatureEarleyChartParser
A chart parser implementing the Earley parsing algorithm, allowing nonterminals that have features (known as FeatStructNonterminals).
  InstantiateVarsChart
A specialized chart that 'instantiates' variables whose names start with '@', by replacing them with unique new variables.
Functions [hide private]
 
load_earley(filename, trace=0, cache=False, verbose=False, chart_class=<class 'nltk.parse.chart.Chart'>)
Load a grammar from a file, and build an Earley feature parser based on that grammar.
source code
 
demo() source code
 
run_profile() source code
Function Details [hide private]

load_earley(filename, trace=0, cache=False, verbose=False, chart_class=<class 'nltk.parse.chart.Chart'>)

source code 

Load a grammar from a file, and build an Earley feature parser based on that grammar.

You can optionally specify a tracing level, for how much output you want to see:

0: No output. 1: Show edges from scanner and completer rules (not predictor). 2 (default): Show all edges as they are added to the chart. 3: Show all edges, plus the results of successful unifications. 4: Show all edges, plus the results of all attempted unifications. 5: Show all edges, plus the results of all attempted unifications, including those with cached results.

If verbose is set to True, then more diagnostic information about grammar-loading is displayed.