code: def _replace_cn(word, num=1, skip_first=True, skip_last=False):
      """
      Perturb the word with 1 letter substituted for a random letter.
  
      :param str word: target word
      :param int num: number of typos to add
      :param bool skip_first: whether replace the char at the beginning of word
      :param bool skip_last: whether replace the char at the beginning of word
      :return: perturbed strings
      """
      if len(word) <= 1:
          return []
  
      chars = list(word)
      start, end = get_start_end(word, skip_first, skip_last)
  
      # error swap num, return original word
      if end - start + 1 < num:
          return word
  
      idxes = random.sample(list(range(start, end + 1)), num)
  
      for idx in idxes:
          chars[idx] = _get_homophone(chars[idx])
  
      return "".join(chars)
  
file_path: textflint/textflint/generation/transformation/NERCN/ent_typos.py
imports: from ....common.utils.word_op import *
  from ..transformation import Transformation
  from ....common.utils.list_op import trade_off_sub_words
  from textflint.generation.transformation.UTCN import CnHomophones
label_desc: Use image node_id 3 for calling a global function with example usage: _replace_cn(word, num, skip_first, skip_last) and returns: str, list, word