python
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
import tkinter as tk
Création du chatbot
bot = chatbot(" Assistant ")
trainer = ChatterBotCorpusTrainer(bot)
trainer.train("chatterbot.corpus.french") # Tu peux aussi ajouter english
Interface graphique
fenetre = tk.Tk()
fenetre.title("ChatBot avec ChatterBot")
Zone d'affichage
conversation = tk.Text(fenetre)
conversation.pack()
champ_texte = tk.Entry(fenetre)
champ_texte.pack()
def envoyer():
question = champ_texte.get()
reponse = bot.get_response(question)
conversation.insert(tk.END, "Vous : " + question + "\n")
conversation.insert(tk.END, "Bot : " + str(reponse) + "\n\n")
champ_texte.delete(0, tk.END)
Bouton d'envoi
bouton_envoyer = tk.Button(fenetre, text="Envoyer", command=envoyer)
bouton_envoyer.pack()
fenetre.mainloop()
python
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
import tkinter as tk
Création du chatbot
bot = chatbot(" Assistant ")
trainer = ChatterBotCorpusTrainer(bot)
trainer.train("chatterbot.corpus.french") # Tu peux aussi ajouter english
Interface graphique
fenetre = tk.Tk()
fenetre.title("ChatBot avec ChatterBot")
Zone d'affichage
conversation = tk.Text(fenetre)
conversation.pack()
champ_texte = tk.Entry(fenetre)
champ_texte.pack()
def envoyer():
question = champ_texte.get()
reponse = bot.get_response(question)
Bouton d'envoi
bouton_envoyer = tk.Button(fenetre, text="Envoyer", command=envoyer)
bouton_envoyer.pack()
fenetre.mainloop()