quick personal FB chatbot.
We see use of chatbots in multiple day-2-day applications for e.g: google assistant. However, we don't have much control over these recommendations. I aim to provide a solution which can be deployed on a personal system / phone, tuned and learnt in an online fashion for personal use, where recommendations are controlled solely by a user. Isn't it exciting ?
Part 1.
Part 1 covers a basic tutorial on how you can download your facebook data and make your first chatbot, which can recommend N answers given a query. It uses widely known and used sequence-2-sequence (seq-2-seq) model. Here the answers will be probabilistically generated according to your past conversations.
you can find the code here
#Downloading FB data: As a start you first need to download your facebook chat data by going to settings.
Facebook took few days to share the data but now they do it right away.
#Set path to messages folder in code/data_cleaning.py
python code/data_cleaning.py
#Seq-2-Seq Model: Sequence-2-Sequence model first encodes a query to get a "thought vector". Thought vector is then used to generate a response. Model used here is vanilla seq-2-seq model, will add more updates to the model like attention layer, gender role (in queries), smileys in the coming days.
python seq2seq-chatbot/main_simple_seq2seq.py
validating on some random new queries while training.. One can produce n-best answers for a query. I am displaying 5 in figure below.
In Part 2, I will be discussing how to exploit external resources, automatic gender based answers to queries and also exploiting architectures with attention mechanism.