Amazon Comprehend — Natural language processing API for sentiment analysis, entity recognition, and text insights.


What is Amazon Comprehend?

Amazon Comprehend is a natural language processing (NLP) service that uses machine learning to extract insights from text. It uncovers meaning, relationships, and sentiment in documents, social media, emails, and more — without requiring ML expertise.

Key Insight: Comprehend is “text analytics as a service” — it tells you what the text means, not just what words it contains.


Key Features

FeatureDescription
Sentiment AnalysisDetect positive, negative, neutral, or mixed sentiment
Targeted SentimentAnalyze sentiment toward specific entities (e.g., “product” mentions)
Entity RecognitionIdentify people, places, dates, organizations, quantities
Key Phrase ExtractionExtract meaningful phrases and topics
PII DetectionDetect PII entities (redaction available via asynchronous jobs)
Toxicity DetectionDetect toxic content and unsafe prompts
Language DetectionDetect dominant language (feature support varies by language)
Topic ModelingDiscover topics in document collections
Syntax AnalysisParse parts of speech and sentence structure
Custom ClassificationTrain models to categorize documents your way
Custom Entity RecognitionTrain models to identify domain-specific entities

Use Cases

Customer Support Analysis

Analyze support tickets for sentiment, detect angry customers, route tickets automatically.

Social Media Monitoring

Track brand sentiment, detect trending topics, identify influencers.

Document Processing

Classify legal documents, extract clauses, redact PII from contracts.

Compliance & Security

Detect PII in logs and emails for GDPR/CCPA compliance, identify security threats.

Content Moderation

Analyze user-generated content for toxic language, detect spam, categorize content.


How It Works

1. Send Text:

  • Real-time: Send UTF-8 plain text directly to API
  • Batch: Upload documents (txt, pdf, docx) to S3 for async processing

2. Choose Operation:

  • DetectSentiment — Overall sentiment
  • DetectEntities — People, places, organizations
  • DetectKeyPhrases — Meaningful phrases
  • DetectPiiEntities — PII detection
  • ClassifyDocument — Custom classification

3. Receive Insights:

{
  "Sentiment": "POSITIVE",
  "SentimentScore": {"Positive": 0.98, "Negative": 0.01},
  "Entities": [
    {"Text": "Amazon", "Type": "ORGANIZATION"},
    {"Text": "Seattle", "Type": "LOCATION"}
  ]
}

4. Use Results: Trigger workflows, store in databases, feed dashboards


Pricing & Free Tier

AspectDetails
Free Tier (first 12 months)50,000 units/month per eligible API (1 unit = 100 characters)
Standard Operations$0.0001 per unit (100 characters)
Custom ModelsTraining: $3/hr · Inference: Async per unit / Real-time per second
PII Detection$0.0001 per unit

Cost Tip: 1 unit = 100 characters. Free tier covers ≈ 5 million characters/month. Note: Most text APIs have a 3-unit (300 character) minimum charge per request.

⚠️ Pricing Disclaimer: AWS pricing is subject to change. Always verify current pricing at the official Amazon Comprehend pricing page.


When to Use Comprehend

UseDon’t Use
Text sentiment analysisSpeech sentiment (use Transcribe + Comprehend)
Entity/keyphrase extractionTranslation (use Translate)
Document classificationDocument data extraction (use Textract)
PII detection/redactionUltra-low-latency moderation requirements

Comprehend Features by Use Case

Use CaseBest Features
Customer FeedbackSentiment, Targeted Sentiment, Key Phrases
Document ProcessingCustom Classification, Entity Recognition, PII Detection
Social MediaSentiment, Key Phrases, Syntax, Language Detection
CompliancePII Detection, Redaction
Content DiscoveryTopic Modeling, Key Phrase Extraction

Sentiment Scores Example

{
  "Sentiment": "MIXED",
  "SentimentScore": {
    "Positive": 0.65,
    "Negative": 0.30,
    "Neutral": 0.04,
    "Mixed": 0.01
  }
}

Important Notes

  • Language Support: Dominant language detection supports many languages; feature support (e.g. PII, sentiment) varies
  • Async Operations: Available for large document collections
  • Custom Models: Train on your own data for domain-specific accuracy
  • PII Redaction: Can redact detected PII entities from text

TL;DR

  • Comprehend = NLP API for text insights
  • Features: Sentiment, entities, key phrases, PII detection, topics, language detection, custom models
  • Free Tier: 5 million units/month for first 12 months (1 unit = 100 characters)
  • Pricing: $0.0001 per unit ($1 per 1M characters)
  • Best for: Customer feedback analysis, social media monitoring, document classification, compliance
  • Works with: Transcribe (speech → text → insights), Textract (documents → text → insights)

Resources

Amazon Comprehend Official product page and overview.

Comprehend Documentation Complete API reference and guides.

Comprehend Pricing Detailed pricing breakdown.