Example #1
0
    def __init__(self, main):
        super().__init__(main, main.tr('Need Help?'),
                         width = 550,
                         height = 500)

        self.label_need_help = wl_label.Wl_Label_Dialog(
            self.tr('''
                <div>
                    If you encounter a problem, find a bug, or require any further information, feel free to ask questions, submit bug reports, or provide feedback by <a href="https://github.com/BLKSerene/Wordless/issues/new">creating an issue</a> on Github if you fail to find the answer by searching <a href="https://github.com/BLKSerene/Wordless/issues">existing issues</a> first.
                </div>

                <div>
                    If you need to post sample texts or other information that cannot be shared or you do not want to share publicly, you may send me an email.
                </div>
            '''),
            self
        )

        self.table_need_help = wl_table.Wl_Table(
            self,
            headers = [
                self.tr('Channel'),
                self.tr('Contact Information')
            ],
            cols_stretch = [
                self.tr('Contact Information')
            ]
        )

        self.table_need_help.setFixedHeight(300)
        self.table_need_help.setRowCount(4)
        self.table_need_help.verticalHeader().setHidden(True)

        self.table_need_help.setCellWidget(0, 0, wl_label.Wl_Label_Html_Centered(self.tr('Documentation'), self))
        self.table_need_help.setCellWidget(0, 1, wl_label.Wl_Label_Html('<a href="https://github.com/BLKSerene/Wordless#documentation">https://github.com/BLKSerene/Wordless#documentation</a>', self))
        self.table_need_help.setCellWidget(1, 0, wl_label.Wl_Label_Html_Centered(self.tr('Email'), self))
        self.table_need_help.setCellWidget(1, 1, wl_label.Wl_Label_Html('<a href="mailto:[email protected]">[email protected]</a>', self))
        self.table_need_help.setCellWidget(2, 0, wl_label.Wl_Label_Html_Centered(self.tr('<a href="https://www.wechat.com/en/">WeChat</a><br>Official Account'), self))
        self.table_need_help.setCellWidget(2, 1, wl_label.Wl_Label_Html_Centered('<img src="imgs/wechat_official_account.jpg">', self))

        self.label_need_help_note = wl_label.Wl_Label_Dialog(
            self.tr('''
                <div>
                    <span style="color: #F00;"><b>Important Note</b></span>: I <b>CANNOT GUARANTEE</b> that all emails will always be checked or replied in time. I <b>WILL NOT REPLY</b> to irrelevant emails and I reserve the right to <b>BLOCK AND/OR REPORT</b> people who send me spam emails.
                </div>
            '''),
            self
        )

        self.wrapper_info.layout().addWidget(self.label_need_help, 0, 0)
        self.wrapper_info.layout().addWidget(self.table_need_help, 1, 0)
        self.wrapper_info.layout().addWidget(self.label_need_help_note, 2, 0)
    def __init__(self, main):
        super().__init__(main)

        settings_global = self.main.settings_global['lemmatizers']

        # Lemmatizer Settings
        group_box_lemmatizer_settings = QGroupBox(
            self.tr('Lemmatizer Settings'), self)

        table_lemmatizers = wl_table.Wl_Table(
            self,
            headers=[self.tr('Language'),
                     self.tr('Lemmatizers')],
            cols_stretch=[self.tr('Lemmatizers')])

        table_lemmatizers.verticalHeader().setHidden(True)
        table_lemmatizers.setRowCount(len(settings_global))

        for i, lang in enumerate(settings_global):
            table_lemmatizers.setItem(
                i, 0,
                QTableWidgetItem(wl_conversion.to_lang_text(self.main, lang)))

            self.__dict__[
                f'combo_box_lemmatizer_{lang}'] = wl_box.Wl_Combo_Box(self)
            self.__dict__[f'combo_box_lemmatizer_{lang}'].addItems(
                settings_global[lang])

            table_lemmatizers.setCellWidget(
                i, 1, self.__dict__[f'combo_box_lemmatizer_{lang}'])

        group_box_lemmatizer_settings.setLayout(wl_layout.Wl_Layout())
        group_box_lemmatizer_settings.layout().addWidget(
            table_lemmatizers, 0, 0)

        # Preview
        group_box_preview = QGroupBox(self.tr('Preview'), self)

        self.label_lemmatization_preview_lang = QLabel(
            self.tr('Select language:'), self)
        self.combo_box_lemmatization_preview_lang = wl_box.Wl_Combo_Box(self)
        self.button_lemmatization_start_processing = QPushButton(
            self.tr('Start processing'), self)
        self.text_edit_lemmatization_preview_samples = QTextEdit(self)
        self.text_edit_lemmatization_preview_results = QTextEdit(self)

        self.combo_box_lemmatization_preview_lang.addItems(
            wl_conversion.to_lang_text(self.main,
                                       list(settings_global.keys())))

        self.button_lemmatization_start_processing.setFixedWidth(150)
        self.text_edit_lemmatization_preview_samples.setAcceptRichText(False)
        self.text_edit_lemmatization_preview_results.setReadOnly(True)

        self.combo_box_lemmatization_preview_lang.currentTextChanged.connect(
            self.preview_changed)
        self.button_lemmatization_start_processing.clicked.connect(
            self.preview_results_changed)
        self.text_edit_lemmatization_preview_samples.textChanged.connect(
            self.preview_changed)
        self.text_edit_lemmatization_preview_results.textChanged.connect(
            self.preview_changed)

        layout_preview_settings = wl_layout.Wl_Layout()
        layout_preview_settings.addWidget(
            self.label_lemmatization_preview_lang, 0, 0)
        layout_preview_settings.addWidget(
            self.combo_box_lemmatization_preview_lang, 0, 1)
        layout_preview_settings.addWidget(
            self.button_lemmatization_start_processing, 0, 3)

        layout_preview_settings.setColumnStretch(2, 1)

        group_box_preview.setLayout(wl_layout.Wl_Layout())
        group_box_preview.layout().addLayout(layout_preview_settings, 0, 0, 1,
                                             2)
        group_box_preview.layout().addWidget(
            self.text_edit_lemmatization_preview_samples, 1, 0)
        group_box_preview.layout().addWidget(
            self.text_edit_lemmatization_preview_results, 1, 1)

        self.setLayout(wl_layout.Wl_Layout())
        self.layout().addWidget(group_box_lemmatizer_settings, 0, 0)
        self.layout().addWidget(group_box_preview, 1, 0)

        self.layout().setContentsMargins(6, 4, 6, 4)
        self.layout().setRowStretch(0, 3)
        self.layout().setRowStretch(1, 2)
    def __init__(self, main):
        super().__init__(main)

        self.pos_tag_mappings_loaded = False

        settings_global = self.main.settings_global['pos_taggers']

        self.settings_tagsets = QWidget(self)

        # Preview Settings
        group_box_preview_settings = QGroupBox(self.tr('Preview Settings:'),
                                               self)

        self.label_tagsets_lang = QLabel(self.tr('Language:'), self)
        self.combo_box_tagsets_lang = wl_box.Wl_Combo_Box(self)
        self.label_tagsets_pos_tagger = QLabel(self.tr('POS Tagger:'), self)
        self.combo_box_tagsets_pos_tagger = wl_box.Wl_Combo_Box_Adjustable(
            self)

        self.combo_box_tagsets_lang.addItems(
            wl_conversion.to_lang_text(self.main, list(settings_global)))

        self.combo_box_tagsets_lang.currentTextChanged.connect(
            self.preview_lang_changed)
        self.combo_box_tagsets_pos_tagger.currentTextChanged.connect(
            self.preview_pos_tagger_changed)

        group_box_preview_settings.setLayout(wl_layout.Wl_Layout())
        group_box_preview_settings.layout().addWidget(self.label_tagsets_lang,
                                                      0, 0)
        group_box_preview_settings.layout().addWidget(
            self.combo_box_tagsets_lang, 0, 1, Qt.AlignLeft)
        group_box_preview_settings.layout().addWidget(
            self.label_tagsets_pos_tagger, 1, 0)
        group_box_preview_settings.layout().addWidget(
            self.combo_box_tagsets_pos_tagger, 1, 1, Qt.AlignLeft)

        group_box_preview_settings.layout().setColumnStretch(2, 1)

        # Mapping Settings
        group_box_mapping_settings = QGroupBox(self.tr('Mapping Settings'))

        self.label_tagsets_num_pos_tags = QLabel('', self)
        self.button_tagsets_reset = QPushButton(self.tr('Reset'), self)
        self.button_tagsets_reset_all = QPushButton(self.tr('Reset All'), self)
        self.table_mappings = wl_table.Wl_Table(
            self,
            headers=[
                self.tr('POS Tag'),
                self.tr('Universal POS Tag'),
                self.tr('Description'),
                self.tr('Examples')
            ])

        self.button_tagsets_reset.setFixedWidth(100)
        self.button_tagsets_reset_all.setFixedWidth(100)

        self.button_tagsets_reset.clicked.connect(self.reset_mappings)
        self.button_tagsets_reset_all.clicked.connect(self.reset_all_mappings)

        group_box_mapping_settings.setLayout(wl_layout.Wl_Layout())
        group_box_mapping_settings.layout().addWidget(
            self.label_tagsets_num_pos_tags, 0, 0)
        group_box_mapping_settings.layout().addWidget(
            self.button_tagsets_reset, 0, 2)
        group_box_mapping_settings.layout().addWidget(
            self.button_tagsets_reset_all, 0, 3)
        group_box_mapping_settings.layout().addWidget(self.table_mappings, 1,
                                                      0, 1, 4)

        group_box_mapping_settings.layout().setColumnStretch(1, 1)

        self.setLayout(wl_layout.Wl_Layout())
        self.layout().addWidget(group_box_preview_settings, 0, 0)
        self.layout().addWidget(group_box_mapping_settings, 1, 0)

        self.layout().setContentsMargins(6, 4, 6, 4)
        self.layout().setRowStretch(1, 1)
    def __init__(self, main):
        super().__init__(main)

        settings_global = self.main.settings_global['stop_words']

        # Stop Words Settings
        group_box_stop_words_settings = QGroupBox(
            self.tr('Stop Words Settings'), self)

        table_stop_words = wl_table.Wl_Table(
            self,
            headers=[self.tr('Language'),
                     self.tr('Lists of Stop Words')],
            cols_stretch=[self.tr('Lists of Stop Words')])

        table_stop_words.verticalHeader().setHidden(True)
        table_stop_words.setRowCount(len(settings_global))

        for i, lang in enumerate(settings_global):
            table_stop_words.setItem(
                i, 0,
                QTableWidgetItem(wl_conversion.to_lang_text(self.main, lang)))

            self.__dict__[
                f'combo_box_stop_words_{lang}'] = wl_box.Wl_Combo_Box(self)

            self.__dict__[f'combo_box_stop_words_{lang}'].addItems(
                settings_global[lang])

            self.__dict__[
                f'combo_box_stop_words_{lang}'].currentTextChanged.connect(
                    lambda text, lang=lang: self.stop_words_changed(lang))

            table_stop_words.setCellWidget(
                i, 1, self.__dict__[f'combo_box_stop_words_{lang}'])

        group_box_stop_words_settings.setLayout(wl_layout.Wl_Layout())
        group_box_stop_words_settings.layout().addWidget(
            table_stop_words, 0, 0)

        # Preview
        group_box_preview = QGroupBox(self.tr('Preview'), self)

        self.label_stop_words_preview_lang = QLabel(
            self.tr('Select language:'), self)
        self.combo_box_stop_words_preview_lang = wl_box.Wl_Combo_Box(self)
        self.combo_box_stop_words_preview_lang.addItems(
            wl_conversion.to_lang_text(self.main,
                                       list(settings_global.keys())))
        self.label_stop_words_preview_count = QLabel('', self)

        self.list_stop_words_preview_results = wl_list.Wl_List_Stop_Words(self)

        self.combo_box_stop_words_preview_lang.currentTextChanged.connect(
            self.preview_settings_changed)
        self.combo_box_stop_words_preview_lang.currentTextChanged.connect(
            self.preview_results_changed)

        layout_preview_settings = wl_layout.Wl_Layout()
        layout_preview_settings.addWidget(self.label_stop_words_preview_lang,
                                          0, 0)
        layout_preview_settings.addWidget(
            self.combo_box_stop_words_preview_lang, 0, 1)
        layout_preview_settings.addWidget(self.label_stop_words_preview_count,
                                          0, 3)

        layout_preview_settings.setColumnStretch(2, 1)

        group_box_preview.setLayout(wl_layout.Wl_Layout())
        group_box_preview.layout().addLayout(layout_preview_settings, 0, 0, 1,
                                             5)
        group_box_preview.layout().addWidget(
            self.list_stop_words_preview_results, 1, 0, 1, 5)
        group_box_preview.layout().addWidget(
            self.list_stop_words_preview_results.button_add, 2, 0)
        group_box_preview.layout().addWidget(
            self.list_stop_words_preview_results.button_remove, 2, 1)
        group_box_preview.layout().addWidget(
            self.list_stop_words_preview_results.button_clear, 2, 2)
        group_box_preview.layout().addWidget(
            self.list_stop_words_preview_results.button_import, 2, 3)
        group_box_preview.layout().addWidget(
            self.list_stop_words_preview_results.button_export, 2, 4)

        self.setLayout(wl_layout.Wl_Layout())
        self.layout().addWidget(group_box_stop_words_settings, 0, 0)
        self.layout().addWidget(group_box_preview, 1, 0)

        self.layout().setContentsMargins(6, 4, 6, 4)
        self.layout().setRowStretch(0, 3)
        self.layout().setRowStretch(1, 2)

        self.preview_results_changed()
