class_docstr: Swap entities which shorter than threshold to longer ones.
class_docstr_tok: ["Swap","entities","which","shorter","than","threshold","to","longer","ones","."]
docstr: :param string swap_type: the swap type in
  ['CrossCategory', 'OOV', 'SwapLonger']
  
  :param string res_path: dir for vocab/dict
docstr_tok: [":","param","string","swap_type",":","the","swap","type","in","[","'CrossCategory","'",",","'OOV","'",",","'SwapLonger","'","]",":","param","string","res_path",":","dir","for","vocab\/dict"]
code: def __init__(self, swap_type="OOV", res_path=None, **kwargs):
      r"""
      :param string swap_type: the swap type in
      ['CrossCategory', 'OOV', 'SwapLonger']
  
      :param string res_path: dir for vocab/dict
      """
      super().__init__()
      if swap_type not in ["OOV", "SwapLonger"]:
          raise ValueError(
              "Not support {0} type, plz ensure swap_type in {1}".format(
                  swap_type, ["OOV", "SwapLonger"]
              )
          )
      self.swap_type = swap_type
  
      if swap_type == "SwapLonger":
          res_path = (
              download_if_needed(CN_LONG_ENTITIES)
              if not res_path
              else res_path
          )
          self.res_dic = json_loader(res_path)
  
      elif swap_type == "OOV":
          res_path = (
              download_if_needed(CN_OOV_ENTITIES)
              if not res_path
              else res_path
          )
          self.res_dic = json_loader(res_path)
  
file_path: textflint/textflint/generation/transformation/NERCN/swap_ent.py
imports: import random
  from ....common.settings import CN_LONG_ENTITIES
  from ....common.settings import CN_OOV_ENTITIES, LABEL_TRANS
  from ....common.utils.install import download_if_needed
  from ....common.utils.load import json_loader
  from ..transformation import Transformation
label_desc: Use image node_id 1 to create a new SwapEnt object from inherited base classes: Transformation with example: obj = SwapEnt(swap_type, res_path)