Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Python console app

This sample demonstrates various forms of speech recognition, intent recognition, and translation using the Speech SDK for Python.

Prerequisites

  • Python 3.5 or later needs to be installed. Downloads are available here.
  • The Speech SDK Python package is available for Windows (x64 and x86), Mac (macOS X version 10.12 or later), and Linux (x64).
  • On Ubuntu 16.04 or 18.04, run the following commands for the installation of required packages:
    sudo apt-get update
    sudo apt-get install build-essential libssl1.0.0 libasound2 wget
  • On Windows you also need the Microsoft Visual C++ Redistributable for Visual Studio 2017 for your platform.

Build the sample

By using the Cognitive Services Speech SDK you acknowledge its license, see Speech SDK license agreement.

  • Install the Speech SDK Python package in your Python interpreter, typically by executing the command

    pip install azure-cognitiveservices-speech

    in a terminal.

  • Download the sample code to your development PC.

  • To tailor the sample to your configuration, use search and replace across the whole sample directory 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.
    • 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.
    • 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.
    • Some samples require audio files to be present. Put appropriate audio files somewhere on your file system and adapt the paths in the Python source files.

Run the samples

To run the app, navigate to the samples/python/console directory in your local copy of the samples repository. Start the app with the command

python3 main.py

Depending on your platform, the Python 3 executable might also just be called python.

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

References