Skip to content

Commit

Permalink
Document embedders: additional languages
Browse files Browse the repository at this point in the history
  • Loading branch information
PrimozGodec committed Sep 7, 2020
1 parent 4207270 commit aa8fc26
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 9 deletions.
34 changes: 33 additions & 1 deletion orangecontrib/text/vectorization/document_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,39 @@

AGGREGATORS = ['Mean', 'Sum', 'Max', 'Min']
AGGREGATORS_L = ['mean', 'sum', 'max', 'min']
LANGS_TO_ISO = {'English': 'en', 'Slovenian': 'sl', 'German': 'de'}
LANGS_TO_ISO = {
'English': 'en',
'Slovenian': 'sl',
'German': 'de',
'Arabic': 'ar',
'Azerbaijani': 'az',
'Bengali': 'bn',
'Chinese': 'zh',
'Danish': 'da',
'Dutch': 'nl',
'Finnish': 'fi',
'French': 'fr',
'Greek': 'el',
'Hebrew': 'he',
'Hindi': 'hi',
'Hungarian': 'hu',
'Indonesian': 'id',
'Italian': 'it',
'Japanese': 'ja',
'Kazakh': 'kk',
'Korean': 'ko',
'Nepali': 'ne',
'Norwegian (Bokm\u00e5l)': 'no',
'Norwegian (Nynorsk)': 'nn',
'Polish': 'pl',
'Portuguese': 'pt',
'Romanian': 'ro',
'Russian': 'ru',
'Spanish': 'es',
'Swedish': 'sv',
'Tajik': 'tg',
'Turkish': 'tr'
}
LANGUAGES = list(LANGS_TO_ISO.values())


Expand Down
19 changes: 11 additions & 8 deletions orangecontrib/text/widgets/owdocumentembedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(self):
OWWidget.__init__(self)
ConcurrentWidgetMixin.__init__(self)

self.languages = list(LANGS_TO_ISO.keys())
self.languages = sorted(list(LANGS_TO_ISO.keys()))
self.aggregators = AGGREGATORS
self.corpus = None
self.new_corpus = None
Expand All @@ -104,13 +104,16 @@ def _setup_layout(self):

widget_box = widgetBox(self.controlArea, 'Settings')

self.language_cb = comboBox(widget=widget_box,
master=self,
value='language',
label='Language: ',
orientation=Qt.Horizontal,
items=self.languages,
callback=self._option_changed)
self.language_cb = comboBox(
widget=widget_box,
master=self,
value='language',
label='Language: ',
orientation=Qt.Horizontal,
items=self.languages,
callback=self._option_changed,
searchable=True
)

self.aggregator_cb = comboBox(widget=widget_box,
master=self,
Expand Down

0 comments on commit aa8fc26

Please sign in to comment.