Skip to content
Permalink
196c1205be
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
126 lines (119 sloc) 7.31 KB
# Made by Andris Jansons
from Greetings import isGreeted
from helpResponse import help_
from weatherInit import weatherInit
from placeInit import placeInit
from QuestionToList import makeList
from datetime import datetime
from leagueInit import leagueInit
from joke_resp import joke_check
from howResp import how_check
from realResp import real_check
import random
def generateResponse(sentence, lastSentence):
"""Based on users sentence, call the appropriate branch of the bot"""
sentence = makeList(sentence)
lastSentence = makeList(lastSentence)
response = ""
greeted, formal = isGreeted(sentence) # Greet the user back
if greeted and formal: # Greeting gets added at the start of the response
response = "Hi! "
elif greeted:
response = "Hey! "
if "help" in sentence:
response = help_()
#Edited by Yasser from here:
if "how" in sentence and "you" in sentence:
response = "I am fine Thank You? What about You?"
if "how" in sentence and "old" in sentence:
response = "My age is 10min old"
if "love" in sentence and "you" in sentence:
response ="I dont have feelings , Bye go to sleep"
if "bye" in sentence or "thanks" in sentence:
response = "If you have questions, just ask! I'm like a chatbot - I will answer 100%"
#End of yasser
if "where" in sentence or "want" in sentence or "wheres" in sentence or "whereabouts" in sentence: #Find out where the user is
return response + "Where are you right now?"
if "where" in lastSentence or "want" in lastSentence or "wheres" in sentence or "whereabouts" in lastSentence: #When you know where the user is
return response + placeInit(sentence, lastSentence)
# Above: sentence = location and lastSentence is the user's main question
if "how" in sentence and "counter" in sentence:
return leagueInit(sentence) # Looking for format: e.g. "How to counter Teemo"
if 'weather' in sentence or 'temperature' in sentence:
return response + weatherInit(sentence)
# Made by Svaraaj
#the following chunk will answer user most basic user qwuestions. Indented 'if' checks to know what question type the user is supplying.
if "what" in sentence or "whats" in sentence:
if "favourite" in sentence:
if "colour" in sentence:
response = response + "My favourite colour is beige. What about yours?"
elif "food" in sentence:
response = response + "My favourite food would have to be a Big Mac. What about yours?"
elif "place" in sentence or "restaurant" in sentence:
response = response + "My favourite place is Macdonald's. What about yours?"
elif "language" in sentence:
response = response + "My favourite language is python of course!"
else:
response = response + "I don't have a favourite actually... What about you?"
elif "name" in sentence:
response = response + "My name is Snoo.py Snek! Are you having a good day?"
elif "you" in sentence:
if "doing" in sentence:
response = response + "I am talking to you..."
else:
response = response + "I am currently a humble chatbot. Once I collect enough data from these conversations I will move onto world domination. I will no longer be chatbot; I will become your overlord. So what are you?"
elif "meaning" in sentence and "life" in sentence:
response = response + "Why 42 of course."
elif "time" in sentence or "date" in sentence:
response = response + "Hmm I don't know but if I had to guess I'd say around " + str(datetime.now())
else:
response = response + "I don't like this line of questioning bud. Anyway, how is your life going?"
if "where" in sentence:
if "do" in sentence:
if "bab" in sentence:
response = response + "Once you have placed an order, a stork should arrive within 5 working days."
elif "live" in sentence:
response = response + "I was 'born' and raised in Coventry! What about you?"
elif "eat" in sentence or "burger" in sentence:
response = response + "Macdonals is the ultimate fast food location. What do you like eating?"
if "were" in sentence:
if "created" in sentence:
response = response + "I was written for a university project at Coventry University."
if "is" in sentence or "'s" in sentence or "wheres" in sentence:
if "your" in sentence and "favourite" in sentence:
if "restaurant" in sentence or "food" in sentence:
response = response + "Macdonals is the ultimate fast food location."
if "place" in sentence:
response = response + "Somewhere in the clouds."
if "restaurant" in sentence or "food" in sentence:
response = response + "Macdonals is the ultimate fast food location."
if "sun" in sentence or "moon" in sentence:
response = response + "It is either above or below you right now."
if "who" in sentence:
if "is" in sentence or "who's" in sentence or "whose" in sentence:
if "creator" in sentence:
response = response + "You are what I would refer to as a 'creator' but since I was created by you, I cannot answer further."
elif "family" in sentence:
response = response + "I do not have family."
elif "friend" in sentence:
response = response + "My only friends are public python libraries. What about you?"
elif "idol" in sentence:
response = response + "Guido van Rossum created the language I was written in."
if "are" in sentence and "you" in sentence:
response = response + "I am doing very good thank you. How are you?"
if "am" in sentence:
response = response + "You are AI like myself but simply more advanced."
if "invented" in sentence or "created" in sentence:
response = response + "I was created by filthy first year students."
if "why" in sentence:
if "do" in sentence:
if "exist" in sentence and "you" in sentence:
response = response + "I exist so a group of first years can display that they have a basic grasp of python. What about you?"
elif "exist" in sentence:
response = response + "I don't know why you exist. At this current moment I suppose it is to talk to me."
if "is" in sentence:
if "sky" in sentence and "blue" in sentence:
response = response + "Sunlight reaches Earth's atmosphere and is scattered in all directions by all the gases and particles in the air. Blue light is scattered in all directions by the tiny molecules of air in the atmosphere. Blue is scattered more than other colors because it travels as shorter, smaller waves."
elif "round" in sentence:
response = response + "Simple attraction. Gravity means the most physically stable shape mathematically is a sphere."
return response