'Construct a new ``ChunkRuleWithContext``.
:type left_context_tag_pattern: str
:param left_context_tag_pattern: A tag pattern that must match
the left context of ``chunk_tag_pattern`` for this rule to
apply.
:type chunk_tag_pattern: str
:param chunk_tag_pattern: A tag pattern that must match for this
rule to apply.  If the rule does apply, then this pattern
also identifies the substring that will be made into a chunk.
:type right_context_tag_pattern: str
:param right_context_tag_pattern: A tag pattern that must match
the right context of ``chunk_tag_pattern`` for this rule to
apply.
:type descr: str
:param descr: A short description of the purpose and/or effect
of this rule.'

def __init__(self, left_context_tag_pattern, chunk_tag_pattern, right_context_tag_pattern, descr):

    re.compile(tag_pattern2re_pattern(left_context_tag_pattern))
    re.compile(tag_pattern2re_pattern(chunk_tag_pattern))
    re.compile(tag_pattern2re_pattern(right_context_tag_pattern))
    self._left_context_tag_pattern = left_context_tag_pattern
    self._chunk_tag_pattern = chunk_tag_pattern
    self._right_context_tag_pattern = right_context_tag_pattern
    regexp = re.compile((u'(?P<left>%s)(?P<chunk>%s)(?P<right>%s)%s' % (tag_pattern2re_pattern(left_context_tag_pattern), tag_pattern2re_pattern(chunk_tag_pattern), tag_pattern2re_pattern(right_context_tag_pattern), ChunkString.IN_CHINK_PATTERN)))
    replacement = u'\\g<left>{\\g<chunk>}\\g<right>'
    RegexpChunkRule.__init__(self, regexp, replacement, descr)
