Skip to content

Commit 97f3024

Browse files
committed
Avoid integral division for Sorensen-Dice coefficient
1 parent 0b69a69 commit 97f3024

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/info/debatty/java/stringsimilarity/StringSet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ public double sorensenDiceSimilarity(StringSet other) throws Exception {
5454
throw new Exception("Profiles were not created using the same kshingling object!");
5555
}
5656

57-
return 2 * this.vector.intersection(other.vector) / (this.vector.size() + other.vector.size());
57+
return 2.0 * this.vector.intersection(other.vector) / (this.vector.size() + other.vector.size());
5858
}
5959
}

0 commit comments

Comments
 (0)