Giter Site home page Giter Site logo

rita's Introduction

Rita

Rita a.k.a RIT-assistant is the virtual assistant of RIT.

Get the code

clone the repostory with

git clone https://github.com/RITct/Rita.git

You need

How to run

First Run

bash setup.sh

for training the models.
A local interface can be run like this

python3 rita.py

Go to,

http://127.0.0.1:5000/test

in the browser. Tada !



RIT-Assistant

Working

Currently building Rita as a facebook messenger bot in python flask based on this tutorial.
Message user send is fetched.

data = request.get_json()

This will be in json format as send by facebook API.

{
  "sender":{
    "id":"USER_ID"
  },
  "recipient":{
    "id":"PAGE_ID"
  },
  "timestamp":1458692752478,
  "message":{
    "mid":"mid.1457764197618:41d102a3e1ae206a38",
    "text":"hello, world!",
    "quick_reply": {
      "payload": "DEVELOPER_DEFINED_PAYLOAD"
    }
  }
}    

The message is parsed and extracted.

message_text = message_event["message"]["text"]

This message is processed and reply is generated using neural networks.

reply = process_msg(message_text)

This is how things work inside process_msg(),

def process_msg(message_text):
    intent = action_predict(str(message_text)) #predicting action
    if intent != "none": #if the message is a command
        k = dsl(intent)
        reply = k.generate()
        return reply
    else: #if the message is just chitchat
        reply = reply_predict(message_text)
        return reply
        

The predict_action() function output an action to be performed or "none" if no intent recognised. If intent is found then action is executed in dsl.py and a reply is generated. If predict_action() return "none", that means its a normal conversation like,
"hello how are you ?"
Another model called seqtoseq will generate a reply for the question.
We use two neural network models in Rita

1. Intent Recognition model

intent = predict_action(str(message_text))

Which will predict the action to be done by the bot from the message. For example say "tell me about RIT", for this question bot may reply with link to RIT website. This is an example tutorial for how to build an intent recogniser. The dataset used to train this model is stored in

 action_dataset.json

The intent recognition model can be trained by running

python3 action_train.py

2. SeqtoSeq model

This model is used for implementing normal conversations for questions like "hello how are you ?" Its a neural network model that will translate the question to answer like this. alt text
Seqtoseq model can be trained by running,

python3 seqtoseq_train.py

SeqtoSeq model in pytorch can be implemented like this.

Tasks

1. chitchat dataset

AI assistants like google assistant are trained with huge conversatonal dataset extracted from email and google plus chat data collections. Those datasets are not available for public. Rita need such a dataset for training the coversational model.

chitchat_dataset.json

is created for collecting that dataset. It contain,

question:

and

answer:

for each sample.

unleash your sarcasm level, contribute in the dataset !
Add more questions and answers in

seqtoseq_dataset.json

like this,


   {
       "question": "your question",
       "answer": "its answer"
   },

2. Action_dataset

Make a list of actions to be performed by Rita.Create dataset for those actions inside

action_dataset.json 

in the form like this,

"intent": "website","sentence": "open college website"
"intent":"website", "sentence":"show me RIT website"
"intent":"website", "sentence":"give me more information"
"intent":"website", "sentence":"tell me more about RIT"

Then train the models again by running ``` bash setup.sh ```

See you on Ritu ❤️

rita's People

Contributors

gksoriginals avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rita's Issues

List out tasks

@GopikrishnanSasikumar Can you explain the project and what the bot is being designed for. Also if you list out the tasks one by one we can start contributing.
Also it would be good if add in some good tutorials to be familiar with this design.

Use gitignore

Use gitignore to not commit unnecessary files and binaries.

Eg.

  • .DS_store in Mac
  • .idea/ folder when using Jetbrains.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.