class ParserI(object): (source)
Known subclasses: nltk.parse.bllip.BllipParser
, nltk.parse.chart.ChartParser
, nltk.parse.corenlp.GenericCoreNLPParser
, nltk.parse.malt.MaltParser
, nltk.parse.pchart.BottomUpProbabilisticChartParser
, nltk.parse.recursivedescent.RecursiveDescentParser
, nltk.parse.shiftreduce.ShiftReduceParser
, nltk.parse.stanford.GenericStanfordParser
, nltk.parse.viterbi.ViterbiParser
A processing class for deriving trees that represent possible structures for a sequence of tokens. These tree structures are known as "parses". Typically, parsers are used to derive syntax trees for sentences. But parsers can also be used to derive other kinds of tree structure, such as morphological trees and discourse structures.
- Subclasses must define:
- at least one of: parse(), parse_sents().
- Subclasses may define:
- grammar()
Method | grammar |
No summary |
Method | parse |
When possible this list is sorted from most likely to least likely. |
Method | parse |
No summary |
Method | parse |
No summary |
Method | parse |
Apply self.parse() to each element of sents. :rtype: iter(iter(Tree)) |
nltk.parse.chart.ChartParser
, nltk.parse.pchart.BottomUpProbabilisticChartParser
, nltk.parse.recursivedescent.RecursiveDescentParser
, nltk.parse.shiftreduce.ShiftReduceParser
, nltk.parse.viterbi.ViterbiParser
Returns | |
The grammar used by this parser. |
nltk.parse.bllip.BllipParser
, nltk.parse.chart.ChartParser
, nltk.parse.pchart.BottomUpProbabilisticChartParser
, nltk.parse.recursivedescent.RecursiveDescentParser
, nltk.parse.shiftreduce.ShiftReduceParser
, nltk.parse.viterbi.ViterbiParser
When possible this list is sorted from most likely to least likely.
Parameters | |
sent:list(str) | The sentence to be parsed |
*args | Undocumented |
**kwargs | Undocumented |
Returns | |
iter(Tree) | An iterator that generates parse trees for the sentence. |
nltk.parse.corenlp.GenericCoreNLPParser
, nltk.parse.malt.MaltParser
, nltk.parse.stanford.GenericStanfordParser
Apply self.parse() to each element of sents. :rtype: iter(iter(Tree))