Package nltk :: Package chunk :: Module regexp :: Class ExpandRightRule
[hide private]
[frames] | no frames]

Class ExpandRightRule

source code

     object --+    
              |    
RegexpChunkRule --+
                  |
                 ExpandRightRule

A rule specifying how to expand chunks in a ChunkString to the right, using two matching tag patterns: a left pattern, and a right pattern. When applied to a ChunkString, it will find any chunk whose end matches left pattern, and immediately followed by a chink whose beginning matches right pattern. It will then expand the chunk to incorporate the new material on the right.

Instance Methods [hide private]
 
__init__(self, left_tag_pattern, right_tag_pattern, descr)
Construct a new ExpandRightRule.
source code
string
__repr__(self)
Returns: A string representation of this rule.
source code

Inherited from RegexpChunkRule: apply, descr

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Static Methods [hide private]

Inherited from RegexpChunkRule: parse

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, left_tag_pattern, right_tag_pattern, descr)
(Constructor)

source code 

Construct a new ExpandRightRule.

Parameters:
  • right_tag_pattern (string) - This rule's right tag pattern. When applied to a ChunkString, this rule will find any chunk whose end matches left_tag_pattern, and immediately followed by a chink whose beginning matches this pattern. It will then merge those two chunks into a single chunk.
  • left_tag_pattern (string) - This rule's left tag pattern. When applied to a ChunkString, this rule will find any chunk whose end matches this pattern, and immediately followed by a chink whose beginning matches right_tag_pattern. It will then expand the chunk to incorporate the new material on the right.
  • descr (string) - A short description of the purpose and/or effect of this rule.
Overrides: RegexpChunkRule.__init__

__repr__(self)
(Representation operator)

source code 
Returns: string
A string representation of this rule. This string representation has the form:
   <ExpandRightRule: '<NN|DT|JJ>', '<NN|JJ>'>

Note that this representation does not include the description string; that string can be accessed separately with the descr method.

Overrides: RegexpChunkRule.__repr__