# Sentiment and Topics Text Classifier (`lofomachines/sentiment-and-topics-text-classifier`) Actor

Super Fast - Classify texts using AI. Paste texts in bulk, define your labels, Sentiment, and get classified results as a dataset. Use it to make text classifications on Tweets, Reviews, and more.

- **URL**: https://apify.com/lofomachines/sentiment-and-topics-text-classifier.md
- **Developed by:** [Lofomachines](https://apify.com/lofomachines) (community)
- **Categories:** AI, Agents, Automation
- **Stats:** 16 total users, 0 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

<h1 align="center">AI Text Classifier - Intelligent Content Categorization</h1>

<p align="center">

<b>Classify any text using AI with custom labels. Perfect for sentiment analysis, content moderation, customer support automation, and more.</b>

</p>

<p align="center">

<a href="#features">Features</a> •

<a href="#use-cases">Use Cases</a> •

<a href="#label-presets">Label Presets</a> •

<a href="#input-configuration">Input</a> •

<a href="#output">Output</a> •

<a href="#cost-of-usage">Cost of Usage</a>

</p>

***

<p>

This actor automatically classifies any text into predefined categories using advanced AI technology. Simply paste your texts, choose a classification preset or define custom labels, and get instant, accurate categorization results. Perfect for automating content analysis, customer support routing, sentiment tracking, and data organization at scale.

</p>

<h2 id="features">✨ Key Features</h2>

- 🤖 **AI-Powered Classification**: Advanced AI technology ensures accurate and consistent text categorization.

- 🚀 **High Performance**: Processes multiple texts in parallel for fast bulk classification.

- 🏷️ **6 Ready-to-Use Presets**: Choose from sentiment analysis, mobile app reviews, customer support, e-commerce reviews, content moderation, and social media categorization.

- ✏️ **Custom Labels**: Define any classification categories you need for your specific use case.

- 📊 **Detailed Results**: Get classification results with status tracking and error handling.

- 💼 **Enterprise Ready**: Handles large volumes of text with automatic error recovery and retry logic.

- 🎯 **Flexible Input**: Paste texts directly in bulk format - one per line.

- 📈 **Real-time Processing**: Results are pushed to dataset as they're processed for immediate access.

<h2 id="use-cases">🎯 Use Cases</h2>

| Use Case | Description |
| :--- | :--- |
| **Sentiment Analysis** | Analyze customer reviews, social media posts, survey responses, and feedback to understand customer sentiment. |
| **Content Moderation** | Automatically categorize user-generated content to identify spam, harassment, inappropriate content, and flag items for review. |
| **Customer Support Automation** | Auto-categorize support tickets by type (question, complaint, technical issue, billing) to route them to the right team. |
| **E-commerce Reviews** | Classify product reviews by topic (quality, shipping, price, customer service) to identify trends and improvement areas. |
| **Mobile App Reviews** | Categorize app store reviews by UX, UI, bugs, feature requests, and performance issues for product development insights. |
| **Social Media Monitoring** | Classify social media posts by engagement type, topic, and sentiment for brand monitoring and marketing analysis. |
| **Lead Scoring** | Classify sales inquiries by intent and priority to prioritize high-value leads. |
| **Market Research** | Analyze open-ended survey responses and categorize feedback for actionable insights. |

***

<h2 id="label-presets">🏷️ Label Presets Reference</h2>

When you select a preset, the following labels are automatically applied. You can also override any preset with custom labels using the "Custom Labels Override" field.

<h3>1. Sentiment</h3>

Perfect for analyzing customer sentiment across reviews, feedback, and social media posts.

- **Sentiment Positive**
- **Sentiment Neutral**
- **Sentiment Negative**

<h3>2. Mobile App Reviews</h3>

Comprehensive categorization for app store reviews and mobile application feedback.

- **UX** - User experience issues and feedback
- **UI** - User interface design feedback
- **Feature Request** - Requests for new features
- **Bug Report** - Technical bugs and errors
- **Performance** - Speed, responsiveness, and optimization issues
- **Security** - Security concerns and vulnerabilities
- **Content** - Content quality and relevance
- **Pricing** - Pricing and subscription feedback
- **Support** - Customer support experiences
- **Onboarding** - First-time user experience
- **Navigation** - App navigation and menu structure
- **Search** - Search functionality and results
- **Notifications** - Push notification preferences and issues
- **Compatibility** - Device and OS compatibility issues
- **Other** - Miscellaneous feedback

<h3>3. Customer Support</h3>

Ideal for automating support ticket routing and categorization.

- **Question** - General inquiries
- **Complaint** - Customer complaints
- **Suggestion** - Feature or service suggestions
- **Praise** - Positive feedback and compliments
- **Technical Issue** - Technical problems requiring IT support
- **Billing** - Payment and billing questions
- **Refund** - Refund requests
- **Account** - Account management issues
- **Product Inquiry** - Questions about products or services
- **Feature Request** - Requests for new features
- **Bug Report** - Software bugs and errors
- **Feedback** - General feedback
- **Escalation** - Issues requiring escalation
- **Follow-up** - Follow-up on previous interactions
- **Other** - Miscellaneous support requests

<h3>4. E-commerce Reviews</h3>

Comprehensive categorization for product reviews and e-commerce feedback.

- **Product Quality** - Quality assessment of products
- **Shipping** - Shipping experience and delivery
- **Price** - Pricing feedback and value perception
- **Customer Service** - Customer service experience
- **Packaging** - Product packaging quality
- **Delivery Speed** - Speed of delivery
- **Product Description** - Accuracy of product descriptions
- **Return Process** - Return and refund process experience
- **Website Experience** - Online shopping experience
- **Payment** - Payment process and security
- **Discount** - Discount codes and promotions
- **Recommendation** - Product recommendations
- **Comparison** - Comparisons with other products
- **Durability** - Product longevity and durability
- **Other** - Miscellaneous review topics

<h3>5. Content Moderation</h3>

Essential for automated content moderation and safety monitoring.

- **Spam** - Spam content
- **Harassment** - Harassing or bullying content
- **Hate Speech** - Hateful or discriminatory content
- **Violence** - Violent or threatening content
- **Adult Content** - Adult or explicit content
- **Copyright** - Copyright infringement concerns
- **Misinformation** - False or misleading information
- **Off-topic** - Content not relevant to the context
- **Appropriate** - Content that is appropriate
- **Inappropriate** - Content that is inappropriate
- **Needs Review** - Content requiring manual review
- **Approved** - Content that has been approved
- **Rejected** - Content that has been rejected
- **Flagged** - Content that has been flagged for review
- **Other** - Other moderation categories

<h3>6. Social Media</h3>

Perfect for social media monitoring and engagement analysis.

- **Engagement** - High engagement content
- **Trending** - Trending topics and content
- **Viral** - Viral or highly shared content
- **Controversial** - Controversial or divisive content
- **Educational** - Educational or informative content
- **Entertainment** - Entertainment-focused content
- **News** - News and current events
- **Opinion** - Opinion pieces and commentary
- **Personal** - Personal updates and stories
- **Promotional** - Promotional or marketing content
- **Question** - Questions and inquiries
- **Answer** - Answers and responses
- **Complaint** - Complaints and negative feedback
- **Praise** - Positive feedback and compliments
- **Other** - Other social media content types

***

<h2 id="input-configuration">📥 Input Configuration</h2>

The Actor expects a JSON input defining the texts to classify and classification settings.

#### Example Input

```json

{

  "bulkTexts": "I absolutely love this product!\nThe service was terrible.\nIt works as expected.",

  "labelPreset": "sentiment",

  "labels": ""

}

```

#### Input Parameters

| Parameter | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| **bulkTexts** | String | ✅ Yes | - | Paste your texts here, one per line. Each line will be classified separately. Supports any number of texts. |
| **labelPreset** | String | ❌ No | `"sentiment"` | Select a classification preset. Options: `sentiment`, `mobile_app_reviews`, `customer_support`, `ecommerce_reviews`, `content_moderation`, `social_media`. See the [Label Presets](#label-presets) section for complete label lists. |
| **labels** | String | ❌ No | `""` | **Custom Labels Override**: Leave empty to use preset labels automatically. Fill this field only if you want to override the preset with your own custom labels (comma-separated). Example: `"Technology, Business, Sports, Entertainment, Politics"`. |

#### How Presets Work

1. **If you select a preset** (e.g., "Sentiment"): The preset labels are automatically applied, even if the "Custom Labels Override" field appears empty.

2. **If you fill "Custom Labels Override"**: Your custom labels will override the preset. Use comma-separated format: `"Label1, Label2, Label3"`.

3. **If no preset is selected and no custom labels**: The actor defaults to the "Sentiment" preset.

***

<h2 id="output">📤 Output</h2>

The Actor outputs a dataset with classification results for each text. Results are pushed in real-time as they're processed.

#### Output Fields

| Field | Type | Description |
| :--- | :--- | :--- |
| **index** | Integer | Sequential number of the text (1, 2, 3, ...) |
| **text** | String | Original text that was classified |
| **classification** | String | The assigned classification label (or `null` if classification failed) |
| **status** | String | Classification status: `"success"` or `"error"` |
| **error** | String | Error message if classification failed (or `null` if successful) |

#### Example Output

```json

[

  {

    "index": 1,

    "text": "I absolutely love this product!",

    "classification": "Sentiment Positive",

    "status": "success",

    "error": null

  },

  {

    "index": 2,

    "text": "The service was terrible.",

    "classification": "Sentiment Negative",

    "status": "success",

    "error": null

  },

  {

    "index": 3,

    "text": "It works as expected.",

    "classification": "Sentiment Neutral",

    "status": "success",

    "error": null

  }

]

```

#### Dataset Views

The output dataset includes three pre-configured views:

- **Overview**: All classification results with index, text, classification, and status.

- **Successful Classifications**: Only successfully classified texts with their assigned labels.

- **Errors**: Failed classifications with error messages for troubleshooting.

***

# Actor input Schema

## `texts` (type: `array`):

Add texts to classify. You can add them one by one, use 'Bulk edit' to paste multiple texts, or upload a .txt file using 'Text file'. Each text will be classified separately.

## `labelPreset` (type: `string`):

Select a classification preset. See the README for the complete list of labels included in each preset.

## `labels` (type: `string`):

Leave empty to use preset labels automatically. Fill this field only if you want to override the preset with your own custom labels (comma-separated). Check the README for preset labels reference.

## Actor input object example

```json
{
  "texts": [
    "Just tried the new update and I'm absolutely loving it! The interface is so much cleaner now. 🎉",
    "The app keeps crashing on my phone. Very frustrating experience.",
    "It's okay, nothing special. Does what it's supposed to do.",
    "This is the best app I've ever used! Worth every penny.",
    "The customer service was terrible. No one responded to my emails.",
    "Pretty average app. Not bad, but nothing to write home about."
  ],
  "labelPreset": "sentiment",
  "labels": "Sentiment Positive, Sentiment Neutral, Sentiment Negative"
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `rawData` (type: `string`):

No description

## `successful` (type: `string`):

No description

## `errors` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "texts": [
        "Just tried the new update and I'm absolutely loving it! The interface is so much cleaner now. 🎉",
        "The app keeps crashing on my phone. Very frustrating experience.",
        "It's okay, nothing special. Does what it's supposed to do.",
        "This is the best app I've ever used! Worth every penny.",
        "The customer service was terrible. No one responded to my emails.",
        "Pretty average app. Not bad, but nothing to write home about."
    ],
    "labels": "Sentiment Positive, Sentiment Neutral, Sentiment Negative"
};

// Run the Actor and wait for it to finish
const run = await client.actor("lofomachines/sentiment-and-topics-text-classifier").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "texts": [
        "Just tried the new update and I'm absolutely loving it! The interface is so much cleaner now. 🎉",
        "The app keeps crashing on my phone. Very frustrating experience.",
        "It's okay, nothing special. Does what it's supposed to do.",
        "This is the best app I've ever used! Worth every penny.",
        "The customer service was terrible. No one responded to my emails.",
        "Pretty average app. Not bad, but nothing to write home about.",
    ],
    "labels": "Sentiment Positive, Sentiment Neutral, Sentiment Negative",
}

# Run the Actor and wait for it to finish
run = client.actor("lofomachines/sentiment-and-topics-text-classifier").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "texts": [
    "Just tried the new update and I'\''m absolutely loving it! The interface is so much cleaner now. 🎉",
    "The app keeps crashing on my phone. Very frustrating experience.",
    "It'\''s okay, nothing special. Does what it'\''s supposed to do.",
    "This is the best app I'\''ve ever used! Worth every penny.",
    "The customer service was terrible. No one responded to my emails.",
    "Pretty average app. Not bad, but nothing to write home about."
  ],
  "labels": "Sentiment Positive, Sentiment Neutral, Sentiment Negative"
}' |
apify call lofomachines/sentiment-and-topics-text-classifier --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=lofomachines/sentiment-and-topics-text-classifier",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ofec6V79clescxzlJ/builds/t5bml4mufV1RW8mVN/openapi.json
