sasctl.services.sentiment_analysis#

class sasctl._services.sentiment_analysis.SentimentAnalysis[source]#

Bases: Service

The Sentiment Analysis API is used to perform sentiment analysis on natural language text documents according to a prebuilt or user-defined model.

classmethod analyze_sentiment(documents, caslib=None, id_column=None, text_column=None, description=None, model=None, output_postfix=None, language='en')[source]#

Performs sentiment analysis on the input data.

Creates a setiment analysis task that executes asynchronously. There are two different interactions for sentiment analysis: analyzing documents in CAS tables and analyzing documents that are uploaded directly.

Parameters:
  • documents (str or dict or Iterable) – Documents to analyze. May be either the URI to a CAS table where the documents are currently stored, or an iterable of strings containing the documents’ text.

  • caslib (str or dict, optional) – URI of a caslib in which the documents will be stored. Required if documents is a list of strings.

  • id_column (str, optional) – The column in documents that contains a unique id for each document. Required if documents is a CAS table URI.

  • text_column (str, optional) – The column in documents that contains the document text to analyze. Required if documents is a CAS table URI.

  • description (str, optional) – Description to add to the sentiment analysis job.

  • model

  • output_postfix (str, optional) – Text to be added to the end of all output table names.

  • language (str, optional) – Two letter ISO 639-1 code indicating the source language. Defaults to ‘en’.

Returns:

RestObj – The submitted job