Skip to content

Commit

Permalink
stdlib: Fix jaro_similarity for matching strings of length 1
Browse files Browse the repository at this point in the history
  • Loading branch information
jessestimpson authored and Ledest committed Feb 5, 2025
1 parent 824edc6 commit 17c8f3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/otpbp_string.erl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jaro_similarity(A0, B0) ->
{{_, 0}, [_|0]} -> 1.0;
{{_, ALen}, [_|BLen]} when ALen =:= 0; BLen =:= 0 -> 0.0;
{{A, ALen}, [B|BLen]} ->
case jaro_match(A, B, max(ALen, BLen) div 2) of
case jaro_match(A, B, max(1, max(ALen, BLen) div 2)) of
{[], _} -> 0.0;
{AM, BM} ->
{M, T} = jaro_calc_mt(AM, BM, 0, 0),
Expand Down

0 comments on commit 17c8f3a

Please sign in to comment.