Skip to content
Permalink
1411aa100c
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
61 lines (51 sloc) 2.85 KB
from Greetings import isGreeted
from weatherInit import weatherInit
from placeInit import placeInit
from QuestionToList import makeList
from datetime import datetime
from leagueInit import leagueInit
import random
def generateResponse(sentence, lastSentence):
sentence = makeList(sentence)
lastSentence = makeList(lastSentence)
response = ""
greeted, formal = isGreeted(sentence) # 2 booleans
if greeted and formal:
response = "Hi "
elif greeted:
response = "Hey "
if "where" in sentence or "want" 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 "whereabouts" in lastSentence: #When you know where the user is
return response + placeInit(sentence, lastSentence)
if "how" in sentence and "counter" in sentence:
return leagueInit(sentence)
#the following chunk will answer user questions starting with 'What'. Still requires expansion -Svaraaj
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 'weather' in sentence or 'temperature' in sentence:
return weatherInit(sentence)
return response