class_docstr: A rule specifying how to add chunks to a ``ChunkString``, using a
  matching tag pattern.  When applied to a ``ChunkString``, it will
  find any substring that matches this tag pattern and that is not
  already part of a chunk, and create a new chunk containing that
  substring.
class_docstr_tok: ["A","rule","specifying","how","to","add","chunks","to","a","``","ChunkString","``",",","using","a","matching","tag","pattern",".","When","applied","to","a","``","ChunkString","``",",","it","will","find","any","substring","that","matches","this","tag","pattern","and","that","is","not","already","part","of","a","chunk",",","and","create","a","new","chunk","containing","that","substring","."]
docstr: Construct a new ``ChunkRule``.
  
  :type tag_pattern: str
  :param tag_pattern: This rule's tag pattern.  When
      applied to a ``ChunkString``, this rule will
      chunk any substring that matches this tag pattern and that
      is not already part of a chunk.
  :type descr: str
  :param descr: A short description of the purpose and/or effect
      of this rule.
docstr_tok: ["Construct","a","new","``","ChunkRule","``",".",":","type","tag_pattern",":","str",":","param","tag_pattern",":","This","rule","'s","tag","pattern",".","When","applied","to","a","``","ChunkString","``",",","this","rule","will","chunk","any","substring","that","matches","this","tag","pattern","and","that","is","not","already","part","of","a","chunk",".",":","type","descr",":","str",":","param","descr",":","A","short","description","of","the","purpose","and\/or","effect","of","this","rule","."]
code: def __init__(self, tag_pattern, descr):
      """
      Construct a new ``ChunkRule``.
  
      :type tag_pattern: str
      :param tag_pattern: This rule's tag pattern.  When
          applied to a ``ChunkString``, this rule will
          chunk any substring that matches this tag pattern and that
          is not already part of a chunk.
      :type descr: str
      :param descr: A short description of the purpose and/or effect
          of this rule.
      """
      self._pattern = tag_pattern
      regexp = re.compile(
          "(?P<chunk>%s)%s"
          % (
              tag_pattern2re_pattern(tag_pattern),
              ChunkString.IN_STRIP_PATTERN,
          )
      )
      RegexpChunkRule.__init__(self, regexp, r"{\g<chunk>}", descr)
  
imports: import re
  import regex
  from nltk.chunk.api import ChunkParserI
  from nltk.tree import Tree
label_desc: Use image node_id 1 to create a new ChunkRule object from inherited base classes: RegexpChunkRule with example: obj = ChunkRule(tag_pattern, descr)