ArcdpsExtension
 
Loading...
Searching...
No Matches
rapidfuzz_amalgamated.hpp File Reference
#include <cmath>
#include <numeric>
#include <algorithm>
#include <array>
#include <cstring>
#include <cassert>
#include <stddef.h>
#include <stdexcept>
#include <stdint.h>
#include <type_traits>
#include <vector>
#include <functional>
#include <iterator>
#include <utility>
#include <string>
#include <unordered_map>
#include <cctype>
#include <cwctype>
#include <limits>
#include <cstddef>
#include <cstdint>
#include <tuple>
Include dependency graph for rapidfuzz_amalgamated.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  rapidfuzz::IteratorView< InputIt >
 
struct  rapidfuzz::StringAffix
 
struct  rapidfuzz::LevenshteinWeightTable
 
struct  rapidfuzz::EditOp
 Edit operations used by the Levenshtein distance. More...
 
struct  rapidfuzz::Opcode
 Edit operations used by the Levenshtein distance. More...
 
class  rapidfuzz::Editops
 
class  rapidfuzz::Opcodes
 
class  rapidfuzz::SplittedSentenceView< InputIt >
 
struct  rapidfuzz::common::PatternMatchVector
 
struct  rapidfuzz::common::PatternMatchVector::MapElem
 
struct  rapidfuzz::common::BlockPatternMatchVector
 
struct  rapidfuzz::common::CharHashTable< CharT1, ValueType, 1 >
 
struct  rapidfuzz::common::CharHashTable< CharT1, ValueType, size >
 
struct  rapidfuzz::common::MatrixVectorView< T >
 
struct  rapidfuzz::common::ConstMatrixVectorView< T >
 
struct  rapidfuzz::common::Matrix< T >
 
struct  rapidfuzz::CachedLevenshtein< CharT1 >
 
struct  rapidfuzz::fuzz::CachedRatio< CharT1 >
 
struct  rapidfuzz::fuzz::CachedPartialRatio< CharT1 >
 
struct  rapidfuzz::fuzz::CachedTokenSortRatio< CharT1 >
 
struct  rapidfuzz::fuzz::CachedPartialTokenSortRatio< CharT1 >
 
struct  rapidfuzz::fuzz::CachedTokenSetRatio< CharT1 >
 
struct  rapidfuzz::fuzz::CachedPartialTokenSetRatio< CharT1 >
 
struct  rapidfuzz::fuzz::CachedTokenRatio< CharT1 >
 
struct  rapidfuzz::fuzz::CachedPartialTokenRatio< CharT1 >
 
struct  rapidfuzz::fuzz::CachedWRatio< CharT1 >
 
struct  rapidfuzz::fuzz::CachedQRatio< CharT1 >
 
class  rapidfuzz::detail::difflib::SequenceMatcher< InputIt1, InputIt2 >
 

Namespaces

namespace  rapidfuzz
 
namespace  rapidfuzz::detail
 
namespace  rapidfuzz::common
 
namespace  rapidfuzz::fuzz
 
namespace  rapidfuzz::detail::difflib
 
namespace  rapidfuzz::fuzz::detail
 

Macros

#define GENERATE_HAS_MEMBER(member)
 

Typedefs

template<typename InputIt >
using rapidfuzz::IteratorViewVec = std::vector< IteratorView< InputIt > >
 

Enumerations

enum class  rapidfuzz::EditType { rapidfuzz::None = 0 , rapidfuzz::Replace = 1 , rapidfuzz::Insert = 2 , rapidfuzz::Delete = 3 }
 Edit operation types used by the Levenshtein distance. More...
 

Functions

template<typename InputIt1 , typename InputIt2 >
bool rapidfuzz::operator== (const IteratorView< InputIt1 > &a, const IteratorView< InputIt2 > &b)
 
template<typename InputIt1 , typename InputIt2 >
bool rapidfuzz::operator!= (const IteratorView< InputIt1 > &a, const IteratorView< InputIt2 > &b)
 
template<typename InputIt1 , typename InputIt2 >
bool rapidfuzz::operator< (const IteratorView< InputIt1 > &a, const IteratorView< InputIt2 > &b)
 
template<typename InputIt1 , typename InputIt2 >
bool rapidfuzz::operator> (const IteratorView< InputIt1 > &a, const IteratorView< InputIt2 > &b)
 
