I have created python chatbot using flask framework using yml file now i want to use json file what should i do now

0 votes
Created python chatbot using flask framework?
Nov 19, 2020 in Python by golu
• 120 points
1,382 views

Hi, @Golu,

Could you please post your code snippet here so that we can understand what has been done and how can we help you!!!

1 answer to this question.

0 votes

Hello @golu ,

Try something like this:

with open(yaml_file, 'r') as yaml_in, open(json_file, 'a') as definition:
    parse_string(yaml_in.read(), data)
    json.dump(data, definition, indent=4)....

Hope it helps you. If not you can share your snippet so that I can help you out.

answered Nov 19, 2020 by Niroj
• 82,880 points
from flask import Flask,render_template,request
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer

app = Flask(__name__)


english_bot = ChatBot("Chatterbot",storage_adapter="chatterbot.storage.SQLStorageAdapter")
trainer = ChatterBotCorpusTrainer(english_bot)
trainer.train("chatterbot.corpus.english")
trainer.train("data/data.yml")

@app.route("/")
def index():
    return render_template("index.html") #to send context to html

@app.route("/get")
def get_bot_response():
     userText = request.args.get("msg") #get data from input,we write js  to index.html
     return str(english_bot.get_response(userText))


if __name__ == "__main__":
     app.run(debug = True)

Related Questions In Python

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

I want to download a file from the website by web scraping. Can anyone explain how to do this in jupyter lab (python) with an example?

Hey, Web scraping is a technique to automatically ...READ MORE

answered Apr 7, 2020 in Python by Gitika
• 65,910 points
2,066 views
0 votes
1 answer

what is vm options ? I installed Pycharm on my pc but it shows no vm options file found . What should i do please help me to fix it

Hi, @Mushfiqkhantrial, It is important to run pycharm.sh from the bin folder. The VM ...READ MORE

answered Oct 4, 2020 in Python by Gitika
• 65,910 points
1,512 views
0 votes
1 answer

How do I use urllib to see if a website is 404 or 200 in Python?

For Python 3, try doing this: import urllib.request, ...READ MORE

answered Nov 29, 2018 in Python by Nymeria
• 3,560 points

edited Dec 11, 2018 by Nymeria 13,287 views
0 votes
1 answer

How to use read a WSDL file from the file system using Python suds?

Hi, good question. It is a very simple ...READ MORE

answered Jan 21, 2019 in Python by Nymeria
• 3,560 points
7,642 views
0 votes
5 answers

What to study in Python to do freelancing using this?

Hello, you are on the right track. ...READ MORE

answered Feb 27, 2019 in Python by Priyaj
• 58,090 points
729 views
0 votes
1 answer

How to get the latest file in a folder using python?

Hello @kartik,  would suggest using glob.iglob() instead of the glob.glob(), as ...READ MORE

answered May 27, 2020 in Python by Niroj
• 82,880 points
10,928 views
0 votes
1 answer

How do I include related model fields using Django Rest Framework?

Hello @kartik, The simplest way is to use the ...READ MORE

answered Jul 1, 2020 in Python by Niroj
• 82,880 points
3,270 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP