Set up Azure portal
Use the Azure Cognitive Text Analytics API to create a resource, get a subscription key, and then use a Reference API to send a POST request.
Create an account with Azure Cognitive Services.
Procedure
- Log in to your Azure account and click Portal.
- Search and select Text Analytics from the drop-down list.
-
Click Create a Resource:
- Enter a Name: TextAnalyticsDemo2020.
- Select the Subscription--use the default Azure subscription 1, select the Location, for example West US, and select the Pricing tier, for example F0 (5K Transactions per 30 days).
- Create a Resource Group and provide a name, for example, TextAnalyticsDemo2020RG.
-
Click Create.
When the Overview window opens, you should be able to see the following status: Your Deployment is complete.
-
Go to your resource TextAnalyticsDemo2020 and select
it.
You should see: TextAnalyticsDemo2020 | Quick Start.
-
From section 1, copy the K1 contents, for example,
0abfa73d93f1469d9d4b5db459394315.
The Text Analytics API (v.2.1) page opens.
-
From section 2, click the API Console (V2) link:
- Select API Reference > POST Sentiment.
-
In Sentiment, Select the testing console
in the region where you created your resource:, select
West US.
The Text Analytics API (v.2.1) Sentiment page opens.
- In the Headers section, enter the value Ocp-Apim-Subscription-Key that you copied from the K1 field.
-
In the Request body, delete the existing content
and replace it with the following code:
{ "documents": [ { "language": "en", "id": "1", "text": "I love this world" } ] }
-
Click Send.
The response status is displayed as 200 OK. The Response content field shows: { "documents": [{ "id": "1", "score": 0.96714282035827637 }], "errors": [] }.