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.
This exercise is part of the course
Spoken Language Processing in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample 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)