Skip to content

Instantly share code, notes, and snippets.

@bytemain
Created May 22, 2020 15:29
Show Gist options
  • Save bytemain/22409d1065c2e3f3359c34fe6aeb4945 to your computer and use it in GitHub Desktop.
Save bytemain/22409d1065c2e3f3359c34fe6aeb4945 to your computer and use it in GitHub Desktop.
rapid_fuzz test
from rapidfuzz import fuzz, process
print(
"QRatio",
process.extractOne("lengthmin", ["cs", "man", "help", "bind"], fuzz.QRatio),
)
print(
"WRatio",
process.extractOne("lengthmin", ["cs", "man", "help", "bind"], fuzz.WRatio),
)
print(
"partial_ratio",
process.extractOne("lengthmin", ["cs", "man", "help", "bind"], fuzz.partial_ratio),
)
print(
"ratio", process.extractOne("lengthmin", ["cs", "man", "help", "bind"], fuzz.ratio),
)
print(
"token_ratio",
process.extractOne("lengthmin", ["cs", "man", "help", "bind"], fuzz.token_ratio),
)
print(
"quick_lev_ratio",
process.extractOne(
"lengthmin", ["cs", "man", "help", "bind"], fuzz.quick_lev_ratio
),
)
print(
"QRatio",
process.extractOne("提醒", ["我的提醒", "cs", "man", "help", "bind"], fuzz.QRatio),
)
print(
"WRatio",
process.extractOne("提醒", ["我的提醒", "cs", "man", "help", "bind"], fuzz.WRatio),
)
print(
"partial_ratio",
process.extractOne("提醒", ["我的提醒", "cs", "man", "help", "bind"], fuzz.partial_ratio),
)
print(
"ratio",
process.extractOne("提醒", ["我的提醒", "cs", "man", "help", "bind"], fuzz.ratio),
)
print(
"token_ratio",
process.extractOne("提醒", ["我的提醒", "cs", "man", "help", "bind"], fuzz.token_ratio),
)
print(
"token_sort_ratio",
process.extractOne(
"提醒", ["我的提醒", "cs", "man", "help", "bind"], fuzz.token_sort_ratio
),
)
print(
"quick_lev_ratio",
process.extractOne(
"提醒", ["我的提醒", "cs", "man", "help", "bind"], fuzz.quick_lev_ratio
),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment