Skip to content

Commit b218316

Browse files
committed
Keywords: Always invoke preprocessor __call__
1 parent 5276211 commit b218316

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

orangecontrib/text/widgets/owkeywords.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ def callback(i: float, status=""):
9494
# Normalize words
9595
for preprocessor in corpus.used_preprocessor.preprocessors:
9696
if isinstance(preprocessor, BaseNormalizer):
97-
words = [preprocessor.normalizer(w) for w in words]
97+
dummy = Corpus(Domain((), metas=[StringVariable("Words")]),
98+
metas=np.array(words)[:, None])
99+
words = list(preprocessor(dummy).tokens.flatten())
98100

99101
# Filter scores using words
100102
existing_words = [w for w in set(words) if w in scores.index]

orangecontrib/text/widgets/tests/test_owkeywords.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_run_with_words(self):
8585
self.assertEqual(len(results.scores), 42)
8686

8787
def test_run_normalize_words(self):
88-
normalizer = WordNetLemmatizer()
88+
normalizer = LemmagenLemmatizer()
8989
corpus = normalizer(self.corpus)
9090

9191
words = ["minor", "tree"]

0 commit comments

Comments
 (0)