Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
14 changed files
with
100 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
|
||
# Made by Andris Jansons | ||
|
||
KEYWORDS = "the, a, an, get, good, best, is, are, to, nice, pleasant, lovely, cool, fine, stupid, goddamn, great, large, small, medium, new, newest, old, closest, smallest, biggest, coolest".split(", ") | ||
|
||
|
||
def findFood(text): | ||
"""Finds food after special KEYWORDS""" | ||
found = False | ||
food = "" | ||
for word in text: | ||
for word in text: | ||
if found == False: | ||
if word == "get": | ||
continue | ||
if word in KEYWORDS: | ||
found = True | ||
found = True #Finds the first keyword | ||
food = word | ||
|
||
else: | ||
if word in KEYWORDS: | ||
food = food + " " + word | ||
continue | ||
food = food + " " + word | ||
break | ||
return food | ||
food = food + " " + word #If multiple keywords follow each other | ||
break # take all of them in account and the word | ||
return food # that follows them as well e.g. "The best burger" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#Not used | ||
#Made by Andris Jansons | ||
def sentenceSplitter(text): | ||
text = text.lower().split(" ") | ||
temp = "" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
import pyowm | ||
# Made by Andris Jansons | ||
import pyowm # (In case of errors) pip install pyowm | ||
|
||
owm = pyowm.OWM('de3ca9ba44d7bc37ce1279f34c3a0911') # You MUST provide a valid API key | ||
owm = pyowm.OWM('de3ca9ba44d7bc37ce1279f34c3a0911') # You get this at OpenWeatherMap | ||
|
||
def weatherFinder(location): | ||
"""For a specific location get weather data""" | ||
observation = owm.weather_at_place(location) | ||
w = observation.get_weather() | ||
print(w) | ||
w = observation.get_weather() | ||
|
||
# Weather details | ||
desc = w.get_detailed_status() | ||
wind = w.get_wind().get('speed') | ||
humidity = w.get_humidity() | ||
desc = w.get_detailed_status() # e.g. few clouds | ||
wind = w.get_wind().get('speed') # dictionary type | ||
humidity = w.get_humidity() # e.g. 98 | ||
temperature = w.get_temperature('celsius').get('temp') # {'temp_max': 10.5, 'temp': 9.7, 'temp_min': 9.0} | ||
return desc, str(temperature), str(wind), str(humidity) | ||
|
||
return desc, str(temperature), str(wind), str(humidity) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from RiotAPI import leagueCounterTips | ||
def leagueInit(sentence): | ||
"""Initialize League of Legends champion counter tips""" | ||
i = sentence.index("counter") | ||
champion = sentence[i+1] | ||
return leagueCounterTips(champion) | ||
champion = sentence[i+1] # The word that follows "counter" is the name of the champion | ||
return leagueCounterTips(champion) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
# Made by Andris Jansons | ||
from FoodFinder import findFood | ||
from placeFinderFinal import findPlace | ||
|
||
def placeInit(sentence, lastSentence): | ||
"""Initialize place finder""" | ||
|
||
food = findFood(lastSentence) #For example: food = the best burger | ||
# food can also be: hotel, bank etc. It's just easier to imagine talking about food | ||
placeName, placeAddress, placeWebsite, placePhone = findPlace(sentence, food) | ||
|
||
placeName, placeAddress, placeWebsite, placePhone = findPlace(sentence, food) # We get a tuple back | ||
|
||
if not(placeName == None): | ||
return "You can get "+food+" at "+placeName+"\nLocation: "+placeAddress | ||
else: #What happens when there is a error in Google Place API | ||
else: #What happens when there is an error in Google Place API | ||
return "I don't know where that is" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters