class_docstr: Augmenter that leverage semantic meaning to substitute word.
  
  :param str aug_src: Support 'wordnet' and 'ppdb' .
  :param str model_path: Path of dictionary. Mandatory field if using PPDB as data source
  :param str lang: Language of your text. Default value is 'eng'. For `wordnet`, you can choose lang from this list
      http://compling.hss.ntu.edu.sg/omw/. For `ppdb`, you simply download corresponding langauge pack from
      http://paraphrase.org/#/download.
  :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 stopwords: List of words which will be skipped from augment operation.
  :param str stopwords_regex: Regular expression for matching words which will be skipped from augment operation.
  :param func tokenizer: Customize tokenization process
  :param func reverse_tokenizer: Customize reverse of tokenization process
  :param bool force_reload: Force reload model to memory when initialize the class.
      Default value is False and suggesting to keep it as False if performance is the consideration.
  :param str name: Name of this augmenter
  
  >>> import nlpaug.augmenter.word as naw
  >>> aug = naw.SynonymAug()
class_docstr_tok: ["Augmenter","that","leverage","semantic","meaning","to","substitute","word",".",":","param","str","aug_src",":","Support","'wordnet","'","and","'ppdb","'",".",":","param","str","model_path",":","Path","of","dictionary",".","Mandatory","field","if","using","PPDB","as","data","source",":","param","str","lang",":","Language","of","your","text",".","Default","value","is","'eng","'",".","For","`","wordnet","`",",","you","can","choose","lang","from","this","list","http",":","\/\/compling.hss.ntu.edu.sg\/omw\/",".","For","`","ppdb","`",",","you","simply","download","corresponding","langauge","pack","from","http",":","\/\/paraphrase.org\/","#","\/download",".",":","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","stopwords",":","List","of","words","which","will","be","skipped","from","augment","operation",".",":","param","str","stopwords_regex",":","Regular","expression","for","matching","words","which","will","be","skipped","from","augment","operation",".",":","param","func","tokenizer",":","Customize","tokenization","process",":","param","func","reverse_tokenizer",":","Customize","reverse","of","tokenization","process",":","param","bool","force_reload",":","Force","reload","model","to","memory","when","initialize","the","class",".","Default","value","is","False","and","suggesting","to","keep","it","as","False","if","performance","is","the","consideration",".",":","param","str","name",":","Name","of","this","augmenter",">",">",">","import","nlpaug.augmenter.word","as","naw",">",">",">","aug","=","naw.SynonymAug","(",")"]
code: def substitute(self, data):
      if not data or not data.strip():
          return data
  
      change_seq = 0
      doc = Doc(data, self.tokenizer(data))
  
      original_tokens = doc.get_original_tokens()
  
      pos = self.model.pos_tag(original_tokens)
  
      aug_idxes = self._get_aug_idxes(pos)
      if aug_idxes is None or len(aug_idxes) == 0:
          if self.include_detail:
              return data, []
          return data
  
      for aug_idx in aug_idxes:
          original_token = original_tokens[aug_idx]
  
          word_poses = PartOfSpeech.constituent2pos(pos[aug_idx][1])
          candidates = []
          if word_poses is None or len(word_poses) == 0:
              # Use every possible words as the mapping does not defined correctly
              candidates.extend(self.model.predict(pos[aug_idx][0]))
          else:
              for word_pos in word_poses:
                  candidates.extend(
                      self.model.predict(pos[aug_idx][0], pos=word_pos)
                  )
  
          candidates = [
              c
              for c in candidates
              if c.lower() != original_token.lower()
          ]
  
          if len(candidates) > 0:
              candidate = self.sample(candidates, 1)[0]
              candidate = (
                  candidate.replace("_", " ").replace("-", " ").lower()
              )
              substitute_token = self.align_capitalization(
                  original_token, candidate
              )
  
              if aug_idx == 0:
                  substitute_token = self.align_capitalization(
                      original_token, substitute_token
                  )
  
              change_seq += 1
              doc.add_change_log(
                  aug_idx,
                  new_token=substitute_token,
                  action=Action.SUBSTITUTE,
                  change_seq=self.parent_change_seq + change_seq,
              )
  
      if self.include_detail:
          return (
              self.reverse_tokenizer(doc.get_augmented_tokens()),
              doc.get_change_logs(),
          )
      else:
          return self.reverse_tokenizer(doc.get_augmented_tokens())
  
file_path: nlpaug/nlpaug/augmenter/word/synonym.py
imports: import os
  from nlpaug.augmenter.word import WordAugmenter
  from nlpaug.util import Action, Doc, PartOfSpeech, WarningException, WarningName, WarningCode, WarningMessage
  import nlpaug.model.word_dict
label_desc: Use image node_id 4 for calling the SynonymAug obj's underlying member method code with example usage: obj.substitute(data) and returns: data, data, self,  doc, self, data,  list