template<typename InputIt1 , typename InputIt2 >
bool rapidfuzz::operator<= (const IteratorView< InputIt1 > &a, const IteratorView< InputIt2 > &b)
 
template<typename InputIt1 , typename InputIt2 >
bool rapidfuzz::operator>= (const IteratorView< InputIt1 > &a, const IteratorView< InputIt2 > &b)
 
bool rapidfuzz::operator== (EditOp a, EditOp b)
 
bool rapidfuzz::operator== (Opcode a, Opcode b)
 
template<typename T >
void rapidfuzz::detail::vector_slice (std::vector< T > &new_vec, const std::vector< T > &vec, int start, int stop, int step)
 
bool rapidfuzz::operator== (const Editops &lhs, const Editops &rhs)
 
bool rapidfuzz::operator!= (const Editops &lhs, const Editops &rhs)
 
void rapidfuzz::swap (Editops &lhs, Editops &rhs)
 
bool rapidfuzz::operator== (const Opcodes &lhs, const Opcodes &rhs)
 
bool rapidfuzz::operator!= (const Opcodes &lhs, const Opcodes &rhs)
 
void rapidfuzz::swap (Opcodes &lhs, Opcodes &rhs)
 
template<typename InputIt1 , typename InputIt2 >
DecomposedSet< InputIt1, InputIt2, InputIt1 > rapidfuzz::common::set_decomposition (SplittedSentenceView< InputIt1 > a, SplittedSentenceView< InputIt2 > b)
 
constexpr double rapidfuzz::common::result_cutoff (double result, double score_cutoff)
 
template<int Max = 1>
constexpr double rapidfuzz::common::norm_distance (int64_t dist, int64_t lensum, double score_cutoff=0)
 
template<typename T >
constexpr bool rapidfuzz::common::is_zero (T a, T tolerance=std::numeric_limits< T >::epsilon())
 
template<typename Sentence , typename CharT = char_type<Sentence>, typename = std::enable_if_t<is_explicitly_convertible<Sentence, std::basic_string<CharT>>::value>>
std::basic_string< CharT > rapidfuzz::common::to_string (Sentence &&str)
 
template<typename Sentence , typename CharT = char_type<Sentence>, typename = std::enable_if_t<!is_explicitly_convertible<Sentence, std::basic_string<CharT>>::value && has_data_and_size<Sentence>::value>>
std::basic_string< CharT > rapidfuzz::common::to_string (const Sentence &str)
 
template<typename CharT >
CharT * rapidfuzz::common::to_begin (CharT *s)
 
template<typename T >
auto rapidfuzz::common::to_begin (T &x)
 
template<typename CharT >
CharT * rapidfuzz::common::to_end (CharT *s)
 
template<typename T >
auto rapidfuzz::common::to_end (T &x)
 
template<typename InputIterator1 , typename InputIterator2 >
std::pair< InputIterator1, InputIterator2 > rapidfuzz::common::mismatch (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2)
 Finds the first mismatching pair of elements from two ranges: one defined by [first1, last1) and another defined by [first2,last2). Similar implementation to std::mismatch from C++14.
 
template<typename InputIt1 , typename InputIt2 >
StringAffix rapidfuzz::common::remove_common_affix (InputIt1 &first1, InputIt1 &last1, InputIt2 &first2, InputIt2 &last2)
 
template<typename InputIt1 , typename InputIt2 >
int64_t rapidfuzz::common::remove_common_prefix (InputIt1 &first1, InputIt1 last1, InputIt2 &first2, InputIt2 last2)
 
template<typename InputIt1 , typename InputIt2 >
int64_t rapidfuzz::common::remove_common_suffix (InputIt1 first1, InputIt1 &last1, InputIt2 first2, InputIt2 &last2)
 
template<typename InputIt , typename CharT = iterator_type<InputIt>>
SplittedSentenceView< InputIt > rapidfuzz::common::sorted_split (InputIt first, InputIt last)
 
template<typename T >
constexpr auto rapidfuzz::common::to_unsigned (T value) -> typename std::make_unsigned< T >::type
 
template<typename T >
constexpr auto rapidfuzz::common::to_signed (T value) -> typename std::make_unsigned< T >::type
 
