# Amazon Comprehend code examples for the SDK for Java 2.x ## Overview Shows how to use the AWS SDK for Java 2.x to work with Amazon Comprehend. *Amazon Comprehend uses natural language processing (NLP) to extract insights about the content of documents without the need of any special preprocessing.* ## ⚠ Important * Running this code might result in charges to your AWS account. * Running the tests might result in charges to your AWS account. * We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege). * This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services). ## Code examples ### Prerequisites For prerequisites, see the [README](../../README.md#Prerequisites) in the `javav2` folder. ### Single actions Code excerpts that show you how to call individual service functions. * [Create a document classifier](src/main/java/com/example/comprehend/DocumentClassifierDemo.java#L62) (`CreateDocumentClassifier`) * [Detect entities in a document](src/main/java/com/example/comprehend/DetectEntities.java#L45) (`DetectEntities`) * [Detect key phrases in a document](src/main/java/com/example/comprehend/DetectKeyPhrases.java#L45) (`DetectKeyPhrases`) * [Detect syntactical elements of a document](src/main/java/com/example/comprehend/DetectSyntax.java#L45) (`DetectSyntax`) * [Detect the dominant language in a document](src/main/java/com/example/comprehend/DetectLanguage.java#L48) (`DetectDominantLanguage`) * [Detect the sentiment of a document](src/main/java/com/example/comprehend/DetectSentiment.java#L43) (`DetectSentiment`) ## Run the examples ### Instructions ### Tests ⚠ Running tests might result in charges to your AWS account. To find instructions for running these tests, see the [README](../../README.md#tests) in the `javav2` folder. ## Additional resources * [Amazon Comprehend Developer Guide](https://docs.aws.amazon.com/comprehend/latest/dg/what-is.html) * [Amazon Comprehend API Reference](https://docs.aws.amazon.com/comprehend/latest/APIReference/welcome.html) * [SDK for Java 2.x Amazon Comprehend reference](https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/comprehend/package-summary.html) --- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0