diff --git a/emojiParser.py b/emojiParser.py index 9453bd5..83a2b5d 100755 --- a/emojiParser.py +++ b/emojiParser.py @@ -3,7 +3,7 @@ # @Author: KevinMidboe # @Date: 2017-07-29 11:56:24 # @Last Modified by: KevinMidboe -# @Last Modified time: 2017-07-29 18:26:06 +# @Last Modified time: 2017-07-29 18:36:55 from fuzzywuzzy import process @@ -114,18 +114,18 @@ class EmojiParser(object): self.findWeatherTokens() noun_list = self.nouns - print(noun_list) primary_forcast = noun_list.pop(0) primary_severity = severity[primary_forcast][self.severity] secondary_forcast = self.emojifyList(noun_list) - print('%s %s %s' % (self.emojify(primary_forcast), primary_severity, secondary_forcast)) + return ('%s %s %s' % (self.emojify(primary_forcast), primary_severity, secondary_forcast)) def convertSematicsToEmoji(self): self.severityValue() - self.emojifyWeatherForecast() + emojiForcast = self.emojifyWeatherForecast() + return emojiForcast def main(): diff --git a/term_weather.py b/term_weather.py index efdb99d..456549f 100755 --- a/term_weather.py +++ b/term_weather.py @@ -3,7 +3,7 @@ # @Author: KevinMidboe # @Date: 2017-07-27 21:26:53 # @Last Modified by: KevinMidboe -# @Last Modified time: 2017-07-29 12:29:34 +# @Last Modified time: 2017-07-29 18:36:36 # TODO LIST # Get coordinates from IP ✔ @@ -18,6 +18,7 @@ import fire, json, geoip2.database, ssl from yr.libyr import Yr from requests import get from pprint import pprint +from emojiParser import EmojiParser class Location(object): @@ -143,6 +144,8 @@ class WeatherForcast(object): self.symbolVariables(now['symbol']) + emojiParser = EmojiParser(now['symbol']['@name']) + print(emojiParser.convertSematicsToEmoji()) temp = now['temperature'] print(temp['@value'] + ' ' + temp['@unit'] + ' ' + self.symbol_table[self.name])