Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

C# Console app for .NET Core (Windows or Linux)

This sample demonstrates various forms of speech recognition, intent recognition, and translation using the Speech SDK for C#. It runs under .NET Core 2.0 on Windows or Linux (Ubuntu 16.04 x64, Ubuntu 18.04 x64, Debian 9 x64 only).

Prerequisites

  • A subscription key for the Speech service. See Try the speech service for free.

  • A PC (Windows x64, Ubuntu 16.04 x64, Ubuntu 18.04 x64, Debian 9 x64); some sample scenarios require a working microphone.

  • Either one of the following:

  • On Ubuntu, run the following commands for the installation of required packages:

    sudo apt-get update
    sudo apt-get install libssl1.0.0 libasound2
  • On Debian 9, run the following commands for the installation of required packages:

    sudo apt-get update
    sudo apt-get install libssl1.0.2 libasound2

Build the sample

  • By building this sample you will download the Microsoft Cognitive Services Speech SDK. By downloading you acknowledge its license, see Speech SDK license agreement.

  • Download the sample code to your development PC.

    Note: make sure to download the complete set of samples, not just this directory. This sample references code in the directory ../../sharedcontent/console, which is shared across samples.

  • If you are using Microsoft Visual Studio 2017 on Windows:

    • Start Microsoft Visual Studio 2017 and select File > Open > Project/Solution.
    • Navigate to the folder containing this sample, and select the solution file contained within it.
  • To tailor the sample to your configuration, use search and replace across the whole solution (for example, in Visual Studio, via Edit > Find and Replace > Quick Replace) to update the following strings:

    • YourSubscriptionKey: replace with your subscription key.
    • YourServiceRegion: replace with the region your subscription is associated with. For example, westus or northeurope.
    • YourEndpointId (optional): replace with the endpoint ID of your customized model in CRIS.
    • The following settings apply for intent recognition powered by the Language Understanding service (LUIS):
      • YourLanguageUnderstandingSubscriptionKey: replace with your Language Understanding service subscription key (endpoint key).
      • YourLanguageUnderstandingServiceRegion: replace with the region associated with your Language Understanding service subscription.
      • YourLanguageUnderstandingAppId: replace with the ID of a Language Understanding service application that you want to recognize intents with.
      • YourLanguageUnderstandingIntentName1, YourLanguageUnderstandingIntentName2, YourLanguageUnderstandingIntentName3: replace with names of intents that your Language Understanding service application recognizes.
    • The following settings apply to keyword-triggered recognition:
      • YourKeywordRecognitionModelFile.table: replace with the location of your keyword recognition model file.
      • YourKeyword: replace with the phrase your keyword recognition model triggers on.
  • If you are using Microsoft Visual Studio 2017 on Windows, press Ctrl+Shift+B, or select Build > Build Solution.

  • If you are using the .NET Core CLI, run the following command from the directory that contains this sample:

    dotnet build helloworld/helloworld.csproj

Run the sample

Using Visual Studio 2017

To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.

The app displays a menu that you can navigate using your keyboard. Choose the scenarios that you're interested in.

Using the .NET Core CLI

Run the following command below from the directory that contains this sample. (We assume we did you performed a Debug build earlier)

cd samples/bin/Debug/netcoreapp2.0
dotnet samples.dll

The app displays a menu that you can navigate using your keyboard. Choose the scenarios that you're interested in.

References