Jaro similarity: Difference between revisions

Content added Content deleted
mNo edit summary
(→‎{{header|jq}}: if .m == 0)
Line 1,746: Line 1,746:
.m+=1)
.m+=1)
| when($l2 == $l1; .p += 1) ) ) )
| when($l2 == $l1; .p += 1) ) ) )
| ((.m-.p)/2) as $t
| if .m == 0 then 0
| ( (.m/$len1) + (.m/$len2) + ((.m-$t)/.m) ) / 3
else ((.m-.p)/2) as $t
| (1/3) * ( (.m/$len1) + (.m/$len2) + ((.m-$t)/.m) )
;
end ;
jaro("MARTHA";"MARHTA")
jaro("MARTHA";"MARHTA")
, jaro("DIXON"; "DICKSONX")
, jaro("DIXON"; "DICKSONX")