Practice Exams:

AI-102 Microsoft Azure AI – Manage speech by using the Speech Service

  1. Implement Text-to-Speech Using the Speech Service

Now, in this section of the course, we’re going to be talking about knowledge mining solutions. The first element of that we’re going to be talking about is called Cognitive Search. Now, this used to be called Azure Search and now called Cognitive Search. Now, the really interesting thing about this is that you can basically create a search engine, point it at a set of documents, and Cognitive Search will go through that document and build an index for you that you can run a search on. The interesting thing about this, of course, is that your Cognitive Search can search for images and other documents that are in your drive and extract the contents of those using Cognitive Services.

So what we need to do is we need to create ourselves a Cognitive Search, or what used to be called Azure Search Solution. If you go into the Azure Portal, assuming you have an Azure account, if you go under Services and search for Search, you will see Search Services. I don’t currently have any, and so I can create a brand new search service. It’s fairly simple to start that up. We select a subscription that we’re in. We can create a new resource group for that. I’m just going to call that Search, and we do have to give it a name and a location. Now, the pricing on this, there is a free plan, which is good, but it only supports three indexes and three indexers and has a fairly low 50 megabyte limit of storage.

And as you can see, free indexes may be automatically deleted after 90 days, which is fine as well. So we can start off with the free plan. If you want to use this in a development or in a type of production environment, you’re going to have to select a higher level of service to support more data, to support some of these things that are going to improve the performance of search. And you can see the pricing does run up from there.

So we’ll start with the free plan. We do have to give it a name. Give it a unique name here and I’ll leave it in the west. US too. Now, since we’re on the free plan, we don’t have the ability to scale this right. So we can see that this is not going to be given any kind of SLA. We cannot scale this more than one Replica. Now, partitions, if you are familiar with Cosmos DB, you’ll know that documents can be divided into partitions by some type of partition key. And so by doing partitions, essentially you’re spanning your index over multiple units, and therefore it’ll be quicker to do searching and things like this. We can skip over that tags we won’t bother with and we go straight into the validation and then the creation. So I’m going to click the Cray button and when we’ve come back, we’re going to have a search service that we can then point to a container of documents and have it do some indexing on.

  1. Implement Speech-to-Text Using the Speech Service

All right, so that got created. We can say go to resource. Now we can see that the search service that we created has a name that we provided and that name is part of a URL. So this is going to become the endpoint for running a search similar to many other services within Azure. In order to access this, you are going to need some security keys. And so you can see here there is some keys that are required for administrating this search and there’s even a query key if we just want queries only. So again, this is the free tier and there is no service level agreement. Since we do have a limit of three indexes, we can switch over to the indexes tab on the overview and we can see that there is no indexes currently. Like we just literally created it. If you are going to be using this for other things, you may want to check to see that you have any indexes left.

Otherwise you’re going to be forced to upgrade to a higher level plan. Now, in order to create index, we need to have data and we don’t have any data sources hooked up. Now there are a set of sample data that we can use. If we go into this import data tab, we can see that we can point to an existing data source which we haven’t created yet, or we can look at one of the samples and there is a hotel sample and a real estate sample. We can click on the real estate sample. We’re going to go to the next page that says add cognitive skills.

And at this point we’re not going to add any of these cognitive skills. We can talk about that in a moment. We’re going to go skip into the next page into the target index. Now, we did point to this hotel sample. We can see that it’s interpreting the primary key, it’s looking at the various fields that are here. This is basically how it’s going to build the index. So I’m just going to accept the defaults here. I don’t have any modifications yet. You can see typically when you’re building a search engine, we’ve got contexts such as facet and filters that are common in the search world, whether something can be sorted by searched on, et cetera. We’re just going to leave the defaults and go next. And the indexer requires a name which is given itself one. And how often do you want this index to be generated?

Now this is a sample and so you can’t re index the sample every hour. But if you wanted to set this up to point to a database or a Blob container, you may want to rerun this index on some custom schedule. So we’re going to start off this indexer pointing to the sample data. Now, while this is running, we can see now this data source has been added to the data sources go over to the indexers tab. This is what we just created.

So this is the indexer it is now running. The last run was a few seconds ago. You can see it’s in progress. And that’s what’s going to end up creating our index. So we can refresh this page. You can see it says success. If we go over to the index tab, the index has been created, it doesn’t showing any documents yet. If I hit refresh, we’ll let that build. It does take a few minutes before the index gets built, of course. And one more refresh, we can see that there are 50 documents in our hotel sample. All right, we can actually click on the click on the index. We can see these 50 documents. Here’s a way of testing the search and see the fields that are available for us to do searches on. Here’s the sample URL that we can use if we’re using this index in one of our applications.

So I can enter a sample, a search word here. So if I’m looking for the word pool, it’s returned me a JSON document here. And we can see the hotels it’s given a score for search stunning downtown hotel with indoor pool. So it’s obviously successfully found that keyword in that hotel. As we scroll down, we can see other hotels that have also met our search criteria.

So we’ve just built a search index pointing it at in this case, it’s the test data. But you can again point this to any database. If we go into the let’s go backup to the object here, go into data sources and we say we want to add a data source, we can see that it supports Blob storage, SQL database, cosmos, DB, table storage and even like data lake source. So we can basically have it run this index on any set of documents that we have available to us in one of these data sources.