class_docstr: An class that supply methods for ABSA task data transformation.
docstr: Reverse the polarity of original opinion and return the new
  transformed opinion words.
  
  :param list trans_words: tokenized words of transformed sentence
  :param list trans_opinion_words: transformed opinion words
  :param int opinion_from: start index of opinion
  :param int opinion_to: end index of opinion
  :param bool has_neg: whether exist negation in transformed sentence
docstr_tok: ["Reverse","the","polarity","of","original","opinion","and","return","the","new","transformed","opinion","words",".",":","param","list","trans_words",":","tokenized","words","of","transformed","sentence",":","param","list","trans_opinion_words",":","transformed","opinion","words",":","param","int","opinion_from",":","start","index","of","opinion",":","param","int","opinion_to",":","end","index","of","opinion",":","param","bool","has_neg",":","whether","exist","negation","in","transformed","sentence"]
code: def reverse_opinion(
      self,
      trans_words,
      trans_opinion_words,
      opinion_from,
      opinion_to,
      has_neg,
  ):
      r"""
      Reverse the polarity of original opinion and return the new
      transformed opinion words.
  
      :param list trans_words: tokenized words of transformed sentence
      :param list trans_opinion_words: transformed opinion words
      :param int opinion_from: start index of opinion
      :param int opinion_to: end index of opinion
      :param bool has_neg: whether exist negation in transformed sentence
      """
      opinion_list = trans_words[opinion_from:opinion_to]
      opinion_words = trans_words[opinion_from:opinion_to]
      opi = opinion_list[0]
      trans_opinion_word = None
      from_to = []
  
      if has_neg and [opinion_from, opinion_to] not in from_to:
          trans_opinion_word = [
              opinion_from,
              opinion_to,
              self.untokenize(opinion_words),
          ]
      elif [opinion_from, opinion_to] not in from_to:
          opi_pos = self.get_postag(
              trans_words, opinion_from, opinion_to
          )
          antonyms = self.get_antonyms(opi_pos)[0]
          candidate = set()
          for antonym in antonyms:
              for ant_word in antonym.lemma_names(lang="eng"):
                  if (ant_word != opi) and ("_" not in ant_word):
                      candidate.add(ant_word)
  
          refined_candidate = self.refine_candidate(
              trans_words, opinion_from, opinion_to, candidate
          )
          if len(refined_candidate) == 0:
              trans_opinion_word = [
                  opinion_from,
                  opinion_to,
                  self.untokenize(["not", opi]),
              ]
          else:
              select = random.randint(0, len(refined_candidate) - 1)
              trans_opinion_word = [
                  opinion_from,
                  opinion_to,
                  self.untokenize([refined_candidate[select]]),
              ]
      if trans_opinion_word is not None:
          trans_opinion_words.append(trans_opinion_word)
          from_to.append([opinion_from, opinion_to])
          trans_words[opinion_from:opinion_to] = [trans_opinion_word[2]]
  
      return trans_words, trans_opinion_words
  
imports: import random
  from abc import ABC
  from copy import deepcopy
  from ..transformation import Transformation
  from ....common.settings import NEGATIVE_WORDS_LIST, DEGREE_WORD_LIST
label_desc: Use image node_id 13 for calling the ABSATransformation obj's underlying member method code with example usage: obj.reverse_opinion(trans_words, trans_opinion_words, opinion_from, opinion_to, has_neg) and returns: trans_words,  trans_opinion_words