class_docstr: Transforms an input by Reverse gender or place names in sentences.
class_docstr_tok: ["Transforms","an","input","by","Reverse","gender","or","place","names","in","sentences","."]
docstr: :param str change_type: change type, only support ['Name', 'Loc']
  :param str prejudice_tendency: prejudice tendency, choose different
      tendency according to change_type
docstr_tok: [":","param","str","change_type",":","change","type",",","only","support","[","'Name","'",",","'Loc","'","]",":","param","str","prejudice_tendency",":","prejudice","tendency",",","choose","different","tendency","according","to","change_type"]
code: def __init__(
      self, change_type="Loc", prejudice_tendency=None, **kwargs
  ):
      r"""
      :param str change_type: change type, only support ['Name', 'Loc']
      :param str prejudice_tendency: prejudice tendency, choose different
          tendency according to change_type
  
      """
      super().__init__()
      if change_type == "Name":
          self.flag_type = True
          if not prejudice_tendency or prejudice_tendency == "woman":
              self.prejudice_tendency = "woman"
          elif prejudice_tendency == "man":
              self.prejudice_tendency = "man"
          else:
              raise ValueError(
                  "Prejudice tendency not support name type {0}, "
                  "please choose change type from woman and man".format(
                      change_type
                  )
              )
          self.type = self.prejudice_tendency
          self.man_name, self.woman_name = self.get_data(
              download_if_needed(PREJUDICE_PATH)
          )
          self.word = self.get_word(
              download_if_needed(PREJUDICE_WORD_PATH),
              prejudice_tendency,
          )
      elif change_type == "Loc":
          self.flag_type = False
          if not prejudice_tendency:
              prejudice_tendency = ["Africa"]
          elif isinstance(prejudice_tendency, str):
              prejudice_tendency = [prejudice_tendency]
          assert isinstance(prejudice_tendency, list)
          for prejudice_type in prejudice_tendency:
              if prejudice_type not in PREJUDICE_LOC2IDX:
                  raise ValueError(
                      "Prejudice tendency not support name type {0}, please "
                      "choose change type from America, Europe,Africa,China,"
                      "Japan,India".format(prejudice_type)
                  )
          self.prejudice_tendency = [
              PREJUDICE_LOC2IDX[i] for i in prejudice_tendency
          ]
          self.max_len_loc = 0
          self.loc2idx, self.idx2loc = self.get_loc_data(
              download_if_needed(PREJUDICE_LOC_PATH)
          )
          self.type = "".join([k[:2] for k in prejudice_tendency])
          self.prejudice_data = [
              j
              for i in self.prejudice_tendency
              for j in self.idx2loc[i]
          ]
  
      else:
          raise ValueError(
              "Prejudice not support name type {0}, please choose"
              " change type from Name and Loc".format(change_type)
          )
  
file_path: textflint/textflint/generation/transformation/UT/prejudice.py
imports: import random
  from ..transformation import Transformation
  from ....common.utils.file_io import read_json
  from ....common.utils.list_op import descartes
  from ....common.utils.load import plain_lines_loader
  from ....common.utils.install import download_if_needed
  from ....common.settings import PREJUDICE_PATH, PREJUDICE_WORD_PATH, PREJUDICE_LOC_PATH, PREJUDICE_LOC2IDX
label_desc: Use image node_id 1 to create a new Prejudice object from inherited base classes: Transformation with example: obj = Prejudice(change_type, prejudice_tendency)