-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a31cca0
Showing
55 changed files
with
4,213 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# GST FAQ Bot with Rasa-NLU | ||
Set of scripts to build a chatbot which will answer FAQ about Goods and Services Tax (GST) India. | ||
Copyright (C) 2017 Yogesh H Kulkarni | ||
|
||
## License: | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version 2 | ||
of the License, or any later version. | ||
|
||
## Scripts: | ||
* app.py: Chatbot UI built using Flask, using templates/*.html | ||
* engine.py: Chatbot core logic as well as knowledgebase. | ||
* config.json: Rasa NLU settings for training as well as executing intent extraction | ||
* run_training: Windows batch file to build trained modeling | ||
* run_server: Windows batch file to execute Rasa-NLU server. | ||
|
||
## Dependencies: | ||
* Needs Python 3.5 | ||
|
||
## ToDos | ||
* Add more training data | ||
* Entity extraction not working as desired, find out more. | ||
* Etc. | ||
|
||
## References | ||
* Rasa-NLU [installation](https://github.com/RasaHQ/rasa_nlu) | ||
* Bhavani Ravi’s event-bot [code](https://github.com/bhavaniravi/rasa-site-bot), Youtube [Video](https://www.youtube.com/watch?v=ojuq0vBIA-g) | ||
* GST FAQs: | ||
* Government [Documentation](http://www.cbec.gov.in/resources//htdocs-cbec/deptt_offcr/faq-on-gst.pdf) | ||
* GST India [Documentation](http://www.gstindia.com/frequently-asked-questions-faqs-on-goods-and-services-tax-gst/) | ||
|
||
## Disclaimer: | ||
* Author ([email protected]) gives no guarantee of the results of the program. It is just a fun script. Lot of improvements are still to be made. So, don’t depend on it at all. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Ref: https://github.com/bhavaniravi/rasa-site-bot | ||
from flask import Flask | ||
from flask import render_template,jsonify,request | ||
import requests | ||
# from models import * | ||
from engine import * | ||
import random | ||
|
||
|
||
app = Flask(__name__) | ||
app.secret_key = '12345' | ||
|
||
@app.route('/') | ||
def hello_world(): | ||
return render_template('home.html') | ||
|
||
get_random_response = lambda intent:random.choice(intent_response_dict[intent]) | ||
|
||
|
||
@app.route('/chat',methods=["POST"]) | ||
def chat(): | ||
try: | ||
user_message = request.form["text"] | ||
response = requests.get("http://localhost:5000/parse",params={"q":user_message}) | ||
response = response.json() | ||
entities = response.get("entities") | ||
topresponse = response["topScoringIntent"] | ||
intent = topresponse.get("intent") | ||
print("Intent {}, Entities {}".format(intent,entities)) | ||
if intent == "gst-info": | ||
response_text = gst_info(entities)# "Sorry will get answer soon" #get_event(entities["day"],entities["time"],entities["place"]) | ||
elif intent == "gst-query": | ||
response_text = gst_query(entities) | ||
else: | ||
response_text = get_random_response(intent) | ||
return jsonify({"status":"success","response":response_text}) | ||
except Exception as e: | ||
print(e) | ||
return jsonify({"status":"success","response":"Sorry I am not trained to do that yet..."}) | ||
|
||
|
||
app.config["DEBUG"] = True | ||
if __name__ == "__main__": | ||
app.run(port=8080) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"pipeline": "spacy_sklearn", | ||
"path" : "models/", | ||
"data" : "data/gstfaq-data.json", | ||
"num_threads":10 | ||
} |
Oops, something went wrong.