def METHOD_NAME(self, current_text, indices_to_modify):
    """Get replacement words for the word we want to replace using BAE
    method.
    Args:
        current_text (AttackedText): Text we want to get replacements for.
        indices_to_modify (list[int]): list of word indices where we want to insert
    """
    masked_texts = []
    for index in indices_to_modify:
        masked_text = current_text.insert_text_before_word_index(
            index, self._lm_tokenizer.mask_token
        )
        # Obtain window
        masked_text = masked_text.text_window_around_index(index, self.window_size)
        masked_texts.append(masked_text)
    i = 0
    # 2-D list where for each index to modify we have a list of replacement words
    new_words = []
    while i < len(masked_texts):
        inputs = self._encode_text(masked_texts[i : i + self.batch_size])
        ids = inputs["input_ids"].tolist()
        with torch.no_grad():
            preds = self._language_model(**inputs)[0]
        for j in range(len(ids)):
            try:
                # Need try-except b/c mask-token located past max_length might be truncated by tokenizer
                masked_index = ids[j].index(self._lm_tokenizer.mask_token_id)
            except ValueError:
                new_words.append([])
                continue
            mask_token_logits = preds[j, masked_index]
            mask_token_probs = torch.softmax(mask_token_logits, dim=0)
            ranked_indices = torch.argsort(mask_token_probs, descending=True)
            top_words = []
            for _id in ranked_indices:
                _id = _id.item()
                word = self._lm_tokenizer.convert_ids_to_tokens(_id)
                if utils.check_if_subword(
                    word,
                    self._language_model.config.model_type,
                    (masked_index == 1),
                ):
                    word = utils.strip_BPE_artifacts(
                        word, self._language_model.config.model_type
                    )
                if (
                    mask_token_probs[_id] >= self.min_confidence
                    and utils.is_one_word(word)
                    and not utils.check_if_punctuations(word)
                ):
                    top_words.append(word)
                if (
                    len(top_words) >= self.max_candidates
                    or mask_token_probs[_id] < self.min_confidence
                ):
                    break
            new_words.append(top_words)
        i += self.batch_size
    return new_words