mirror of
https://github.com/LC044/WeChatMsg
synced 2024-11-15 06:11:19 +08:00
15 lines
377 B
Python
15 lines
377 B
Python
|
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)
|