IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Spoken Language Processing in Python

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

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

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

# Print the text
print(text)
Modifica ed esegui il codice