Home | Trees | Indices | Help |
|
---|
|
object --+ | api.ParserI --+ | RecursiveDescentParser --+ | SteppingRecursiveDescentParser
A RecursiveDescentParser
that allows you to step through
the parsing process, performing a single operation at a time.
The initialize
method is used to start parsing a text.
expand
expands the first element on the frontier using a
single CFG production, and match
matches the first element
on the frontier against the next text token. backtrack
undoes the most recent expand or match operation. step
performs a single expand, match, or backtrack operation.
parses
returns the set of parses that have been found by the
parser.
See Also:
nltk.cfg
|
|||
|
|||
|
|||
list of Tree
|
|
||
|
|||
list of String
|
|
||
list of tuple of int
|
|
||
Tree
|
|
||
Production or String or
boolean
|
|
||
Production or None
|
|
||
String or None
|
|
||
boolean
|
|
||
list of Production
|
|
||
list of Production
|
|
||
boolean
|
|
||
boolean
|
|
||
list of int
|
|
||
list of Tree
|
|
||
|
|||
Inherited from Inherited from Inherited from Inherited from |
|||
Deprecated | |||
---|---|---|---|
Inherited from |
|
|||
_history A list of (rtext, tree, frontier) tripples, containing
the previous states of the parser.
|
|||
_tried_e A record of all productions that have been tried for a given tree. |
|||
_tried_m A record of what tokens have been matched for a given tree. |
|
|||
Inherited from |
|
Create a new
|
|
Start parsing a given text. This sets the parser's tree to the start
symbol, its frontier to the root node, and its remaining text to
|
|
|
|
Perform a single parsing operation. If an untried match is possible, then perform the match, and return the matched token. If an untried expansion is possible, then perform the expansion, and return the production that it is based on. If backtracking is possible, then backtrack, and return 1. Otherwise, return 0.
|
Expand the first element of the frontier. In particular, if the first
element of the frontier is a subtree whose node type is equal to
|
Match the first element of the frontier. In particular, if the first element of the frontier has the same type as the next text token, then substitute the text token into the tree.
|
Return the parser to its state before the most recent match or expand
operation. Calling
|
|
|
|
|
A stub version of
|
|
Change the grammar used to parse texts.
|
|
_historyA list of(rtext, tree, frontier) tripples, containing the
previous states of the parser. This history is used to implement the
backtrack operation.
|
_tried_eA record of all productions that have been tried for a given tree. This record is used byexpand to perform the next untried
production.
|
_tried_mA record of what tokens have been matched for a given tree. This record is used bystep to decide whether or not to match a token.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Wed Aug 27 15:08:56 2008 | http://epydoc.sourceforge.net |