rapidfuzz - Man Page

Synopsis

Functions

template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
calculates a simple ratio between two strings
template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::partial_ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
calculates the fuzz::ratio of the optimal string alignment
template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::token_sort_ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
Sorts the words in the strings and calculates the fuzz::ratio between them.
template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::partial_token_sort_ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
Sorts the words in the strings and calculates the fuzz::partial_ratio between them.
template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::token_set_ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
Compares the words in the strings based on unique and common words between them using fuzz::ratio.
template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::partial_token_set_ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
Compares the words in the strings based on unique and common words between them using fuzz::partial_ratio.
template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::token_ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
Helper method that returns the maximum of fuzz::token_set_ratio and fuzz::token_sort_ratio (faster than manually executing the two functions)
template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::partial_token_ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
Helper method that returns the maximum of fuzz::partial_token_set_ratio and fuzz::partial_token_sort_ratio (faster than manually executing the two functions)
template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::WRatio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
Calculates a weighted ratio based on the other ratio algorithms.
template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::QRatio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
Calculates a quick ratio between two strings using fuzz.ratio.

Detailed Description

A collection of string matching algorithms from FuzzyWuzzy

Function Documentation

template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::partial_ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)

#include <rapidfuzz/fuzz.hpp>

calculates the fuzz::ratio of the optimal string alignment test [hyrro_2004] [wagner_fischer_1974]

// 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 to basic_string_view<char_type>
Sentence2 This is a string that can be converted to basic_string_view<char_type>

Parameters

s1 string to compare with s2 (for type info check Template parameters above)
s2 string to compare with s1 (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

template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::partial_token_ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)

#include <rapidfuzz/fuzz.hpp>

Helper method that returns the maximum of fuzz::partial_token_set_ratio and fuzz::partial_token_sort_ratio (faster than manually executing the two functions)

Template Parameters

Sentence1 This is a string that can be converted to basic_string_view<char_type>
Sentence2 This is a string that can be converted to basic_string_view<char_type>

Parameters

s1 string to compare with s2 (for type info check Template parameters above)
s2 string to compare with s1 (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

template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::partial_token_set_ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)

#include <rapidfuzz/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 to basic_string_view<char_type>
Sentence2 This is a string that can be converted to basic_string_view<char_type>

Parameters

s1 string to compare with s2 (for type info check Template parameters above)
s2 string to compare with s1 (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

template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::partial_token_sort_ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)

#include <rapidfuzz/fuzz.hpp>

Sorts the words in the strings and calculates the fuzz::partial_ratio between them.

Template Parameters

Sentence1 This is a string that can be converted to basic_string_view<char_type>
Sentence2 This is a string that can be converted to basic_string_view<char_type>

Parameters

s1 string to compare with s2 (for type info check Template parameters above)
s2 string to compare with s1 (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

template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::QRatio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)

#include <rapidfuzz/fuzz.hpp>

Calculates a quick ratio between two strings using fuzz.ratio.

Template Parameters

Sentence1 This is a string that can be converted to basic_string_view<char_type>
Sentence2 This is a string that can be converted to basic_string_view<char_type>

Parameters

s1 string to compare with s2 (for type info check Template parameters above)
s2 string to compare with s1 (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

template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)

#include <rapidfuzz/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 This is a string that can be converted to basic_string_view<char_type>
Sentence2 This is a string that can be converted to basic_string_view<char_type>

Parameters

s1 string to compare with s2 (for type info check Template parameters above)
s2 string to compare with s1 (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

template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::token_ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)

#include <rapidfuzz/fuzz.hpp>

Helper method that returns the maximum of fuzz::token_set_ratio and fuzz::token_sort_ratio (faster than manually executing the two functions)

Template Parameters

Sentence1 This is a string that can be converted to basic_string_view<char_type>
Sentence2 This is a string that can be converted to basic_string_view<char_type>

Parameters

s1 string to compare with s2 (for type info check Template parameters above)
s2 string to compare with s1 (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

template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::token_set_ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)

#include <rapidfuzz/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 This is a string that can be converted to basic_string_view<char_type>
Sentence2 This is a string that can be converted to basic_string_view<char_type>

Parameters

s1 string to compare with s2 (for type info check Template parameters above)
s2 string to compare with s1 (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

template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::token_sort_ratio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)

#include <rapidfuzz/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 to basic_string_view<char_type>
Sentence2 This is a string that can be converted to basic_string_view<char_type>

Parameters

s1 string to compare with s2 (for type info check Template parameters above)
s2 string to compare with s1 (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

template<typename Sentence1 , typename Sentence2 > double rapidfuzz::fuzz::WRatio (const Sentence1 & s1, const Sentence2 & s2, double score_cutoff = 0)

#include <rapidfuzz/fuzz.hpp>

Calculates a weighted ratio based on the other ratio algorithms.

Template Parameters

Sentence1 This is a string that can be converted to basic_string_view<char_type>
Sentence2 This is a string that can be converted to basic_string_view<char_type>

Parameters

s1 string to compare with s2 (for type info check Template parameters above)
s2 string to compare with s1 (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.

Info

RapidFuzz