Skip to content

Commit

Permalink
adding test_keep_largest_overlapped_keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmednasserswe committed Aug 21, 2024
1 parent 6602091 commit 255fe2d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/lib/model/test_yake_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ def test_run_yake_real(self):
})
results = self.yake_model.run_yake(**self.yake_model.get_params(message))
self.assertEqual(results, {"keywords": [('love Meedan', 0.0013670273525686505)]})

def test_keep_largest_overlapped_keywords(self):
keywords_test = [('Alegre',0), ('AlegreAlegre', 0), ('Alegre Alegre', 0), ("Presto", 0)]
expected = [('AlegreAlegre', 0), ('Alegre Alegre', 0), ('Presto', 0)]
self.assertEqual(self.yake_model.keep_largest_overlapped_keywords(keywords_test), expected)
def test_get_params_with_defaults(self):
message = schemas.parse_message({
"body": {
Expand All @@ -51,7 +54,7 @@ def test_get_params_with_defaults(self):
},
"model_name": "yake_keywords__Model"
})
expected = {'text': 'Some Text', 'language': "en", 'max_ngram_size': 3, 'deduplication_threshold': 0.25, 'deduplication_algo': 'seqm', 'window_size': 0, 'num_of_keywords': 10}
expected = {'text': 'Some Text', 'language': "auto", 'max_ngram_size': 3, 'deduplication_threshold': 0.25, 'deduplication_algo': 'seqm', 'window_size': 0, 'num_of_keywords': 10}
self.assertEqual(self.yake_model.get_params(message), expected)

def test_get_params_with_specifics(self):
Expand Down

0 comments on commit 255fe2d

Please sign in to comment.