class_docstr: An class that supply methods for ABSA task data transformation.
docstr: Reverse the polarity of opinions.
  
  :param list words_list: tokenized words of original sentence
  :param list opinion_position: opinion position
  :return: transformed sentence and transformed opinion words
docstr_tok: ["Reverse","the","polarity","of","opinions",".",":","param","list","words_list",":","tokenized","words","of","original","sentence",":","param","list","opinion_position",":","opinion","position",":","return",":","transformed","sentence","and","transformed","opinion","words"]
code: def reverse(self, words_list, opinion_position):
      r"""
      Reverse the polarity of opinions.
  
      :param list words_list: tokenized words of original sentence
      :param list opinion_position: opinion position
      :return: transformed sentence and transformed opinion words
      """
      trans_words = deepcopy(words_list)
      trans_opinion_words = []
  
      for position in opinion_position:
          opinion_from = position[0]
          opinion_to = position[1]
          opinion_list = trans_words[opinion_from:opinion_to]
          (
              trans_words,
              opinion_words,
              opinion_from,
              opinion_to,
              has_neg,
          ) = self.check_negation(trans_words, opinion_from, opinion_to)
          if len(opinion_list) == 1:
              trans_words, trans_opinion_words = self.reverse_opinion(
                  trans_words,
                  trans_opinion_words,
                  opinion_from,
                  opinion_to,
                  has_neg,
              )
          elif len(opinion_list) > 1:
              if has_neg:
                  trans_opinion_words.append(
                      [
                          opinion_from,
                          opinion_to,
                          self.untokenize(opinion_words),
                      ]
                  )
              else:
                  # negate the closest verb
                  trans_opinion_words.append(
                      [
                          opinion_from,
                          opinion_to,
                          self.untokenize(
                              ["not " + opinion_words[0]]
                              + opinion_words[1:]
                          ),
                      ]
                  )
                  trans_words[opinion_from : opinion_from + 1] = [
                      "not " + opinion_words[0]
                  ]
  
      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 2 for calling the ABSATransformation obj's underlying member method code with example usage: obj.reverse(words_list, opinion_position) and returns: trans_words,  trans_opinion_words