Skip to content

Commit

Permalink
fixes for issue #28
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Soldaini committed Oct 18, 2018
1 parent 4a32fa8 commit e02723e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions quickumls.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ def _get_all_matches(self, ngrams):
n=self.ngram_length,
similarity_name=self.similarity_name
)
if match_similarity == 0:
continue

if not self._is_ok_semtype(semtypes):
continue
Expand Down
5 changes: 5 additions & 0 deletions toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ def make_ngrams(s, n):


def get_similarity(x, y, n, similarity_name):
if len(x) == 0 or len(y) == 0:
# we define similarity between two strings
# to be 0 if any of the two is empty.
return 0.

X, Y = set(make_ngrams(x, n)), set(make_ngrams(y, n))
intersec = len(X.intersection(Y))

Expand Down

0 comments on commit e02723e

Please sign in to comment.