class_docstr: Augmenter that apply target word replacement for augmentation.
  Can also be used to generate all possible combinations.
  :param float aug_p: Percentage of word will be augmented. 
  :param int aug_min: Minimum number of word will be augmented.
  :param int aug_max: Maximum number of word will be augmented. If None is passed, number of augmentation is
      calculated via aup_p. If calculated result from aug_p is smaller than aug_max, will use calculated result from
      aug_p. Otherwise, using aug_max.
  :param list reserved_tokens: A list of swappable tokens (a list of list). For example, "FWD", "Fwd" and "FW" 
      are referring to "foward" in email communcation while "Sincerely" and "Best Regards" treated as same 
      meaning. The input should be [["FWD", "Fwd", "FW"], ["Sincerely", "Best Regards"]]. 
  :param bool case_sensitive: Default is True. If True, it will only replace alternative token if all cases are same.
  :param bool generate_all_combinations: Default is False. If True, all the possible combinations of sentences
      possible with reserved_tokens will be returned. 
  :param func tokenizer: Customize tokenization process
  :param func reverse_tokenizer: Customize reverse of tokenization process
  :param str name: Name of this augmenter
  >>> import nlpaug.augmenter.word as naw
  >>> aug = naw.ReservedAug()
code: def __init__(
      self,
      reserved_tokens,
      action=Action.SUBSTITUTE,
      case_sensitive=True,
      name="Reserved_Aug",
      aug_min=1,
      aug_max=10,
      aug_p=0.3,
      tokenizer=None,
      reverse_tokenizer=None,
      verbose=0,
      generate_all_combinations=False,
  ):
      super().__init__(
          action=action,
          name=name,
          aug_p=aug_p,
          aug_min=aug_min,
          aug_max=aug_max,
          tokenizer=tokenizer,
          reverse_tokenizer=reverse_tokenizer,
          device="cpu",
          verbose=verbose,
          include_detail=False,
      )
  
      self.generate_all_combinations = generate_all_combinations
  
      self.reserved_tokens = reserved_tokens
      self.reserved_lower_tokens = []
      self.case_sensitive = case_sensitive
  
      self.reserved_token_dict = {}
      self.reserved_phrase_dict = {}
      self.reserved_phrase_concats = []
      self.reserved_phrase_regexs = []
  
      if not case_sensitive:
          self.reserved_lower_tokens = [
              t.lower() for tokens in reserved_tokens for t in tokens
          ]
  
      reserved_phrase_dict_by_len = defaultdict(list)
      for i, tokens in enumerate(reserved_tokens):
          for t in tokens:
              if not case_sensitive:
                  t = t.lower()
  
              phrase_tokens = self.tokenizer(t)
              if len(phrase_tokens) == 1:
                  # For single word
                  # If duplicates word occurs, pick the last one.
                  self.reserved_token_dict[t] = i
              else:
                  # For phrase
                  reserved_phrase_dict_by_len[
                      len(phrase_tokens)
                  ].append((t, phrase_tokens, i))
  
      for i in sorted(reserved_phrase_dict_by_len.keys(), reverse=True):
          for phrase, phrase_tokens, pos in reserved_phrase_dict_by_len[
              i
          ]:
              phrase_concat_token = self.CONNECT_TOKEN.join(
                  phrase_tokens
              )
              phrase_token_regex = re.compile(
                  "(" + phrase + ")", re.IGNORECASE
              )
  
              self.reserved_phrase_dict[phrase_concat_token] = pos
              self.reserved_phrase_concats.append(phrase_concat_token)
              self.reserved_phrase_regexs.append(phrase_token_regex)
  
file_path: nlpaug/nlpaug/augmenter/word/reserved.py
imports: import re
  from collections import defaultdict
  from nlpaug.augmenter.word import WordAugmenter
  from nlpaug.util import Action, Doc
label_desc: Use image node_id 1 to create a new ReservedAug object from inherited base classes: WordAugmenter with example: obj = ReservedAug(reserved_tokens, action, case_sensitive, name, aug_min, aug_max, aug_p, tokenizer, reverse_tokenizer, verbose, generate_all_combinations)