Add fuzzy and text-classification light model #1
					 2 changed files with 13 additions and 4 deletions
				
			
		Add date
				commit
				
					
					
						a44ea35b7d
					
				
			
		|  | @ -64,6 +64,8 @@ class Ratatouille(): | |||
|         command = payload['intentName'] | ||||
|         if command == 'GetTime': | ||||
|             return self.send_hour() | ||||
|         elif command == 'GetDate': | ||||
|             return self.send_date() | ||||
|         elif command == "LightOn": | ||||
|             return self.light_on_single(payload['intentArg'][0]) | ||||
|         elif command == "LightOff": | ||||
|  |  | |||
|  | @ -1,7 +1,10 @@ | |||
| from src.tools.str import int_to_str | ||||
| 
 | ||||
| MONTHS = ['janvier','février','mars','avril','mai','juin','juillet','aout','septembre','octobre','novembre','decembre'] | ||||
| WEEKDAY = ['lundi','mardi','mercredi','jeudi','vendredi','samedi','dimanche'] | ||||
| MONTHS = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', | ||||
|           'juillet', 'aout', 'septembre', 'octobre', 'novembre', 'decembre'] | ||||
| WEEKDAY = ['lundi', 'mardi', 'mercredi', | ||||
|            'jeudi', 'vendredi', 'samedi', 'dimanche'] | ||||
| 
 | ||||
| 
 | ||||
| def get_time(date): | ||||
|     hour = date.hour | ||||
|  | @ -13,11 +16,12 @@ def get_time(date): | |||
|     elif minute == 45: | ||||
|         return 'il est '+format_hour(hour+1)+' moins le quart' | ||||
|     elif minute == 15: | ||||
|         return 'il est '+format_hour(hour+1)+' et quart' | ||||
|         return 'il est '+format_hour(hour)+' et quart' | ||||
|     else: | ||||
|         return 'il est '+format_hour(hour)+' '+str(minute) | ||||
|     return | ||||
| 
 | ||||
| 
 | ||||
| def get_date(date): | ||||
|     week_day = date.weekday() | ||||
|     day = date.day | ||||
|  | @ -26,6 +30,7 @@ def get_date(date): | |||
|     return 'Nous somme le '+format_weekday(week_day)+' '+str(day)+' '+format_month(month)+' '+str(year) | ||||
|     # self.yoda.say('Nous somme le '+str(week_day)+' '+str(day)+' '+str(month)+' '+str(year)) | ||||
| 
 | ||||
| 
 | ||||
| def format_hour(hour): | ||||
|     if hour == 12: | ||||
|         return 'midi' | ||||
|  | @ -34,8 +39,10 @@ def format_hour(hour): | |||
| 
 | ||||
|     return int_to_str(hour, 'f') + ' heure' | ||||
| 
 | ||||
| 
 | ||||
| def format_month(month): | ||||
|     return MONTHS[month - 1] | ||||
| 
 | ||||
| 
 | ||||
| def format_weekday(week_day): | ||||
|     return WEEKDAY[week_day] | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue