rapidfuzz(3)
π rapidfuzz(3) π
okay bestie, welcome to rapidfuzz(3) β this page comes straight out of the Library Functions Manual, section 3, and it's giving "C++ string matching but make it fast" energy. We're doing this in parts, this is part 1, so hydrate and stay with me. πβ¨
π NAME π
rapidfuzz β rapidfuzz.
that's it. that's the name. she's self-titled. main character energy, no notes. π
π¦ SYNOPSIS π¦
πΈ Functions πΈ
okay so here's the whole squad of functions. they're all templates, they all take two sentences and a score_cutoff that defaults to 0, and they all hand you back a double. iconic consistency, fr fr. π
rapidfuzz::fuzz::ratioβ calculates a simple ratio between two strings. the baseline, the blueprint, the moment. π«Ά
template<typename Sentence1, typename Sentence2> double
rapidfuzz::fuzz::ratio (const Sentence1 &s1, const Sentence2 &s2,
double score_cutoff=0)
rapidfuzz::fuzz::partial_ratioβ calculates thefuzz::ratioof the optimal string alignment. she's looking for the best fit, not the whole thing. lowkey obsessed with her. β¨
template<typename Sentence1, typename Sentence2> double
rapidfuzz::fuzz::partial_ratio (const Sentence1 &s1, const Sentence2
&s2, double score_cutoff=0)
rapidfuzz::fuzz::token_sort_ratioβ sorts the words in the strings and calculates thefuzz::ratiobetween them. order? never heard of her. π¦
template<typename Sentence1, typename Sentence2> double
rapidfuzz::fuzz::token_sort_ratio (const Sentence1 &s1, const
Sentence2 &s2, double score_cutoff=0)
rapidfuzz::fuzz::partial_token_sort_ratioβ sorts the words in the strings and calculates thefuzz::partial_ratiobetween them. the sort girlies and the partial girlies collabed and it ate. π
template<typename Sentence1, typename Sentence2> double
rapidfuzz::fuzz::partial_token_sort_ratio (const Sentence1 &s1,
const Sentence2 &s2, double score_cutoff=0)
rapidfuzz::fuzz::token_set_ratioβ compares the words in the strings based on unique and common words between them usingfuzz::ratio. she's doing a whole venn diagram situation and honestly? valid. πΈ
template<typename Sentence1, typename Sentence2> double
rapidfuzz::fuzz::token_set_ratio (const Sentence1 &s1, const
Sentence2 &s2, double score_cutoff=0)
rapidfuzz::fuzz::partial_token_set_ratioβ compares the words in the strings based on unique and common words between them usingfuzz::partial_ratio. same venn diagram energy but she brought the partial flavor. π
template<typename Sentence1, typename Sentence2> double
rapidfuzz::fuzz::partial_token_set_ratio (const Sentence1 &s1, const
Sentence2 &s2, double score_cutoff=0)
rapidfuzz::fuzz::token_ratioβ helper method that returns the maximum offuzz::token_set_ratioandfuzz::token_sort_ratio(faster than manually executing the two functions). she just picks the winner for you and does it quicker, which is the definition of a supportive bestie. π₯
template<typename Sentence1, typename Sentence2> double
rapidfuzz::fuzz::token_ratio (const Sentence1 &s1, const Sentence2
&s2, double score_cutoff=0)
rapidfuzz::fuzz::partial_token_ratioβ helper method that returns the maximum offuzz::partial_token_set_ratioandfuzz::partial_token_sort_ratio(faster than manually executing the two functions). same deal, partial edition, still faster than doing it by hand. periodt. π
template<typename Sentence1, typename Sentence2> double
rapidfuzz::fuzz::partial_token_ratio (const Sentence1 &s1, const
Sentence2 &s2, double score_cutoff=0)
rapidfuzz::fuzz::WRatioβ calculates a weighted ratio based on the other ratio algorithms. the "let me average the vibes of everyone else" algorithm. β
template<typename Sentence1, typename Sentence2> double
rapidfuzz::fuzz::WRatio (const Sentence1 &s1, const Sentence2 &s2,
double score_cutoff=0)
rapidfuzz::fuzz::QRatioβ calculates a quick ratio between two strings usingfuzz.ratio. quick. in and out. no small talk. π§
template<typename Sentence1, typename Sentence2> double
rapidfuzz::fuzz::QRatio (const Sentence1 &s1, const Sentence2 &s2,
double score_cutoff=0)
lowkey note bestie: every single one of these caps out at adoublereturn and takes thatscore_cutoff=0default, so if you forget it, nobody's mad. π«Ά
π₯ Detailed Description π₯
a collection of string matching algorithms from FuzzyWuzzy. π
like, that's the whole description, and honestly it understood the assignment. it's the FuzzyWuzzy algorithm lineup, ported into a rapid situation, and it's here to match your strings with speed and style. no cap. π
<div align="center">πΈ to be continued in part 2 πΈ</div>
wait no, that's a sign-off, and we're not doing that. anyway β the fuzz:: namespace is literally the moment, and every function above is a different flavor of "how similar are these two strings actually", each one with its own whole personality. iykyk. π¦
β¨ Function Documentation β¨
Okay bestie, this is the main character energy section π
β every single ratio function RapidFuzz has for you. They're all templates, they all live in #include <fuzz.hpp>, and they all share the exact same score_cutoff situation. Let's take them one by one, no skips, no cap π«Ά
π rapidfuzz::fuzz::partial_ratio π
template<typename Sentence1, typename Sentence2>
double rapidfuzz::fuzz::partial_ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)
#include <fuzz.hpp>
Calculates the fuzz::ratio of the optimal string alignment test, per the sources [hyrro_2004] [wagner_fischer_1974] π
Like, watch:
// score is 100
double score = partial_ratio("this is a test", "this is a test!")
Template Parameters
Sentence1β this is a string that can be converted tobasic_string_view<char_type>Sentence2β this is a string that can be converted tobasic_string_view<char_type>
Parameters
s1β the string you're comparing againsts2(for type info, peek the template parameters above)s2β the string you're comparing againsts1(same, check the template parameters above)score_cutoffβ optional argument for a score threshold between 0% and 100%. Matches with a lower score than this number will not be returned. Defaults to 0.
Returns
returns the ratio between s1 and s2 or 0 when ratio < score_cutoff
π¦ rapidfuzz::fuzz::partial_token_ratio π¦
template<typename Sentence1, typename Sentence2>
double rapidfuzz::fuzz::partial_token_ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)
#include <fuzz.hpp>
Helper method that returns the maximum of fuzz::partial_token_set_ratio and fuzz::partial_token_sort_ratio β and it's faster than manually executing the two functions, so like, why would you π
Template Parameters
Sentence1β a string convertible tobasic_string_view<char_type>Sentence2β a string convertible tobasic_string_view<char_type>
Parameters
s1β string to compare withs2(for type info check Template parameters above)s2β string to compare withs1(for type info check Template parameters above)score_cutoffβ optional argument for a score threshold between 0% and 100%. Matches with a lower score than this number will not be returned. Defaults to 0.
Returns
returns the ratio between s1 and s2 or 0 when ratio < score_cutoff
π rapidfuzz::fuzz::partial_token_set_ratio π
template<typename Sentence1, typename Sentence2>
double rapidfuzz::fuzz::partial_token_set_ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)
#include <fuzz.hpp>
Compares the words in the strings based on unique and common words between them, using fuzz::partial_ratio π§
Template Parameters
Sentence1β this is a string that can be converted tobasic_string_view<char_type>Sentence2β this is a string that can be converted tobasic_string_view<char_type>
Parameters
s1β string to compare withs2(for type info check Template parameters above)s2β string to compare withs1(for type info check Template parameters above)score_cutoffβ optional argument for a score threshold between 0% and 100%. Matches with a lower score than this number will not be returned. Defaults to 0.
Returns
returns the ratio between s1 and s2 or 0 when ratio < score_cutoff
πΈ rapidfuzz::fuzz::partial_token_sort_ratio πΈ
template<typename Sentence1, typename Sentence2>
double rapidfuzz::fuzz::partial_token_sort_ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)
#include <fuzz.hpp>
Sorts the words in the strings, then calculates the fuzz::partial_ratio between them β¨
Template Parameters
Sentence1β a string that can be converted tobasic_string_view<char_type>Sentence2β a string that can be converted tobasic_string_view<char_type>
Parameters
s1β string to compare withs2(for type info check Template parameters above)s2β string to compare withs1(for type info check Template parameters above)score_cutoffβ optional argument for a score threshold between 0% and 100%. Matches with a lower score than this number will not be returned. Defaults to 0.
Returns
returns the ratio between s1 and s2 or 0 when ratio < score_cutoff
π rapidfuzz::fuzz::QRatio π
template<typename Sentence1, typename Sentence2>
double rapidfuzz::fuzz::QRatio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)
#include <fuzz.hpp>
Calculates a quick ratio between two strings using fuzz.ratio β‘ (yes bestie, the Q stands for quick, we love an efficiency icon)
Template Parameters
Sentence1β this is a string that can be converted tobasic_string_view<char_type>Sentence2β this is a string that can be converted tobasic_string_view<char_type>
Parameters
s1β string to compare withs2(for type info check Template parameters above)s2β string to compare withs1(for type info check Template parameters above)score_cutoffβ optional argument for a score threshold between 0% and 100%. Matches with a lower score than this number will not be returned. Defaults to 0.
Returns
returns the ratio between s1 and s2 or 0 when ratio < score_cutoff
π rapidfuzz::fuzz::ratio π
template<typename Sentence1, typename Sentence2>
double rapidfuzz::fuzz::ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)
#include <fuzz.hpp>
Calculates a simple ratio between two strings π
// score is 96.55
double score = ratio("this is a test", "this is a test!")
Template Parameters
Sentence1β a string that can be converted tobasic_string_view<char_type>Sentence2β a string that can be converted tobasic_string_view<char_type>
Parameters
s1β string to compare withs2(for type info check Template parameters above)s2β string to compare withs1(for type info check Template parameters above)score_cutoffβ optional argument for a score threshold between 0% and 100%. Matches with a lower score than this number will not be returned. Defaults to 0.
Returns
returns the ratio between s1 and s2 or 0 when ratio < score_cutoff
π rapidfuzz::fuzz::token_ratio π
template<typename Sentence1, typename Sentence2>
double rapidfuzz::fuzz::token_ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)
#include <fuzz.hpp>
Helper method that returns the maximum of fuzz::token_set_ratio and fuzz::token_sort_ratio β and it's faster than manually executing the two functions, so it's giving "do less, get more" π
Template Parameters
Sentence1β this is a string that can be converted tobasic_string_view<char_type>Sentence2β this is a string that can be converted tobasic_string_view<char_type>
Parameters
s1β string to compare withs2(for type info check Template parameters above)s2β string to compare withs1(for type info check Template parameters above)score_cutoffβ optional argument for a score threshold between 0% and 100%. Matches with a lower score than this number will not be returned. Defaults to 0.
Returns
returns the ratio between s1 and s2 or 0 when ratio < score_cutoff
π§ rapidfuzz::fuzz::token_set_ratio π§
template<typename Sentence1, typename Sentence2>
double rapidfuzz::fuzz::token_set_ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)
#include <fuzz.hpp>
Compares the words in the strings based on unique and common words between them, using fuzz::ratio β¨
// score1 is 83.87
double score1 = token_sort_ratio("fuzzy was a bear", "fuzzy fuzzy was a bear")
// score2 is 100
double score2 = token_set_ratio("fuzzy was a bear", "fuzzy fuzzy was a bear")
Template Parameters
Sentence1β a string that can be converted tobasic_string_view<char_type>Sentence2β a string that can be converted tobasic_string_view<char_type>
Parameters
s1β string to compare withs2(for type info check Template parameters above)s2β string to compare withs1(for type info check Template parameters above)score_cutoffβ optional argument for a score threshold between 0% and 100%. Matches with a lower score than this number will not be returned. Defaults to 0.
Returns
returns the ratio between s1 and s2 or 0 when ratio < score_cutoff
π«Ά rapidfuzz::fuzz::token_sort_ratio π«Ά
template<typename Sentence1, typename Sentence2>
double rapidfuzz::fuzz::token_sort_ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)
#include <fuzz.hpp>
Sorts the words in the strings and calculates the fuzz::ratio between them π
// score is 100
double score = token_sort_ratio("fuzzy wuzzy was a bear", "wuzzy fuzzy was a bear")
Template Parameters
Sentence1β this is a string that can be converted tobasic_string_view<char_type>Sentence2β this is a string that can be converted tobasic_string_view<char_type>
Parameters
s1β string to compare withs2(for type info check Template parameters above)s2β string to compare withs1(for type info check Template parameters above)score_cutoffβ optional argument for a score threshold between 0% and 100%. Matches with a lower score than this number will not be returned. Defaults to 0.
Returns
returns the ratio between s1 and s2 or 0 when ratio < score_cutoff
β rapidfuzz::fuzz::WRatio β
template<typename Sentence1, typename Sentence2>
double rapidfuzz::fuzz::WRatio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)
#include <fuzz.hpp>
Calculates a weighted ratio based on the other ratio algorithms π₯ (yes it's the whole squad rolled into one, main character behaviour fr fr)
Template Parameters
Sentence1β a string that can be converted tobasic_string_view<char_type>Sentence2β a string that can be converted tobasic_string_view<char_type>
Parameters
s1β string to compare withs2(for type info check Template parameters above)s2β string to compare withs1(for type info check Template parameters above)score_cutoffβ optional argument for a score threshold between 0% and 100%. Matches with a lower score than this number will not be returned. Defaults to 0.
Returns
returns the ratio between s1 and s2 or 0 when ratio < score_cutoff
π Author π
Generated automatically by Doxygen for RapidFuzz from the source code. So no, a human didn't hand-write this one β Doxygen did, and honestly? It ate π
And that's the whole page bestie, you made it to the end π₯³ This absolute unit of a manual page is a RapidFuzz production, filed under rapidfuzz(3) in your friendly neighbourhood section 3 β so go forth and fuzzy-match everything, and remember: score_cutoff is your friend, defaults are 0, and 0 is returned when the ratio falls below it. Periodt πβ¨
π¦ where this page comes from
- fedora 44: rapidfuzz-cpp-devel 3.3.3-2.fc44 Β· MIT
- fedora 44: rapidfuzz-cpp-devel 3.3.3-2.fc44 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms