Sorensen–Dice coefficient: Difference between revisions
m
→{{header|jq}}: simplify
m (→{{header|jq}}: simplify) |
|||
(One intermediate revision by the same user not shown) | |||
Line 26:
SDC = 2 × |A∩B| / (|A| + |B|)
The Sørensen–Dice coefficient is thus a ratio between 0.0 and 1.0 giving the "percent similarity" between the two populations.
Line 327:
| .[1] as $j
| if $i == ($A|length) or $j == ($B|length) then empty
elif $A[$i] == $B[$j] then
elif $A[$i] < $B[$j] then [$i+1, $j] | pop
else [$i, $j+1] | pop
Line 337:
# Emit a stream of the bigrams of the input string blindly
def bg: . as $in | range(0;length-1 ) | $in[.:.+2];
ascii_downcase | [splits(" *") | bg];
|