class_docstr: Transforms an input by replacing its words with synonyms in the word
  embedding space.
  
  Args:
      max_candidates (int): maximum number of synonyms to pick
      embedding (textattack.shared.AbstractWordEmbedding): Wrapper for word embedding
  >>> from textattack.transformations import WordSwapEmbedding
  >>> from textattack.augmentation import Augmenter
  
  >>> transformation = WordSwapEmbedding()
  >>> augmenter = Augmenter(transformation=transformation)
  >>> s = 'I am fabulous.'
  >>> augmenter.augment(s)
docstr: Returns a list of possible 'candidate words' to replace a word in a
  sentence or phrase.
  
  Based on nearest neighbors selected word embeddings.
docstr_tok: ["Returns","a","list","of","possible","'candidate","words","'","to","replace","a","word","in","a","sentence","or","phrase",".","Based","on","nearest","neighbors","selected","word","embeddings","."]
code: def _get_replacement_words(self, word):
      """Returns a list of possible 'candidate words' to replace a word in a
      sentence or phrase.
  
      Based on nearest neighbors selected word embeddings.
      """
      try:
          word_id = self.embedding.word2index(word.lower())
          nnids = self.embedding.nearest_neighbours(
              word_id, self.max_candidates
          )
          candidate_words = []
          for i, nbr_id in enumerate(nnids):
              nbr_word = self.embedding.index2word(nbr_id)
              candidate_words.append(recover_word_case(nbr_word, word))
          return candidate_words
      except KeyError:
          # This word is not in our word embedding database, so return an empty list.
          return []
  
file_path: TextAttack/textattack/transformations/word_swaps/word_swap_embedding.py
imports: from textattack.shared import AbstractWordEmbedding, WordEmbedding
  from .word_swap import WordSwap
label_desc: Use image node_id 2 for calling the WordSwapEmbedding obj's underlying member method code with example usage: obj._get_replacement_words(word) and returns: candidate_words, list