GithubHelp home page GithubHelp logo

chatbotta's Introduction

ChatbotTA

A chatbot teaching assistant to answer student questions via slack

Setup

To run locally, you'll need:

First, export your Slack API key:

$ export SLACK_API_TOKEN="your-slack-api-key-goes-here"

Install dependencies:

$ npm install

Then, run the script:

$ node slackbot.js

Chat with your bot via direct message in Slack. Ask it a question, and it will respond.

Setting up your own Watson instance

For setting up your own instance of the Watson Retrieve and Rank API, grab your credentials (username and password) from Bluemix.

First, you'll need to create the Redis cluster:

$ curl -X POST -u "{username}":"{password}" "https://gateway.watsonplatform.net/retrieve-and-rank/api/v1/solr_clusters" -d ""

You'll get a redis cluster id in return. You'll need that for the following commands.

Next, you'll need to configure the Redis cluster and set the schema.

$ curl -X POST -H "Content-Type: application/zip" -u "{username}":"{password}" "https://gateway.watsonplatform.net/retrieve-and-rank/api/v1/solr_clusters/{solr_cluster_id}/config/example_config" --data-binary @./solr_config.zip

Create a collection:

$ curl -X POST -u "{username}":"{password}" "https://gateway.watsonplatform.net/retrieve-and-rank/api/v1/solr_clusters/{solr_cluster_id}/solr/admin/collections" -d "action=CREATE&name=example_collection&collection.configName=example_config"

Then you'll need to parse the forum data into questions and answers. Unzip the forum dataset located at ./forum_data/forum_data.tar.gz

Use the parse_answers awk progfile to parse the data for answers into a new parsed_answers.json:

$ awk -f parse_answers ./forum_data/forum_node.tsv > ./forum_data/parsed_answers.json

Use the parse_questions awk progfile to parse the data for questions with which to train Watson into a new parsed_questions.csv:

$ awk -f parse_questions ./forum_data/forum_node.tsv > ./forum_data/parsed_questions.csv

Upload the answers to Watson:

$ curl -X POST -H "Content-Type: application/json" -u "{username}":"{password}" "https://gateway.watsonplatform.net/retrieve-and-rank/api/v1/solr_clusters/{solr_cluster_id}/solr/example_collection/update" --data-binary @./forum_data/parsed_answers.json

Train watson using the following script.

$ python ./train.py -u {username}:{password} -i ./forum_data/parsed_questions.csv -c {solr_cluster_id} -x example_collection -n "example_ranker"

Training will take time (+20min).

You can then lob questions against the watson endpoint:

$ curl https://{username}:{password}@gateway.watsonplatform.net/retrieve-and-rank/api/v1/solr_clusters/{solr_cluster_id}/solr/example_collection/select?&wt=json&fl=answer&q={your question for watson goes here}

Example watson response

Or you can chat it up with the bot directly:

Example bot response

chatbotta's People

Contributors

lhawley avatar nathanielwroblewski avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

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.