diff --git a/Get_Functions.py b/Get_Functions.py index e5c8200..417a079 100644 --- a/Get_Functions.py +++ b/Get_Functions.py @@ -14,15 +14,7 @@ randomStuff = ["Cherophobia is the fear of fun","A flock of crows is called a mu def getName(sentence): """get the name of the user from the inputed sentence""" - #first - getting rid of unwanted chars - unwantedChar = [".","'","!","?",","] - newSentence = "" - for char in sentence: - if char not in unwantedChar: - newSentence = newSentence + char - newSentence = newSentence.lower() # makes all letters into lowercase - much easier and more efficient - - userWords = newSentence.split() #the sentence is split up into words and put into a list + userWords = sentence.split() #the sentence is split up into words and put into a list # ways of introduction: # "Hello, my name is ___" diff --git a/determineUserInput.py b/determineUserInput.py index 051d6b5..05c130b 100644 --- a/determineUserInput.py +++ b/determineUserInput.py @@ -9,12 +9,17 @@ def determineUserInput(sentence): response = "" sentence = sentence.lower() sentenceParse = sentence.split() - + #first - getting rid of unwanted chars + unwantedChar = [".","'","!","?",","] + newSentence = "" + for char in unwantedChar: + sentence.replace(char,"") + 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[0] in "abcd": + elif sentenceParse[0] in "abcd": response = sentence, 3 else: response = sentence, 0