How to use ChatGPT for sentiment analysis

August 29, 2023

The challenge many organizations face is understanding sentiment, summaries, and classifications in large amounts of textual data. This data may be related to product feedback, service desk tickets, or even IOT device alerts.

In this example, we use a dataset containing 1500 movie reviews, ranging between 500 and 1000 words. We will show how Pyramid’s OpenAI integration can be used to perform sentiment analysis.

Here, we use a Pyramid Data Flow to read the data and apply a Python script to clean the reviews and remove any bad characters.

Next, we process each row of data through OpenAi’s API. The output of this results in 3 new columns created containing the sentiment, a summary of the review text, and a positivity score

Jumping to our dashboard, the user can select a movie which filters the reviews. We can see the overall positivity score and sentiment timeline, showing us the number of reviews split by positive, neutral, and negative classifications over time.

The summary section shows a consolidated view of positive, neutral, and negative reviews in a single paragraph of text. This uses Pyramid’s text aggregation and built-in ChatGPT functions.

This example highlights how Pyramid leverages its built-open AI integrations to deliver a robust text classification solution that correctly classifies sarcasm, irony, and negation.

Get the latest insights delivered to your inbox