Amazon Comprehend

A fully managed natural language processing (NLP) service that performs sentiment analysis, entity extraction, topic modeling, and more on text data

Overview

Amazon Comprehend is a fully managed service that provides natural language processing capabilities including sentiment analysis, entity recognition, key phrase extraction, language detection, and topic modeling for text data. In addition to instant analysis using pre-trained models, you can train custom classifiers and custom entity recognizers on your own data to handle industry-specific terminology and classification schemes. Amazon Comprehend Medical, a specialized variant for the healthcare domain, extracts medical entities such as medication names, disease names, and test values from clinical text with high accuracy.

Leveraging Pre-trained Models and Choosing Among NLP Tasks

Comprehend's NLP tasks fall into five major categories. Sentiment Analysis classifies the overall sentiment of text into four categories - Positive, Negative, Neutral, and Mixed - and returns confidence scores for each. Entity Recognition extracts named entities such as person names, organization names, dates, and quantities. Key Phrase Extraction identifies phrases representing the main concepts in text. Language Detection can identify over 100 languages, making it useful for preprocessing multilingual content. Topic Modeling is an asynchronous batch process that automatically discovers latent topics from large document collections, applicable to customer review trend analysis and support ticket auto-classification. All these APIs are stateless - simply send text and receive results - so you can start using them immediately without ML expertise. Azure's Text Analytics (now Azure AI Language) offers similar NLP capabilities, but Comprehend excels in batch processing throughput and is particularly strong at bulk analysis of large document sets stored in S3.

Building Domain-Specific Text Classification with Custom Classifiers

For domain-specific classification requirements that pre-trained models cannot address, Custom Classifiers are effective. For example, if you want to classify support tickets into "Billing," "Technical Issues," "Feature Requests," and "Cancellations," you simply prepare labeled data in CSV format for each category and submit it to Comprehend for training to build a custom model. Training can start with as few as 50 samples, with accuracy improving as data volume increases. Multi-label classification is also supported, allowing multiple categories to be assigned to a single document simultaneously. Custom Entity Recognizers work similarly, enabling you to train models that extract domain-specific entities such as "Contract Duration," "Penalty Clauses," and "Auto-Renewal Conditions" from contracts. Related books on natural language processing (Amazon) cover practical workflows from training data design to model evaluation. Trained models can be deployed as endpoints for real-time inference or used in batch jobs to process large volumes of data.

Comprehend Medical and Data Pipeline Design in Practice

Amazon Comprehend Medical is an NLP service specialized for clinical text and medical documents. It extracts medical entities from free-text electronic health records as structured data, including medication names (with dosage, frequency, and route), disease names, test names and values, and anatomical sites. It also provides linking to ICD-10-CM (disease classification) and RxNorm (medication codes), enabling mapping of extracted entities to standard medical coding systems. As a HIPAA-eligible service, it can process data containing protected health information (PHI). A common data pipeline design in practice involves detecting text uploads to S3 via EventBridge, invoking Comprehend batch jobs through Lambda, and storing results in DynamoDB or OpenSearch for search and analysis. The real-time API processes up to 100KB of text per request with response times of a few hundred milliseconds. For large document volumes, the batch API processes data asynchronously via S3 input/output, reducing costs.

ShareXB!