Add fuzzy and text-classification light model #1

Merged
Tjiho merged 18 commits from fuzzy into master 2025-02-01 01:35:11 +01:00
Showing only changes of commit 33ee285d88 - Show all commits

View file

@ -65,9 +65,9 @@ class Ratatouille():
if command == 'GetTime':
return self.send_hour()
elif command == "LightOn":
self.walle.light_on(payload['intentArg'][0])
self.light_on_single(payload['intentArg'][0])
elif command == "LightOff":
self.walle.light_off(payload['intentArg'][0])
self.light_off_single(payload['intentArg'][0])
def weather_query(self, entities):
if any(a in entities['B-weather_descriptor'] for a in TEMPERATURE_KEYWORD):
@ -113,6 +113,26 @@ class Ratatouille():
).replace('.', ' virgule ')
return 'il fait '+temperature+' degrés'
def light_off_single(self, lamp):
try:
self.walle.light_off(lamp)
except Exception as e:
logging.warning("Error light off:")
logging.warning(e)
return "J'ai pas pu éteindre la lampe '" + lamp + "'."
return "J'ai éteint la lampe '" + lamp + "'."
def light_on_single(self, lamp):
try:
self.walle.light_on(lamp)
except Exception as e:
logging.warning("Error light on:")
logging.warning(e)
return "J'ai pas pu allumer la lampe '" + lamp + "'."
return "J'ai allumé la lampe '" + lamp + "'."
def light_off(self, entities):
number_error = 0
for lamp in entities: