mirror of
https://github.com/KevinMidboe/termForecast.git
synced 2025-10-29 09:50:18 +00:00
Now term_weather uses emojiParser to translate the output of yr to emoji icons
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
# @Author: KevinMidboe
|
# @Author: KevinMidboe
|
||||||
# @Date: 2017-07-29 11:56:24
|
# @Date: 2017-07-29 11:56:24
|
||||||
# @Last Modified by: KevinMidboe
|
# @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
|
from fuzzywuzzy import process
|
||||||
|
|
||||||
@@ -114,18 +114,18 @@ class EmojiParser(object):
|
|||||||
self.findWeatherTokens()
|
self.findWeatherTokens()
|
||||||
|
|
||||||
noun_list = self.nouns
|
noun_list = self.nouns
|
||||||
print(noun_list)
|
|
||||||
|
|
||||||
primary_forcast = noun_list.pop(0)
|
primary_forcast = noun_list.pop(0)
|
||||||
primary_severity = severity[primary_forcast][self.severity]
|
primary_severity = severity[primary_forcast][self.severity]
|
||||||
secondary_forcast = self.emojifyList(noun_list)
|
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):
|
def convertSematicsToEmoji(self):
|
||||||
self.severityValue()
|
self.severityValue()
|
||||||
self.emojifyWeatherForecast()
|
emojiForcast = self.emojifyWeatherForecast()
|
||||||
|
return emojiForcast
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# @Author: KevinMidboe
|
# @Author: KevinMidboe
|
||||||
# @Date: 2017-07-27 21:26:53
|
# @Date: 2017-07-27 21:26:53
|
||||||
# @Last Modified by: KevinMidboe
|
# @Last Modified by: KevinMidboe
|
||||||
# @Last Modified time: 2017-07-29 12:29:34
|
# @Last Modified time: 2017-07-29 18:36:36
|
||||||
|
|
||||||
# TODO LIST
|
# TODO LIST
|
||||||
# Get coordinates from IP ✔
|
# Get coordinates from IP ✔
|
||||||
@@ -18,6 +18,7 @@ import fire, json, geoip2.database, ssl
|
|||||||
from yr.libyr import Yr
|
from yr.libyr import Yr
|
||||||
from requests import get
|
from requests import get
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
from emojiParser import EmojiParser
|
||||||
|
|
||||||
|
|
||||||
class Location(object):
|
class Location(object):
|
||||||
@@ -143,6 +144,8 @@ class WeatherForcast(object):
|
|||||||
|
|
||||||
self.symbolVariables(now['symbol'])
|
self.symbolVariables(now['symbol'])
|
||||||
|
|
||||||
|
emojiParser = EmojiParser(now['symbol']['@name'])
|
||||||
|
print(emojiParser.convertSematicsToEmoji())
|
||||||
temp = now['temperature']
|
temp = now['temperature']
|
||||||
print(temp['@value'] + ' ' + temp['@unit'] + ' ' + self.symbol_table[self.name])
|
print(temp['@value'] + ' ' + temp['@unit'] + ' ' + self.symbol_table[self.name])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user