Machine Learning Chatbot
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2021-04-07 17:20:46 -06:00
common Optimize generation with temperature and training epochs calculation (#46) 2018-12-06 15:43:48 -06:00
config Optimize generation with temperature and training epochs calculation (#46) 2018-12-06 15:43:48 -06:00
connectors Add files via upload 2021-04-04 23:27:20 -06:00
db Delete statistics.db 2021-04-04 23:30:11 -06:00
models Add files via upload 2021-04-04 23:27:20 -06:00
scripts Fix typo 2018-02-23 18:36:40 -06:00
storage Add files via upload 2021-04-04 23:27:20 -06:00
trainingdata !!THIS BRANCH IS NOT COMPLETE YET!!! 2017-12-22 14:58:01 -06:00
unittest Add discord support 2017-12-30 17:00:01 -06:00
weights Delete structure-model.h5 2021-04-04 23:30:41 -06:00
.gitattributes Remove unnecessary line from git attributes file 2017-11-29 21:45:40 -06:00
.gitignore Added needed directories for first run 2018-01-01 18:40:55 -06:00
armchair_expert.py Retrain markov when no database is found 2018-12-07 08:18:11 -06:00
LICENSE Create LICENSE 2017-11-07 20:32:29 -06:00
markov_engine.py Add files via upload 2021-04-04 23:27:20 -06:00
README.md Update README.md 2021-04-07 17:20:46 -06:00

About

armchair-expert is a chatbot inspired by old Markov chain IRC bots like PyBorg. It regurgitates what it learns from you in unintentionally hilarious ways.

Features

  • Uses NLP to select the most optimal subjects for which to generate a response
  • Uses a Recurrent Neural Network (RNN) to structure and capitalize the output, mimicking sentence structure and capitalization of learned text
  • Learns new words in real-time with an n-gram markov chain, which is positionally aware of the distances between different words, creating a more coherent sentence

Requirements

  • python3
  • keras (Tensorflow backend)
  • spaCy
  • spacymoji
  • numpy
  • tweepy
  • discord.py
  • sqlalchemy
  • tensorflow
  • tweepy

Setup & Training

  • Copy config/armchair_expert.example.py to config/armchair_expert.py
  • Copy config/ml.example.py to config/ml.py
  • Make sure you have the spacy 'en' dataset downloaded: 'python -m spacy download en'
  • I would suggest import some data for training before starting the bot. Here is one example: https://github.com/csvance/armchair-expert/blob/master/scripts/import_text_file.py
  • Every time the bot starts it will train on all new data it acquired since it started up last
  • The bots sentence structure model is only trained once on initial startup. To train it with the most recent acquired data, start the bot with the --retrain-structure flag. If you are noticing the bot is not generating sentences which the structure of learned material, this will help.

Connectors

Twitter

  • You will need to create an application on the twitter devleoper site on your bot's twitter account https://apps.twitter.com
  • After creating it, assign it permissions to do direct messages (this isn't default)
  • Create an access token for your account
  • Copy config/twitter.example.py to config/twitter.py
  • Fill in the tokens and secrets along with your handle
  • python armchair_expert.py

Discord

  • You will need to register a bot with Discord: https://discordapp.com/developers/applications/me#top
  • Once you register it take note of the Client ID, Username, and Token
  • Copy config/discord.example.py to config/discord.py and fill in the relevant fields
  • python armchair_expert.py
  • When the bot starts you should see a message print to the console containing a link which will allow you to join the bot to a server.

Todo

  • make requirments.txt
  • fix learning and db.storage / remove "huh" and "i havent been taught on that" to estimate response or delay reply
  • fix twitter
  • finish discord