Академический Документы
Профессиональный Документы
Культура Документы
07/30/2019
3 minutes to read
o
o
o
o
o
o +6
In this article
1. Prerequisites
2. JSON schema definition
3. Set up a request in Postman
4. See also
5. Next steps
Calls to the Text Analytics API are HTTP POST/GET calls, which you can formulate in
any language. In this article, we use REST and Postman to demonstrate key concepts.
Each request must include your access key and an HTTP endpoint. The endpoint
specifies the region you chose during sign up, the service URL, and a resource used
on the request: sentiment, keyphrases, languages, and entities.
Recall that Text Analytics is stateless so there are no data assets to manage. Your text
is uploaded, analyzed upon receipt, and results are returned immediately to the
calling application.
Tip
For detailed API technical documentation and to see it in action, use the following
links. You can also send POST requests from the built-in API test console. No setup is
required, simply paste your resource key and JSON documents into the request:
Latest stable API - v3.0
Latest preview API - v3.1-Preview.1
Important
Text Analytics API v3 is not available in the following regions: Central India, UAE
North, China North 2, China East.
Prerequisites
A key and endpoint for a Text Analytics resource. Azure Cognitive Services are
represented by Azure resources that you subscribe to. Create a resource for Text
Analytics using the Azure portal or Azure CLI on your local machine. You can also
view your resource on the Azure portal
You can currently submit the same documents for all Text Analytics operations:
sentiment, key phrase, language detection, and entity identification. (The schema is
likely to vary for each analysis in the future.)
For more information about limits, see Text Analytics Overview > Data limits.
JSONCopy
{
"documents": [
{
"language": "en",
"id": "1",
"text": "Sample text to be sent to the text analytics api."
},
{
"language": "en",
"id": "2",
"text": "It's incredibly sunny outside! I'm so happy."
},
{
"language": "en",
"id": "3",
"text": "Pike place market is my favorite Seattle attraction."
}
]
}
1. In Postman:
o Choose Post as the request type.
o Paste in the endpoint you copied from the portal page.
o Append a resource.
o https://westus.api.cognitive.microsoft.com/text/analytics/v3.0/senti
ment
o https://westus.api.cognitive.microsoft.com/text/analytics/v3.0/keyPh
rases
o https://westus.api.cognitive.microsoft.com/text/analytics/v3.0/langu
ages
o https://westus.api.cognitive.microsoft.com/text/analytics/v3.0/entit
ies/recognition/general
2. Set the three request headers:
o Ocp-Apim-Subscription-Key: your access key, obtained from Azure portal.
o Content-Type: application/json.
o Accept: application/json.
Your request should look similar to the following screenshot, assuming
a /keyPhrases resource.
4. Paste in some JSON documents in a format that is valid for the intended
analysis. For more information about a particular analysis, see the topics below:
Language detection
Key phrase extraction
Sentiment analysis
Entity recognition