Practice Exams:

AI-102 Microsoft Azure AI – Implement Natural Language Processing Solutions

  1. Detect Language using Text Analytics

So this last one’s fairly straightforward after what we’ve already seen, simply being able to detect the language used in text. Now we are in the case of this, we’ll go into our GitHub repository, text Analytics Detect Language. Fairly short script. You can see it’s only a few lines and once again we’re using the rest APIs. So we’re going to call the API with a post and we got a response and we’re passing in and it looks like English, Spanish and probably Japanese text to the service. We’re going to see if it can detect those languages. Now, we’ve already seen in previous examples that it did have to understand the language in order to do sentiments and key phrases and stuff.

So we’re not expecting it to have too much difficulty with this. Now, if there is API documentation, and if you look at the API documentation, you do have the option of passing in a country hint. And so if you know that this text comes from a certain area of the world, then you can help the API out by passing in a country code. But if you don’t know that, then that’s okay too. So we load up the script fairly simple. We run it. We can see that the languages came back as English, Spanish and simplified Chinese. And so fairly easily, fairly quickly, Microsoft Azure was able to recognize the languages in written text.

  1. Text Analytics Entity Recognition using Visual Studio 2019 and C#

All right, so I don’t expect you to remember, but way back in the beginning of this course, in the first section of the course, I did a little demo of the text analytics service. Text analytics service, as we’ve seen with the Python code, basically takes text that you provide and does various analysis on it. So the demo that I did at the beginning just was looking for the sentiment and the key phrases. But that’s not the only things that are available. You could detect which language, which human language that a particular piece of text is.

You could look at the contents of that text and recognize the entities, right? So the recognizable objects, the names, the places, things like that within a piece of text. And finally you could do something such as linking, adding some hyperlinks inside of the text to places such as Wikipedia so that it makes it a more engaging piece of text that people can click on to go find out more about relative things. So if you’re talking about stuff that has Wikipedia page, the entity linking method within the text analytics can do that for you. So let’s add the entity detection.

So we’re going to have to call to it by calling an entity recognition line within the main use the same client that we created. Now I have to create a method with the same name. So I’ll go down to the bottom and I’ll create the entity recognition example. Now there is some text here. I’m going to replace it with my own custom text a bit longer and some random entities for it to recognize. So it says this AI 102 course demonstrates how to access Azure Cartridge services using Python and C Sharp. Yada, yada. Well, first I’m going to comment out sentiment Analysis and Key Phrase Extraction just so that we’re not running the same methods on the same text. We’ve already done in this course. And I’ll hit f five.

So this is going to run and as you can see, it comes back with the entity category for the entity, any subcategory if it exists, and a confidence score. So we can see contents of services. Python is listed as a skill. C Sharp is listed as a skill with 100% confidence. The name students is listed as a person type. Now the AI 102 seems to have been just interpreted as a number, but you can say certifications listed as a skill. One year is a date time as well as 1040 06:00 p. m. . So we’ve got date times, skills, organizations, people, types, locations. This is the entity recognition service within text analytics.