From 727094375f701822279f9956db0ca2701362ffb5 Mon Sep 17 00:00:00 2001
From: Primoz Godec
Date: Thu, 9 Sep 2021 12:38:33 +0200
Subject: [PATCH] Document Embedder: fix default language setting
---
orangecontrib/text/widgets/owdocumentembedding.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/orangecontrib/text/widgets/owdocumentembedding.py b/orangecontrib/text/widgets/owdocumentembedding.py
index 6f23fc121..3bdf8f47c 100644
--- a/orangecontrib/text/widgets/owdocumentembedding.py
+++ b/orangecontrib/text/widgets/owdocumentembedding.py
@@ -16,6 +16,9 @@
from orangecontrib.text.corpus import Corpus
+LANGUAGES = sorted(list(LANGS_TO_ISO.keys()))
+
+
def run_pretrained_embedder(corpus: Corpus,
language: str,
aggregator: str,
@@ -40,7 +43,6 @@ def run_pretrained_embedder(corpus: Corpus,
Corpus
New corpus with additional features.
"""
-
embedder = DocumentEmbedder(language=language,
aggregator=aggregator)
@@ -82,14 +84,13 @@ class Error(OWWidget.Error):
class Warning(OWWidget.Warning):
unsuccessful_embeddings = Msg('Some embeddings were unsuccessful.')
- language = Setting(default=0)
+ language = Setting(default=LANGUAGES.index("English"))
aggregator = Setting(default=0)
def __init__(self):
OWWidget.__init__(self)
ConcurrentWidgetMixin.__init__(self)
- self.languages = sorted(list(LANGS_TO_ISO.keys()))
self.aggregators = AGGREGATORS
self.corpus = None
self.new_corpus = None
@@ -111,11 +112,10 @@ def _setup_layout(self):
value='language',
label='Language: ',
orientation=Qt.Horizontal,
- items=self.languages,
+ items=LANGUAGES,
callback=self._option_changed,
searchable=True
)
- self.language_cb.setCurrentText("English")
self.aggregator_cb = comboBox(widget=widget_box,
master=self,
@@ -168,7 +168,7 @@ def commit(self):
self.start(run_pretrained_embedder,
self.corpus,
- LANGS_TO_ISO[self.languages[self.language]],
+ LANGS_TO_ISO[LANGUAGES[self.language]],
self.aggregators[self.aggregator])
self.Error.clear()