The lexicon is constructed by calling lexicon.fromstring(<lexicon string>).
In order to construct a parser, you also need a rule set. The standard English rules are provided in chart as chart.DefaultRuleSet.
The parser can then be constructed by calling, for example: parser = chart.CCGChartParser(<lexicon>, <ruleset>)
Parsing is then performed by running parser.parse(<sentence>.split()).
While this returns a list of trees, the default representation of the produced trees is not very enlightening, particularly given that it uses the same tree class as the CFG parsers. It is probably better to call: chart.printCCGDerivation(<parse tree extracted from list>) which should print a nice representation of the derivation.
This entire process is shown far more clearly in the demonstration: python chart.py
Class |
|
Class for applying backward type raising. |
Class |
|
Class implementing application of a binary combinator to a chart. Takes the directed combinator to apply. |
Class |
|
Undocumented |
Class |
|
Chart parser for CCGs. Based largely on the ChartParser class from NLTK. |
Class |
|
Undocumented |
Class |
|
Class representing leaf edges in a CCG derivation. |
Class |
|
Class for applying forward type raising |
Function | compute |
Undocumented |
Function | demo |
Undocumented |
Function | print |
Undocumented |
Function | print |
Undocumented |
Variable |
|
Undocumented |
Variable |
|
Undocumented |
Variable |
|
Undocumented |
Variable | lex |
Undocumented |
Variable |
|
Undocumented |
Variable |
|
Undocumented |