How to automate sentiment analysis (plus the best sentiment analysis tools)

Get data for sentiment analysis and learn how to automate the process with AI tools.

Doing sentiment analysis on a regular basis means diving into tons of data sheets, except when you automate it. Here, you’ll learn about the tools that help you get data for sentiment analysis and how to automate the process with AI tools.

Where to get sentiment analysis data

For sentiment analysis, you need data from platforms where people express opinions or emotions. Common sources include social media platforms such as Instagram, TikTok, Facebook, and YouTube, as well as e-commerce and Google reviews.

The easiest way to collect data from such platforms is with web automation tools. Apify Store has ready-made solutions (Actors) for automating data collection from these sources, which we include below.

The following Actors extract comments for sentiment analysis:

Here’s an example of output (text from post comments) using TikTok Comments Scraper:

TikTok data for sentiment analysis
💡
Find other scrapers that will help you with sentiment analysis

These are Actors that will get you posts that you can further analyze for sentiment:

Another way to get unique data to analyze your customers' sentiment is through Google Maps. Google Maps Reviews Scraper will help you with that.

The best tools for automating sentiment analysis

1. LLMs for data post-processing

Once you have your data, you need to process it. Doing this manually involves reviewing comments or posts in sheets and categorizing them one by one. While effective for small datasets, it’s time-consuming and inefficient for larger projects. A faster method is with AI tools, like large language models.

You can use LLMs like ChatGPT or Claude with prompts for sentiment analysis. Example:

You’re a skilled sentiment analyzer. Evaluate these posts as “neutral,” “negative,” or “positive.”

While speed is a benefit of this approach, it isn’t free of frustrations. Here are a couple of important limitations:

  • Preprocessing requirements: To make the data suitable for LLMs, it often needs to be preprocessed into structured formats like cleaned text or categorized inputs. This step is necessary because LLMs aren’t great at handling raw, unstructured data effectively.
  • Dataset limitations: Free or lower-tier versions of LLMs may not perform well with large datasets because of token restrictions or processing limitations, so they’re not exactly the most scalable option for extensive sentiment analysis tasks.

2. Sentiment Analysis Online Tool

A more structured and scalable alternative to LLMs for post-processing is an Actor called Sentiment Analysis Online Tool, particularly efficient if you’re dealing with large datasets or need consistent scoring.

💡
Benefits
  • Easy input handling: You can input data in bulk or JSON format, which streamlines the process for structured and large datasets. LLMs often require preprocessing to ensure data fits within their prompt limits, which can be time-intensive and complex for larger datasets.
  • Standardized scoring and classification: It provides numerical sentiment scores ranging from 0 to 1 alongside categorical sentiment classifications (e.g., positive, neutral, or negative). In contrast, LLMs rely on text-based prompts and may lack consistent scoring unless explicitly instructed, which can lead to subjective or inconsistent results.
  • Automation and repeatability: With this tool, sentiment analysis is automated and repeatable for similar datasets. LLMs often require re-prompting and manual adjustments to achieve uniform results across multiple analyses, which adds an extra layer of effort.
  • Cost efficiency for large data: Free or lower-tier versions of LLMs struggle with extensive datasets due to token limits and require chunking data into smaller pieces. Sentiment Analysis Online Tool is optimized for bulk processing without those challenges.
💡
How it works
  1. Go to Sentiment Analysis Online Tool on Apify Store and click Try for free. Sign in to your Apify account or sign up for a free plan.
  2. In your dashboard (Apify Console), enter or paste the text you want to analyze.
  3. Click Run to start the text analysis.
  4. View the sentiment classification and confidence score in the Dataset tab.
  5. Download, export with an API, or integrate your results into other apps.
▶️
Input example
Sentiment Analysis Online Tool - Input
◀️
Output example
Sentiment Analysis Online Tool -Output

3. Social Media Sentiment Analysis Tool

With Social Media Sentiment Analysis Tool, you can automate both data collection (from social media platforms) and data processing for sentiment analysis.

Just fill in somebody’s name, and the Actor will scrape posts from their accounts on Facebook, Instagram, and TikTok.

