class_docstr: Transforms an input by replacing its words with their inflections.
  
  For example, the inflections of 'schedule' are {'schedule', 'schedules', 'scheduling'}.
  
  Base on ``It’s Morphin’ Time! Combating Linguistic Discrimination with Inflectional Perturbations``.
  
  `Paper URL`_
  
  .. _Paper URL: https://www.aclweb.org/anthology/2020.acl-main.263.pdf
code: def _get_replacement_words(self, word, word_part_of_speech):
      # only nouns, verbs, and adjectives are considered for replacement
      if word_part_of_speech not in self._enptb_to_universal:
          return []
  
      # gets a dict that maps part-of-speech (POS) to available lemmas
      replacement_inflections_dict = lemminflect.getAllLemmas(word)
  
      # if dict is empty, there are no replacements for this word
      if not replacement_inflections_dict:
          return []
  
      # map the fine-grained POS to a universal POS
      lemminflect_pos = self._enptb_to_universal[word_part_of_speech]
  
      # choose lemma with same POS, if ones exists; otherwise, choose lemma randomly
      if lemminflect_pos in replacement_inflections_dict:
          lemma = replacement_inflections_dict[lemminflect_pos][0]
      else:
          lemma = random.choice(
              list(replacement_inflections_dict.values())
          )[0]
  
      # get the available inflections for chosen lemma
      inflections = lemminflect.getAllInflections(
          lemma, upos=lemminflect_pos
      ).values()
  
      # merge tuples, remove duplicates, remove copy of the original word
      replacement_words = list(
          set([infl for tup in inflections for infl in tup])
      )
      replacement_words = [r for r in replacement_words if r != word]
  
      return replacement_words
  
file_path: TextAttack/textattack/transformations/word_swaps/word_swap_inflections.py
imports: import random
  import lemminflect
  from .word_swap import WordSwap
label_desc: Use image node_id 2 for calling the WordSwapInflections obj's underlying member method code with example usage: obj._get_replacement_words(word, word_part_of_speech) and returns: replacement_words, list, list