class_docstr: Main class for executing Sentiment Solution pipeline.
  
  Args:
      anonymiser (Anonymiser, optional): Method to anonymise events' text.
      max_events (int, optional): Maximum number of events to show for each aspect-polarity pair.
class_docstr_tok: ["Main","class","for","executing","Sentiment","Solution","pipeline",".","Args",":","anonymiser","(","Anonymiser",",","optional",")",":","Method","to","anonymise","events","'","text",".","max_events","(","int",",","optional",")",":","Maximum","number","of","events","to","show","for","each","aspect-polarity","pair","."]
code: def run(
      self,
      aspect_lex: PathLike = None,
      opinion_lex: PathLike = None,
      data: PathLike = None,
      parsed_data: PathLike = None,
      inference_results: PathLike = None,
  ) -> Optional[pd.DataFrame]:
      opinions = load_opinion_lex(opinion_lex)
      if not opinions:
          raise ValueError("Empty opinion lexicon!")
      aspects = pd.read_csv(aspect_lex, header=None, encoding="utf-8")[
          0
      ]
      if aspects.empty:
          raise ValueError("Empty aspect lexicon!")
      if inference_results:
          with open(inference_results, encoding="utf-8") as f:
              results = json.loads(
                  f.read(), object_hook=SentimentDoc.decoder
              )
      elif data or parsed_data:
          inference = SentimentInference(aspect_lex, opinions)
          parsed = parsed_data is not None
          results = {}
          print(
              "Running inference on data files... (Iterating data files)"
          )
          data_source = parsed_data if parsed_data else data
          for file, doc in self._iterate_docs(data_source):
              parsed_doc = (
                  inference.parser.parse([doc])[0]
                  if not parsed
                  else json.loads(doc, object_hook=CoreNLPDoc.decoder)
              )
              sentiment_doc = inference.run(parsed_doc=parsed_doc)
              if sentiment_doc:
                  results[file] = sentiment_doc
  
          with open(
              SENTIMENT_OUT / "inference_results.json",
              "w",
              encoding="utf-8",
          ) as f:
              json.dump(
                  results,
                  f,
                  cls=SentimentDocEncoder,
                  indent=4,
                  sort_keys=True,
              )
      else:
          print(
              "No input given. Please supply one of: "
              "data directory, parsed data directory, or inference results."
          )
          return None
  
      print("\nComputing statistics...")
      stats = self._compute_stats(results, aspects, opinions)
      print("Done.")
      return stats
  
imports: import argparse
  import json
  from os import PathLike
  from os.path import isdir
  from typing import Optional
  import csv
  import re
  from abc import abstractmethod
  import numpy
  import pandas
  from tqdm import tqdm
  from nlp_architect import LIBRARY_OUT
  from nlp_architect.common.core_nlp_doc import CoreNLPDoc
  from nlp_architect.models.absa.inference.data_types import TermType, SentimentDocEncoder, SentimentDoc, SentimentSentence
  from nlp_architect.models.absa.inference.inference import SentimentInference
  from nlp_architect.models.absa.utils import load_opinion_lex
  from nlp_architect.utils.io import walk_directory, validate_existing_filepath, validate_existing_directory, validate_existing_path, line_count
label_desc: Use image node_id 2 for calling the SentimentSolution obj's underlying member method code with example usage: obj.run(aspect_lex, opinion_lex, data, parsed_data, inference_results) and returns: stats, None