class_docstr: A rule specifying how to modify the chunking in a ``ChunkString``,
  using a transformational regular expression.  The
  ``RegexpChunkRule`` class itself can be used to implement any
  transformational rule based on regular expressions.  There are
  also a number of subclasses, which can be used to implement
  simpler types of rules, based on matching regular expressions.
  
  Each ``RegexpChunkRule`` has a regular expression and a
  replacement expression.  When a ``RegexpChunkRule`` is "applied"
  to a ``ChunkString``, it searches the ``ChunkString`` for any
  substring that matches the regular expression, and replaces it
  using the replacement expression.  This search/replace operation
  has the same semantics as ``re.sub``.
  
  Each ``RegexpChunkRule`` also has a description string, which
  gives a short (typically less than 75 characters) description of
  the purpose of the rule.
  
  This transformation defined by this ``RegexpChunkRule`` should
  only add and remove braces; it should *not* modify the sequence
  of angle-bracket delimited tags.  Furthermore, this transformation
  may not result in nested or mismatched bracketing.
class_docstr_tok: ["A","rule","specifying","how","to","modify","the","chunking","in","a","``","ChunkString","``",",","using","a","transformational","regular","expression",".","The","``","RegexpChunkRule","``","class","itself","can","be","used","to","implement","any","transformational","rule","based","on","regular","expressions",".","There","are","also","a","number","of","subclasses",",","which","can","be","used","to","implement","simpler","types","of","rules",",","based","on","matching","regular","expressions",".","Each","``","RegexpChunkRule","``","has","a","regular","expression","and","a","replacement","expression",".","When","a","``","RegexpChunkRule","``","is","``","applied","''","to","a","``","ChunkString","``",",","it","searches","the","``","ChunkString","``","for","any","substring","that","matches","the","regular","expression",",","and","replaces","it","using","the","replacement","expression",".","This","search\/replace","operation","has","the","same","semantics","as","``","re.sub","``",".","Each","``","RegexpChunkRule","``","also","has","a","description","string",",","which","gives","a","short","(","typically","less","than","75","characters",")","description","of","the","purpose","of","the","rule",".","This","transformation","defined","by","this","``","RegexpChunkRule","``","should","only","add","and","remove","braces",";","it","should","*","not","*","modify","the","sequence","of","angle-bracket","delimited","tags",".","Furthermore",",","this","transformation","may","not","result","in","nested","or","mismatched","bracketing","."]
docstr: Apply this rule to the given ``ChunkString``.  See the
  class reference documentation for a description of what it
  means to apply a rule.
  
  :type chunkstr: ChunkString
  :param chunkstr: The chunkstring to which this rule is applied.
  :rtype: None
  :raise ValueError: If this transformation generated an
      invalid chunkstring.
docstr_tok: ["Apply","this","rule","to","the","given","``","ChunkString","``",".","See","the","class","reference","documentation","for","a","description","of","what","it","means","to","apply","a","rule",".",":","type","chunkstr",":","ChunkString",":","param","chunkstr",":","The","chunkstring","to","which","this","rule","is","applied",".",":","rtype",":","None",":","raise","ValueError",":","If","this","transformation","generated","an","invalid","chunkstring","."]
code: def apply(self, chunkstr):
      # Keep docstring generic so we can inherit it.
      """
      Apply this rule to the given ``ChunkString``.  See the
      class reference documentation for a description of what it
      means to apply a rule.
  
      :type chunkstr: ChunkString
      :param chunkstr: The chunkstring to which this rule is applied.
      :rtype: None
      :raise ValueError: If this transformation generated an
          invalid chunkstring.
      """
      chunkstr.xform(self._regexp, self._repl)
  
imports: import re
  import regex
  from nltk.chunk.api import ChunkParserI
  from nltk.tree import Tree
label_desc: Use image node_id 2 for calling the RegexpChunkRule obj's underlying member method code with example usage: obj.apply(chunkstr) without return types