AI-900 Microsoft Azure AI Fundamentals – Describe features of Natural Language Processing and Conversational AI workloads
And welcome to this section. Now in this section, we are going to discuss some other interesting services that are available in Azure. So we are going to go ahead and cover text and text service. So we can go ahead and use this service to basically take in text. You can understand the language of the text. You can go ahead and actually convert the language of the text. So there’s a lot that you can actually do with the Text Addict service. Then I quickly go through the speech service. So you can go ahead and use a service to, let’s say, convert speech to text. Convert text to speech. This is available with the speech service. We’ll go through another interesting service known as Lewis, which is a language understanding service. Then we’ll go over the questions and answers. That’s a question and answer maker, so go ahead and create your knowledge base. And finally, I’ll give some information when it comes to the bot framework, right? So let’s go out with a section to understand these different services.
Hi, and welcome back. Now in this section, we are going to go ahead and cover the services that are available when it comes to natural language processing. So in the field of artificial intelligence, it defines how well a computer is able to process large amounts of data. Basically, does it understand the data that is trying to be relayed? So over here, let’s quickly just go through the different services that are available when it comes to natural language processing.
So first we have key phrase extraction. So, for example, let’s say you go ahead and submit a sentence to this particular service. Let’s say life is too short to wait. So does it have the ability to go ahead and pick out the keywords from this particular sentence? So over here, examples of keywords are “life is short” and “wait.” Let’s say that you have a review system in place for a restaurant, and let’s say the review indicates that the food was amazing. So can it actually go ahead and understand what the sentence is trying to convey the meaning?
So does this service actually have the ability to go ahead and extract the keywords from this review? So, in terms of food, this place is fantastic. So this is when it comes to key phrase extraction, and then you have entity recognition. So, over here, this allows you to read textual information and then categorise it. So for example, if you’re going ahead and reading information about a person, it has the ability to go ahead and, okay, say detect the name, the phone number, and the email address from the information that has been given to the service. Then you have sentiment analysis. So what is a person trying to convey in terms of sentiments?
So, let’s say you have reviews for the food at a restaurant. And over here, you want to go ahead and try to understand from the review text itself: is it a positive review? Is it a negative review? Or is it just neutral? So over here, the sentiment analysis service has the ability to go ahead and take that textual information and understand whether or not something is trying to be relayed in terms of the content or in terms of the sentiment. Then we have translation services. So, over here, this has the ability to translate text or speech from one language to another. Then we have speech recognition. So here, the service is able to listen to speech and then has the ability to go ahead and generate content based on that speech. And then you have speech synthesis. This gives you the ability to go ahead and generate speech. So over here, when it comes to natural language processing in Azure, there are a lot of services that we have in place. So over here, I just want to give an introduction to these offices.
Now if you want to go ahead and look at the Text addicts service, you can go on to the language service. So over here, you have text analytics. You can get there if you go ahead and scroll down. So over here, you can see that based on a particular text, it has gone ahead and first extracted a lot of key phrases. Over here, it has gone ahead and detected the underlying language itself. So this is another feature that is available.
So it can go ahead and actually detect the underlying language of the text itself. If you go ahead and scroll down, it can also go ahead and detect a sentiment. It could be a positive sentiment, a neutral sentiment, or a negative sentiment. So if you look at the first sentence, over here in the sentence we have, we adore the spot.
So over here, it’s detecting a positive sentiment. So based on the sentence itself, it’s able to go ahead and also automatically detect the sentiment itself. So there’s a lot of information that you can actually get from the Text Addict service. Over here, you also have something known as named entities. So, for example, New York City is a location. The last week has been basically daytime. So all of this is basically some entity. It has mapped to those keywords. So we want to go ahead and understand the features that are available with the Text Addict service. So that is what we are going to do in the subsequent chapters.
Hi, and welcome back. Now in the next set of chapters, we will look at how to use the text analytics API. So the first thing that we are going to do in Azure is go ahead and create a new resource. So I’ll go ahead and add it. So I’ll just go ahead and search for the text analytics service, and let me go ahead and hit “Create” to go ahead and create a new resource.
So over here, let me go ahead and choose my resource group. Let me go ahead and again choose the location. Let me give a name to the resource. Let me go ahead and select the pricing tier so that I can select the free tier. Let me go on next for tags. Let me go on to review and create. And let’s go ahead and hit Create. So, once again, we’re going to use the Postman tool to explore the various features available through the text and API. So once you have the resource in place, I’ll just go ahead and add it.
So again, I’m just going to go ahead and use the keys that are available with this resource. So over here, we are first going to go ahead and look at key phrases. Second, over here we have the request URL, and there should also be a post request. So in the Postman tool, let me go ahead and just take the first part of the URL. So I’ll create a new request. It will be a post-request. Let me go ahead and take the endpoint. So I’ll go ahead and take the North Europe endpoint, replace it over here, and go on to the headers. Let’s make sure to add the authorization header. So let me go on to the key. Let me add the key over here. Let me add the value. So, moving on to our resource, let’s use the key as an endpoint; let me take the key. Paste it over here. Now I have to go on to the body of the request to make sure it is changed to raw.
Over here, I need to make sure it’s in JSON format. And over here, I need to go ahead and add the text sentences that I want to go ahead and submit to the Text Addict service. So all of these will be an array of documents. I’m giving an ID for each document. And what is the text? Let me go ahead and hit on Send.And now over here, you can see all of the key phrases. So for the first text document, these are the key phrases, and so on and so forth. So an application can take the specific key phrases from a sentence and then probably store its own database to understand what are the frequent words that probably users use for, say, reviewing the application or reviewing a specific product that a company sells. So, again, there are many ways you can actually go ahead and use these key phrases over here. I just want to go ahead and give you an example of how you can extract key phrases using the TextAddict API.
Now, in the last chapter, we have looked at key phrases for the text and API. This time, let’s go ahead and use the detect language, which is part of the API. So, once again, very simple. Again, this is the request URL. So let me go ahead and ensure that we choose or just change languages in our previous request. Let’s go ahead and make use of that same post request. So over here, instead of key phrases, let me go ahead and add languages to the body of the request. So let me go ahead and change this. So I want to go ahead and add two documents.
So the first is in the English language, and the other is in a different language. So please allow me to submit this to the text and the service. Let me go ahead and click on “Send.” And over here, it’s able to go ahead and detect the individual languages of the sentences themselves. So over here, it has gone ahead and detected that the first sentence is in English and the second one is in French. So again, this service or this feature of the Text Hank service has the ability to go ahead and detect the language of the underlying text that is being sent onto the service.
Now let’s go on to the next part of the API. So let’s go on to sentiment analysis. Again, this is also very simple. Let’s go ahead and ensure that we use sentiment. I’ll go on to our previous post request. Let’s go ahead and just change this to sentiment. Over here, let me go ahead and change the documents. So I’m going to add three documents over here.
So I’m seeing the hotel as a great place. As a result, this should be a very positive sentiment. Over here, we’re saying we didn’t enjoy our state, so this is kind of a negative sentiment. And over here, this should just be neutral. So I’m just giving some information about the hotel itself. So let me go ahead and click on “Send.” So over here, when you look at the scoring of the sentiment, if it’s a value close to one, that means it’s a positive sentiment. Over here, the value is close to zero. That means it’s a negative sentiment. And over here, the score is 0.5. That means it is a neutral sentiment. So again, this is also a very useful feature. So if you have, for example, a hotel site that wants to go ahead and look at the reviews that have been placed by customers and quickly understand whether they are positive reviews, negative reviews, or neutral reviews, you can go ahead and basically use this service.
Now I want to go on to the last one, which is the entities part for the text antics API. But over here, just as an example of using a different version of the API, So currently, this is text and API version two. For starters, they have version 3.1, which is currently in preview. So again, when it comes to the APIs, you will have different versions of the API that get released from time to time.
Because this is still in the preview stage, they are currently soliciting customer feedback to determine whether this API works as expected. But over here, you can see that when it comes to this particular API, you have a lot of other features in place. So just to showcase that, you can have different versions of the API and use different versions of the API. Let’s go ahead and use version 3.1 when it comes to detecting entities. So if you go on to name entity recognition, over here, you’ll see the details of this particular API. So now over here, when it comes to the end point, let’s go ahead and use the endpoint of our service. So in the Postman tool, for an existing request, let me go and replace this. I have to go ahead and ensure that we have the right resource name. So over here, if I go onto our resource, it’s basically a text resource. So let me go ahead and just replace it. Over here, everything else is the same. Now, in the body of the request, I’m basically going to go ahead and add one document.
So over here, it’s some text. So in this text, I’m basically just giving sort of an example of a conversation. So over here, we learned a lot today via remote learning. I attended hissy lessons, et cetera. So this is the text I want to go ahead and submit to the service. Let me go ahead and hit send. So now over here, if you look at the output, right, if you look at the text of today, it’s gone ahead and extracted some keywords from the text.
So it has gone ahead and defined a category of the text as “daytime” because it is talking about today. So it goes ahead and maps a specific textword to a specific entity or category. If you go ahead and scroll down, it has gone ahead and tagged “history” and “remote learning has skills.” If you go ahead and scroll down, it has gone ahead and been tagged. Microsoft has a company, and similarly, for a directed identifier value, it has gone ahead and been assigned a number. So over here, it has now gone ahead, taken some keywords from the text, and gone ahead and mapped them onto general entities. This is something that this service can do, right? So this marks the end of this chapter. I just want to give an example. when it comes to entity recognition.
Now in this chapter, we are quickly going to go through the translator service. So this service is part of the cognitive suite of APIs. It is available in Azure. This service is also available as part of the Azure Speed service. It basically provides support for text translation and language detection. So let’s see how we can use this service. So firstly, in Azure, we have to go ahead and create a new service. So let me go ahead and click on Add in all resources. So over here, let me go ahead and search for the translator service. So I’ll go ahead and choose that. Let me go ahead and hit Create. Now let me go ahead and choose a resource group over here; let me go ahead and choose a global region over here; let me go ahead and choose the region as global. Over here, let me go ahead and give a name for the resource in the pricing tier. Let me go ahead and choose the free pricing tier, and let me go on to the next attacks. Allow me to proceed to View and Create.
And let’s go ahead and hit Create. Now, we are going to be using the Postman tool to go ahead and issue a request against this API service. Now, once you have the resource in place, you can go ahead and use it. Now, over here, you could go on to the API reference. Then you could go on to the Translate section, and over here you could go ahead and make the API request. So in the Postman tool over here, let’s go ahead and issue a new post request. Enter the URL over here if you want to go ahead and, let’s say, change the language to Spanish. So let’s go ahead and add two. Yes, that’s a language code for Spanish. Then let’s go ahead and get to the headers. Let’s go ahead and basically add the subscription key. Then let’s go on to our resource. Let’s go on to keys and endpoints. Let’s go ahead and take either key. Go on to the Postman tool over here. Let’s paste it. Let’s go on to the body of the request. Let’s go ahead and choose raw. Let’s go ahead and choose JSON. And over here, I’ll add some simple text. So I want to go ahead and convert this text into Spanish. Let me go ahead and hit on Send.And over here, you’re getting the translation that was requested. So over here, you can go ahead and translate your text into a different language using the translation service.
Now if you want to go ahead and look at some of the speed services that are available, So if I go on to the speed service over here, if you go on to the text-to-speed service, you can go ahead and scroll down. So over here, we can go ahead and add some text, and then, based on the voice, you can go ahead and hit on Play.Hello and welcome to Azure. So over here, it has gone ahead and taken the text and given you a speech output. Similarly, we also have the option, if I go back onto the speech service, to go on to the speech-to-text service. So let me go ahead and hit Hello, and welcome to Azure. So let me go ahead and hit Stop. So it has gone ahead and directed what I am actually saying, and it goes ahead, takes a speech, and actually gives you the text. So these are some of the features that are available with the speech service.
Hi, and welcome back. Now, in this chapter, I want to go through the speech service. So this service is available in Azure, and it has a lot of features. So it has, first, a speech-to-text feature. So this provides real-time conversion of speech into text. Here, audio streams or local files can be transcribed and typed in real time. Then you have the text-to-speech service. This can be used to go ahead and convert input text to human-like synthesised speech. Speech translation is available. This provides real-time, multilingual speech translation. You have voice assistants. This service basically empowers developers to go ahead and create natural, human-like conversational interfaces for their applications and experiences. Then you have the speaker recognition service. This is used to help verify and identify speakers. Now, to go ahead and start working with the speed service, we have to go ahead and create a resource based on the speed service.
So let’s go ahead and search for speech. Let me go ahead and choose that service. Let me go ahead and hit Create. So over here, let me go ahead and give a name for the resource. I’ll go ahead and choose my subscription over here. Let me go out and choose my region in the pricing tier. I can go ahead and choose a free pricing tier. I can go ahead and choose my resource group, and let’s go ahead and hit Create. Let’s wait until we have the resource in place. Now, once we have the speed service in place, let me go ahead and introduce the resource. Now, I have a net programme in place. So this will go ahead and make use of the speed service. Now, over here, by default, when you’re using the audio recognition service, it will go ahead and recognise the audio until a silence is reached in the audio clip or for just 15 seconds. You have to go ahead and basically keep on ensuring that you go through the entire file to go ahead and transcribe the entire text of the audio itself. But just to give you a very simple example of how you can actually convert speech to text, that’s why I’m giving this particular example. So I have a sample wave file in my temporary directory. So if I go on to the temp directory, hi, welcome back.
Now, in this chapter, I just want to go through some of the broad classifications of data that we have. So this is the file that I have in place. Now, I need to go ahead and ensure that I change the endpoint, which I’ve gone ahead and changed, and also the key that is used for authorization. So for that, you have to go on to your speedservice, go on to keys and endpoints, go ahead and copy the key, and go ahead and copy the endpoint, right? So now let me go ahead and actually run this program. So now it’s taking that audio file and going ahead and transcribing it, and it’s going to give us part of the text of that audio file. So over here, you can see that you’ve got a partial text of what it has recognised in that audio file. So over here, you can go ahead and use the speech service to go ahead and, you know, transcribe the speech that you have in the audiofile and give you the relevant text.
Popular posts
Recent Posts