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: Inits SentimentInference with given aspect and opinion lexicons.
docstr_tok: ["Inits","SentimentInference","with","given","aspect","and","opinion","lexicons","."]
code: def __init__(
      self,
      aspect_lex: Union[str, PathLike],
      opinion_lex: Union[str, PathLike, dict],
      parse: bool = True,
      parser="spacy",
      spacy_model="en_core_web_sm",
  ):
      """Inits SentimentInference with given aspect and opinion lexicons."""
      INFERENCE_OUT.mkdir(parents=True, exist_ok=True)
      self.opinion_lex = (
          opinion_lex
          if type(opinion_lex) is dict
          else load_opinion_lex(Path(opinion_lex))
      )
      self.aspect_lex = _load_aspect_lexicon(Path(aspect_lex))
      self.intensifier_lex = _read_lexicon_from_csv(
          "IntensifiersLex.csv"
      )
      self.negation_lex = _read_lexicon_from_csv("NegationSentLex.csv")
      self.parser_name = parser
  
      if parse:
          if parser == "bist":
              from nlp_architect.pipelines.spacy_bist import (
                  SpacyBISTParser,
              )
  
              self.parser = SpacyBISTParser(spacy_model=spacy_model)
          elif parser == "spacy":
              from nlp_architect.utils.text import SpacyInstance
  
              disable = [
                  "merge_noun_chunks",
                  "ner",
                  "entity_linker",
                  "textcat",
                  "entity_ruler",
                  "sentencizer",
                  "merge_entities",
              ]
              self.parser = SpacyInstance(
                  model=spacy_model,
                  disable=disable,
                  ptb_pos=True,
                  n_jobs=1,
              )
      else:
          self.parser = None
  
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 1 to create a new SentimentInference object  with example: obj = SentimentInference(aspect_lex, opinion_lex, parse, parser, spacy_model)