pre-requisites for installing speech recognition and speech to text python libraries

sudo apt update && sudo apt upgrade

sudo apt-get install libportaudio2
sudo apt install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg libav-tools

pip3 install --upgrade pip

pip3 install SpeechRecognition
sudo apt-get install python3-setuptools

pip3 install pyaudio  

pip3 install pocketsphinx  


http://www.codesofinterest.com/2017/03/python-speech-recognition-pocketsphinx.html
http://www.codesofinterest.com/2017/01/audio-classification-pyaudio-getting-started.html