Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,7 +65,8 @@ def sentence_similarity(sent1, sent2, stopwords): #Creating words in sentences
|
|
| 65 |
if w in stopwords:
|
| 66 |
continue
|
| 67 |
vector2[all_words.index(w)] += 1
|
| 68 |
-
|
|
|
|
| 69 |
return 1 - cosine_distance(vector1, vector2)
|
| 70 |
|
| 71 |
|
|
|
|
| 65 |
if w in stopwords:
|
| 66 |
continue
|
| 67 |
vector2[all_words.index(w)] += 1
|
| 68 |
+
if np.isnan(1 - cosine_distance(vector1, vector2)):
|
| 69 |
+
return 0
|
| 70 |
return 1 - cosine_distance(vector1, vector2)
|
| 71 |
|
| 72 |
|