This commit is contained in:
睿 安
2026-01-21 16:48:36 +08:00
commit abba5cb273
246 changed files with 57473 additions and 0 deletions

14
app/util/search.py Normal file
View File

@@ -0,0 +1,14 @@
from typing import List
from fuzzywuzzy import process
def search_by_content(key, choices: List[List]):
result = []
for i, choice in enumerate(choices):
res = process.extractOne(key, choice)
result.append((res, i))
result.sort(key=lambda x: x[0][1], reverse=True)
k = result[0][1]
item = result[0][0][0]
return choices[k].index(item)