Add fuzzy and text-classification light model #1
1 changed files with 4 additions and 3 deletions
|
@ -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'}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue