It supports any natural language (Russian by default). To change the language, change the settings of recognizer and synthesizer and retrain bot with your language sources (corpus, Twitter, etc.).
Main script is speech_ai. It requires internet connection to run. It recognizes your speech, looks for an answer using chatterbot library and replies you with a speech synthesized by GTTS library.
This script uses:
You can use this idea in you video game or Smart House project.
Enjoy!
conda create --name speech_ai
source activate speech_ai
conda install python=3.5
# Install pyaudio
# You can try pip3 command with sudo if errors appears
sudo apt-get install python-pyaudio python3-pyaudio
pip3 install pyaudio
pip3 install gTTS
pip3 install SpeechRecognition
pip3 install chatterbot
pip3 install pygame
In Windows OS we have several methods to install packages:
- We can install compiler suggested for our Python version
- Or we can easily use
Wheel
.
On windows it's bit difficult to installpyaudio
andpygame
. So, easy way to useWheel
. This package versions for Python 3.4.x, but you can download versions what you need
- Install Python 3.4.x standalone or in Anaconda
- Download wheels depending on your architecture (x86 or amd64) and Python version:
- Install packages (install wheel if you haven't did it yet).
pip install --upgrade pip
pip install wheel
pip install pygame-1.9.3-cp34-cp34m-win32.whl
pip install PyAudio-0.2.11-cp34-cp34m-win32.whl
pip3 install gTTS
pip3 install SpeechRecognition
pip3 install chatterbot
python3 speech_ai.py