class_docstr: Transformation that leverage pre-defined spelling mistake dictionary to
  simulate spelling mistake.
  
  https://arxiv.org/ftp/arxiv/papers/1812/1812.04718.pdf
class_docstr_tok: ["Transformation","that","leverage","pre-defined","spelling","mistake","dictionary","to","simulate","spelling","mistake",".","https",":","\/\/arxiv.org\/ftp\/arxiv\/papers\/1812\/1812.04718.pdf"]
code: def spell(self, word):
      spell_error_rule = {
          "ao": "a",
          "ing": "in",
          "a": "e",
          "e": "a",
      }
      pinyin = lazy_pinyin(word)
      replace_index = random.randint(0, len(pinyin) - 1)
      replace_str = pinyin[replace_index]
      replaced_str = None
      for k, v in spell_error_rule.items():
          if k in replace_str:
              replaced_str = replace_str.replace(k, v)
              break
      if replaced_str is None:
          return []
      pinyin[replace_index] = replaced_str
      try:
          result = viterbi(
              hmm_params=hmmparams, observations=pinyin, path_num=1
          )
      except Exception:
          return []
  
      ret = []
      for i in result:
          if "".join(i.path) != word:
              ret.append("".join(i.path))
      return ret
  
file_path: textflint/textflint/generation/transformation/UTCN/cn_spelling_error.py
imports: import random
  from pypinyin import lazy_pinyin
  from Pinyin2Hanzi import DefaultHmmParams
  from Pinyin2Hanzi import viterbi
  from ...transformation import CnWordSubstitute
label_desc: Use image node_id 5 for calling the CnSpellingError obj's underlying member method code with example usage: obj.spell(word) and returns: ret, list, list