💡
How it works
  1. Go to Social Media Sentiment Analysis Tool on Apify Store and click Try for free. Sign in to your Apify account or sign up for a free plan.
  2. In your dashboard (Apify Console), enter the social profile name you want to scrape, e.g., Arnold Schwarzenegger.
  3. Choose the number of posts and comments you want analyzed.
  4. Choose which platforms you want scraped (TikTok, Facebook, Instagram).
  5. Click Start and wait for scraping and analysis to be completed.
  6. Preview your data in the Output tab.
  7. Export structured data from the Storage tab in JSON, XML, CSV, Excel, HTML, or via an API.
▶️
Input example
Social Media Sentiment Analysis Tool - Input
◀️
Output example
Social Media Sentiment Analysis Tool - Output

4. LLM Dataset Processor

LLM Dataset Processor is an Actor that lets you process the output of other Actors or stored datasets with a single LLM prompt. It's great for enriching data, summarizing content, extracting specific information, or manipulating data in a structured way using AI.

💡
Key features
  • Customizable prompts with placeholders: Users can craft prompts that incorporate placeholders corresponding to dataset columns. For instance, with a dataset containing title and content columns, placeholders like ${title}and ${content} can be used within the prompt to dynamically insert the respective data for each entry.
  • Integration capabilities: It functions both as a standalone Actor and as part of an Actor-to-Actor integration, which provides a streamlined workflow within the Apify platform.
  • Support for multiple LLM providers: LLM Dataset Processor is compatible with various LLM providers, including OpenAI, Anthropic, and Google, offering a range of models such as GPT-4o, Claude 3.5, and Gemini 1.5.

How to use LLM Dataset Processor for sentiment analysis

Step 1. Open the Integration tab for your desired Actor

TikTok Comments Scraper - Integration

Step 2. Connect Actor

Click on Connect Actor or Task and search for LLM Dataset Processor.

Actor-to-Actor integration

Set LLM Dataset Processor as an integration.

TikTok Comments Scraper - LLM Dataset Processor integration

Step 3. Fill in the input schema

LLM Dataset Processor - Input
  • Select your dataset: Leave the Input Dataset ID free - the ID from the run of the Actor you’re connecting will be used automatically.
  • Choose an LLM: Pick a model from supported providers, such as OpenAI (GPT-4o, GPT-4o-mini), Anthropic (Claude 3.5 Haiku, Sonnet, or Opus), or Google (Gemini 1.5 variants). For cost-effective options, use GPT-4o-mini or Claude 3.5 Haiku.
  • Provide API token: Make sure you have an API token for your chosen LLM provider.
  • Craft your prompt: Write a prompt with placeholders matching your dataset's column names (e.g., ${title}${content}). For nested fields, use dot notation (e.g., ${metadata.title}).

Here’s a prompt that can be used for inspiration:

👨‍💻
Take a look at this comment (here it is: {{text}} ) and do a sentiment analysis - write \"positive\" \"negative\" or \"neutral\" in a new column called "Analysis”

Note: “{{text}} “ is the name of the column from the input (in this case, where TikTok comments are held).

Step 4. Define output format

  • Single-column output: The processed responses will be stored in a new column named llmresponse. Use this format for straightforward tasks like sentiment analysis or translation.
  • Multi-column output: The responses will be stored across multiple columns in JSON format. Ensure your prompt specifies the desired column names and structure.

Step 5. Test your prompt

Enable Test Prompt Mode to verify the output structure. If the structure doesn’t match expectations, adjust the prompt to be more specific. For example, include exact field names in a JSON format or provide detailed column descriptions.

Step 6. Run the Actor

Start processing your dataset. The Actor will replace placeholders in your prompt with actual dataset values for each item and send the requests to the LLM.

◀️
Output example
LLM Dataset Processor - Output
Apify logo
Tools for sentiment analysis
Choose from thousands of Actors on Apify Store
Sign up for free

Summary

Sentiment analysis becomes manageable with the right tools. Those listed above and the guides on how to use them will help you source sentiment data, automate your processes, and make data collection and analysis easier.

On this page

Build the scraper you want

No credit card required

Start building