# Create a new instance of a ChatBot chatbot = ChatBot("Terminal", read_only=True, storage_adapter="chatbot.adapters.storage.MongoDatabaseAdapter", logic_adapters=[ "chatbot.adapters.logic.AttributeLogicAdapter", "chatbot.adapters.logic.TimeLogicAdapter", "chatbot.adapters.logic.WeatherLogicAdapter", "chatbot.adapters.logic.MovieLogicAdapter", "chatbot.adapters.logic.ClosestMatchAdapter" ], io_adapter="chatbot.adapters.io.TerminalAdapter", pyowm_api_key="cf798079c1e5c638a93cc16cff6d7171", #user_profile="user.pkl", database="chatterbot-database") ''' chatbot.train("chatbot.corpus.english.overview") chatbot.train("chatbot.corpus.english.greetings") chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.atomic") chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.atomic-categories0") chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.knowledge") chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.ai") chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.astrology") chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.biography") chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.computers") chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.emotion") chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.geography") chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.misc") chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.music") chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.politics") chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.psychology")
from chatbot import ChatBot if __name__ == '__main__': chatbot = ChatBot('Tom') chatbot.train([ "Hi, can I help you?", "Sure, I'd like to book a flight to Iceland.", "Your flight has been booked." ])
chatbot = ChatBot("HiBot", read_only=False, storage_adapter="chatbot.adapters.storage.JsonDatabaseAdapter", #storage_adapter="chatbot.adapters.storage.MongoDatabaseAdapter", logic_adapters=[ "chatbot.adapters.logic.AttributeLogicAdapter", "chatbot.adapters.logic.EvaluateMathematically", "chatbot.adapters.logic.WeatherLogicAdapter", "chatbot.adapters.logic.TimeLogicAdapter", "chatbot.adapters.logic.ClosestMatchAdapter" ], pyowm_api_key="cf798079c1e5c638a93cc16cff6d7171", database="chaerbot-database_test.db") # Train based on the english corpus #chatbot.train("chatterbot.corpus.english") chatbot.train("chatbot.corpus.english.greetings") #chatbot.train("chatbot.corpus.english.conversations") chatbot.train("chatbot.corpus.english.trivia") #chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.ai") #chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.drugs") #chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.sex") #chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.atomic") ##chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.science") #chatbot.train("chatbot.corpus.english.AIML.AIML_IN_JSON.misc") ''' chatbot = ChatBot("HiBot", read_only=False, #storage_adapter="chatbot.adapters.storage.JsonDatabaseAdapter", storage_adapter="chatbot.adapters.storage.MongoDatabaseAdapter", logic_adapters=[ "chatbot.adapters.logic.AttributeLogicAdapter",
from chatbot import ChatBot if __name__ == '__main__': bot = ChatBot("train") bot.train()
from chatbot import ChatBot import pandas as pd '''import nltk #baixar em models: rslp e punckt #baixar em corpora: stopwords nltk.download() ''' df = pd.read_csv('./chatbot_dataset_treino.csv') chatbot = ChatBot() chatbot.train(df, 'Pergunta', 'Assunto') print("####### CHATBOT Alpha 0.0.1 #######") while True: question = input('Pergunta: ') answer_id = chatbot.answer(question) full_answer = chatbot.full_answer(answer_id, 'Assunto') print('Chatbot: ', full_answer)