thanks for clicking in. I am building a website with Flask, and I want to insert a chat bot in it. You can see there is nothing yet. This is app.py
from flask import Flask
from flask import url_for, redirect, render_template
app = Flask(__name__)
@app.route('/')
def home_get():
return render_template('show.html')
app.secret_key = '45653537'
if __name__ == "__main__":
app.run()
The bot does not aim to be AI. It is very dumb and simple. How can i build the chat environment like that in Cleverbot? This is bot.py
import random
GREETING_KEYWORDS = ["hello", "hi", "greetings", "sup", "what's up"]
GREETING_RESPONSES = ["'sup bro", "hey", "*nods*", "hey you get my snap?"]
while True:
sentence = raw_input().lower()
if set(GREETING_KEYWORDS).intersection(sentence.split()):
print(random.choice(GREETING_RESPONSES))
else:
print("what?")
Thank you very much!
Aucun commentaire:
Enregistrer un commentaire