This article shows you how to detect language, analyze sentiment, and extract key phrases using the Text Analytics APIs with Java.
Refer to the API definitions for technical documentation for the APIs.
You must have a Cognitive Services API account with Text Analytics API. You can use the free tier for 5,000 transactions/month to complete this quickstart.
You must also have the endpoint and access key that was generated for you during sign up.
To get these samples running locally, simply get the pre-requisites above, then:
- git clone https://github.com/Azure-Samples/cognitive-services-java-sdk-samples.git
- cd cognitive-services-java-sdk-samples/TextAnalytics
- mvn compile
- set env variable AZURE_TEXTANALYTICS_API_KEY to your cognitive services API key.
- mvn exec:java -Dexec.mainClass="com.microsoft.azure.textanalytics.samples.Samples"