NLTK Parsers
Classes and interfaces for producing tree structures that represent the internal organization of a text. This task is known as "parsing" the text, and the resulting tree structures are called the text's "parses". Typically, the text is a single sentence, and the tree structure represents the syntactic structure of the sentence. However, parsers can also be used in other domains. For example, parsers can be used to derive the morphological structure of the morphemes that make up a word, or to derive the discourse structure for a set of utterances.
Sometimes, a single piece of text can be represented by more than one tree structure. Texts represented by more than one tree structure are called "ambiguous" texts. Note that there are actually two ways in which a text can be ambiguous:
- The text has multiple correct parses.
- There is not enough information to decide which of several candidate parses is correct.
However, the parser module does not distinguish these two types of ambiguity.
The parser module defines ParserI, a standard interface for parsing texts; and two simple implementations of that interface, ShiftReduceParser and RecursiveDescentParser. It also contains three sub-modules for specialized kinds of parsing:
- nltk.parser.chart defines chart parsing, which uses dynamic programming to efficiently parse texts.
- nltk.parser.probabilistic defines probabilistic parsing, which associates a probability with each parse.
Module | api |
No module docstring; 1/1 class documented |
Module | bllip |
No module docstring; 1/4 function, 1/1 class documented |
Module | chart |
Data classes and parser implementations for "chart parsers", which use dynamic programming to efficiently parse a text. A chart parser derives parse trees for a text by iteratively adding "edges" to a "chart... |
Module | corenlp |
No module docstring; 0/1 variable, 0/2 function, 1/1 exception, 3/4 classes documented |
Module | dependencygraph |
Tools for reading and writing dependency trees. The input is assumed to be in Malt-TAB format (http://stp.lingfil.uu.se/~nivre/research/MaltXML.html). |
Module | earleychart |
Data classes and parser implementations for incremental chart parsers, which use dynamic programming to efficiently parse a text. A "chart parser" derives parse trees for a text by iteratively adding "edges" to a "chart"... |
Module | evaluate |
No module docstring; 1/1 class documented |
Module | featurechart |
Extension of chart parsing implementation to handle grammars with feature structures as nodes. |
Module | generate |
No module docstring; 0/1 variable, 1/4 function documented |
Module | malt |
No module docstring; 2/3 functions, 1/1 class documented |
Module | nonprojectivedependencyparser |
No module docstring; 0/1 variable, 0/4 function, 4/5 classes documented |
Module | pchart |
Classes and interfaces for associating probabilities with tree structures that represent the internal organization of a text. The probabilistic parser module defines BottomUpProbabilisticChartParser. |
Module | projectivedependencyparser |
No module docstring; 3/4 functions, 4/4 classes documented |
Module | recursivedescent |
No module docstring; 1/1 function, 2/2 classes documented |
Module | shiftreduce |
No module docstring; 1/1 function, 2/2 classes documented |
Module | stanford |
No module docstring; 0/1 variable, 4/4 classes documented |
Module | transitionparser |
No module docstring; 1/1 function, 3/3 classes documented |
Module | util |
Utility functions for parsers. |
Module | viterbi |
No module docstring; 1/1 function, 1/1 class documented |