docstr: This will add a complex_label to the given sentence for every match.span() for every registered_mapping.
  
  If a match span overlaps with a token span an exception is raised.
docstr_tok: ["This","will","add","a","complex_label","to","the","given","sentence","for","every","match.span","(",")","for","every","registered_mapping",".","If","a","match","span","overlaps","with","a","token","span","an","exception","is","raised","."]
code: def _label(self, sentence: Sentence):
      """This will add a complex_label to the given sentence for every match.span() for every registered_mapping.
  
      If a match span overlaps with a token span an exception is raised.
      """
      collection = TokenCollection(sentence)
  
      for label, pattern in self._regexp_mapping.items():
          for match in pattern.finditer(sentence.to_original_text()):
              span: Tuple[int, int] = match.span()
              try:
                  token_span = collection.get_token_span(span)
              except ValueError:
                  raise Exception(
                      f"The match span {span} for label '{label}' is overlapping with a token!"
                  )
              token_span.add_label(label, label)
  
file_path: flair/flair/models/regexp_tagger.py
imports: import re
  import typing
  from dataclasses import dataclass, field
  from typing import Dict, List, Tuple, Union
  from flair.data import Sentence, Span, Token
label_desc: Use image node_id 7 for calling the RegexpTagger obj's underlying member method code with example usage: obj._label(sentence) without return types