Text Analysis

Basic Sentiment

Performs deterministic sentiment analysis on text using predefined word lists, returning positive, negative, or neutral classifications with confidence scores. Access via MCP in Cursor or Windsurf, or REST API at `/v1/text/sentiment`. Example: "I love this product" returns positive with high confidence. Uses lexicon-based scoring rather than ML models for consistent results.

API Endpoint

GET /v1/text/sentiment

Code Examples

curl "https://tinyfn.io/v1/text/sentiment" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/text/sentiment', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/text/sentiment',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's text analysis tools:

{
  "mcpServers": {
    "tinyfn-text": {
      "url": "https://tinyfn.io/mcp/text",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How does basic sentiment analysis work compared to ML models?

Uses predefined word lists with sentiment scores rather than machine learning. More predictable but less nuanced than neural networks—good for consistent classification across similar inputs.

What sentiment scores and formats does the API return?

Returns sentiment label (positive/negative/neutral) with numerical confidence score typically ranging 0-1. Also includes word-level breakdown showing which terms influenced the classification.

Can I analyze sentiment in MCP tools like Cursor for code comments?

Yes, perfect for analyzing commit messages, code comments, or user feedback within your development workflow. Claude Code and Cursor can process multiple text snippets efficiently.

How does it handle mixed sentiment or sarcasm in text?

Lexicon-based analysis struggles with sarcasm and irony since it lacks contextual understanding. Mixed sentiment returns the dominant polarity based on word counts and weights.

What's the difference between basic sentiment and advanced NLP sentiment?

Basic sentiment uses word lists for fast, deterministic results. Advanced NLP considers context, negation, and linguistic patterns but requires more processing time and complexity.

Try Basic Sentiment Now

Get your free API key and start using Basic Sentiment in seconds.

Get Free API Key