Spaces:
Sleeping
Sleeping
Commit ·
ef2509f
1
Parent(s): cc0c71f
Create helper.py
Browse files
helper.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fuzzywuzzy import fuzz, process
|
| 2 |
+
from constants import builders
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def find_best_match(query):
|
| 6 |
+
best_matches = process.extractBests(query, choices=builders, scorer=fuzz.token_set_ratio, limit=3)
|
| 7 |
+
best_matches.insert(0, " ")
|
| 8 |
+
return "\n".join([str(item[0]) for item in best_matches])
|
| 9 |
+
|