# VADER Sentiment Analyzer (`web.harvester/sentiment-analyzer`) Actor

Analyze text sentiment using VADER (Valence Aware Dictionary for Sentiment Reasoning). Fast, accurate sentiment analysis optimized for social media, reviews, and customer feedback. No GPU required.

- **URL**: https://apify.com/web.harvester/sentiment-analyzer.md
- **Developed by:** [Web Harvester](https://apify.com/web.harvester) (community)
- **Categories:** AI, Developer tools, Social media
- **Stats:** 5 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## VADER Sentiment Analyzer

> 😊😐😠 Analyze text sentiment instantly using VADER. Optimized for social media, product reviews, and customer feedback. No GPU required, runs on CPU in milliseconds.

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-blue)](https://apify.com)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

### 🎯 What This Actor Does

[VADER](https://github.com/cjhutto/vaderSentiment) (Valence Aware Dictionary and sEntiment Reasoner) is a lexicon and rule-based sentiment analysis tool specifically tuned for social media. This Actor wraps VADER to provide:

- **Instant Analysis** - No model loading, no GPU needed
- **Social Media Optimized** - Understands slang, emojis, and emphasis
- **Accurate Scoring** - Compound score from -1 (negative) to +1 (positive)
- **Batch Processing** - Analyze thousands of texts efficiently

### 📊 Understanding the Output

| Score | Range | Meaning |
|-------|-------|---------|
| `compound` | -1 to +1 | Overall sentiment (normalized) |
| `positive` | 0 to 1 | Proportion of positive words |
| `negative` | 0 to 1 | Proportion of negative words |
| `neutral` | 0 to 1 | Proportion of neutral words |

#### Sentiment Classification

| Compound Score | Classification |
|----------------|----------------|
| ≥ 0.6 | Very Positive |
| 0.2 to 0.6 | Positive |
| -0.2 to 0.2 | Neutral |
| -0.6 to -0.2 | Negative |
| ≤ -0.6 | Very Negative |

### 🚀 Use Cases

- **Social Media Monitoring** - Track brand sentiment on Twitter/X
- **Product Reviews** - Analyze Amazon, Yelp, or app store reviews
- **Customer Feedback** - Classify support tickets by sentiment
- **Survey Analysis** - Quantify open-ended responses
- **Content Moderation** - Flag negative or toxic content
- **Market Research** - Gauge public opinion on topics

### 📥 Input Options

#### Direct Text Input

```json
{
    "texts": [
        "I absolutely love this product! Best purchase ever! 😍",
        "Terrible experience, would not recommend.",
        "It's okay, nothing special."
    ]
}
````

#### From Apify Dataset

```json
{
    "datasetId": "abc123",
    "textField": "review_text"
}
```

### ⚙️ Configuration

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `texts` | array | `[]` | Array of text strings to analyze |
| `datasetId` | string | - | ID of Apify Dataset containing texts |
| `textField` | string | `text` | Field name containing text in dataset |
| `batchSize` | integer | `100` | Texts per batch for saving |

### 📤 Output

```json
{
    "text": "I absolutely love this product! Best purchase ever! 😍",
    "textPreview": "I absolutely love this product! Best purchase ever! 😍",
    "compound": 0.9231,
    "positive": 0.567,
    "negative": 0.0,
    "neutral": 0.433,
    "sentiment": "very_positive",
    "confidence": "high",
    "analyzedAt": "2024-01-15T10:30:00.000Z"
}
```

### 🧪 Examples

#### VADER's Special Handling

```python
## Capitalization for emphasis
"This is GREAT!" → compound: 0.6588
"This is great"  → compound: 0.6249

## Exclamation marks intensify
"This is great!"  → compound: 0.6588
"This is great!!" → compound: 0.7003

## Emojis are understood
"I love it 😊"    → compound: 0.7845
"I hate it 😠"    → compound: -0.7845

## Slang and abbreviations
"This is lit 🔥"  → compound: 0.4215
"lol so funny"    → compound: 0.4215
```

### 🚀 Quick Start

#### Using Apify Console

1. Paste your texts as JSON array
2. Or enter a Dataset ID
3. Click **Start**
4. View results in **Dataset** tab

#### Using Apify API

```bash
curl -X POST "https://api.apify.com/v2/acts/YOUR_USERNAME~sentiment-analyzer/runs?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "texts": [
      "Best product ever!",
      "Worst experience of my life",
      "It works fine I guess"
    ]
  }'
