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 f3afb19ae5 - Show all commits

View file

@ -35,7 +35,8 @@ SENTENCES_MUSIQUE_GENRE_SHORT = compute_sentences_musique_genre_short()
def fuzz_predict(text):
choices = SENTENCES_HOUR + SENTENCES_LAMP_ON + SENTENCES_LAMP_OFF
choices = SENTENCES_HOUR + SENTENCES_LAMP_ON + SENTENCES_LAMP_OFF + \
SENTENCES_MUSIQUE_GENRE_LONG + SENTENCES_MUSIQUE_GENRE_SHORT
result = process.extractOne(
text, choices, scorer=fuzz.WRatio, processor=utils.default_process)
@ -50,10 +51,10 @@ def fuzz_predict(text):
return {'intentName': 'LightOff', 'intentArg': [find_matching(ROOMS, text)]}
if choosen_sentence in SENTENCES_MUSIQUE_GENRE_LONG:
return {'intentName': 'LightOff', 'intentArg': [find_matching(MUSIQUE_GENRE_SHORT, text)]}
return {'intentName': 'PlayMusicGenre', 'intentArg': [find_matching(MUSIQUE_GENRE_SHORT, text)]}
if choosen_sentence in SENTENCES_MUSIQUE_GENRE_SHORT:
return {'intentName': 'LightOff', 'intentArg': [find_matching(MUSIQUE_GENRE_SHORT, text)]}
return {'intentName': 'PlayMusicGenre', 'intentArg': [find_matching(MUSIQUE_GENRE_SHORT, text)]}
return {'intentName': 'Unknown'}