mirror of
https://github.com/KevinMidboe/termForecast.git
synced 2025-10-29 09:50:18 +00:00
Grammar fixing. Changed all places with forcast for the correct forecast
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-30 10:31:52
|
# @Last Modified time: 2017-07-30 13:17:19
|
||||||
|
|
||||||
from fuzzywuzzy import process
|
from fuzzywuzzy import process
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ class EmojiParser(object):
|
|||||||
self.nouns = [sentence]
|
self.nouns = [sentence]
|
||||||
|
|
||||||
|
|
||||||
# Use the symbol_table to convert the forcast name to emoji
|
# Use the symbol_table to convert the forecast name to emoji
|
||||||
def emojify(self, noun):
|
def emojify(self, noun):
|
||||||
return symbol_table[noun]
|
return symbol_table[noun]
|
||||||
|
|
||||||
@@ -115,18 +115,18 @@ class EmojiParser(object):
|
|||||||
|
|
||||||
return ' '.join(returnList)
|
return ' '.join(returnList)
|
||||||
|
|
||||||
def findPrimaryForcast(self):
|
def findPrimaryForecast(self):
|
||||||
# Copies the contents not the refrence to the list
|
# Copies the contents not the refrence to the list
|
||||||
noun_list = list(self.nouns)
|
noun_list = list(self.nouns)
|
||||||
forcast = noun_list.pop(0)
|
forecast = noun_list.pop(0)
|
||||||
|
|
||||||
# Translates to emoji once here instead of twice below
|
# Translates to emoji once here instead of twice below
|
||||||
forcast_emoji = self.emojify(forcast)
|
forecast_emoji = self.emojify(forecast)
|
||||||
|
|
||||||
if forcast in severity:
|
if forecast in severity:
|
||||||
return ('%s %s' % (forcast_emoji, severity[forcast]))
|
return ('%s %s' % (forecast_emoji, severity[forecast]))
|
||||||
else:
|
else:
|
||||||
return forcast_emoji
|
return forecast_emoji
|
||||||
|
|
||||||
|
|
||||||
# Trying to analyze the semantics of the condition text
|
# Trying to analyze the semantics of the condition text
|
||||||
@@ -135,10 +135,10 @@ class EmojiParser(object):
|
|||||||
self.findWeatherTokens()
|
self.findWeatherTokens()
|
||||||
self.severityValue()
|
self.severityValue()
|
||||||
|
|
||||||
primary_forcast = self.findPrimaryForcast()
|
primary_forecast = self.findPrimaryForecast()
|
||||||
secondary_forcast = self.emojifyList(self.nouns[1:])
|
secondary_forecast = self.emojifyList(self.nouns[1:])
|
||||||
|
|
||||||
return ('%s %s' % (primary_forcast, secondary_forcast))
|
return ('%s %s' % (primary_forecast, secondary_forecast))
|
||||||
|
|
||||||
|
|
||||||
def convertSematicsToEmoji(self):
|
def convertSematicsToEmoji(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user