```

#### Using Python

```python
from apify_client import ApifyClient

client = ApifyClient('YOUR_TOKEN')

## Analyze texts
run = client.actor('YOUR_USERNAME/sentiment-analyzer').call(run_input={
    'texts': [
        'Great customer service!',
        'Product broke after one day',
        'Average quality for the price'
    ]
})

## Get results
items = client.dataset(run['defaultDatasetId']).list_items().items
for item in items:
    print(f"{item['sentiment']}: {item['textPreview']}")
```

#### Using JavaScript

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

const client = new ApifyClient({ token: 'YOUR_TOKEN' });

const run = await client.actor('YOUR_USERNAME/sentiment-analyzer').call({
    texts: [
        'Amazing experience!',
        'Terrible waste of money',
        'It is what it is'
    ]
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

### 🔗 Integration Pipeline Example

```javascript
// 1. Scrape reviews
const scrapeRun = await client.actor('apify/web-scraper').call({
    startUrls: [{ url: 'https://example.com/reviews' }],
    pageFunction: async ({ $ }) => {
        return $('.review').map((i, el) => ({
            text: $(el).find('.review-text').text()
        })).get();
    }
});

// 2. Analyze sentiment
const sentimentRun = await client.actor('YOUR_USERNAME/sentiment-analyzer').call({
    datasetId: scrapeRun.defaultDatasetId,
    textField: 'text'
});

// 3. Get results
const { items } = await client.dataset(sentimentRun.defaultDatasetId).listItems();

const stats = items.reduce((acc, item) => {
    acc[item.sentiment] = (acc[item.sentiment] || 0) + 1;
    return acc;
}, {});

