class_docstr: ABSASample Class
class_docstr_tok: ["ABSASample","Class"]
docstr: Update the term_list of ABSASample.
  
  :param ABSAsample sample: updated sample
docstr_tok: ["Update","the","term_list","of","ABSASample",".",":","param","ABSAsample","sample",":","updated","sample"]
code: def update_term_list(self, sample):
      r"""
      Update the term_list of ABSASample.
  
      :param ABSAsample sample: updated sample
  
      """
      if not sample.is_legal():
          raise FlintError(
              "Term list {0} is not legal, "
              "aspect words or opinion words are "
              "in the wrong position.".format(sample.terms)
          )
      terms = sample.terms
  
      term_list = sample.term_list
      copy_sent = ABSASample.text_processor.tokenize(
          sample.sentence.text
      )
      trans_term_list = term_list
  
      for term_id in term_list:
          opinions_spans = terms[term_id]["opinion_position"]
  
          for i in range(len(opinions_spans)):
              position = opinions_spans[i]
              opinion_from = position[0]
              opinion_to = position[1]
              left = ABSASample.text_processor.inverse_tokenize(
                  copy_sent[:opinion_from]
              )
              if left != "":
                  left += " "
              opinion = ABSASample.text_processor.inverse_tokenize(
                  copy_sent[opinion_from:opinion_to]
              )
              terms[term_id]["opinion_words"][i] = opinion
              trans_term_list[term_id]["opinion_words"][i] = opinion
              trans_term_list[term_id]["opinion_position"][i] = [
                  len(left),
                  len(left) + len(opinion),
              ]
  
          term_from = terms[term_id]["from"]
          term_to = terms[term_id]["to"]
          left = ABSASample.text_processor.inverse_tokenize(
              copy_sent[:term_from]
          )
          if left != "":
              left += " "
          aspect = ABSASample.text_processor.inverse_tokenize(
              copy_sent[term_from:term_to]
          )
          terms[term_id]["term"] = aspect
          trans_term_list[term_id]["term"] = aspect
          trans_term_list[term_id]["id"] = term_id
          trans_term_list[term_id]["from"] = len(left)
          trans_term_list[term_id]["to"] = len(left) + len(aspect)
          trans_term_list[term_id]["polarity"] = terms[term_id][
              "polarity"
          ]
  
imports: from .sample import Sample
  from ..field import TextField
  from ....common.utils.error import FlintError
label_desc: Use image node_id 10 for calling the ABSASample obj's underlying member method code with example usage: obj.update_term_list(sample) without return types