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: Run SentimentInference on a single document.
  
  Returns:
      The sentiment annotated document, which contains the detected events per sentence.
docstr_tok: ["Run","SentimentInference","on","a","single","document",".","Returns",":","The","sentiment","annotated","document",",","which","contains","the","detected","events","per","sentence","."]
code: def run(
      self, doc: str = None, parsed_doc: CoreNLPDoc = None
  ) -> SentimentDoc:
      """Run SentimentInference on a single document.
  
      Returns:
          The sentiment annotated document, which contains the detected events per sentence.
      """
      if not parsed_doc:
          if not self.parser:
              raise RuntimeError(
                  "Parser not initialized (try parse=True at init)"
              )
          parsed_doc = self.parser.parse([doc])[0]
  
      sentiment_doc = None
      for sentence in parsed_doc.sentences:
          events = []
          scores = []
          for aspect_row in self.aspect_lex:
              _, asp_events = self._extract_event(aspect_row, sentence)
              for asp_event in asp_events:
                  events.append(asp_event)
                  scores += [
                      term.score
                      for term in asp_event
                      if term.type == TermType.ASPECT
                  ]
  
          if events:
              if not sentiment_doc:
                  sentiment_doc = SentimentDoc(parsed_doc.doc_text)
              sentiment_doc.sentences.append(
                  SentimentSentence(
                      sentence[0]["start"],
                      sentence[-1]["start"] + sentence[-1]["len"] - 1,
                      events,
                  )
              )
      return sentiment_doc
  
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 3 for calling the SentimentInference obj's underlying member method code with example usage: obj.run(doc, parsed_doc) and returns: sentiment_doc