Sou novo no reconhecimento de fala e estou tentando usar a Google Speech API para criar um programa de fala para texto. Eu usei o tutorial fornecido no link a seguir e os comandos dentro para instalar dependências.
TUTORIAL: link
Comandos:
git clone http://people.csail.mit.edu/hubert/git/pyaudio.git
cd pyaudio
sudo python setup.py install
sudo apt-get installl libportaudio-dev
sudo apt-get install python-dev
sudo apt-get install libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev
sudo pip3 install SpeechRecognition
Eu então estava tentando executar este script falso no spyder para ver se estava funcionando,
import speech_recognition as sr
# Record Audio
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say something!")
audio = r.listen(source)
# Speech recognition using Google Speech Recognition
try:
# for testing purposes, we're just using the default API key
# to use another API key, use 'r.recognize_google(audio,
#key="GOOGLE_SPEECH_RECOGNITION_API_KEY")'
# instead of 'r.recognize_google(audio)'
print("You said: " + r.recognize_google(audio))
except sr.UnknownValueError:
print("Google Speech Recognition could not understand audio")
except sr.RequestError as e:
print("Could not request results from Google Speech Recognition service; {0}".format(e))
'
Agora, quando eu executo esse script, sempre recebo esse erro:
Could not import the PyAudio C module '_portaudio'.
Traceback (most recent call last):
File "<ipython-input-1-2b39d94ceb5b>", line 1, in <module>
runfile('/home/sanwal092/Desktop/Python/SR/dummy.py', wdir='/home/sanwal092/Desktop/Python/SR')
File "/home/sanwal092/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 866, in runfile
execfile(filename, namespace)
File "/home/sanwal092/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "/home/sanwal092/Desktop/Python/SR/dummy.py", line 14, in <module>
with sr.Microphone() as source:
File "/home/sanwal092/anaconda3/lib/python3.6/site-packages/speech_recognition/__init__.py", line 78, in __init__
self.pyaudio_module = self.get_pyaudio()
File "/home/sanwal092/anaconda3/lib/python3.6/site-packages/speech_recognition/__init__.py", line 109, in get_pyaudio
raise AttributeError("Could not find PyAudio; check installation")
AttributeError: Could not find PyAudio; check installation
Eu tenho procurado na internet para ver se eu posso trabalhar o meu caminho em torno disso, mas nada que eu encontrei parece funcionar e esta é a primeira vez que eu estou trabalhando com reconhecimento de fala de qualquer tipo.
Qualquer ajuda para este problema e qualquer sugestão de como aprender e melhorar no reconhecimento de fala seria tremendamente apreciada.