From 4508d0bced0e5cc87f8b73dab2e171b8579bdc67 Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Mon, 13 Jul 2020 12:03:59 +0200 Subject: [PATCH] use rapidfuzz instead of fuzzywuzzy (#92) Signed-off-by: maxbachmann --- __init__.py | 4 ++-- requirements.txt | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/__init__.py b/__init__.py index 6981895..25a3fe4 100644 --- a/__init__.py +++ b/__init__.py @@ -18,7 +18,7 @@ from os.path import dirname from adapt.intent import IntentBuilder from mycroft.skills.core import MycroftSkill, intent_handler from mycroft.util.log import getLogger -from fuzzywuzzy import fuzz +from rapidfuzz import fuzz import requests import json @@ -167,7 +167,7 @@ class openHABSkill(MycroftSkill): try: for itemName, itemLabel in list(itemDictionary.items()): - score = fuzz.ratio(messageItem, itemLabel) + score = fuzz.ratio(messageItem, itemLabel, score_cutoff=bestScore) if score > bestScore: bestScore = score bestItem = itemName diff --git a/requirements.txt b/requirements.txt index 2485ffc..310a13c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ requests>=2.10.0 -fuzzywuzzy==0.14.0 -python-Levenshtein==0.12.0 \ No newline at end of file +rapidfuzz==0.7.6 \ No newline at end of file