class documentation
class MergeRule(RegexpChunkRule): (source)
Constructor: MergeRule(left_tag_pattern, right_tag_pattern, descr)
A rule specifying how to merge chunks in a ChunkString, 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 chunk whose beginning matches right pattern. It will then merge those two chunks into a single chunk.
Method | __init__ |
Construct a new MergeRule. |
Method | __repr__ |
Return a string representation of this rule. It has the form: |
Instance Variable | _left |
Undocumented |
Instance Variable | _right |
Undocumented |
Inherited from RegexpChunkRule
:
Static Method | fromstring |
Create a RegexpChunkRule from a string description. Currently, the following formats are supported: |
Method | apply |
Apply this rule to the given ChunkString. See the class reference documentation for a description of what it means to apply a rule. |
Method | descr |
Return a short description of the purpose and/or effect of this rule. |
Instance Variable | _descr |
Undocumented |
Instance Variable | _regexp |
Undocumented |
Instance Variable | _repl |
Undocumented |
Construct a new MergeRule.
Parameters | |
left | 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 chunk whose beginning matches right_tag_pattern. It will then merge those two chunks into a single chunk. |
right | 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 chunk whose beginning matches this pattern. It will then merge those two chunks into a single chunk. |
descr:str | A short description of the purpose and/or effect of this rule. |