AZURE COGNITIVE SERVICES USING BING SPEECH API AND BING SEARCH API

What are Cognitive Services?

Cognitive services are a set of APIs that are designed to democratize artificial intelligence by enabling systems to see, hear, speak, understand and interpret our needs using natural methods of communication.

What these services generally do is bring structured semantic data to human knowledge I/O with a degree of confidence.

As per the categories here  , we have various set of APIs available such as Vision, Speech, Language, Knowledge and Search.

In this article we will see how to work with Bing Speech API along with Bing Search API.

First We have to go to Microsoft Cognitive Service portal and obtain keys for both the APIs category we want to work with.

We will develop our WPF Client which will take user input and make a request to these APIs.

In this tutorial we will cover Bing speech Api for speech to text (STT) using wpf application in visual studio 2017. First we will start from how to get keys for Bing speech Api.

To register for Bing speech Api perform the following steps.

Navigate to https://azure.microsoft.com/en-us/try/cognitive-services/

Navigate to speech tab and select Bing speech api and press get api key.

Select I agree and Your region as shown in image


Login With Microsoft account to get your api key.


Save your key

 

Similarly you have to get keys for the Bing Search API which you can do as follows: 

Now It’s time to create wpf application using visual studio 2017. Please follow the steps describe below,

  • Open Visual studio 2017 ,In my case I am using community Edition . go to file menu,Click New then project
  • Select WPF App (.Net Framework) from ,expand Installed > Templates > Visual C# > Windows Classic Desktop > and select WPF App (.NET Framework).
  • Then inside Solution explorer, right click your project and click manage nuget packages

Inside the NuGet Package manger window navigate to browse tab and search for Microsoft.ProjectOxford.Speech and install both x-86 and x-64 version.

In Solution Explorer check your references Speech Client will be added.

Now almost all set up is done ,let’s dive to app design, copy following code to your MainWindow.xaml file and replace the code between .


Paste following code to MainWindow.xaml.cs