console.log('Sentiment Distribution:', stats);
```

### 💰 Cost Estimation

| Texts | Approx. Time | Compute Units |
|-------|--------------|---------------|
| 100 | ~2 seconds | ~0.001 |
| 1,000 | ~5 seconds | ~0.002 |
| 10,000 | ~30 seconds | ~0.01 |
| 100,000 | ~3 minutes | ~0.08 |

VADER is extremely efficient - **no model loading**, **no GPU**, **instant results**.

### 📈 Accuracy

VADER was validated on social media text and achieves:

- **F1 Score:** 0.96 on product reviews
- **Accuracy:** 84% on Twitter sentiment
- **Correlation:** 0.88 with human raters

### ⚠️ Limitations

- **English Only** - VADER is optimized for English text
- **Short Text** - Best for tweets, reviews, comments (not long documents)
- **Context** - May miss sarcasm or domain-specific language
- **Slang Evolution** - Lexicon may not include newest slang

For multilingual or complex analysis, consider BERT-based models.

### 🔧 Technical Details

- **Language:** Python 3.12
- **Library:** vaderSentiment 3.3.2
- **Memory:** 128MB-256MB
- **Speed:** ~10,000 texts/second

### 🆚 VADER vs. Other Methods

| Method | Speed | Accuracy | Languages | GPU |
|--------|-------|----------|-----------|-----|
| **VADER** | ⚡ Instant | Good | English | No |
| BERT | Slow | Excellent | Many | Yes |
| TextBlob | Fast | Fair | English | No |
| GPT-4 | Very Slow | Excellent | Many | No\* |

\*API-based, expensive for high volume

### 📄 License

MIT License - see [LICENSE](LICENSE) for details.

***

### 🏪 Apify Store Listing

<details>
<summary>Click to copy store details</summary>

**Actor name:**

```
VADER Sentiment Analyzer
```

**Description:** *(299/300 chars)*

```
Analyze text sentiment using VADER. Optimized for social media, reviews & customer feedback. Understands emojis, slang, emphasis. Returns compound score (-1 to +1) plus positive/negative/neutral breakdown. Instant CPU inference, no GPU needed. Batch processing supported.
```

**SEO Actor name:**

```
Sentiment Analysis API - Social Media & Reviews
```

**SEO Description:** *(199/200 chars)*

```
Analyze sentiment from social media, reviews & feedback. VADER-powered, handles emojis & slang. Returns compound scores. Instant inference, no GPU. Batch processing for high volume.
```

**Icon:** Use `assets/icon.svg` in this folder

</details>

***

**Keywords:** sentiment analysis, VADER, text analysis, opinion mining, social media analysis, product review analysis, customer feedback, NLP, natural language processing, emotion detection, polarity detection, brand monitoring

# Actor input Schema

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

Enter texts to analyze for sentiment (one per line)

## `datasetId` (type: `string`):

Apify Dataset ID. Leave empty to use the texts above.

## `textField` (type: `string`):

Field name containing text in dataset records (e.g., 'text', 'content', 'review')

## `batchSize` (type: `integer`):

Number of texts to process before saving. Larger = faster but uses more memory.

## Actor input object example

```json
{
  "texts": [
    "I absolutely love this product! Best purchase ever! 😊",
    "This is terrible, worst experience of my life. 😠",
    "The weather is okay today, nothing special."
  ],
  "textField": "text",
  "batchSize": 100
}
```

# 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": [
        "I absolutely love this product! Best purchase ever! 😊",
        "This is terrible, worst experience of my life. 😠",
        "The weather is okay today, nothing special."
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("web.harvester/sentiment-analyzer").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": [
        "I absolutely love this product! Best purchase ever! 😊",
        "This is terrible, worst experience of my life. 😠",
        "The weather is okay today, nothing special.",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("web.harvester/sentiment-analyzer").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": [
    "I absolutely love this product! Best purchase ever! 😊",
    "This is terrible, worst experience of my life. 😠",
    "The weather is okay today, nothing special."
  ]
}' |
apify call web.harvester/sentiment-analyzer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=web.harvester/sentiment-analyzer",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "VADER Sentiment Analyzer",
        "description": "Analyze text sentiment using VADER (Valence Aware Dictionary for Sentiment Reasoning). Fast, accurate sentiment analysis optimized for social media, reviews, and customer feedback. No GPU required.",
        "version": "0.0",
        "x-build-id": "x96egYFFydPvWWZ5l"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/web.harvester~sentiment-analyzer/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-web.harvester-sentiment-analyzer",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/web.harvester~sentiment-analyzer/runs": {
            "post": {
                "operationId": "runs-sync-web.harvester-sentiment-analyzer",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/web.harvester~sentiment-analyzer/run-sync": {
            "post": {
                "operationId": "run-sync-web.harvester-sentiment-analyzer",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "texts": {
                        "title": "Texts to Analyze",
                        "type": "array",
                        "description": "Enter texts to analyze for sentiment (one per line)",
                        "items": {
                            "type": "string"
                        }
                    },
                    "datasetId": {
                        "title": "Or Load from Dataset",
                        "type": "string",
                        "description": "Apify Dataset ID. Leave empty to use the texts above."
                    },
                    "textField": {
                        "title": "Text Field Name",
                        "type": "string",
                        "description": "Field name containing text in dataset records (e.g., 'text', 'content', 'review')",
                        "default": "text"
                    },
                    "batchSize": {
                        "title": "Batch Size",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Number of texts to process before saving. Larger = faster but uses more memory.",
                        "default": 100
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
