class_docstr: Replace entity mention with entity with same entity types
docstr: replace entity with random token span
  
  :param str types: entity type
  :param list index: entity index [start, end]
  :param list token: tokenized sentence
  :return Tuple(list, int): new sentence and \
  number of new entity words greater than old entity words
docstr_tok: ["replace","entity","with","random","token","span",":","param","str","types",":","entity","type",":","param","list","index",":","entity","index","[","start",",","end","]",":","param","list","token",":","tokenized","sentence",":","return","Tuple","(","list",",","int",")",":","new","sentence","and","\\","number","of","new","entity","words","greater","than","old","entity","words"]
code: def replace_en(self, types, index, token):
      r"""
          replace entity with random token span
  
          :param str types: entity type
          :param list index: entity index [start, end]
          :param list token: tokenized sentence
          :return Tuple(list, int): new sentence and \
          number of new entity words greater than old entity words
          """
      assert isinstance(types, str), (
          f"the type of 'type' should be string, got "
          f"{type(types)} instead"
      )
      assert isinstance(index, list), (
          f"the type of 'index' "
          f"should be list, got "
          f"{type(index)} instead"
      )
      assert isinstance(token, list), (
          f"the type of 'token' "
          f"should be list, got "
          f"{type(token)} instead"
      )
      assert len(index) == 2, (
          f"the length of index "
          f"should be two, got length {len(index)} instead"
      )
      assert index[0] >= 0 and index[1] < len(token), (
          f"elements of index should not be negative or longer than "
          f"the length of token, got input "
          f"{index[0]}<0 or {index[1]}>= {len(token)}"
      )
      length = 0
      if types in self.type_dict.keys():
          new_subj = random.choice(self.type_dict[types])
          token_before, token_after = (
              token[: index[0]],
              token[index[1] + 1 :],
          )
          token = token_before + new_subj.split(" ") + token_after
          length = len(new_subj.split(" ")) - (index[1] - index[0] + 1)
      return token, length
  
file_path: textflint/textflint/generation/transformation/RE/swap_ent.py
imports: import random
  from ....common.settings import LOWFREQ, MULTI_TYPE, TYPES
  from ....common.utils.install import download_if_needed
  from ....common.utils.load import json_loader
  from ...transformation import Transformation
  from ....input.component.sample import RESample
label_desc: Use image node_id 3 for calling the SwapEnt obj's underlying member method code with example usage: obj.replace_en(types, index, token) and returns: token,  length