Skip to content

Commit

Permalink
annotate documents: update to work with the latest changes in keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
PrimozGodec committed May 9, 2022
1 parent bd433eb commit b2a4aa3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion orangecontrib/text/annotate_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def _get_characteristic_terms(
n_keywords: int = 20,
progress_callback: Callable = None
) -> List[List[Tuple[str, float]]]:
keywords = tfidf_keywords(corpus.tokens, progress_callback)
keywords = tfidf_keywords(corpus, progress_callback)
return [sorted(k, key=lambda x: x[1], reverse=True)[:n_keywords]
for k in keywords]

Expand Down
2 changes: 1 addition & 1 deletion orangecontrib/text/tests/test_annotate_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def setUp(self):
def test_get_characteristic_terms(self):
keywords = _get_characteristic_terms(self.corpus, 4)
keywords = [[w for w, _ in doc_keywords] for doc_keywords in keywords]
self.assertEqual(["applications", "abc", "lab", "for"], keywords[0])
self.assertEqual(["abc", "applications", "for", "lab"], keywords[0])

def test_hypergeom_clusters(self):
labels = ClusterDocuments.gmm(self.corpus.metas[:, -2:], 3, 0.6)
Expand Down

0 comments on commit b2a4aa3

Please sign in to comment.