Ejemplo n.º 1
0
    def preview_results_changed(self):
        settings_custom = self.main.settings_custom['lemmatization']

        if settings_custom['preview_samples']:
            if self.combo_box_lemmatization_preview_lang.isEnabled():
                self.__dict__[
                    f"combo_box_lemmatizer_{settings_custom['preview_lang']}"].setEnabled(
                        False)
                self.combo_box_lemmatization_preview_lang.setEnabled(False)
                self.button_lemmatization_start_processing.setEnabled(False)
                self.text_edit_lemmatization_preview_samples.setEnabled(False)

                self.button_lemmatization_start_processing.setText(
                    self.tr('Processing ...'))

                lemmatizer = self.__dict__[
                    f"combo_box_lemmatizer_{settings_custom['preview_lang']}"].currentText(
                    )

                worker_preview_lemmatizer = Wl_Worker_Preview_Lemmatizer(
                    self.main,
                    update_gui=self.update_gui,
                    lemmatizer=lemmatizer)

                self.thread_preview_lemmatizer = wl_threading.Wl_Thread_No_Progress(
                    worker_preview_lemmatizer)
                self.thread_preview_lemmatizer.start_worker()
        else:
            self.text_edit_lemmatization_preview_results.clear()
Ejemplo n.º 2
0
    def preview_results_changed(self):
        settings_custom = self.main.settings_custom['pos_tagging']

        if settings_custom['preview_samples']:
            if self.combo_box_pos_tagging_preview_lang.isEnabled():
                self.__dict__[
                    f"combo_box_pos_tagger_{settings_custom['preview_lang']}"].setEnabled(
                        False)
                self.combo_box_pos_tagging_preview_lang.setEnabled(False)

                self.label_pos_tagging_preview_processing.setText(
                    self.tr('Processing text ...'))

                pos_tagger = self.__dict__[
                    f"combo_box_pos_tagger_{settings_custom['preview_lang']}"].currentText(
                    )

                if self.checkbox_to_universal_pos_tags.isChecked():
                    tagset = 'universal'
                else:
                    tagset = 'default'

                worker_preview_pos_tagger = Wl_Worker_Preview_Pos_Tagger(
                    self.main,
                    update_gui=self.update_gui,
                    pos_tagger=pos_tagger,
                    tagset=tagset)

                self.thread_preview_pos_tagger = wl_threading.Wl_Thread_No_Progress(
                    worker_preview_pos_tagger)
                self.thread_preview_pos_tagger.start_worker()
        else:
            self.text_edit_pos_tagging_preview_results.clear()
    def preview_results_changed(self):
        if self.settings_custom['preview_samples']:
            if self.combo_box_syl_tokenization_preview_lang.isEnabled():
                row = list(self.settings_global.keys()).index(
                    self.settings_custom['preview_lang'])

                self.table_syl_tokenizers.itemDelegateForRow(row).set_enabled(
                    False)
                self.combo_box_syl_tokenization_preview_lang.setEnabled(False)
                self.button_syl_tokenization_show_preview.setEnabled(False)
                self.text_edit_syl_tokenization_preview_samples.setEnabled(
                    False)

                self.button_syl_tokenization_show_preview.setText(
                    self.tr('Processing...'))

                syl_tokenizer = wl_nlp_utils.to_lang_util_code(
                    self.main,
                    util_type='syl_tokenizers',
                    util_text=self.table_syl_tokenizers.model().item(row,
                                                                     1).text())

                worker_preview_syl_tokenizer = Wl_Worker_Preview_Syl_Tokenizer(
                    self.main,
                    update_gui=self.update_gui,
                    syl_tokenizer=syl_tokenizer)

                self.thread_preview_syl_tokenizer = wl_threading.Wl_Thread_No_Progress(
                    worker_preview_syl_tokenizer)
                self.thread_preview_syl_tokenizer.start_worker()
        else:
            self.text_edit_syl_tokenization_preview_results.clear()
Ejemplo n.º 4
0
    def preview_results_changed(self):
        settings_custom = self.main.settings_custom['sentence_tokenization']

        if settings_custom['preview_samples']:
            if self.combo_box_sentence_tokenization_preview_lang.isEnabled():
                self.__dict__[f"combo_box_sentence_tokenizer_{settings_custom['preview_lang']}"].setEnabled(False)
                self.combo_box_sentence_tokenization_preview_lang.setEnabled(False)

                self.label_sentence_tokenization_preview_processing.show()

                sentence_tokenizer = self.__dict__[f"combo_box_sentence_tokenizer_{settings_custom['preview_lang']}"].currentText()

                worker_preview_sentence_tokenizer = Wl_Worker_Preview_Sentence_Tokenizer(
                    self.main,
                    update_gui = self.update_gui,
                    sentence_tokenizer = sentence_tokenizer
                )

                self.thread_preview_sentence_tokenizer = wl_threading.Wl_Thread_No_Progress(worker_preview_sentence_tokenizer)
                self.thread_preview_sentence_tokenizer.start_worker()
        else:
            self.text_edit_sentence_tokenization_preview_results.clear()
Ejemplo n.º 5
0
    def preview_results_changed(self):
        if self.settings_custom['preview_samples']:
            if self.combo_box_pos_tagging_preview_lang.isEnabled():
                row = list(self.settings_global.keys()).index(
                    self.settings_custom['preview_lang'])

                self.table_pos_taggers.itemDelegateForRow(row).set_enabled(
                    False)
                self.combo_box_pos_tagging_preview_lang.setEnabled(False)
                self.button_pos_tagging_show_preview.setEnabled(False)
                self.text_edit_pos_tagging_preview_samples.setEnabled(False)
                self.checkbox_to_universal_pos_tags.setEnabled(False)

                self.button_pos_tagging_show_preview.setText(
                    self.tr('Processing...'))

                pos_tagger = wl_nlp_utils.to_lang_util_code(
                    self.main,
                    util_type='pos_taggers',
                    util_text=self.table_pos_taggers.model().item(row,
                                                                  1).text())

                if self.checkbox_to_universal_pos_tags.isChecked():
                    tagset = 'universal'
                else:
                    tagset = 'default'

                worker_preview_pos_tagger = Wl_Worker_Preview_Pos_Tagger(
                    self.main,
                    update_gui=self.update_gui,
                    pos_tagger=pos_tagger,
                    tagset=tagset)

                self.thread_preview_pos_tagger = wl_threading.Wl_Thread_No_Progress(
                    worker_preview_pos_tagger)
                self.thread_preview_pos_tagger.start_worker()
        else:
            self.text_edit_pos_tagging_preview_results.clear()