nltk.chunk.RegexpChunkParser
¶
-
class
nltk.chunk.
RegexpChunkParser
(rules, chunk_label=u'NP', root_label=u'S', trace=0)[source]¶ A regular expression based chunk parser.
RegexpChunkParser
uses a sequence of “rules” to find chunks of a single type within a text. The chunking of the text is encoded using aChunkString
, and each rule acts by modifying the chunking in theChunkString
. The rules are all implemented using regular expression matching and substitution.The
RegexpChunkRule
class and its subclasses (ChunkRule
,ChinkRule
,UnChunkRule
,MergeRule
, andSplitRule
) define the rules that are used byRegexpChunkParser
. Each rule defines anapply()
method, which modifies the chunking encoded by a givenChunkString
.Variables: - _rules – The list of rules that should be applied to a text.
- _trace – The default level of tracing.
Methods¶
__init__ (rules[, chunk_label, root_label, trace]) |
Construct a new RegexpChunkParser . |
||||
evaluate (gold) |
Score the accuracy of the chunker against the gold standard. | ||||
grammar () |
|
||||
parse (chunk_struct[, trace]) |
|
||||
parse_all (sent, *args, **kwargs) |
|
||||
parse_one (sent, *args, **kwargs) |
|
||||
parse_sents (sents, *args, **kwargs) |
Apply self.parse() to each element of sents . |
||||
rules () |
|
||||
unicode_repr () |
|