Skip to content

Commit a9c913e

Browse files
authored
Merge pull request #15 from gokhanercan/master
Removed redundant intersection loop
2 parents 3c42c73 + d56b44f commit a9c913e

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

strsimpy/sorensen_dice.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,5 @@ def similarity(self, s0, s1):
4444
union.add(k)
4545
for k in profile1.keys():
4646
union.add(k)
47-
inter = 0
48-
for k in union:
49-
if k in profile0.keys() and k in profile1.keys():
50-
inter += 1
47+
inter = int(len(profile0.keys()) + len(profile1.keys()) - len(union))
5148
return 2.0 * inter / (len(profile0) + len(profile1))

0 commit comments

Comments
 (0)