Spaces:
Sleeping
Sleeping
fix on repetitions
Browse files
app.py
CHANGED
@@ -75,7 +75,7 @@ def return_top_k(sentence, k=10):
|
|
75 |
predictions = [tokenizer.decode(tokens, skip_special_tokens=True) for tokens in output_sequences['sequences']]
|
76 |
probabilities = [round(float(prob), 2) for prob in decoded_probabilities]
|
77 |
|
78 |
-
stripped_sent = [remove_punctuation(word) for word in sentence.split()]
|
79 |
for pred in predictions:
|
80 |
if (len(pred) < 2) | (pred in stripped_sent):
|
81 |
predictions.pop(predictions.index(pred))
|
|
|
75 |
predictions = [tokenizer.decode(tokens, skip_special_tokens=True) for tokens in output_sequences['sequences']]
|
76 |
probabilities = [round(float(prob), 2) for prob in decoded_probabilities]
|
77 |
|
78 |
+
stripped_sent = [remove_punctuation(word.lower()) for word in sentence.split()]
|
79 |
for pred in predictions:
|
80 |
if (len(pred) < 2) | (pred in stripped_sent):
|
81 |
predictions.pop(predictions.index(pred))
|