nltk.ParserI

class nltk.ParserI[source]

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()

Methods

grammar()
return:The grammar used by this parser.
parse(sent, *args, **kwargs)
return:An iterator that generates parse trees for the sentence.
parse_all(sent, *args, **kwargs)
rtype:list(Tree)
parse_one(sent, *args, **kwargs)
rtype:Tree or None
parse_sents(sents, *args, **kwargs) Apply self.parse() to each element of sents.