Example #5
0
    def __init__(self, main):
        super().__init__(main, main.tr('Acknowledgments'), width=550)

        with open('wl_acks/wl_acks_general.csv',
                  'r',
                  encoding='utf_8',
                  newline='') as f:
            csv_reader = csv.reader(f, delimiter='|')

            self.ACKS_GENERAL = [row for row in csv_reader]

        with open('wl_acks/wl_acks_nlp.csv', 'r', encoding='utf_8',
                  newline='') as f:
            csv_reader = csv.reader(f, delimiter='|')

            self.ACKS_NLP = [row for row in csv_reader]

        with open('wl_acks/wl_acks_lang_data.csv',
                  'r',
                  encoding='utf_8',
                  newline='') as f:
            csv_reader = csv.reader(f, delimiter='|')

            self.ACKS_LANG_DATA = [row for row in csv_reader]

        with open('wl_acks/wl_acks_plotting.csv',
                  'r',
                  encoding='utf_8',
                  newline='') as f:
            csv_reader = csv.reader(f, delimiter='|')

            self.ACKS_PLOTTING = [row for row in csv_reader]

        with open('wl_acks/wl_acks_misc.csv',
                  'r',
                  encoding='utf_8',
                  newline='') as f:
            csv_reader = csv.reader(f, delimiter='|')

            self.ACKS_MISC = [row for row in csv_reader]

        self.label_acks = wl_label.Wl_Label_Dialog(
            self.tr('''
                <div>
                    I would like to extend my sincere gratitude to the following open-source projects without which this project would not have been possible:
                </div>
            '''), self)
        self.label_browse_category = QLabel(self.tr('Browse by category:'),
                                            self)
        self.combo_box_browse_category = wl_box.Wl_Combo_Box(self)

        self.table_acks = wl_table.Wl_Table(self,
                                            headers=[
                                                self.tr('Name'),
                                                self.tr('Version'),
                                                self.tr('Author(s)'),
                                                self.tr('License')
                                            ])

        self.combo_box_browse_category.addItems([
            self.tr('General'),
            self.tr('Natural Language Processing'),
            self.tr('Language Data'),
            self.tr('Plotting'),
            self.tr('Miscellaneous')
        ])

        self.table_acks.setFixedHeight(250)

        self.combo_box_browse_category.currentTextChanged.connect(
            self.browse_category_changed)

        layout_browse_category = wl_layout.Wl_Layout()
        layout_browse_category.addWidget(self.label_browse_category, 0, 0)
        layout_browse_category.addWidget(self.combo_box_browse_category, 0, 1)

        layout_browse_category.setColumnStretch(2, 1)

        self.wrapper_info.layout().addWidget(self.label_acks, 0, 0)
        self.wrapper_info.layout().addLayout(layout_browse_category, 1, 0)
        self.wrapper_info.layout().addWidget(self.table_acks, 2, 0)

        self.load_settings()

        self.set_fixed_height()
