This commit is contained in:
maxbachmann 2020-05-20 11:55:49 +02:00
commit 2e29648ef4
2 changed files with 6 additions and 5 deletions

View File

@ -1,7 +1,7 @@
# Benchmarks # Benchmarks
To compare the speed of FuzzyWuzzy and RapidFuzz the Benchmark of FuzzyWuzzy is used. To compare the speed of FuzzyWuzzy and RapidFuzz the Benchmark of FuzzyWuzzy is used.
Therefore the Benchmark is always executed for FuzzyWuzzy, RapidFuzz and when directly calling the CPP handler without redirection (e.g. `rapidfuzz.fuzz.fuzz_cpp.ratio`). Therefore the Benchmark is always executed for FuzzyWuzzy and RapidFuzz.
Afterwards a ratio between the runtime of both results is calculated. The benchmark can be found [here](https://github.com/rhasspy/rapidfuzz/blob/master/python/bench). The results of the benchmarks are visualised below. Afterwards a ratio between the runtime of both results is calculated. The benchmark can be found [here](https://github.com/rhasspy/rapidfuzz/blob/master/python/bench). The results of the benchmarks are visualised below.
## fuzz.ratio ## fuzz.ratio

View File

@ -137,7 +137,7 @@ static PyObject* ratio(PyObject* /*self*/, PyObject* args, PyObject* keywds) {
PyDoc_STRVAR(partial_ratio_docstring, PyDoc_STRVAR(partial_ratio_docstring,
"partial_ratio($module, s1, s2, processor = False, score_cutoff = 0)\n" "partial_ratio($module, s1, s2, processor = False, score_cutoff = 0)\n"
"--\n\n" "--\n\n"
"calculates a partial ratio between two strings\n\n" "calculates the fuzz.ratio of the optimal string alignment\n\n"
"Args:\n" "Args:\n"
" s1 (str): first string to compare\n" " s1 (str): first string to compare\n"
" s2 (str): first string to compare\n" " s2 (str): first string to compare\n"
@ -159,7 +159,7 @@ static PyObject* partial_ratio(PyObject* /*self*/, PyObject* args, PyObject* key
PyDoc_STRVAR(token_sort_ratio_docstring, PyDoc_STRVAR(token_sort_ratio_docstring,
"token_sort_ratio($module, s1, s2, processor = False, score_cutoff = 0)\n" "token_sort_ratio($module, s1, s2, processor = False, score_cutoff = 0)\n"
"--\n\n" "--\n\n"
"Compares the words in the strings based on unique and common words between them using fuzz.ratio\n\n" "sorts the words in the strings and calculates the fuzz.ratio between them\n\n"
"Args:\n" "Args:\n"
" s1 (str): first string to compare\n" " s1 (str): first string to compare\n"
" s2 (str): first string to compare\n" " s2 (str): first string to compare\n"
@ -326,7 +326,8 @@ PyDoc_STRVAR(quick_lev_ratio_docstring,
"quick_lev_ratio($module, s1, s2, processor = False, score_cutoff = 0)\n" "quick_lev_ratio($module, s1, s2, processor = False, score_cutoff = 0)\n"
"--\n\n" "--\n\n"
"Calculates a quick estimation of fuzz.ratio by counting uncommon letters between the two sentences.\n" "Calculates a quick estimation of fuzz.ratio by counting uncommon letters between the two sentences.\n"
"Guaranteed to be equal or higher than fuzz.ratio and can therefore be used to filter results before using fuzz.ratio\n\n" "Guaranteed to be equal or higher than fuzz.ratio.\n"
"(internally used by fuzz.ratio when providing it with a score_cutoff to speed up the matching)\n\n"
"Args:\n" "Args:\n"
" s1 (str): first string to compare\n" " s1 (str): first string to compare\n"
" s2 (str): first string to compare\n" " s2 (str): first string to compare\n"
@ -376,4 +377,4 @@ static struct PyModuleDef moduledef = {
PyMODINIT_FUNC PyInit_fuzz(void) { PyMODINIT_FUNC PyInit_fuzz(void) {
return PyModule_Create(&moduledef); return PyModule_Create(&moduledef);
} }