Could you use chatterbot pakage

#1
by RITESHRAJ - opened

This is a demo code i created offcourse there is some error in it but you guys could give a short
from chatterbot import ChatBot
from chatterbot_weather import WeatherLogicAdapter

Create a new chat bot named Weather Bot

chatbot = ChatBot(
'Weather Bot',
logic_adapters=[
# {
# 'import_path': 'chatterbot.logic.BestMatch'
# },
{
'import_path': 'chatterbot_weather.WeatherLogicAdapter',
# You need to get an API key from https://openweathermap.org/api
'api_key': '',
# You can specify a default location for the weather queries
'default_location': ''
}
]
)

Train your chat bot with some weather related conversations

chatbot.train([
"What's the weather like today?",
"It's sunny and 25 degrees Celsius.",
"How about tomorrow?",
"It will be cloudy with a chance of rain.",
"Do I need an umbrella?",
"Yes, you might need one."
])

Get a response to an input statement

response = chatbot.get_response("Is it snowing?")
print(response)

Sign up or log in to comment