E
E
Endernyan832020-12-22 22:31:49
Python
Endernyan83, 2020-12-22 22:31:49

Why is an error returned in speech_recognition?

I am creating a voice assistant but ran into a problem:
the code gives an error when executed.

The code:

import speech_recognition as sr
r = sr.Recognizer()

with sr.Microphone(device_index=5) as source:
    print("Say something...")
    audio = r.listen(source)

query = r.recognize_google(audio, language="ru-RU")
print(query.lower())

Log:
Say something...

Traceback (most recent call last):
  File "D:\Proger\Progect School Adv\main.py", line 8, in <module>
    query = r.recognize_google(audio, language="ru-RU")
  File "C:\Python\lib\site-packages\speech_recognition\__init__.py", line 858, in recognize_google
    if not isinstance(actual_result, dict) or len(actual_result.get("alternative", [])) == 0: raise UnknownValueError()
speech_recognition.UnknownValueError

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alan Gibizov, 2020-12-22
@Endernyan83

Some time ago, a comrade here attracted me to a similar topic, but he quickly abandoned it, and I became bored alone.
I still have fragments of that project in github , it worked there - dig deeper ...
There are several branches, I experimented and combed it as best I could, but didn’t comb it. And now I'm afraid to look there ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question