class_docstr: Parallelly Word replace transformation to implement normal word replace functions.
class_docstr_tok: ["Parallelly","Word","replace","transformation","to","implement","normal","word","replace","functions","."]
docstr: Returns a list containing all possible words .
  
  :param list words: all words
  :param list legal_indices: indices which has not been skipped
  :param None|list pos: None or list of pos tags
  :param int n: max candidates for each word to be substituted
  :return list: list of list
docstr_tok: ["Returns","a","list","containing","all","possible","words",".",":","param","list","words",":","all","words",":","param","list","legal_indices",":","indices","which","has","not","been","skipped",":","param","None|list","pos",":","None","or","list","of","pos","tags",":","param","int","n",":","max","candidates","for","each","word","to","be","substituted",":","return","list",":","list","of","list"]
code: def _get_substitute_words(self, words, legal_indices, pos=None, n=5):
      r"""
      Returns a list containing all possible words .
  
      :param list words: all words
      :param list legal_indices: indices which has not been skipped
      :param None|list pos: None or list of pos tags
      :param int n: max candidates for each word to be substituted
      :return list: list of list
  
      """
      source_legal_words = [
          words[0][index] for index in legal_indices[0]
      ]
      target_legal_words = [
          words[1][index] for index in legal_indices[1]
      ]
      source_legal_words_pos = (
          [pos[0][index] for index in legal_indices[0]]
          if self.get_pos
          else None
      )
      target_legal_words_pos = (
          [pos[1][index] for index in legal_indices[1]]
          if self.get_pos
          else None
      )
  
      candidates_list = []
      candidates_indices = []
  
      last_target_index = 0
      for index, word in enumerate(source_legal_words):
          _source_pos = (
              source_legal_words_pos[index] if self.get_pos else None
          )
          _target_pos = (
              target_legal_words_pos[index] if self.get_pos else None
          )
          candidates, target_index = self._get_candidates(
              word,
              (target_legal_words, legal_indices[1], last_target_index),
              pos=_source_pos,
              n=n,
          )
          # filter no word without candidates
          if candidates and target_index:
              candidates_indices.append(
                  [legal_indices[0][index], target_index]
              )
              candidates_list.append(candidates)
              last_target_index = target_index + 1
      return candidates_list, candidates_indices
  
file_path: textflint/textflint/generation/transformation/NMT/parallel_word_substitute.py
imports: from abc import abstractmethod
  from ..word_substitute import WordSubstitute
  from ....common.utils.error import FlintError
  from ....common.utils import logger
  from ....common.utils.list_op import trade_off_sub_words
label_desc: Use image node_id 5 for calling the ParallelWordSubstitute obj's underlying member method code with example usage: obj._get_substitute_words(words, legal_indices, pos, n) and returns: candidates_list,  candidates_indices