RapidFuzz
Loading...
Searching...
No Matches
fuzz.hpp
1/* SPDX-License-Identifier: MIT */
2/* Copyright © 2021 Max Bachmann */
3/* Copyright © 2011 Adam Cohen */
4
5#pragma once
6#include <rapidfuzz/details/CharSet.hpp>
7#include <rapidfuzz/details/PatternMatchVector.hpp>
8#include <rapidfuzz/details/common.hpp>
9#include <rapidfuzz/distance/Indel.hpp>
10
11namespace rapidfuzz {
12namespace fuzz {
13
44template <typename Sentence1, typename Sentence2>
45double ratio(const Sentence1& s1, const Sentence2& s2, double score_cutoff = 0);
46
47template <typename InputIt1, typename InputIt2>
48double ratio(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, double score_cutoff = 0);
49
50#ifdef RAPIDFUZZ_SIMD
51namespace experimental {
52template <int MaxLen>
53struct MultiRatio {
54public:
55 MultiRatio(size_t count) : input_count(count), scorer(count)
56 {}
57
58 size_t result_count() const
59 {
60 return scorer.result_count();
61 }
62
63 template <typename Sentence1>
64 void insert(const Sentence1& s1_)
65 {
66 insert(detail::to_begin(s1_), detail::to_end(s1_));
67 }
68
69 template <typename InputIt1>
70 void insert(InputIt1 first1, InputIt1 last1)
71 {
72 scorer.insert(first1, last1);
73 }
74
75 template <typename InputIt2>
76 void similarity(double* scores, size_t score_count, InputIt2 first2, InputIt2 last2,
77 double score_cutoff = 0.0) const
78 {
79 similarity(scores, score_count, detail::make_range(first2, last2), score_cutoff);
80 }
81
82 template <typename Sentence2>
83 void similarity(double* scores, size_t score_count, const Sentence2& s2, double score_cutoff = 0) const
84 {
85 scorer.normalized_similarity(scores, score_count, s2, score_cutoff / 100.0);
86
87 for (size_t i = 0; i < input_count; ++i)
88 scores[i] *= 100.0;
89 }
90
91private:
92 size_t input_count;
93 rapidfuzz::experimental::MultiIndel<MaxLen> scorer;
94};
95} /* namespace experimental */
96#endif
97
98// TODO documentation
99template <typename CharT1>
100struct CachedRatio {
101 template <typename InputIt1>
102 CachedRatio(InputIt1 first1, InputIt1 last1) : cached_indel(first1, last1)
103 {}
104
105 template <typename Sentence1>
106 CachedRatio(const Sentence1& s1) : cached_indel(s1)
107 {}
108
109 template <typename InputIt2>
110 double similarity(InputIt2 first2, InputIt2 last2, double score_cutoff = 0.0,
111 double score_hint = 0.0) const;
112
113 template <typename Sentence2>
114 double similarity(const Sentence2& s2, double score_cutoff = 0.0, double score_hint = 0.0) const;
115
116 // private:
117 CachedIndel<CharT1> cached_indel;
118};
119
120#ifdef RAPIDFUZZ_DEDUCTION_GUIDES
121template <typename Sentence1>
122CachedRatio(const Sentence1& s1) -> CachedRatio<char_type<Sentence1>>;
123
124template <typename InputIt1>
125CachedRatio(InputIt1 first1, InputIt1 last1) -> CachedRatio<iter_value_t<InputIt1>>;
126#endif
127
128template <typename InputIt1, typename InputIt2>
129ScoreAlignment<double> partial_ratio_alignment(InputIt1 first1, InputIt1 last1, InputIt2 first2,
130 InputIt2 last2, double score_cutoff = 0);
131
132template <typename Sentence1, typename Sentence2>
133ScoreAlignment<double> partial_ratio_alignment(const Sentence1& s1, const Sentence2& s2,
134 double score_cutoff = 0);
135
161template <typename Sentence1, typename Sentence2>
162double partial_ratio(const Sentence1& s1, const Sentence2& s2, double score_cutoff = 0);
163
164template <typename InputIt1, typename InputIt2>
165double partial_ratio(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2,
166 double score_cutoff = 0);
167
168// todo add real implementation
169template <typename CharT1>
170struct CachedPartialRatio {
171 template <typename>
172 friend struct CachedWRatio;
173
174 template <typename InputIt1>
175 CachedPartialRatio(InputIt1 first1, InputIt1 last1);
176
177 template <typename Sentence1>
178 explicit CachedPartialRatio(const Sentence1& s1_)
179 : CachedPartialRatio(detail::to_begin(s1_), detail::to_end(s1_))
180 {}
181
182 template <typename InputIt2>
183 double similarity(InputIt2 first2, InputIt2 last2, double score_cutoff = 0.0,
184 double score_hint = 0.0) const;
185
186 template <typename Sentence2>
187 double similarity(const Sentence2& s2, double score_cutoff = 0.0, double score_hint = 0.0) const;
188
189private:
190 std::vector<CharT1> s1;
191 rapidfuzz::detail::CharSet<CharT1> s1_char_set;
192 CachedRatio<CharT1> cached_ratio;
193};
194
195#ifdef RAPIDFUZZ_DEDUCTION_GUIDES
196template <typename Sentence1>
197explicit CachedPartialRatio(const Sentence1& s1) -> CachedPartialRatio<char_type<Sentence1>>;
198
199template <typename InputIt1>
200CachedPartialRatio(InputIt1 first1, InputIt1 last1) -> CachedPartialRatio<iter_value_t<InputIt1>>;
201#endif
202
229template <typename Sentence1, typename Sentence2>
230double token_sort_ratio(const Sentence1& s1, const Sentence2& s2, double score_cutoff = 0);
231
232template <typename InputIt1, typename InputIt2>
233double token_sort_ratio(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2,
234 double score_cutoff = 0);
235
236#ifdef RAPIDFUZZ_SIMD
237namespace experimental {
238template <int MaxLen>
239struct MultiTokenSortRatio {
240public:
241 MultiTokenSortRatio(size_t count) : scorer(count)
242 {}
243
244 size_t result_count() const
245 {
246 return scorer.result_count();
247 }
248
249 template <typename Sentence1>
250 void insert(const Sentence1& s1_)
251 {
252 insert(detail::to_begin(s1_), detail::to_end(s1_));
253 }
254
255 template <typename InputIt1>
256 void insert(InputIt1 first1, InputIt1 last1)
257 {
258 scorer.insert(detail::sorted_split(first1, last1).join());
259 }
260
261 template <typename InputIt2>
262 void similarity(double* scores, size_t score_count, InputIt2 first2, InputIt2 last2,
263 double score_cutoff = 0.0) const
264 {
265 scorer.similarity(scores, score_count, detail::sorted_split(first2, last2).join(), score_cutoff);
266 }
267
268 template <typename Sentence2>
269 void similarity(double* scores, size_t score_count, const Sentence2& s2, double score_cutoff = 0) const
270 {
271 similarity(scores, score_count, detail::to_begin(s2), detail::to_end(s2), score_cutoff);
272 }
273
274private:
275 MultiRatio<MaxLen> scorer;
276};
277} /* namespace experimental */
278#endif
279
280// todo CachedRatio speed for equal strings vs original implementation
281// TODO documentation
282template <typename CharT1>
283struct CachedTokenSortRatio {
284 template <typename InputIt1>
285 CachedTokenSortRatio(InputIt1 first1, InputIt1 last1)
286 : s1_sorted(detail::sorted_split(first1, last1).join()), cached_ratio(s1_sorted)
287 {}
288
289 template <typename Sentence1>
290 explicit CachedTokenSortRatio(const Sentence1& s1)
291 : CachedTokenSortRatio(detail::to_begin(s1), detail::to_end(s1))
292 {}
293
294 template <typename InputIt2>
295 double similarity(InputIt2 first2, InputIt2 last2, double score_cutoff = 0.0,
296 double score_hint = 0.0) const;
297
298 template <typename Sentence2>
299 double similarity(const Sentence2& s2, double score_cutoff = 0.0, double score_hint = 0.0) const;
300
301private:
302 std::vector<CharT1> s1_sorted;
303 CachedRatio<CharT1> cached_ratio;
304};
305
306#ifdef RAPIDFUZZ_DEDUCTION_GUIDES
307template <typename Sentence1>
308explicit CachedTokenSortRatio(const Sentence1& s1) -> CachedTokenSortRatio<char_type<Sentence1>>;
309
310template <typename InputIt1>
311CachedTokenSortRatio(InputIt1 first1, InputIt1 last1) -> CachedTokenSortRatio<iter_value_t<InputIt1>>;
312#endif
313
334template <typename Sentence1, typename Sentence2>
335double partial_token_sort_ratio(const Sentence1& s1, const Sentence2& s2, double score_cutoff = 0);
336
337template <typename InputIt1, typename InputIt2>
338double partial_token_sort_ratio(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2,
339 double score_cutoff = 0);
340
341// TODO documentation
342template <typename CharT1>
343struct CachedPartialTokenSortRatio {
344 template <typename InputIt1>
345 CachedPartialTokenSortRatio(InputIt1 first1, InputIt1 last1)
346 : s1_sorted(detail::sorted_split(first1, last1).join()), cached_partial_ratio(s1_sorted)
347 {}
348
349 template <typename Sentence1>
350 explicit CachedPartialTokenSortRatio(const Sentence1& s1)
351 : CachedPartialTokenSortRatio(detail::to_begin(s1), detail::to_end(s1))
352 {}
353
354 template <typename InputIt2>
355 double similarity(InputIt2 first2, InputIt2 last2, double score_cutoff = 0.0,
356 double score_hint = 0.0) const;
357
358 template <typename Sentence2>
359 double similarity(const Sentence2& s2, double score_cutoff = 0.0, double score_hint = 0.0) const;
360
361private:
362 std::vector<CharT1> s1_sorted;
363 CachedPartialRatio<CharT1> cached_partial_ratio;
364};
365
366#ifdef RAPIDFUZZ_DEDUCTION_GUIDES
367template <typename Sentence1>
368explicit CachedPartialTokenSortRatio(const Sentence1& s1)
369 -> CachedPartialTokenSortRatio<char_type<Sentence1>>;
370
371template <typename InputIt1>
372CachedPartialTokenSortRatio(InputIt1 first1,
373 InputIt1 last1) -> CachedPartialTokenSortRatio<iter_value_t<InputIt1>>;
374#endif
375
404template <typename Sentence1, typename Sentence2>
405double token_set_ratio(const Sentence1& s1, const Sentence2& s2, double score_cutoff = 0);
406
407template <typename InputIt1, typename InputIt2>
408double token_set_ratio(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2,
409 double score_cutoff = 0);
410
411// TODO documentation
412template <typename CharT1>
413struct CachedTokenSetRatio {
414 template <typename InputIt1>
415 CachedTokenSetRatio(InputIt1 first1, InputIt1 last1)
416 : s1(first1, last1), tokens_s1(detail::sorted_split(std::begin(s1), std::end(s1)))
417 {}
418
419 template <typename Sentence1>
420 explicit CachedTokenSetRatio(const Sentence1& s1_)
421 : CachedTokenSetRatio(detail::to_begin(s1_), detail::to_end(s1_))
422 {}
423
424 template <typename InputIt2>
425 double similarity(InputIt2 first2, InputIt2 last2, double score_cutoff = 0.0,
426 double score_hint = 0.0) const;
427
428 template <typename Sentence2>
429 double similarity(const Sentence2& s2, double score_cutoff = 0.0, double score_hint = 0.0) const;
430
431private:
432 std::vector<CharT1> s1;
433 detail::SplittedSentenceView<typename std::vector<CharT1>::iterator> tokens_s1;
434};
435
436#ifdef RAPIDFUZZ_DEDUCTION_GUIDES
437template <typename Sentence1>
438explicit CachedTokenSetRatio(const Sentence1& s1) -> CachedTokenSetRatio<char_type<Sentence1>>;
439
440template <typename InputIt1>
441CachedTokenSetRatio(InputIt1 first1, InputIt1 last1) -> CachedTokenSetRatio<iter_value_t<InputIt1>>;
442#endif
443
463template <typename Sentence1, typename Sentence2>
464double partial_token_set_ratio(const Sentence1& s1, const Sentence2& s2, double score_cutoff = 0);
465
466template <typename InputIt1, typename InputIt2>
467double partial_token_set_ratio(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2,
468 double score_cutoff = 0);
469
470// TODO documentation
471template <typename CharT1>
472struct CachedPartialTokenSetRatio {
473 template <typename InputIt1>
474 CachedPartialTokenSetRatio(InputIt1 first1, InputIt1 last1)
475 : s1(first1, last1), tokens_s1(detail::sorted_split(std::begin(s1), std::end(s1)))
476 {}
477
478 template <typename Sentence1>
479 explicit CachedPartialTokenSetRatio(const Sentence1& s1_)
480 : CachedPartialTokenSetRatio(detail::to_begin(s1_), detail::to_end(s1_))
481 {}
482
483 template <typename InputIt2>
484 double similarity(InputIt2 first2, InputIt2 last2, double score_cutoff = 0.0,
485 double score_hint = 0.0) const;
486
487 template <typename Sentence2>
488 double similarity(const Sentence2& s2, double score_cutoff = 0.0, double score_hint = 0.0) const;
489
490private:
491 std::vector<CharT1> s1;
492 detail::SplittedSentenceView<typename std::vector<CharT1>::iterator> tokens_s1;
493};
494
495#ifdef RAPIDFUZZ_DEDUCTION_GUIDES
496template <typename Sentence1>
497explicit CachedPartialTokenSetRatio(const Sentence1& s1) -> CachedPartialTokenSetRatio<char_type<Sentence1>>;
498
499template <typename InputIt1>
500CachedPartialTokenSetRatio(InputIt1 first1,
501 InputIt1 last1) -> CachedPartialTokenSetRatio<iter_value_t<InputIt1>>;
502#endif
503
523template <typename Sentence1, typename Sentence2>
524double token_ratio(const Sentence1& s1, const Sentence2& s2, double score_cutoff = 0);
525
526template <typename InputIt1, typename InputIt2>
527double token_ratio(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, double score_cutoff = 0);
528
529// todo add real implementation
530template <typename CharT1>
531struct CachedTokenRatio {
532 template <typename InputIt1>
533 CachedTokenRatio(InputIt1 first1, InputIt1 last1)
534 : s1(first1, last1),
535 s1_tokens(detail::sorted_split(std::begin(s1), std::end(s1))),
536 s1_sorted(s1_tokens.join()),
537 cached_ratio_s1_sorted(s1_sorted)
538 {}
539
540 template <typename Sentence1>
541 explicit CachedTokenRatio(const Sentence1& s1_)
542 : CachedTokenRatio(detail::to_begin(s1_), detail::to_end(s1_))
543 {}
544
545 template <typename InputIt2>
546 double similarity(InputIt2 first2, InputIt2 last2, double score_cutoff = 0.0,
547 double score_hint = 0.0) const;
548
549 template <typename Sentence2>
550 double similarity(const Sentence2& s2, double score_cutoff = 0.0, double score_hint = 0.0) const;
551
552private:
553 std::vector<CharT1> s1;
554 detail::SplittedSentenceView<typename std::vector<CharT1>::iterator> s1_tokens;
555 std::vector<CharT1> s1_sorted;
556 CachedRatio<CharT1> cached_ratio_s1_sorted;
557};
558
559#ifdef RAPIDFUZZ_DEDUCTION_GUIDES
560template <typename Sentence1>
561explicit CachedTokenRatio(const Sentence1& s1) -> CachedTokenRatio<char_type<Sentence1>>;
562
563template <typename InputIt1>
564CachedTokenRatio(InputIt1 first1, InputIt1 last1) -> CachedTokenRatio<iter_value_t<InputIt1>>;
565#endif
566
587template <typename Sentence1, typename Sentence2>
588double partial_token_ratio(const Sentence1& s1, const Sentence2& s2, double score_cutoff = 0);
589
590template <typename InputIt1, typename InputIt2>
591double partial_token_ratio(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2,
592 double score_cutoff = 0);
593
594// todo add real implementation
595template <typename CharT1>
596struct CachedPartialTokenRatio {
597 template <typename InputIt1>
598 CachedPartialTokenRatio(InputIt1 first1, InputIt1 last1)
599 : s1(first1, last1),
600 tokens_s1(detail::sorted_split(std::begin(s1), std::end(s1))),
601 s1_sorted(tokens_s1.join())
602 {}
603
604 template <typename Sentence1>
605 explicit CachedPartialTokenRatio(const Sentence1& s1_)
606 : CachedPartialTokenRatio(detail::to_begin(s1_), detail::to_end(s1_))
607 {}
608
609 template <typename InputIt2>
610 double similarity(InputIt2 first2, InputIt2 last2, double score_cutoff = 0.0,
611 double score_hint = 0.0) const;
612
613 template <typename Sentence2>
614 double similarity(const Sentence2& s2, double score_cutoff = 0.0, double score_hint = 0.0) const;
615
616private:
617 std::vector<CharT1> s1;
618 detail::SplittedSentenceView<typename std::vector<CharT1>::iterator> tokens_s1;
619 std::vector<CharT1> s1_sorted;
620};
621
622#ifdef RAPIDFUZZ_DEDUCTION_GUIDES
623template <typename Sentence1>
624explicit CachedPartialTokenRatio(const Sentence1& s1) -> CachedPartialTokenRatio<char_type<Sentence1>>;
625
626template <typename InputIt1>
627CachedPartialTokenRatio(InputIt1 first1, InputIt1 last1) -> CachedPartialTokenRatio<iter_value_t<InputIt1>>;
628#endif
629
651template <typename Sentence1, typename Sentence2>
652double WRatio(const Sentence1& s1, const Sentence2& s2, double score_cutoff = 0);
653
654template <typename InputIt1, typename InputIt2>
655double WRatio(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, double score_cutoff = 0);
656
657// todo add real implementation
658template <typename CharT1>
659struct CachedWRatio {
660 template <typename InputIt1>
661 explicit CachedWRatio(InputIt1 first1, InputIt1 last1);
662
663 template <typename Sentence1>
664 CachedWRatio(const Sentence1& s1_) : CachedWRatio(detail::to_begin(s1_), detail::to_end(s1_))
665 {}
666
667 template <typename InputIt2>
668 double similarity(InputIt2 first2, InputIt2 last2, double score_cutoff = 0.0,
669 double score_hint = 0.0) const;
670
671 template <typename Sentence2>
672 double similarity(const Sentence2& s2, double score_cutoff = 0.0, double score_hint = 0.0) const;
673
674private:
675 // todo somehow implement this using other ratios with creating PatternMatchVector
676 // multiple times
677 std::vector<CharT1> s1;
678 CachedPartialRatio<CharT1> cached_partial_ratio;
679 detail::SplittedSentenceView<typename std::vector<CharT1>::iterator> tokens_s1;
680 std::vector<CharT1> s1_sorted;
681 rapidfuzz::detail::BlockPatternMatchVector blockmap_s1_sorted;
682};
683
684#ifdef RAPIDFUZZ_DEDUCTION_GUIDES
685template <typename Sentence1>
686explicit CachedWRatio(const Sentence1& s1) -> CachedWRatio<char_type<Sentence1>>;
687
688template <typename InputIt1>
689CachedWRatio(InputIt1 first1, InputIt1 last1) -> CachedWRatio<iter_value_t<InputIt1>>;
690#endif
691
713template <typename Sentence1, typename Sentence2>
714double QRatio(const Sentence1& s1, const Sentence2& s2, double score_cutoff = 0);
715
716template <typename InputIt1, typename InputIt2>
717double QRatio(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, double score_cutoff = 0);
718
719#ifdef RAPIDFUZZ_SIMD
720namespace experimental {
721template <int MaxLen>
722struct MultiQRatio {
723public:
724 MultiQRatio(size_t count) : scorer(count)
725 {}
726
727 size_t result_count() const
728 {
729 return scorer.result_count();
730 }
731
732 template <typename Sentence1>
733 void insert(const Sentence1& s1_)
734 {
735 insert(detail::to_begin(s1_), detail::to_end(s1_));
736 }
737
738 template <typename InputIt1>
739 void insert(InputIt1 first1, InputIt1 last1)
740 {
741 scorer.insert(first1, last1);
742 str_lens.push_back(static_cast<size_t>(std::distance(first1, last1)));
743 }
744
745 template <typename InputIt2>
746 void similarity(double* scores, size_t score_count, InputIt2 first2, InputIt2 last2,
747 double score_cutoff = 0.0) const
748 {
749 similarity(scores, score_count, detail::make_range(first2, last2), score_cutoff);
750 }
751
752 template <typename Sentence2>
753 void similarity(double* scores, size_t score_count, const Sentence2& s2, double score_cutoff = 0) const
754 {
755 auto s2_ = detail::make_range(s2);
756 if (s2_.empty()) {
757 for (size_t i = 0; i < str_lens.size(); ++i)
758 scores[i] = 0;
759
760 return;
761 }
762
763 scorer.similarity(scores, score_count, s2, score_cutoff);
764
765 for (size_t i = 0; i < str_lens.size(); ++i)
766 if (str_lens[i] == 0) scores[i] = 0;
767 }
768
769private:
770 std::vector<size_t> str_lens;
771 MultiRatio<MaxLen> scorer;
772};
773} /* namespace experimental */
774#endif
775
776template <typename CharT1>
777struct CachedQRatio {
778 template <typename InputIt1>
779 CachedQRatio(InputIt1 first1, InputIt1 last1) : s1(first1, last1), cached_ratio(first1, last1)
780 {}
781
782 template <typename Sentence1>
783 explicit CachedQRatio(const Sentence1& s1_) : CachedQRatio(detail::to_begin(s1_), detail::to_end(s1_))
784 {}
785
786 template <typename InputIt2>
787 double similarity(InputIt2 first2, InputIt2 last2, double score_cutoff = 0.0,
788 double score_hint = 0.0) const;
789
790 template <typename Sentence2>
791 double similarity(const Sentence2& s2, double score_cutoff = 0.0, double score_hint = 0.0) const;
792
793private:
794 std::vector<CharT1> s1;
795 CachedRatio<CharT1> cached_ratio;
796};
797
798#ifdef RAPIDFUZZ_DEDUCTION_GUIDES
799template <typename Sentence1>
800explicit CachedQRatio(const Sentence1& s1) -> CachedQRatio<char_type<Sentence1>>;
801
802template <typename InputIt1>
803CachedQRatio(InputIt1 first1, InputIt1 last1) -> CachedQRatio<iter_value_t<InputIt1>>;
804#endif
805
808} // namespace fuzz
809} // namespace rapidfuzz
810
811#include <rapidfuzz/fuzz_impl.hpp>
double WRatio(const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
Calculates a weighted ratio based on the other ratio algorithms.
Definition fuzz_impl.hpp:825
double ratio(const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
calculates a simple ratio between two strings
Definition fuzz_impl.hpp:29
double QRatio(const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
Calculates a quick ratio between two strings using fuzz.ratio.
Definition fuzz_impl.hpp:905
double 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_r...
Definition fuzz_impl.hpp:491
double 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 th...
Definition fuzz_impl.hpp:567
double 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_...
Definition fuzz_impl.hpp:733
double 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.
Definition fuzz_impl.hpp:433
double 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.
Definition fuzz_impl.hpp:345
double 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.
Definition fuzz_impl.hpp:307
double partial_ratio(const Sentence1 &s1, const Sentence2 &s2, double score_cutoff=0)
calculates the fuzz::ratio of the optimal string alignment
Definition fuzz_impl.hpp:245