Uberi / speech_recognition

Speech recognition module for Python, supporting several engines and APIs, online and offline.
https://pypi.python.org/pypi/SpeechRecognition/
BSD 3-Clause "New" or "Revised" License
8.27k stars 2.39k forks source link

diffrent behavior of recognize_google on windows and ubuntu #587

Open yoad-ashuri opened 2 years ago

yoad-ashuri commented 2 years ago

hi, I am using this great package in windows and I'm trying to pass my code for remote AWS ec2 ubuntu server. my code goes like this:

filename = "temp.wav" r = sr.Recognizer() with sr.AudioFile(filename) as source:

listen for the data (load audio to memory)

audio_data = r.record(source)
# recognize (convert from speech to text)
text = r.recognize_google(audio_data, language="en-US")
print(text)

on windows, it's working well and recognizes my text as expected but when I run it I'm on the ubuntu server with the same file its returns different text and the incorrect one.

why this difference occurs and how can I resolve this problem.

thank you.

details: Ubuntu 18.04.5 LTS x64 Python 3.6.9 SpeechRecognition 3.8.1 pyaudio 0.2.11

Ccode-lang commented 2 years ago

Did you test multiple times because recognise google works by sending the data to google through requests library. Google could have updated their recogniser between the two times.

Ccode-lang commented 2 years ago

Another more likely possibility is that the microphones are different on the two computers.