Monday, October 16, 2017

How to create and configure Chatterbot on linux

How to create and configure Chatterbot on linux

install Python3
Download chatterbot from github
sudo pip3 install git+git://github.com/gunthercox/ChatterBot.git@master

install
How to create and configure chatterbot on linux




get your com with twitter

pip3 install ./ChatterBot
pip3 install -U pip setuptools

get your twitter keys

goto https://developer.twitter.com/
https://apps.twitter.com/app/new
login and create and app

get your keys

 "CONSUMER_KEY": "???",
    "CONSUMER_SECRET": "??",
    "ACCESS_TOKEN": "??",
    "ACCESS_TOKEN_SECRET": "??"

create a file
setting.py

and add the following to it


TWITTER = {
    "CONSUMER_KEY": "???",
    "CONSUMER_SECRET": "??",
    "ACCESS_TOKEN": "??",
    "ACCESS_TOKEN_SECRET": "??"
}

Run the twitter test scripts
#############################################
sudo python3 twitter_training_example.py
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Requesting 50 random tweets containing the word DIGITAL
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Adding 1 tweets with responses
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Requesting 50 random tweets containing the word never
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Adding 6 tweets with responses
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Requesting 50 random tweets containing the word some
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Adding 6 tweets with responses
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Requesting 50 random tweets containing the word from
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Adding 3 tweets with responses
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Requesting 50 random tweets containing the word four
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Adding 2 tweets with responses
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Requesting 50 random tweets containing the word Tweet
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Adding 11 tweets with responses
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Requesting 50 random tweets containing the word living
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Adding 1 tweets with responses
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Requesting 50 random tweets containing the word house
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
WARNING:chatterbot.trainers:[{'code': 179, 'message': 'Sorry, you are not authorized to see this status.'}]
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Adding 6 tweets with responses
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Requesting 50 random tweets containing the word Like
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Adding 10 tweets with responses
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Requesting 50 random tweets containing the word people
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
INFO:chatterbot.trainers:Adding 5 tweets with responses
INFO:chatterbot.chatterbot:Trained database generated successfully!
###############################################



To run the desktop Chatter app you need to add the following python library
sudo apt-get install python3-tk

then run




 Setingup the Chatterbot Voice


sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 sudo apt-get install ffmpeg libav-tools sudo apt-get install python3-pyaudio
sudo apt-get install espeak python3-espeak
sudo apt-get swig swig3
sudp apt-get install libpulseaudio

pip3 install pyaudio




No comments: