Skip to content
Permalink
Browse files
Add files via upload
  • Loading branch information
jansonsa committed Nov 13, 2017
1 parent 81f01e0 commit 1411aa100c063d99186c3923f453c127df309916
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
@@ -3,32 +3,28 @@ 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, "
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
@@ -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)
BIN +56.3 KB leagueData.txt
Binary file not shown.
@@ -0,0 +1,5 @@
from RiotAPI import leagueCounterTips
def leagueInit(sentence):
i = sentence.index("counter")
champion = sentence[i+1]
return leagueCounterTips(champion)
@@ -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"))

0 comments on commit 1411aa1

Please sign in to comment.