Skip to content

Commit

Permalink
Test Annotator heuristics
Browse files Browse the repository at this point in the history
  • Loading branch information
ajdapretnar committed Mar 20, 2024
1 parent b545ece commit edf91c8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions orangecontrib/text/widgets/tests/test_owannotator.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,28 @@ def test_attr_label_metas(self):
simulate.combobox_activate_item(self.widget.controls.attr_label,
self.corpus.domain[-1].name)

@patch("Orange.projection.manifold.TSNE", DummyTSNE)
@patch("Orange.projection.manifold.TSNEModel", DummyTSNEModel)
def test_attr_heuristics(self):
c = Corpus.from_file("slo-opinion-corpus.tab")[:20]

for pp in (LowercaseTransformer(), RegexpTokenizer(r"\w+"),
StopwordsFilter("sl"), FrequencyFilter(0.25, 0.5)):
corpus = pp(c)
corpus = BowVectorizer().transform(corpus)

owtsne = self.create_widget(OWtSNE)
self.send_signal(owtsne.Inputs.data, corpus, widget=owtsne)
self.wait_until_finished(widget=owtsne)
tsne_output = self.get_output(owtsne.Outputs.annotated_data, owtsne)

widget = self.create_widget(OWAnnotator)
self.send_signal(widget.Inputs.corpus, tsne_output)
self.wait_until_finished()

self.assertEqual(widget.attr_x.name, "t-SNE-x")
self.assertEqual(widget.attr_y.name, "t-SNE-y")

def test_attr_models(self):
self.send_signal(self.widget.Inputs.corpus, self.corpus[::30])
self.wait_until_finished()
Expand Down

0 comments on commit edf91c8

Please sign in to comment.