
In this Azure tutorial, we will discuss Language Detection With Azure Cognitive Service. Along with this, we will also discuss a few other topics below.
- Create Azure Text Analytics Using Azure Portal
- Language Detection Azure
Table of Contents
Language Detection With Azure Cognitive Service
Well, here we will discuss how to detect Language With Azure Cognitive Service. Many times we will have the requirement to detect different languages which is really a difficult task and can able to solve many problems. Here is the Azure Cognitive Service that actually helps the developers to implement such a difficult AI feature easily with the help of the Azure Cognitive Service.
- How To Convert m4a File To Text Using Azure Cognitive Services
- How To Extract Text from Image Using Azure Cognitive Services
Before moving to the actual topic i.e Language Detection With Azure Cognitive Service, we should know What is Azure text analytics?.
What Is Azure Cognitive Services
Prerequisites
- You must have an Azure Account or a valid Azure Subscription. If you don’t have an Azure account till now. Create a Free Azure Account now.
Create Azure Text Analytics Using Azure Portal
You need to follow the below steps to Create Azure Text Analytics in Azure Portal.
Login to the Azure Portal (https://portal.azure.com/)
Once you logged in to the Azure Portal, from the left side panel, click on the + Create a Resource button.

Search for the Text Analytics as show below

Or, For the same option, Once you logged in to the Azure Portal, Search for the Text Analytics on the global search and click on the search result Text Analytics under the Marketplace.

On the Create window, Provide the below details to create the Azure Text Analytics service.
- Name: You need to provide a unique name for the Azure Text Analytics service.
- Subscription: You will have to choose the correct subscription that you want to use to create the Azure Text Analytics service.
- Location: You need to choose a location for the Azure Text Analytics service.
- Pricing Tier: Choose a pricing tier based on your requirement. You can choose the Free F0 for the demo purpose or you can use a maximum of 5K transactions per 30 days. If you want to know some more information on the pricing details then You can click on the view full pricing details link.
- Resource Group: You can choose an existing Resource Group or you can click on the Create new link to create a new Resource Group.
Finally, click on the Create button to create the Azure Text Analytics service.

You can able to see, The deployment is completed successfully with out any issue.

Click on the Go to resource button to navigate to the Azure Text Analytics service that you have created just now. You can able to see our DemoTextAnalytics12 service created as below.

Now, the next step is to copy the key1 value and the endpoint URL. To copy the key1 value, follow the below steps.
Click on the Keys and Endpoint from the left navigation on the Cognitive services page that you have created above. Once you will click on the Keys and Endpoint link, you can able to see the KEY1 and KEY2 value. You can click on the Show Keys button to show the Key 1 and Key 2 values.
If you don’t want to use the existing Key1 or Key2 value then you can click on the Regenerate Key1 and Regenerate Key2 button to generate the new keys that you want to copy.
Click on the copy button next to the Key1 value as highlighted below and keep it in a note pad as we are going to use this Key 1 value in the next steps.

The next thing is we need the Endpoint URL. The location for my Azure Text Analytics API is eastus so the Endpoint URL for my Azure Text Analytics API will be as below
https://eastus.api.cognitive.microsoft.com/text/analytics/v3.0/languages
Now the next step is to work with the Postman tool. Open the Postman App and we need to set the below properties.
- Ocp-Apim-Subscription-Key: You need to provide the Key1 value of the Azure Text Analytics API that you have copied above and kept it in a notepad.
- Content-Type: You need to set this property value to
application/json
. - Accept: You need to set this property value to
application/json
.
Set the above properties as highlighted below on the Headers tab.

Now the next step is, click on the Body tab, then choose the Raw option and then paste the below JSON as it is.
{
"documents": [
{
"id": "1",
"text": "I Love AzureLessons"
},
{
"id": "2",
"text": "ମୁଁ AzureLessons କୁ ଭଲ ପାଏ |"
},
{
"id": "3",
"text": "我爱Azure课程"
}
]
}
You can see it as highlighted below

Now we are done with the configuration. Click on the Send button to see the Output. Once you clicked on the Send button, you can able to see we got the expected output as below
{
"documents": [
{
"id": "1",
"detectedLanguages": [
{
"name": "English",
"iso6391Name": "en",
"score": 1
}
]
},
{
"id": "2",
"detectedLanguages": [
{
"name": "Oriya",
"iso6391Name": "or",
"score": 0.83333337306976318
}
]
},
{
"id": "3",
"detectedLanguages": [
{
"name": "Chinese_Simplified",
"iso6391Name": "zh_chs",
"score": 0.800000011920929
}
]
}
],
"errors": []
}
You can see it as below

This is how we can perform Language Detection With Azure Cognitive Service. You can also use the Azure Text Analytics In Power BI. Another important usage is to work with the Sentiment Analysis and the Key Phrase Detection.
Language Detection Azure
We will get lots of requirements where we need to detect different languages while working with multiple languages in Azure. In this type of Scenario, Azure Text Analytics service can help you to immediately achieve this functionality.
The Azure Text Analytics API detects the language and returns the actual language with a numeric score between 0 and 1. This score indicates the strength of the analysis. The Language Detection feature can detect a wide range of languages including the regional or cultural languages.
The Endpoint URL will be like POST {Endpoint}/text/analytics/v2.1/languages and depends on what is the location for your Azure Text Analytics API.
Few important parameters are Ocp-Apim-Subscription-Key, Endpoint, etc. The input document we will be provided to the Azure Text Analytics API must be in JSON format and should contain the format as ID and text. The JSON document can contain a maximum of up to 5,120 characters and not more than that limit and can contain up to 1,000 items (IDs) per collection. You can provide the collection with the body of the request.
The example of a JSON document is as below
{
"documents": [
{
"id": "1",
"text": "I Love AzureLessons"
},
{
"id": "2",
"text": "ମୁଁ AzureLessons କୁ ଭଲ ପାଏ |"
},
{
"id": "3",
"text": "我爱Azure课程"
}
,
{
"id": "4",
"text": "आई लव अज़ुरेलेसन"
}
,
{
"id": "5",
"text": "
আমি অ্যাজুরিলেসনকে ভালবাসি"
}
]
}
If you will closely look at the above JSON document, you can able to see it contains the ID and text value format.
The sample response will be like below
{
"documents": [
{
"id": "1",
"detectedLanguage": {
"name": "English",
"iso6391Name": "en",
"confidenceScore": 0.9
},
"warnings": []
},
{
"id": "2",
"detectedLanguage": {
"name": "Oriya",
"iso6391Name": "or",
"confidenceScore": 0.83
},
"warnings": []
},
{
"id": "3",
"detectedLanguage": {
"name": "Chinese_Simplified",
"iso6391Name": "zh_chs",
"confidenceScore": 0.8
},
"warnings": []
},
{
"id": "4",
"detectedLanguage": {
"name": "Hindi",
"iso6391Name": "hi",
"confidenceScore": 0.97
},
"warnings": []
},
{
"id": "5",
"detectedLanguage": {
"name": "Bengali",
"iso6391Name": "bn",
"confidenceScore": 1
},
"warnings": []
}
],
"errors": [],
"modelVersion": "2020-09-01"
FAQs
What is Azure text analytics?
Azure text analytics API is one part of Azure cognitive services that helps you to perform different operations like Key phrase extraction, Language detection, Sentiment analysis, named entity recognition, etc easily. You will get a lot of requirements in these areas, Azure text analytics service can help a lot to quickly achieve these functionalities.
Azure text analytics supports many languages like Greek, Italian, Korean, Polish, Japanese, Russian, Swedish, Spanish, Turkish, Chinese, Danish, Dutch, English, French, German, etc.
Ohk, now we have a little bit of idea on the What is Azure text analytics?. Before starting the actual development, we should know the Prerequisites needed for the actual development.
Assuming you have a little bit idea now about Azure Cognitive Service and What is Azure text analytics?. we will start with the actual functionality now. As the first step, we need to create a Text Analytics API in the Azure Portal.
You may also like following the below Articles
- How To Implement Azure Face API Using Visual Studio 2019
- Microsoft Cognitive Services Bing Search Example
Wrapping Up
In this article, we have discussed how to perform Language Detection With Azure Cognitive Service, Create Azure Text Analytics Using Azure Portal and Language Detection Azure Hope you have enjoyed this Article!!!.