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 a
ChunkString
, and each rule acts by modifying the chunking in
the ChunkString
. The rules are all implemented using
regular expression matching and substitution.
|
__init__(self,
rules,
chunk_node=' NP ' ,
top_node=' S ' ,
trace=0)
Construct a new RegexpChunkParser . |
source code
|
|
None
|
_trace_apply(self,
chunkstr,
verbose)
Apply each of this RegexpChunkParser 's rules to
chunkstr , in turn. |
source code
|
|
None
|
|
Tree
|
parse(self,
chunk_struct,
trace=None)
Returns:
the best chunk structure for the given tokens and return a tree. |
source code
|
|
list of RegexpChunkRule
|
rules(self)
Returns:
the sequence of rules used by RegexpChunkParser . |
source code
|
|
string
|
|
string
|
__str__(self)
Returns:
a verbose string representation of this
RegexpChunkParser . |
source code
|
|
Inherited from parse.api.ParserI :
batch_iter_parse ,
batch_nbest_parse ,
batch_parse ,
batch_prob_parse ,
grammar ,
iter_parse ,
nbest_parse ,
prob_parse
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__
|
Inherited from parse.api.ParserI :
batch_test ,
get_parse ,
get_parse_dict ,
get_parse_list ,
get_parse_prob
|