class_docstr: Main class for sentiment inference execution.
  
  Attributes:
      opinion_lex: Opinion lexicon as outputted by TrainSentiment module.
      aspect_lex: Aspect lexicon as outputted by TrainSentiment module.
      intensifier_lex (dict): Pre-defined intensifier lexicon.
      negation_lex (dict): Pre-defined negation lexicon.
class_docstr_tok: ["Main","class","for","sentiment","inference","execution",".","Attributes",":","opinion_lex",":","Opinion","lexicon","as","outputted","by","TrainSentiment","module",".","aspect_lex",":","Aspect","lexicon","as","outputted","by","TrainSentiment","module",".","intensifier_lex","(","dict",")",":","Pre-defined","intensifier","lexicon",".","negation_lex","(","dict",")",":","Pre-defined","negation","lexicon","."]
docstr: Extract negation terms from sentence.
  
  Args:
      toks: Sentence text broken down to tokens (words).
      op_i: Index of opinion term in sentence.
      sentence: parsed sentence
  
  Returns:
      List of negation terms and its aggregated sign (positive or negative).
docstr_tok: ["Extract","negation","terms","from","sentence",".","Args",":","toks",":","Sentence","text","broken","down","to","tokens","(","words",")",".","op_i",":","Index","of","opinion","term","in","sentence",".","sentence",":","parsed","sentence","Returns",":","List","of","negation","terms","and","its","aggregated","sign","(","positive","or","negative",")","."]
code: def _extract_neg_terms(
      self, toks: list, op_i: int, sentence: list
  ) -> tuple:
      """Extract negation terms from sentence.
  
      Args:
          toks: Sentence text broken down to tokens (words).
          op_i: Index of opinion term in sentence.
          sentence: parsed sentence
  
      Returns:
          List of negation terms and its aggregated sign (positive or negative).
      """
      sign = 1
      terms = []
      gov_op_i = sentence[op_i]["gov"]
      dep_op_indices = [
          sentence.index(x) for x in sentence if x["gov"] == op_i
      ]
      for neg_i, negation in [
          (i, x) for i, x in enumerate(toks) if x in self.negation_lex
      ]:
          position = self.negation_lex[negation].position
          dist = op_i - neg_i
          before = position == "before" and (
              dist == 1 or neg_i in dep_op_indices
          )
          after = position == "after" and (
              dist == -1 or neg_i == gov_op_i
          )
          both = position == "both" and dist in (1, -1)
          if before or after or both:
              terms.append(
                  Term(
                      negation,
                      TermType.NEGATION,
                      Polarity.NEG,
                      self.negation_lex[negation].score,
                      sentence[toks.index(negation)]["start"],
                      sentence[toks.index(negation)]["len"],
                  )
              )
              sign *= self.negation_lex[negation].score
      return terms, sign
  
imports: import math
  from os import PathLike
  from pathlib import Path, PosixPath
  from typing import Union
  from nlp_architect.common.core_nlp_doc import CoreNLPDoc
  from nlp_architect.models.absa import INFERENCE_OUT
  from nlp_architect.models.absa.inference.data_types import Term, TermType, Polarity, SentimentDoc, SentimentSentence, LexiconElement
  from nlp_architect.models.absa.utils import _read_lexicon_from_csv, load_opinion_lex, _load_aspect_lexicon, parse_docs, parse_docs_bist, _load_parsed_docs_from_dir
  from tqdm import tqdm
label_desc: Use image node_id 6 for calling the SentimentInference obj's underlying member method code with example usage: obj._extract_neg_terms(toks, op_i, sentence) and returns: terms,  sign