Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbachmann committed Oct 24, 2024
1 parent f651666 commit 4dc6be8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
8 changes: 4 additions & 4 deletions rapidfuzz/distance/JaroWinkler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ struct CachedJaroWinkler : public detail::CachedSimilarityBase<CachedJaroWinkler
};

template <typename Sentence1>
explicit CachedJaroWinkler(const Sentence1& s1_, double _prefix_weight = 0.1)
-> CachedJaroWinkler<char_type<Sentence1>>;
explicit CachedJaroWinkler(const Sentence1& s1_,
double _prefix_weight = 0.1) -> CachedJaroWinkler<char_type<Sentence1>>;

template <typename InputIt1>
CachedJaroWinkler(InputIt1 first1, InputIt1 last1, double _prefix_weight = 0.1)
-> CachedJaroWinkler<iter_value_t<InputIt1>>;
CachedJaroWinkler(InputIt1 first1, InputIt1 last1,
double _prefix_weight = 0.1) -> CachedJaroWinkler<iter_value_t<InputIt1>>;

} // namespace rapidfuzz
19 changes: 12 additions & 7 deletions rapidfuzz/distance/Jaro_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ static inline size_t count_transpositions_block(const BlockPatternMatchVector& P

uint64_t PatternFlagMask = blsi(P_flag);

Transpositions += !(PM.get(PatternWord, T_first[static_cast<ptrdiff_t>(countr_zero(T_flag))]) & PatternFlagMask);
Transpositions += !(PM.get(PatternWord, T_first[static_cast<ptrdiff_t>(countr_zero(T_flag))]) &
PatternFlagMask);

T_flag = blsr(T_flag);
P_flag ^= PatternFlagMask;
Expand Down Expand Up @@ -649,7 +650,9 @@ jaro_similarity_simd_long_s2(Range<double*> scores, const detail::BlockPatternMa

for (size_t i = 0; i < vec_width; ++i) {
size_t CommonChars = static_cast<size_t>(counts[i]);
if (!jaro_common_char_filter(static_cast<size_t>(s1_lengths[result_index]), s2.size(), CommonChars, score_cutoff)) {
if (!jaro_common_char_filter(static_cast<size_t>(s1_lengths[result_index]), s2.size(),
CommonChars, score_cutoff))
{
scores[result_index] = 0.0;
result_index++;
continue;
Expand Down Expand Up @@ -683,8 +686,8 @@ jaro_similarity_simd_long_s2(Range<double*> scores, const detail::BlockPatternMa
}
}

double Sim =
jaro_calculate_similarity(static_cast<size_t>(s1_lengths[result_index]), s2.size(), CommonChars, Transpositions);
double Sim = jaro_calculate_similarity(static_cast<size_t>(s1_lengths[result_index]), s2.size(),
CommonChars, Transpositions);

scores[result_index] = (Sim >= score_cutoff) ? Sim : 0;
result_index++;
Expand Down Expand Up @@ -760,7 +763,9 @@ jaro_similarity_simd_short_s2(Range<double*> scores, const detail::BlockPatternM
T_flag.store(T_flags.data());
for (size_t i = 0; i < vec_width; ++i) {
size_t CommonChars = static_cast<size_t>(counts[i]);
if (!jaro_common_char_filter(static_cast<size_t>(s1_lengths[result_index]), s2.size(), CommonChars, score_cutoff)) {
if (!jaro_common_char_filter(static_cast<size_t>(s1_lengths[result_index]), s2.size(),
CommonChars, score_cutoff))
{
scores[result_index] = 0.0;
result_index++;
continue;
Expand All @@ -783,8 +788,8 @@ jaro_similarity_simd_short_s2(Range<double*> scores, const detail::BlockPatternM
P_flag_cur ^= PatternFlagMask;
}

double Sim =
jaro_calculate_similarity(static_cast<size_t>(s1_lengths[result_index]), s2.size(), CommonChars, Transpositions);
double Sim = jaro_calculate_similarity(static_cast<size_t>(s1_lengths[result_index]), s2.size(),
CommonChars, Transpositions);

scores[result_index] = (Sim >= score_cutoff) ? Sim : 0;
result_index++;
Expand Down
4 changes: 2 additions & 2 deletions rapidfuzz/distance/LCSseq_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ void lcs_simd(Range<size_t*> scores, const BlockPatternMatchVector& block, const
#endif

template <size_t N, bool RecordMatrix, typename PMV, typename InputIt1, typename InputIt2>
auto lcs_unroll(const PMV& block, const Range<InputIt1>&, const Range<InputIt2>& s2, size_t score_cutoff = 0)
-> LCSseqResult<RecordMatrix>
auto lcs_unroll(const PMV& block, const Range<InputIt1>&, const Range<InputIt2>& s2,
size_t score_cutoff = 0) -> LCSseqResult<RecordMatrix>
{
uint64_t S[N];
unroll<size_t, N>([&](size_t i) { S[i] = ~UINT64_C(0); });
Expand Down
8 changes: 4 additions & 4 deletions rapidfuzz/distance/Levenshtein.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,11 @@ struct CachedLevenshtein : public detail::CachedDistanceBase<CachedLevenshtein<C
};

template <typename Sentence1>
explicit CachedLevenshtein(const Sentence1& s1_, LevenshteinWeightTable aWeights = {1, 1, 1})
-> CachedLevenshtein<char_type<Sentence1>>;
explicit CachedLevenshtein(const Sentence1& s1_, LevenshteinWeightTable aWeights = {
1, 1, 1}) -> CachedLevenshtein<char_type<Sentence1>>;

template <typename InputIt1>
CachedLevenshtein(InputIt1 first1, InputIt1 last1, LevenshteinWeightTable aWeights = {1, 1, 1})
-> CachedLevenshtein<iter_value_t<InputIt1>>;
CachedLevenshtein(InputIt1 first1, InputIt1 last1,
LevenshteinWeightTable aWeights = {1, 1, 1}) -> CachedLevenshtein<iter_value_t<InputIt1>>;

} // namespace rapidfuzz

0 comments on commit 4dc6be8

Please sign in to comment.