class_docstr: Transforms an input by replacing its tokens with words of mask language
  predicted.
  To accelerate transformation for long text, input single sentence to
  language model rather than whole text.
docstr: Returns a list containing all possible words .
  
  :param str word: token word to transform.
  :param str pos: pos tag
  :param int n: max number of candidates
  :param list[int] word_postion: position of word in the sentence
  
  :return list candidates: candidates list
docstr_tok: ["Returns","a","list","containing","all","possible","words",".",":","param","str","word",":","token","word","to","transform",".",":","param","str","pos",":","pos","tag",":","param","int","n",":","max","number","of","candidates",":","param","list","[","int","]","word_postion",":","position","of","word","in","the","sentence",":","return","list","candidates",":","candidates","list"]
code: def _get_candidates(
      self, word, pos=None, n=5, word_position=None, text=None
  ):
      r"""
      Returns a list containing all possible words .
  
      :param str word: token word to transform.
      :param str pos: pos tag
      :param int n: max number of candidates
      :param list[int] word_postion: position of word in the sentence
  
      :return list candidates: candidates list
  
      """
      import torch
  
      if self.model is None:
          self.get_model()
  
      word_length = len(word)
      mask_sentence = "[MASK]" * word_length
  
      if word_position[1] > 510:
          return []
  
      new_text = (
          text[: word_position[0]]
          + mask_sentence
          + text[word_position[1] :]
      )
      new_text_tensor = self.tokenizer(
          new_text, return_tensors="pt", truncation=True, max_length=512
      )
  
      with torch.no_grad():
          output = self.model(**new_text_tensor)
      output = output.logits[0][
          word_position[0] + 1 : word_position[1] + 1, :
      ]
      output = torch.argsort(output, descending=True, dim=-1)[
          :, : n + 1
      ].transpose(0, 1)
      tokens = [
          self.tokenizer.decode(
              word,
              skip_special_tokens=True,
              clean_up_tokenization_spaces=True,
          ).replace(" ", "")
          for word in output
      ]
      tokens = [
          token for token in tokens if token != word and token != ""
      ]
      return tokens
  
file_path: textflint/textflint/generation/transformation/UTCN/cn_mlm_suggestion.py
imports: import torch
  from ....common import device
  from ...transformation import CnWordSubstitute
  from ....common.settings import CN_BERT_MODEL_NAME
  from ....common.utils.list_op import trade_off_sub_words
label_desc: Use image node_id 7 for calling the MLMSuggestion obj's underlying member method code with example usage: obj._get_candidates(word, pos, n, word_position, text) and returns: tokens, list