Skip to content
Permalink
Browse files
Added option to catch if the user doesnt want to answer and if the se…
…ntence starts with i and the second word is am join them to compare to greetings list
  • Loading branch information
mateussa committed Nov 10, 2017
1 parent 7fa3ad8 commit e8ece04734404ba2844b8dce8f90a5c0b4737579
Showing 1 changed file with 9 additions and 2 deletions.
@@ -1,6 +1,7 @@
operatorList = ["+","-","*","/","plus","minus","times","divided"]
numberList = ["1","2","3","4","5","6","7","8","9","0"]
questionStarters = ["what","whats","are","how","hows","do"]
notAnswer = ["dont want to", "i dont want to", "its enough", "dont want more"]

from Get_Functions import *

@@ -16,14 +17,20 @@ def determineUserInput(sentence):

sentenceParse = sentence.split()

if (sentenceParse[0] == "i" and len(sentenceParse) > 1):
if (sentenceParse[1] == "am"):
sentenceParse.insert(0, " ".join(sentenceParse[0:2]))

if sentenceParse[0] in questionStarters: # ------------- execute the "what is" code here ---------------
response = respondQuestion(sentence), 2
elif sentenceParse[0] in greetings:
response = getName(sentence), 1
elif sentence in "abcd":
response = sentence, 3
elif (sentence.casefold() == "Yes") or (sentence.casefold() == "No"):
response = sentence, 4
elif (sentence.casefold() == "Yes".casefold()) or (sentence.casefold() == "No".casefold()):
response = sentence, 4
elif sentence in notAnswer:
response = sentence, 5
else:
response = sentence, 0
return response

0 comments on commit e8ece04

Please sign in to comment.