diff --git a/ResponseGenerator.py b/ResponseGenerator.py index 38866d4..bc9fc23 100644 --- a/ResponseGenerator.py +++ b/ResponseGenerator.py @@ -3,6 +3,7 @@ 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) @@ -10,25 +11,20 @@ def generateResponse(sentence, lastSentence): response = "" greeted, formal = isGreeted(sentence) # 2 booleans if greeted and formal: - response = "Hi, " + response = "Hi " elif greeted: - response = "Hey, " + response = "Hey " if "where" in sentence or "want" in sentence or "whereabouts" in sentence: #Find out where the user is - response = response + "Where are you right now?" + 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 - response = response + placeInit(sentence, lastSentence) + return response + placeInit(sentence, lastSentence) - - # greet_keywords = ["Hello" , "hello", "Hi" , "hi" , "What's up", "what's up", "Sup", "sup", "How's it going","Howdy", "Yo", "Greetings", "greetings"] - # greet_responces = ["Hello there! ", "Hey" , "Hello to you, too!", "Oh, hi there!", "Look who it is!"] - # for word in greet_keywords: - # if word in sentence: - # if len(response) < 2: - # response = random.choice(greet_responces) + 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: + 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?" @@ -60,6 +56,6 @@ def generateResponse(sentence, lastSentence): if 'weather' in sentence or 'temperature' in sentence: - response = response + weatherInit(sentence) + return weatherInit(sentence) return response diff --git a/client1.py b/client1.py index 53b9b4e..7c64b25 100644 --- a/client1.py +++ b/client1.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 import socket -import win32com.client as wincl +#import win32com.client as wincl client = socket.socket() # Connect to IP:Port port = 12346 client.connect(('localhost', port)) @@ -14,9 +14,9 @@ try: msg = rawmsg.decode('utf-8').rstrip('\r\n') # Decode received message from bits to string print(msg) # convert and clean the input - speak = wincl.Dispatch("SAPI.SpVoice") - msg = msg.replace('m/s','meters per second') # So speach reads m/s correctly - speak.Speak(msg) + #speak = wincl.Dispatch("SAPI.SpVoice") + #msg = msg.replace('m/s','meters per second') # So speach reads m/s correctly + #speak.Speak(msg) except KeyboardInterrupt: print('Shutdown') client.shutdown(1) diff --git a/leagueData.txt b/leagueData.txt new file mode 100644 index 0000000..ab9850e Binary files /dev/null and b/leagueData.txt differ diff --git a/leagueInit.py b/leagueInit.py new file mode 100644 index 0000000..4c9bd8d --- /dev/null +++ b/leagueInit.py @@ -0,0 +1,5 @@ +from RiotAPI import leagueCounterTips +def leagueInit(sentence): + i = sentence.index("counter") + champion = sentence[i+1] + return leagueCounterTips(champion) diff --git a/placeFinderFinal.py b/placeFinderFinal.py index 82e585c..60ba0da 100644 --- a/placeFinderFinal.py +++ b/placeFinderFinal.py @@ -45,4 +45,3 @@ def findPlace(location_str='Coventry University',keyword_str='Food'): placePhone = None finally: return placeName, placeAddress, placeWebsite, placePhone -print(findPlace("Coventry UK","burger"))