Example #6
0
    def __init__(self, main):
        super().__init__(main)

        settings_global = self.main.settings_global['pos_taggers']

        # POS Tagger Settings
        group_box_pos_tagger_settings = QGroupBox(
            self.tr('POS Tagger Settings'), self)

        self.table_pos_taggers = wl_table.Wl_Table(
            self,
            headers=[self.tr('Language'),
                     self.tr('POS Taggers')],
            cols_stretch=[self.tr('POS Taggers')])

        self.checkbox_to_universal_pos_tags = QCheckBox(
            self.tr('Convert all POS tags to universal POS tags'))

        self.table_pos_taggers.verticalHeader().setHidden(True)
        self.table_pos_taggers.setRowCount(len(settings_global))

        for i, lang in enumerate(settings_global):
            self.table_pos_taggers.setItem(
                i, 0,
                QTableWidgetItem(wl_conversion.to_lang_text(self.main, lang)))

            self.__dict__[
                f'combo_box_pos_tagger_{lang}'] = wl_box.Wl_Combo_Box(self)

            self.__dict__[f'combo_box_pos_tagger_{lang}'].addItems(
                settings_global[lang])

            self.__dict__[
                f'combo_box_pos_tagger_{lang}'].currentTextChanged.connect(
                    lambda text, lang=lang: self.pos_taggers_changed(lang))

            self.table_pos_taggers.setCellWidget(
                i, 1, self.__dict__[f'combo_box_pos_tagger_{lang}'])

        self.checkbox_to_universal_pos_tags.stateChanged.connect(
            self.preview_results_changed)

        group_box_pos_tagger_settings.setLayout(wl_layout.Wl_Layout())
        group_box_pos_tagger_settings.layout().addWidget(
            self.table_pos_taggers, 0, 0)
        group_box_pos_tagger_settings.layout().addWidget(
            self.checkbox_to_universal_pos_tags, 1, 0)

        # Preview
        group_box_preview = QGroupBox(self.tr('Preview'), self)

        self.label_pos_tagging_preview_lang = QLabel(
            self.tr('Select language:'), self)
        self.combo_box_pos_tagging_preview_lang = wl_box.Wl_Combo_Box(self)
        self.label_pos_tagging_preview_processing = QLabel('', self)
        self.text_edit_pos_tagging_preview_samples = QTextEdit(self)
        self.text_edit_pos_tagging_preview_results = QTextEdit(self)

        self.combo_box_pos_tagging_preview_lang.addItems(
            wl_conversion.to_lang_text(self.main, list(settings_global)))

        self.text_edit_pos_tagging_preview_samples.setAcceptRichText(False)
        self.text_edit_pos_tagging_preview_results.setReadOnly(True)

        self.combo_box_pos_tagging_preview_lang.currentTextChanged.connect(
            self.preview_changed)
        self.combo_box_pos_tagging_preview_lang.currentTextChanged.connect(
            self.preview_results_changed)
        self.text_edit_pos_tagging_preview_samples.textChanged.connect(
            self.preview_changed)
        self.text_edit_pos_tagging_preview_samples.textChanged.connect(
            self.preview_results_changed)
        self.text_edit_pos_tagging_preview_results.textChanged.connect(
            self.preview_changed)

        layout_preview_settings = wl_layout.Wl_Layout()
        layout_preview_settings.addWidget(self.label_pos_tagging_preview_lang,
                                          0, 0)
        layout_preview_settings.addWidget(
            self.combo_box_pos_tagging_preview_lang, 0, 1)
        layout_preview_settings.addWidget(
            self.label_pos_tagging_preview_processing, 0, 3)

        layout_preview_settings.setColumnStretch(2, 1)

        group_box_preview.setLayout(wl_layout.Wl_Layout())
        group_box_preview.layout().addLayout(layout_preview_settings, 0, 0, 1,
                                             2)
        group_box_preview.layout().addWidget(
            self.text_edit_pos_tagging_preview_samples, 1, 0)
        group_box_preview.layout().addWidget(
            self.text_edit_pos_tagging_preview_results, 1, 1)

        self.setLayout(wl_layout.Wl_Layout())
        self.layout().addWidget(group_box_pos_tagger_settings, 0, 0)
        self.layout().addWidget(group_box_preview, 1, 0)

        self.layout().setContentsMargins(6, 4, 6, 4)
        self.layout().setRowStretch(0, 3)
        self.layout().setRowStretch(1, 2)