template<typename T , typename U >
bool rapidfuzz::common::CanTypeFitValue (const U value)
 
template<typename InputIt1 , typename InputIt2 >
int64_t rapidfuzz::levenshtein_distance (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, LevenshteinWeightTable weights={1, 1, 1}, int64_t max=std::numeric_limits< int64_t >::max())
 Calculates the minimum number of insertions, deletions, and substitutions required to change one sequence into the other according to Levenshtein with custom costs for insertion, deletion and substitution.
 
template<typename Sentence1 , typename Sentence2 >
int64_t rapidfuzz::levenshtein_distance (const Sentence1 &s1, const Sentence2 &s2, LevenshteinWeightTable weights={1, 1, 1}, int64_t max=std::numeric_limits< int64_t >::max())
 
template<typename InputIt1 , typename InputIt2 >
int64_t rapidfuzz::levenshtein_similarity (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, LevenshteinWeightTable weights={1, 1, 1}, int64_t score_cutoff=0.0)
 
template<typename Sentence1 , typename Sentence2 >
int64_t rapidfuzz::levenshtein_similarity (const Sentence1 &s1, const Sentence2 &s2, LevenshteinWeightTable weights={1, 1, 1}, int64_t score_cutoff=0.0)
 
template<typename InputIt1 , typename InputIt2 >
double rapidfuzz::levenshtein_normalized_distance (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, LevenshteinWeightTable weights={1, 1, 1}, double score_cutoff=1.0)
 
template<typename Sentence1 , typename Sentence2 >
double rapidfuzz::levenshtein_normalized_distance (const Sentence1 &s1, const Sentence2 &s2, LevenshteinWeightTable weights={1, 1, 1}, double score_cutoff=1.0)
 
template<typename InputIt1 , typename InputIt2 >
double rapidfuzz::levenshtein_normalized_similarity (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, LevenshteinWeightTable weights={1, 1, 1}, double score_cutoff=0.0)
 Calculates a normalized levenshtein distance using custom costs for insertion, deletion and substitution.
 
template<typename Sentence1 , typename Sentence2 >
double rapidfuzz::levenshtein_normalized_similarity (const Sentence1 &s1, const Sentence2 &s2, LevenshteinWeightTable weights={1, 1, 1}, double score_cutoff=0.0)
 
template<typename InputIt1 , typename InputIt2 >
Editops rapidfuzz::levenshtein_editops (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2)
 Return list of EditOp describing how to turn s1 into s2.
 
template<typename Sentence1 , typename Sentence2 >
Editops rapidfuzz::levenshtein_editops (const Sentence1 &s1, const Sentence2 &s2)
 
template<typename InputIt1 , typename InputIt2 >
double rapidfuzz::fuzz::ratio (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, double score_cutoff=0)
 calculates a simple ratio between two strings
 
template<typename Sentence1 , typename Sentence2 >
double rapidfuzz::fuzz::ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
 
template<typename InputIt1 , typename InputIt2 >
double rapidfuzz::fuzz::partial_ratio (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, double score_cutoff=0)
 calculates the fuzz::ratio of the optimal string alignment
 
template<typename Sentence1 , typename Sentence2 >
double rapidfuzz::fuzz::partial_ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
 
template<typename InputIt1 , typename InputIt2 >
double rapidfuzz::fuzz::token_sort_ratio (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, double score_cutoff=0)
 Sorts the words in the strings and calculates the fuzz::ratio between them.
 
template<typename Sentence1 , typename Sentence2 , typename CharT1 = char_type<Sentence1>, typename CharT2 = char_type<Sentence2>>
double rapidfuzz::fuzz::token_sort_ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
 
