Course Content
What is Python?
Introduction of Python and Its setup
0/2
Control Statement
Control statements are used to control the flow of execution depending upon the specified condition/logic.
0/4
File Handling
File handling is an important component of any application. Python has multiple functions for creating, reading, updating, and deleting files.
0/2
Examples
Following are the examples of python scripts to try hands-on, you are ready to start your python journey.
0/7
Python
About Lesson

Speech to Text using Wit.Ai

Wit.ai is a natural language interface for applications’ ability to turn sentences into organized data. It is also pretty accurate for speech recognition and audio transcription.

Follow the below steps to use wit.ai:

  1. Open wit.ai in a web browser.
  2. Login using your GitHub or Facebook account. if you don’t have one, create one.
  3. Click on the New App button to create a new app.
  4. In the Settings tab, you will find Server Access Token and Client Access Token. Copy it, as it will be needed for authentication in the python script.

Run the following command to install wit packages.

pip3 install wit

Wit will be successfully be installed.

Speech to text using Wit.Ai (Audio file)

from wit import Wit


access_token = "Your access token"
client = Wit(access_token)

resp = None
with open('avatar.wav', 'rb') as f:
  resp = client.speech(f, None, {'Content-Type': 'audio/wav'})
print(f'Yay, got Wit.ai response: {str(resp)}')