Skip to content

Commit 5202c9f

Browse files
committed
jaccard: auto convert input type to set
1 parent af90c42 commit 5202c9f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

ppjoin/ppjoin_.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ def overlap_constraint(len_s1, len_s2, threshold):
3333

3434

3535
def jaccard(a, b):
36+
if not isinstance(a, set):
37+
a = set(a)
38+
if not isinstance(b, set):
39+
b = set(b)
3640
return 1.0 * len(a & b) / len(a | b)
3741

3842

0 commit comments

Comments
 (0)