class_docstr: Replace word with its synonym.
  
  Example::
  
      先生过奖了 -> 先生过誉了
class_docstr_tok: ["Replace","word","with","its","synonym",".","Example",":",":","\u5148\u751f\u8fc7\u5956\u4e86","-",">","\u5148\u751f\u8fc7\u8a89\u4e86"]
docstr: Replace synonym function
  
  :param list words: chinese sentence words
  :param int n: the number of transformations
  :return list: two list include the pos which changed the word which
      changed and the label which changed
docstr_tok: ["Replace","synonym","function",":","param","list","words",":","chinese","sentence","words",":","param","int","n",":","the","number","of","transformations",":","return","list",":","two","list","include","the","pos","which","changed","the","word","which","changed","and","the","label","which","changed"]
code: def _get_transformations(self, words, n):
      r"""
      Replace synonym function
  
      :param list words: chinese sentence words
      :param int n: the number of transformations
      :return list: two list include the pos which changed the word which
          changed and the label which changed
  
      """
      start = 0
      change_pos = []
      change_word = []
  
      for word in words:
          # find the word
          if word in self.synonym_dict:
              # save synonyms and change word segmentation labels
              change_pos.append([start, start + len(word)])
              change_word += [
                  random.sample(
                      self.synonym_dict[word],
                      min(n, len(self.synonym_dict[word])),
                  )
              ]
          start += len(word)
  
      return change_pos, change_word
  
file_path: textflint/textflint/generation/transformation/CWS/swap_syn.py
imports: from ..transformation import Transformation
  from ....common.settings import SYNONYM_PATH
  from ....common.utils.load import plain_lines_loader
  from ....common.utils.install import download_if_needed
  from ....common.utils.list_op import descartes
  import random
label_desc: Use image node_id 5 for calling the SwapSyn obj's underlying member method code with example usage: obj._get_transformations(words, n) and returns: change_pos,  change_word