@@ -139,34 +139,34 @@ namespace rapidfuzz {
139
139
*/
140
140
template <typename InputIt1, typename InputIt2>
141
141
size_t levenshtein_distance (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2,
142
- LevenshteinWeightTable weights = {1 , 1 , 1 },
143
- size_t score_cutoff = std::numeric_limits<size_t >::max(),
144
- size_t score_hint = std::numeric_limits<size_t>::max())
142
+ LevenshteinWeightTable weights = {1 , 1 , 1 },
143
+ size_t score_cutoff = std::numeric_limits<size_t >::max(),
144
+ size_t score_hint = std::numeric_limits<size_t>::max())
145
145
{
146
146
return detail::Levenshtein::distance (first1, last1, first2, last2, weights, score_cutoff, score_hint);
147
147
}
148
148
149
149
template <typename Sentence1, typename Sentence2>
150
150
size_t levenshtein_distance (const Sentence1& s1, const Sentence2& s2,
151
- LevenshteinWeightTable weights = {1 , 1 , 1 },
152
- size_t score_cutoff = std::numeric_limits<size_t >::max(),
153
- size_t score_hint = std::numeric_limits<size_t>::max())
151
+ LevenshteinWeightTable weights = {1 , 1 , 1 },
152
+ size_t score_cutoff = std::numeric_limits<size_t >::max(),
153
+ size_t score_hint = std::numeric_limits<size_t>::max())
154
154
{
155
155
return detail::Levenshtein::distance (s1, s2, weights, score_cutoff, score_hint);
156
156
}
157
157
158
158
template <typename InputIt1, typename InputIt2>
159
159
size_t levenshtein_similarity (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2,
160
- LevenshteinWeightTable weights = {1 , 1 , 1 }, size_t score_cutoff = 0 ,
161
- size_t score_hint = 0 )
160
+ LevenshteinWeightTable weights = {1 , 1 , 1 }, size_t score_cutoff = 0 ,
161
+ size_t score_hint = 0 )
162
162
{
163
163
return detail::Levenshtein::similarity (first1, last1, first2, last2, weights, score_cutoff, score_hint);
164
164
}
165
165
166
166
template <typename Sentence1, typename Sentence2>
167
167
size_t levenshtein_similarity (const Sentence1& s1, const Sentence2& s2,
168
- LevenshteinWeightTable weights = {1 , 1 , 1 }, size_t score_cutoff = 0 ,
169
- size_t score_hint = 0 )
168
+ LevenshteinWeightTable weights = {1 , 1 , 1 }, size_t score_cutoff = 0 ,
169
+ size_t score_hint = 0 )
170
170
{
171
171
return detail::Levenshtein::similarity (s1, s2, weights, score_cutoff, score_hint);
172
172
}
@@ -389,17 +389,13 @@ struct MultiLevenshtein : public detail::MultiDistanceBase<MultiLevenshtein<MaxL
389
389
390
390
detail::Range scores_ (scores, scores + score_count);
391
391
if constexpr (MaxLen == 8 )
392
- detail::levenshtein_hyrroe2003_simd<uint8_t >(scores_, PM, str_lens, s2,
393
- score_cutoff);
392
+ detail::levenshtein_hyrroe2003_simd<uint8_t >(scores_, PM, str_lens, s2, score_cutoff);
394
393
else if constexpr (MaxLen == 16 )
395
- detail::levenshtein_hyrroe2003_simd<uint16_t >(scores_, PM, str_lens, s2,
396
- score_cutoff);
394
+ detail::levenshtein_hyrroe2003_simd<uint16_t >(scores_, PM, str_lens, s2, score_cutoff);
397
395
else if constexpr (MaxLen == 32 )
398
- detail::levenshtein_hyrroe2003_simd<uint32_t >(scores_, PM, str_lens, s2,
399
- score_cutoff);
396
+ detail::levenshtein_hyrroe2003_simd<uint32_t >(scores_, PM, str_lens, s2, score_cutoff);
400
397
else if constexpr (MaxLen == 64 )
401
- detail::levenshtein_hyrroe2003_simd<uint64_t >(scores_, PM, str_lens, s2,
402
- score_cutoff);
398
+ detail::levenshtein_hyrroe2003_simd<uint64_t >(scores_, PM, str_lens, s2, score_cutoff);
403
399
}
404
400
405
401
template <typename InputIt2>
@@ -458,9 +454,8 @@ struct CachedLevenshtein : public detail::CachedDistanceBase<CachedLevenshtein<C
458
454
// max can make use of the common divisor of the three weights
459
455
size_t new_score_cutoff = detail::ceil_div (score_cutoff, weights.insert_cost );
460
456
size_t new_score_hint = detail::ceil_div (score_hint, weights.insert_cost );
461
- size_t dist = detail::uniform_levenshtein_distance (
462
- PM, detail::Range (s1), s2, new_score_cutoff,
463
- new_score_hint);
457
+ size_t dist = detail::uniform_levenshtein_distance (PM, detail::Range (s1), s2,
458
+ new_score_cutoff, new_score_hint);
464
459
dist *= weights.insert_cost ;
465
460
466
461
return (dist <= score_cutoff) ? dist : score_cutoff + 1 ;
@@ -478,8 +473,7 @@ struct CachedLevenshtein : public detail::CachedDistanceBase<CachedLevenshtein<C
478
473
}
479
474
}
480
475
481
- return detail::generalized_levenshtein_distance (
482
- detail::Range (s1), s2, weights, score_cutoff);
476
+ return detail::generalized_levenshtein_distance (detail::Range (s1), s2, weights, score_cutoff);
483
477
}
484
478
485
479
std::vector<CharT1> s1;
0 commit comments