CommencerCommencer gratuitement

Different kinds of audio

Now you've seen an example of how the Recognizer class works. Let's try a few more. How about speech from a different language?

What do you think will happen when we call the recognize_google() function on a Japanese version of good_morning.wav (file) (japanese_audio)?

The default language is "en-US", are the results the same with the "ja" tag?

How about non-speech audio? Like this leopard roaring (leopard_audio).

Or speech where the sounds may not be real words, such as a baby talking (charlie_audio)?

To familiarize more with the Recognizer class, we'll look at an example of each of these.

Cet exercice fait partie du cours

Spoken Language Processing in Python

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Create a recognizer class
recognizer = sr.Recognizer()

# Pass the Japanese audio to recognize_google
text = recognizer.recognize_google(____, language=____)

# Print the text
print(text)
Modifier et exécuter le code