mirror of
				https://github.com/KevinMidboe/termForecast.git
				synced 2025-10-29 18:00:17 +00:00 
			
		
		
		
	Better commenting on functions and conditions
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 12:27:31 | # @Last Modified time: 2017-07-29 12:34:58 | ||||||
|  |  | ||||||
| from fuzzywuzzy import process | from fuzzywuzzy import process | ||||||
|  |  | ||||||
| @@ -16,13 +16,16 @@ weather_nouns = ['cleary sky', 'fair', 'cloudy', 'rain showers', 'rain', 'sleet' | |||||||
| # and then match the second to list and add that emoji  | # and then match the second to list and add that emoji  | ||||||
| # REGEX this bitch up | # REGEX this bitch up | ||||||
|  |  | ||||||
|  | # Splits and lowers the condition text for easier parsing | ||||||
| def splitCondition(condition): | def splitCondition(condition): | ||||||
| 	condition = condition.lower() | 	condition = condition.lower() | ||||||
| 	return condition.split() | 	return condition.split() | ||||||
|  |  | ||||||
|  | # Trying to analyze the semantics of the condition text | ||||||
| def findConditionContext(condition_text): | def findConditionContext(condition_text): | ||||||
| 	condition_expression = splitCondition(condition_text) | 	condition_expression = splitCondition(condition_text) | ||||||
|  |  | ||||||
|  | 	# Iterate over each word and find what matches 100% | ||||||
| 	for expression_value in condition_expression: | 	for expression_value in condition_expression: | ||||||
| 		noun_matches = process.extract(expression_value, weather_nouns) | 		noun_matches = process.extract(expression_value, weather_nouns) | ||||||
| 		print(expression_value + ': ' + str(noun_matches)) | 		print(expression_value + ': ' + str(noun_matches)) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user