template<typename InputIt1 , typename InputIt2 >
double rapidfuzz::fuzz::partial_token_sort_ratio (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, 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::partial_token_sort_ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
 
template<typename InputIt1 , typename InputIt2 >
double rapidfuzz::fuzz::token_set_ratio (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, 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::token_set_ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
 
template<typename InputIt1 , typename InputIt2 >
double rapidfuzz::fuzz::partial_token_set_ratio (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, 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::partial_token_set_ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
 
template<typename InputIt1 , typename InputIt2 >
double rapidfuzz::fuzz::token_ratio (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, 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::token_ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
 
template<typename InputIt1 , typename InputIt2 >
double rapidfuzz::fuzz::partial_token_ratio (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, 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::partial_token_ratio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
 
template<typename InputIt1 , typename InputIt2 >
double rapidfuzz::fuzz::WRatio (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, double score_cutoff=0)
 Calculates a weighted ratio based on the other ratio algorithms.
 
template<typename Sentence1 , typename Sentence2 >
double rapidfuzz::fuzz::WRatio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
 
template<typename InputIt1 , typename InputIt2 >
double rapidfuzz::fuzz::QRatio (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, double score_cutoff=0)
 Calculates a quick ratio between two strings using fuzz.ratio.
 
template<typename Sentence1 , typename Sentence2 >
double rapidfuzz::fuzz::QRatio (const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
 
template<typename InputIt1 , typename InputIt2 , typename CachedCharT1 >
double rapidfuzz::fuzz::detail::partial_ratio_short_needle (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, const CachedRatio< CachedCharT1 > &cached_ratio, const common::CharHashTable< iterator_type< InputIt1 >, bool > &s1_char_map, double score_cutoff)
 
template<typename InputIt1 , typename InputIt2 , typename CharT1 = iterator_type<InputIt1>>
double rapidfuzz::fuzz::detail::partial_ratio_short_needle (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, double score_cutoff)
 
template<typename InputIt1 , typename InputIt2 , typename CachedCharT1 >
double rapidfuzz::fuzz::detail::partial_ratio_long_needle (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, const CachedRatio< CachedCharT1 > &cached_ratio, double score_cutoff)
 
template<typename InputIt1 , typename InputIt2 , typename CharT1 = iterator_type<InputIt1>>
double rapidfuzz::fuzz::detail::partial_ratio_long_needle (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, double score_cutoff)
 
template<typename InputIt1 , typename InputIt2 >
double rapidfuzz::fuzz::detail::token_set_ratio (const SplittedSentenceView< InputIt1 > &tokens_a, const SplittedSentenceView< InputIt2 > &tokens_b, const double score_cutoff)
 
template<typename InputIt1 , typename InputIt2 >
double rapidfuzz::fuzz::detail::partial_token_set_ratio (const SplittedSentenceView< InputIt1 > &tokens_a, const SplittedSentenceView< InputIt2 > &tokens_b, const double score_cutoff)
 
template<typename CharT1 , typename CachedCharT1 , typename InputIt2 >
double rapidfuzz::fuzz::detail::token_ratio (const SplittedSentenceView< CharT1 > &s1_tokens, const CachedRatio< CachedCharT1 > &cached_ratio_s1_sorted, InputIt2 first2, InputIt2 last2, double score_cutoff)
 
template<typename CharT1 , typename InputIt1 , typename InputIt2 >
double rapidfuzz::fuzz::detail::token_ratio (const std::basic_string< CharT1 > &s1_sorted, const SplittedSentenceView< InputIt1 > &tokens_s1, const common::BlockPatternMatchVector &blockmap_s1_sorted, InputIt2 first2, InputIt2 last2, double score_cutoff)
 
template<typename CharT1 , typename InputIt1 , typename InputIt2 >
double rapidfuzz::fuzz::detail::partial_token_ratio (const std::basic_string< CharT1 > &s1_sorted, const SplittedSentenceView< InputIt1 > &tokens_s1, InputIt2 first2, InputIt2 last2, double score_cutoff)
 

Macro Definition Documentation

◆ GENERATE_HAS_MEMBER

#define GENERATE_HAS_MEMBER (   member)
Value:
\
template<typename T> \
struct has_member_##member { \
private: \
using yes = std::true_type; \
using no = std::false_type; \
\
struct Fallback { \
int member; \
}; \
struct Derived : T, Fallback {}; \
\
template<class U> \
static no test(decltype(U::member)*); \
template<typename U> \
static yes test(U*); \
\
template<typename U, typename = std::enable_if_t<std::is_class<U>::value>> \
static constexpr bool class_test(U*) { \
return std::is_same<decltype(test<Derived>(nullptr)), yes>::value; \
} \
\
template<typename U, typename = std::enable_if_t<!std::is_class<U>::value>> \
static constexpr bool class_test(const U&) { \
return false; \
} \
\
public: \
static constexpr bool value = class_test(static_cast<T*>(nullptr)); \
};