Exemplo n.º 1
0
def wordless_widgets_token_settings_concordancer(parent):
    def use_tags_changed():
        if checkbox_use_tags.isChecked():
            stacked_widget_ignore_tags.setCurrentIndex(1)
            stacked_widget_ignore_tags_type.setCurrentIndex(1)
        else:
            stacked_widget_ignore_tags.setCurrentIndex(0)
            stacked_widget_ignore_tags_type.setCurrentIndex(0)

    checkbox_puncs = QCheckBox(parent.tr('Punctuations'), parent)
    checkbox_ignore_tags = QCheckBox(parent.tr('Ignore'), parent)
    checkbox_ignore_tags_tags = QCheckBox(parent.tr('Ignore'), parent)
    combo_box_ignore_tags = wordless_box.Wordless_Combo_Box(parent)
    combo_box_ignore_tags_tags = wordless_box.Wordless_Combo_Box(parent)

    label_ignore_tags = QLabel(parent.tr('Tags'), parent)
    checkbox_use_tags = QCheckBox(parent.tr('Use tags only'), parent)

    combo_box_ignore_tags.addItems([
        parent.tr('all'),
        parent.tr('POS'),
        parent.tr('non-POS')
    ])

    combo_box_ignore_tags_tags.addItems([
        parent.tr('POS'),
        parent.tr('non-POS')
    ])

    stacked_widget_ignore_tags = QStackedWidget(parent)
    stacked_widget_ignore_tags.addWidget(checkbox_ignore_tags)
    stacked_widget_ignore_tags.addWidget(checkbox_ignore_tags_tags)

    stacked_widget_ignore_tags_type = QStackedWidget(parent)
    stacked_widget_ignore_tags_type.addWidget(combo_box_ignore_tags)
    stacked_widget_ignore_tags_type.addWidget(combo_box_ignore_tags_tags)

    checkbox_use_tags.stateChanged.connect(use_tags_changed)

    use_tags_changed()

    return (checkbox_puncs,

            stacked_widget_ignore_tags,
            checkbox_ignore_tags,
            checkbox_ignore_tags_tags,

            stacked_widget_ignore_tags_type,
            combo_box_ignore_tags,
            combo_box_ignore_tags_tags,

            label_ignore_tags,
            checkbox_use_tags)
Exemplo n.º 2
0
def wordless_widgets_filter_results(parent, table):
    def table_item_changed():
        if combo_box_filter_file.count() == 1:
            file_old = ''
        else:
            file_old = combo_box_filter_file.currentText()

        combo_box_filter_file.clear()

        for file in table.settings['files']['files_open']:
            if file['selected']:
                combo_box_filter_file.addItem(file['name'])

        combo_box_filter_file.addItem(parent.tr('Total'))

        if combo_box_filter_file.findText(file_old) > -1:
            combo_box_filter_file.setCurrentText(file_old)

    label_filter_file = QLabel(parent.tr('Filter File:'), parent)
    combo_box_filter_file = wordless_box.Wordless_Combo_Box(parent)
    button_filter_results = QPushButton(parent.tr('Filter Results in Table'), parent)

    button_filter_results.clicked.connect(lambda: table.update_filters())

    table.itemChanged.connect(table_item_changed)

    table_item_changed()

    return (label_filter_file, combo_box_filter_file,
            button_filter_results)
Exemplo n.º 3
0
    def __init__(self, main):
        if platform.system() == 'Windows':
            super().__init__(main,
                             main.tr('Citing'),
                             width=400,
                             height=200,
                             no_button=True)
        elif platform.system() == 'Darwin':
            super().__init__(main,
                             main.tr('Citing'),
                             width=400,
                             height=250,
                             no_button=True)

        self.label_citing = wordless_label.Wordless_Label_Dialog(
            self.tr('''
                <div>
                    If you publish work that uses Wordless, please cite as follows.
                </div>
            '''), self)

        self.label_citation_sys = QLabel(self.tr('Citation System:'), self)
        self.combo_box_citation_sys = wordless_box.Wordless_Combo_Box(self)
        self.text_edit_citing = QTextEdit(self)

        self.button_copy = QPushButton(self.tr('Copy'), self)
        self.button_close = QPushButton(self.tr('Close'), self)

        self.combo_box_citation_sys.addItems([
            self.tr('MLA (8th Edition)'),
            self.tr('APA (6th Edition)'),
            self.tr('GB (GB/T 7714—2015)')
        ])

        self.button_copy.setFixedWidth(100)
        self.button_close.setFixedWidth(100)

        self.text_edit_citing.setFixedHeight(100)
        self.text_edit_citing.setReadOnly(True)

        self.combo_box_citation_sys.currentTextChanged.connect(
            self.citation_sys_changed)

        self.button_copy.clicked.connect(self.copy)
        self.button_close.clicked.connect(self.accept)

        layout_citation_sys = wordless_layout.Wordless_Layout()
        layout_citation_sys.addWidget(self.label_citation_sys, 0, 0)
        layout_citation_sys.addWidget(self.combo_box_citation_sys, 0, 1)

        layout_citation_sys.setColumnStretch(2, 1)

        self.wrapper_info.layout().addWidget(self.label_citing, 0, 0, 1, 2)
        self.wrapper_info.layout().addLayout(layout_citation_sys, 1, 0, 1, 2)
        self.wrapper_info.layout().addWidget(self.text_edit_citing, 2, 0, 1, 2)

        self.wrapper_buttons.layout().addWidget(self.button_copy, 0, 0)
        self.wrapper_buttons.layout().addWidget(self.button_close, 0, 1)

        self.load_settings()
Exemplo n.º 4
0
def wordless_widgets_use_data_freq(parent):
    label_use_data = QLabel(parent.tr('Use Data:'), parent)
    combo_box_use_data = wordless_box.Wordless_Combo_Box(parent)

    combo_box_use_data.addItems([parent.tr('Absolute Frequency'),
                                 parent.tr('Relative Frequency')])

    return label_use_data, combo_box_use_data
Exemplo n.º 5
0
def wordless_widgets_direction_2(parent):
    label_direction = QLabel(parent.tr('Direction:'), parent)
    combo_box_direction = wordless_box.Wordless_Combo_Box(parent)

    combo_box_direction.addItems([parent.tr('Two-tailed'),
                                  parent.tr('One-tailed')])

    return label_direction, combo_box_direction
Exemplo n.º 6
0
def wordless_widgets_measure_adjusted_freq(parent):
    main = wordless_misc.find_wordless_main(parent)

    label_measure_adjusted_freq = QLabel(parent.tr('Measure of Adjusted Frequency:'), parent)
    combo_box_measure_adjusted_freq = wordless_box.Wordless_Combo_Box(parent)

    combo_box_measure_adjusted_freq.addItems(list(main.settings_global['measures_adjusted_freq'].keys()))

    return (label_measure_adjusted_freq,
            combo_box_measure_adjusted_freq)
Exemplo n.º 7
0
def wordless_widgets_measure_dispersion(parent):
    main = wordless_misc.find_wordless_main(parent)

    label_measure_dispersion = QLabel(parent.tr('Measure of Dispersion:'), parent)
    combo_box_measure_dispersion = wordless_box.Wordless_Combo_Box(parent)

    combo_box_measure_dispersion.addItems(list(main.settings_global['measures_dispersion'].keys()))

    return (label_measure_dispersion,
            combo_box_measure_dispersion)
Exemplo n.º 8
0
    def dropEvent(self, event):
        rows_dragged = []

        if self.indexAt(event.pos()).row() == -1:
            row_dropped = self.rowCount()
        else:
            row_dropped = self.indexAt(event.pos()).row()

        selected_rows = self.get_selected_rows()

        self.blockSignals(True)

        for row in selected_rows:
            rows_dragged.append([])

            for col in range(self.columnCount()):
                if self.item(row, col):
                    rows_dragged[-1].append(self.takeItem(row, col))
                else:
                    rows_dragged[-1].append(self.cellWidget(row, col))

        for i in reversed(selected_rows):
            self.removeRow(i)

            if i < row_dropped:
                row_dropped -= 1

        for row, items in enumerate(rows_dragged):
            self.insertRow(row_dropped + row)

            for col, item in enumerate(items):
                if isinstance(item, QTableWidgetItem):
                    self.setItem(row_dropped + row, col, item)

                    self.item(row, col).setSelected(True)
                elif isinstance(item, QComboBox):
                    item_combo_box = wordless_box.Wordless_Combo_Box(self)
                    item_combo_box.addItems(
                        [item.itemText(i) for i in range(item.count())])
                    item_combo_box.setCurrentText(item.currentText())

                    self.setCellWidget(row_dropped + row, col, item_combo_box)

        self.blockSignals(False)

        self.itemChanged.emit(self.item(0, 0))

        event.accept()
Exemplo n.º 9
0
    def __init__(self, main):
        super().__init__(main, main.tr('Donating'), width=400, height=510)

        self.label_donating = wordless_label.Wordless_Label_Dialog(
            self.tr('''
                <div>
                    If you would like to support the development of Wordless, you may donate via PayPal, Alipay or WeChat.
                </div>
            '''), self)
        self.label_donating_via = QLabel(self.tr('Donating via:'), self)
        self.combo_box_donating_via = wordless_box.Wordless_Combo_Box(self)
        self.label_donating_via_img = wordless_label.Wordless_Label_Html(
            '', self)
        self.label_donating_note = wordless_label.Wordless_Label_Dialog(
            self.tr('''
                <div>
                    <span style="color: #F00;"><b>Important Note</b></span>: I <b>WILL NOT PROVIDE</b> refund services, private email/phone support, information concerning my social media, gurantees on bug fixes, enhancements, new features or new releases of Wordless, invoices, receipts or detailed weekly/monthly/yearly/etc. spending report for donation. 
                </div>
            '''), self)

        self.combo_box_donating_via.addItems(
            [self.tr('PayPal'),
             self.tr('Alipay'),
             self.tr('WeChat')])

        self.combo_box_donating_via.currentTextChanged.connect(
            self.donating_via_changed)

        layout_donating_via = wordless_layout.Wordless_Layout()
        layout_donating_via.addWidget(self.label_donating_via, 0, 0)
        layout_donating_via.addWidget(self.combo_box_donating_via, 0, 1)

        layout_donating_via.setColumnStretch(2, 1)

        self.wrapper_info.layout().addWidget(self.label_donating, 0, 0)
        self.wrapper_info.layout().addLayout(layout_donating_via, 1, 0)
        self.wrapper_info.layout().addWidget(self.label_donating_via_img, 2, 0,
                                             Qt.AlignHCenter | Qt.AlignVCenter)
        self.wrapper_info.layout().addWidget(self.label_donating_note, 3, 0)

        self.load_settings()
Exemplo n.º 10
0
def wordless_widgets_fig_settings(parent):
    def graph_type_changed():
        if combo_box_graph_type.currentText() == parent.tr('Line Chart'):
            combo_box_use_file.setEnabled(False)

            use_data_changed()
        elif combo_box_graph_type.currentText() == parent.tr('Word Cloud'):
            combo_box_use_file.setEnabled(True)

            checkbox_use_pct.setEnabled(False)
            checkbox_use_cumulative.setEnabled(False)

    def use_data_changed():
        if combo_box_graph_type.currentText() == parent.tr('Line Chart'):
            if combo_box_use_data.currentText() == parent.tr('Frequency'):
                checkbox_use_pct.setEnabled(True)
                checkbox_use_cumulative.setEnabled(True)
            else:
                checkbox_use_pct.setEnabled(False)
                checkbox_use_cumulative.setEnabled(False)

    def wordless_files_changed():
        if combo_box_use_file.count() == 1:
            use_file_old = ''
        else:
            use_file_old = combo_box_use_file.currentText()

        combo_box_use_file.clear()

        for file in main.wordless_files.get_selected_files():
            combo_box_use_file.addItem(file['name'])

        combo_box_use_file.addItem(parent.tr('Total'))

        if use_file_old and combo_box_use_file.findText(use_file_old) > -1:
            combo_box_use_file.setCurrentText(use_file_old)

    main = wordless_misc.find_wordless_main(parent)

    label_graph_type = QLabel(parent.tr('Graph Type:'), parent)
    combo_box_graph_type = wordless_box.Wordless_Combo_Box(parent)
    label_use_file = QLabel(parent.tr('Use File:'), parent)
    combo_box_use_file = wordless_box.Wordless_Combo_Box(parent)
    label_use_data = QLabel(parent.tr('Use Data:'), parent)
    combo_box_use_data = wordless_box.Wordless_Combo_Box(parent)

    # Clip long file names
    combo_box_use_file.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLengthWithIcon)

    checkbox_use_pct = QCheckBox(parent.tr('Use Percentage Data'), parent)
    checkbox_use_cumulative = QCheckBox(parent.tr('Use Cumulative Data'), parent)

    combo_box_graph_type.addItems([parent.tr('Line Chart'),
                                   parent.tr('Word Cloud')])

    combo_box_graph_type.currentTextChanged.connect(graph_type_changed)
    combo_box_use_data.currentTextChanged.connect(use_data_changed)

    main.wordless_files.table.itemChanged.connect(wordless_files_changed)

    combo_box_use_file.wordless_files_changed = wordless_files_changed

    graph_type_changed()
    use_data_changed()
    wordless_files_changed()

    return (label_graph_type, combo_box_graph_type,
            label_use_file, combo_box_use_file,
            label_use_data, combo_box_use_data,
            checkbox_use_pct, checkbox_use_cumulative)
Exemplo n.º 11
0
def wordless_widgets_measure_effect_size(parent):
    label_measure_effect_size = QLabel(parent.tr('Measure of Effect Size:'), parent)
    combo_box_measure_effect_size = wordless_box.Wordless_Combo_Box(parent)

    return (label_measure_effect_size,
            combo_box_measure_effect_size)
Exemplo n.º 12
0
def wordless_widgets_test_significance(parent):
    label_test_significance = QLabel(parent.tr('Test of Statistical Significance:'), parent)
    combo_box_test_significance = wordless_box.Wordless_Combo_Box(parent)

    return (label_test_significance,
            combo_box_test_significance)
Exemplo n.º 13
0
    def __init__(self, main):
        super().__init__(main, main.tr('Donating'),
                         width = 450)

        self.label_donating = wordless_label.Wordless_Label_Dialog(
            self.tr('''
                <div>
                    If you would like to support the development of Wordless, you may donate via PayPal, Alipay or WeChat.
                </div>
            '''),
            self
        )
        self.label_donating_via = QLabel(self.tr('Donating via:'), self)
        self.combo_box_donating_via = wordless_box.Wordless_Combo_Box(self)
        self.label_donating_via_img = wordless_label.Wordless_Label_Html('', self)
        self.label_donating_note = wordless_label.Wordless_Label_Dialog(
            self.tr('''
                <div>
                    <span style="color: #F00;"><b>Important Note</b></span>: I <b>WILL NOT PROVIDE</b> invoices, receipts, refund services, detailed spending reports, my contact information other than email addresses, my personal social media accounts, private email/phone support, or guarantees on bug fixes, enhancements, new features, or new releases of Wordless for donation.
                </div>
            '''),
            self
        )

        self.combo_box_donating_via.addItems([
            self.tr('PayPal'),
            self.tr('Alipay'),
            self.tr('WeChat')
        ])

        self.combo_box_donating_via.currentTextChanged.connect(self.donating_via_changed)

        layout_donating_via = wordless_layout.Wordless_Layout()
        layout_donating_via.addWidget(self.label_donating_via, 0, 0)
        layout_donating_via.addWidget(self.combo_box_donating_via, 0, 1)

        layout_donating_via.setColumnStretch(2, 1)

        self.wrapper_info.layout().addWidget(self.label_donating, 0, 0)
        self.wrapper_info.layout().addLayout(layout_donating_via, 1, 0)
        self.wrapper_info.layout().addWidget(self.label_donating_via_img, 2, 0, Qt.AlignHCenter | Qt.AlignVCenter)
        self.wrapper_info.layout().addWidget(self.label_donating_note, 3, 0)

        # Calculate height
        donating_via_old = self.main.settings_custom['menu']['help']['donating']['donating_via']

        self.combo_box_donating_via.setCurrentText('PayPal')
        self.donating_via_changed()

        height_donating_via_paypal = self.label_donating_via_img.sizeHint().height()
        self.height_paypal = self.heightForWidth(self.width())

        self.combo_box_donating_via.setCurrentText('Alipay')
        self.donating_via_changed()

        height_donating_via_alipay = self.label_donating_via_img.sizeHint().height()
        self.height_alipay = self.heightForWidth(self.width()) + (height_donating_via_alipay - height_donating_via_paypal)

        self.main.settings_custom['menu']['help']['donating']['donating_via'] = donating_via_old

        self.load_settings()
Exemplo n.º 14
0
def wordless_widgets_search_settings(parent, tab):
    def multi_search_mode_changed():
        if checkbox_multi_search_mode.isChecked():
            label_search_term.setText(parent.tr('Search Terms:'))

            if line_edit_search_term.text() and list_search_terms.count() == 0:
                list_search_terms.load_items([line_edit_search_term.text()])

            stacked_widget_search_term.setCurrentIndex(1)
        else:
            label_search_term.setText(parent.tr('Search Term:'))

            stacked_widget_search_term.setCurrentIndex(0)

    def match_tags_changed():
        if checkbox_match_tags.isChecked():
            checkbox_match_inflected_forms.setEnabled(False)

            stacked_widget_ignore_tags.setCurrentIndex(1)
            stacked_widget_ignore_tags_type.setCurrentIndex(1)
        else:
            checkbox_match_inflected_forms.setEnabled(True)
            
            stacked_widget_ignore_tags.setCurrentIndex(0)
            stacked_widget_ignore_tags_type.setCurrentIndex(0)

    def token_settings_changed():
        token_settings = main.settings_custom[tab]['token_settings']
        
        if line_edit_search_term.isEnabled() == True:
            if token_settings['use_tags']:
                checkbox_match_tags.setEnabled(False)
                checkbox_match_tags.setChecked(True)

                if token_settings['ignore_tags_tags']:
                    stacked_widget_ignore_tags.setEnabled(False)
                    stacked_widget_ignore_tags_type.setEnabled(False)
                else:
                    stacked_widget_ignore_tags.setEnabled(True)
                    stacked_widget_ignore_tags_type.setEnabled(True)
            else:
                checkbox_match_tags.setChecked(False)

                if token_settings['ignore_tags']:
                    if token_settings['ignore_tags_type'] == parent.tr('All'):
                        stacked_widget_ignore_tags.setEnabled(False)
                        stacked_widget_ignore_tags_type.setEnabled(False)
                        checkbox_match_tags.setEnabled(False)
                    else:
                        if checkbox_match_tags.isChecked():
                            stacked_widget_ignore_tags.setEnabled(False)
                            stacked_widget_ignore_tags_type.setEnabled(False)
                        else:
                            stacked_widget_ignore_tags.setEnabled(True)
                            stacked_widget_ignore_tags_type.setEnabled(True)
                            
                        checkbox_match_tags.setEnabled(True)
                else:
                    stacked_widget_ignore_tags.setEnabled(True)
                    stacked_widget_ignore_tags_type.setEnabled(True)
                    checkbox_match_tags.setEnabled(True)

            if checkbox_match_tags.isEnabled():
                match_tags_changed()

    main = wordless_misc.find_wordless_main(parent)

    label_search_term = QLabel(parent.tr('Search Term:'), parent)
    checkbox_multi_search_mode = QCheckBox(parent.tr('Multi-search Mode'), parent)
    line_edit_search_term = QLineEdit(parent)
    list_search_terms = wordless_list.Wordless_List_Search_Terms(parent)
    label_separator = wordless_label.Wordless_Label_Hint(parent.tr('* Use space to separate multiple tokens'), parent)

    checkbox_ignore_case = QCheckBox(parent.tr('Ignore case'), parent)
    checkbox_match_inflected_forms = QCheckBox(parent.tr('Match all inflected forms'), parent)
    checkbox_match_whole_words = QCheckBox(parent.tr('Match whole words only'), parent)
    checkbox_use_regex = QCheckBox(parent.tr('Use regular expression'), parent)

    checkbox_ignore_tags = QCheckBox(parent.tr('Ignore'), parent)
    checkbox_ignore_tags_tags = QCheckBox(parent.tr('Ignore'), parent)
    combo_box_ignore_tags = wordless_box.Wordless_Combo_Box(parent)
    combo_box_ignore_tags_tags = wordless_box.Wordless_Combo_Box(parent)
    label_ignore_tags = QLabel(parent.tr('tags'), parent)
    checkbox_match_tags = QCheckBox(parent.tr('Match tags only'), parent)

    combo_box_ignore_tags.addItems([
        parent.tr('all'),
        parent.tr('POS'),
        parent.tr('non-POS')
    ])

    combo_box_ignore_tags_tags.addItems([
        parent.tr('POS'),
        parent.tr('non-POS')
    ])

    wrapper_search_terms = QWidget(parent)

    wrapper_search_terms.setLayout(wordless_layout.Wordless_Layout())
    wrapper_search_terms.layout().addWidget(list_search_terms, 0, 0, 5, 1)
    wrapper_search_terms.layout().addWidget(list_search_terms.button_add, 0, 1)
    wrapper_search_terms.layout().addWidget(list_search_terms.button_remove, 1, 1)
    wrapper_search_terms.layout().addWidget(list_search_terms.button_clear, 2, 1)
    wrapper_search_terms.layout().addWidget(list_search_terms.button_import, 3, 1)
    wrapper_search_terms.layout().addWidget(list_search_terms.button_export, 4, 1)

    wrapper_search_terms.layout().setContentsMargins(0, 0, 0, 0)

    stacked_widget_search_term = wordless_layout.Wordless_Stacked_Widget(parent)
    stacked_widget_search_term.addWidget(line_edit_search_term)
    stacked_widget_search_term.addWidget(wrapper_search_terms)

    stacked_widget_ignore_tags = wordless_layout.Wordless_Stacked_Widget(parent)
    stacked_widget_ignore_tags.addWidget(checkbox_ignore_tags)
    stacked_widget_ignore_tags.addWidget(checkbox_ignore_tags_tags)

    stacked_widget_ignore_tags_type = wordless_layout.Wordless_Stacked_Widget(parent)
    stacked_widget_ignore_tags_type.addWidget(combo_box_ignore_tags)
    stacked_widget_ignore_tags_type.addWidget(combo_box_ignore_tags_tags)

    checkbox_match_tags.token_settings_changed = token_settings_changed

    checkbox_multi_search_mode.stateChanged.connect(multi_search_mode_changed)
    checkbox_match_tags.stateChanged.connect(match_tags_changed)

    multi_search_mode_changed()
    match_tags_changed()

    return (label_search_term,
            checkbox_multi_search_mode,

            stacked_widget_search_term,
            line_edit_search_term,
            list_search_terms,

            label_separator,

            checkbox_ignore_case,
            checkbox_match_inflected_forms,
            checkbox_match_whole_words,
            checkbox_use_regex,

            stacked_widget_ignore_tags,
            checkbox_ignore_tags,
            checkbox_ignore_tags_tags,

            stacked_widget_ignore_tags_type,
            combo_box_ignore_tags,
            combo_box_ignore_tags_tags,

            label_ignore_tags,
            checkbox_match_tags)
Exemplo n.º 15
0
    def __init__(self, main):
        super().__init__(main, main.tr('Acknowledgments'), width=580)

        self.ACKS_GENERAL = [
            [
                '<a href="https://www.python.org/">Python</a>', '3.7.2',
                'Guido van Rossum, Python Software Foundation',
                '<a href="https://docs.python.org/3.7/license.html#psf-license-agreement-for-python-release">PSF</a>'
            ],
            [
                '<a href="https://www.riverbankcomputing.com/software/pyqt/intro">PyQt</a>',
                '5.12.1', 'Riverbank Computing Limited',
                '<a href="http://pyqt.sourceforge.net/Docs/PyQt5/introduction.html#license">GPL-3.0</a>'
            ]
        ]

        self.ACKS_NLP = [
            [
                main.tr('<a href="https://github.com/fxsjy/jieba">jieba</a>'),
                '0.39', 'Sun Junyi',
                '<a href="https://github.com/fxsjy/jieba/blob/master/LICENSE">MIT</a>'
            ],
            [
                '<a href="https://github.com/taishi-i/nagisa">nagisa</a>',
                '0.2.1', 'Taishi Ikeda (池田大志)',
                '<a href="https://github.com/taishi-i/nagisa/blob/master/LICENSE.txt">MIT</a>'
            ],
            [
                '<a href="http://www.nltk.org/">NLTK</a>', '3.4',
                'Steven Bird, Liling Tan',
                '<a href="https://github.com/nltk/nltk/blob/develop/LICENSE.txt">Apache-2.0</a>'
            ],
            [
                '<a href="https://github.com/Esukhia/pybo">pybo</a>', '0.4.2',
                'Hélios Drupchen Hildt',
                '<a href="https://github.com/Esukhia/pybo/blob/master/LICENSE">Apache-2.0</a>'
            ],
            [
                '<a href="https://github.com/kmike/pymorphy2/">pymorphy2</a>',
                '0.8', 'Mikhail Korobov',
                '<a href="https://github.com/kmike/pymorphy2/#pymorphy2">MIT</a>'
            ],
            [
                '<a href="https://github.com/PyThaiNLP/pythainlp">PyThaiNLP</a>',
                '1.7.4',
                'Wannaphong Phatthiyaphaibun (วรรณพงษ์ ภัททิยไพบูลย์)',
                '<a href="https://github.com/PyThaiNLP/pythainlp/blob/dev/LICENSE">Apache-2.0</a>'
            ],
            [
                '<a href="https://github.com/alvations/sacremoses">SacreMoses</a>',
                '0.0.13', 'Liling Tan',
                '<a href="https://github.com/alvations/sacremoses#license">LGPL-2.1</a>'
            ],
            [
                '<a href="https://spacy.io/">spaCy</a>', '2.1.3',
                'Matthew Honnibal, Ines Montani',
                '<a href="https://github.com/explosion/spaCy/blob/master/LICENSE">MIT</a>'
            ],
            [
                '<a href="https://github.com/undertheseanlp/underthesea">Underthesea</a>',
                '1.1.15', 'Vu Anh',
                '<a href="https://github.com/undertheseanlp/underthesea/blob/master/LICENSE">GPL-3.0</a>'
            ]
        ]

        self.ACKS_PLOTTING = [
            [
                '<a href="https://matplotlib.org/">Matplotlib</a>', '3.0.3',
                'Matplotlib Development Team',
                '<a href="https://matplotlib.org/users/license.html">Matplotlib</a>'
            ],
            [
                '<a href="https://amueller.github.io/word_cloud/">wordcloud</a>',
                '1.5.0', 'Andreas Christian Mueller',
                '<a href="https://github.com/amueller/word_cloud/blob/master/LICENSE">MIT</a>'
            ]
        ]

        self.ACKS_MISC = [
            [
                '<a href="https://www.crummy.com/software/BeautifulSoup/">Beautiful Soup</a>',
                '4.7.1', 'Leonard Richardson',
                '<a href="https://bazaar.launchpad.net/~leonardr/beautifulsoup/bs4/view/head:/LICENSE">MIT</a>'
            ],
            [
                '<a href="https://github.com/PyYoshi/cChardet">cChardet</a>',
                '2.1.4', 'Yoshihiro Misawa',
                '<a href="https://github.com/PyYoshi/cChardet/blob/master/COPYING">MPL-1.0/GPL-2.0/LGPL-2.1</a>'
            ],
            [
                '<a href="https://github.com/chardet/chardet">chardet</a>',
                '3.0.4', 'Daniel Blanchard',
                '<a href="https://github.com/chardet/chardet/blob/master/LICENSE">LGPL-2.1</a>'
            ],
            [
                '<a href="https://github.com/Mimino666/langdetect">langdetect</a>',
                '1.0.7', 'Michal Mimino Danilak',
                '<a href="https://github.com/Mimino666/langdetect/blob/master/LICENSE">Apache-2.0</a>'
            ],
            [
                '<a href="https://github.com/saffsd/langid.py">langid.py</a>',
                '1.1.6', 'Marco Lui',
                '<a href="https://github.com/saffsd/langid.py/blob/master/LICENSE">BSD-2-Clause</a>'
            ],
            [
                '<a href="https://lxml.de/">lxml</a>', '4.3.3',
                'Stefan Behnel',
                '<a href="https://github.com/lxml/lxml/blob/master/doc/licenses/BSD.txt">BSD-3-Clause</a>'
            ],
            [
                '<a href="http://www.numpy.org/">NumPy</a>', '1.16.2',
                'NumPy Developers',
                '<a href="http://www.numpy.org/license.html">BSD-3-Clause</a>'
            ],
            [
                '<a href="https://openpyxl.readthedocs.io/en/stable/">openpyxl</a>',
                '2.6.1', 'Eric Gazoni, Charlie Clark',
                '<a href="https://bitbucket.org/openpyxl/openpyxl/src/5983d4ba5c18b85171185e8b1ca136876ec52864/LICENCE.rst">MIT</a>'
            ],
            [
                '<a href="http://www.pyinstaller.org/">PyInstaller</a>',
                '3.5.dev0+cb8d10af6', 'Hartmut Goebel',
                '<a href="https://github.com/pyinstaller/pyinstaller/blob/develop/COPYING.txt">PyInstaller</a>'
            ],
            [
                '<a href="https://github.com/python-openxml/python-docx">python-docx</a>',
                '0.8.10', 'Steve Canny',
                '<a href="https://github.com/python-openxml/python-docx/blob/master/LICENSE">MIT</a>'
            ],
            [
                '<a href="http://python-requests.org">requests</a>', '2.21.0',
                'Kenneth Reitz',
                '<a href="https://github.com/requests/requests/blob/master/LICENSE">Apache-2.0</a>'
            ],
            [
                '<a href="https://www.scipy.org/">SciPy</a>', '1.2.1',
                'SciPy Developers',
                '<a href="https://www.scipy.org/scipylib/license.html">BSD-3-Clause</a>'
            ],
            [
                '<a href="https://github.com/python-excel/xlrd">xlrd</a>',
                '1.2.0', 'Stephen John Machin',
                '<a href="https://github.com/python-excel/xlrd/blob/master/LICENSE">BSD-3-Clause/BSD-4-Clause</a>'
            ]
        ]

        self.ACKS_DATA = [
            [
                '<a href="https://github.com/pharos-alexandria/grk-stoplist">grk-stoplist</a>',
                '/', 'Annette von Stockhausen',
                '<a href="https://github.com/pharos-alexandria/grk-stoplist/blob/master/LICENSE">CC0-1.0</a>'
            ],
            [
                '<a href="https://github.com/stenskjaer/lemmalist-greek">lemmalist-greek</a>',
                '/', 'Michael Stenskjær Christensen',
                '<a href="https://github.com/stenskjaer/lemmalist-greek/blob/master/LICENSE">GPL-3.0</a>'
            ],
            [
                '<a href="https://github.com/michmech/lemmatization-lists">Lemmatization Lists</a>',
                '/', 'Michal Boleslav Měchura',
                '<a href="https://github.com/michmech/lemmatization-lists/blob/master/LICENCE">ODbL</a>'
            ],
            [
                '<a href="https://github.com/stopwords-iso/stopwords-iso">Stopwords ISO</a>',
                '0.4.0', 'Gene Diaz',
                '<a href="https://github.com/stopwords-iso/stopwords-iso/blob/master/LICENSE">MIT</a>'
            ]
        ]

        self.label_acks = wordless_label.Wordless_Label_Dialog(
            self.tr('''
                <div>
                    Wordless stands on the shoulders of giants. Thus, I would like to extend my thanks to the following open-source projects:
                </div>
            '''), self)
        self.label_browse_category = QLabel(self.tr('Browse by Category:'),
                                            self)
        self.combo_box_browse_category = wordless_box.Wordless_Combo_Box(self)

        self.table_acks = wordless_table.Wordless_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('Plotting'),
            self.tr('Miscellaneous'),
            self.tr('Data')
        ])

        self.table_acks.setFixedHeight(250)

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

        layout_browse_category = wordless_layout.Wordless_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()
Exemplo n.º 16
0
def wordless_widgets_token_settings(parent):
    def words_changed():
        if checkbox_words.isChecked():
            checkbox_lowercase.setEnabled(True)
            checkbox_uppercase.setEnabled(True)
            checkbox_title_case.setEnabled(True)
        else:
            checkbox_lowercase.setEnabled(False)
            checkbox_uppercase.setEnabled(False)
            checkbox_title_case.setEnabled(False)

    def use_tags_changed():
        if checkbox_use_tags.isChecked():
            checkbox_lemmatize_tokens.setEnabled(False)

            stacked_widget_ignore_tags.setCurrentIndex(1)
            stacked_widget_ignore_tags_type.setCurrentIndex(1)
        else:
            checkbox_lemmatize_tokens.setEnabled(True)

            stacked_widget_ignore_tags.setCurrentIndex(0)
            stacked_widget_ignore_tags_type.setCurrentIndex(0)

    checkbox_words = QCheckBox(parent.tr('Words'), parent)
    checkbox_lowercase = QCheckBox(parent.tr('Lowercase'), parent)
    checkbox_uppercase = QCheckBox(parent.tr('Uppercase'), parent)
    checkbox_title_case = QCheckBox(parent.tr('Title Case'), parent)
    checkbox_nums = QCheckBox(parent.tr('Numerals'), parent)
    checkbox_puncs = QCheckBox(parent.tr('Punctuations'), parent)

    checkbox_treat_as_lowercase = QCheckBox(parent.tr('Treat as all lowercase'), parent)
    checkbox_lemmatize_tokens = QCheckBox(parent.tr('Lemmatize all tokens'), parent)
    checkbox_filter_stop_words = QCheckBox(parent.tr('Filter stop words'), parent)

    checkbox_ignore_tags = QCheckBox(parent.tr('Ignore'), parent)
    checkbox_ignore_tags_tags = QCheckBox(parent.tr('Ignore'), parent)
    combo_box_ignore_tags = wordless_box.Wordless_Combo_Box(parent)
    combo_box_ignore_tags_tags = wordless_box.Wordless_Combo_Box(parent)
    label_ignore_tags = QLabel(parent.tr('tags'), parent)
    checkbox_use_tags = QCheckBox(parent.tr('Use tags only'), parent)

    combo_box_ignore_tags.addItems([
        parent.tr('all'),
        parent.tr('POS'),
        parent.tr('non-POS')
    ])

    combo_box_ignore_tags_tags.addItems([
        parent.tr('POS'),
        parent.tr('non-POS')
    ])

    stacked_widget_ignore_tags = QStackedWidget(parent)
    stacked_widget_ignore_tags.addWidget(checkbox_ignore_tags)
    stacked_widget_ignore_tags.addWidget(checkbox_ignore_tags_tags)

    stacked_widget_ignore_tags_type = QStackedWidget(parent)
    stacked_widget_ignore_tags_type.addWidget(combo_box_ignore_tags)
    stacked_widget_ignore_tags_type.addWidget(combo_box_ignore_tags_tags)

    checkbox_words.stateChanged.connect(words_changed)
    checkbox_use_tags.stateChanged.connect(use_tags_changed)

    words_changed()
    use_tags_changed()

    return (checkbox_words,
            checkbox_lowercase,
            checkbox_uppercase,
            checkbox_title_case,
            checkbox_nums,
            checkbox_puncs,

            checkbox_treat_as_lowercase,
            checkbox_lemmatize_tokens,
            checkbox_filter_stop_words,

            stacked_widget_ignore_tags,
            checkbox_ignore_tags,
            checkbox_ignore_tags_tags,

            stacked_widget_ignore_tags_type,
            combo_box_ignore_tags,
            combo_box_ignore_tags_tags,

            label_ignore_tags,
            checkbox_use_tags)
Exemplo n.º 17
0
    def __init__(self, main):
        super().__init__(main, main.tr('Acknowledgments'), width=550)

        self.ACKS_GENERAL = [
            # Python
            [
                'Python', 'https://www.python.org', '3.7.5',
                'Guido van Rossum', 'PSF',
                'https://docs.python.org/3.7/license.html#psf-license-agreement-for-python-release'
            ],
            # PyInstaller
            [
                'PyInstaller', 'http://www.pyinstaller.org',
                '4.0.dev0+46286a1f4', 'Hartmut Goebel', 'PyInstaller',
                'https://github.com/pyinstaller/pyinstaller/blob/develop/COPYING.txt'
            ],
            # PyQt
            [
                'PyQt',
                'https://www.riverbankcomputing.com/software/pyqt/intro',
                '5.13.2', 'Riverbank Computing Limited', 'GPL-3.0',
                'http://pyqt.sourceforge.net/Docs/PyQt5/introduction.html#license'
            ],
            # pytest
            [
                'pytest', 'https://pytest.org', '5.3.1', 'Holger Krekel',
                'MIT',
                'https://github.com/pytest-dev/pytest/blob/master/LICENSE'
            ]
        ]

        self.ACKS_NLP = [
            # botok
            [
                'botok', 'https://github.com/Esukhia/botok', '0.6.18',
                'Hélios Drupchen Hildt', 'Apache-2.0',
                'https://github.com/Esukhia/botok/blob/master/LICENSE'
            ],
            # jieba
            [
                'jieba<br>(“结巴”中文分词)', 'https://github.com/fxsjy/jieba',
                '0.39', 'Sun Junyi (孙君意)', 'MIT',
                'https://github.com/fxsjy/jieba/blob/master/LICENSE'
            ],
            # nagisa
            [
                'nagisa', 'https://github.com/taishi-i/nagisa', '0.2.4',
                'Taishi Ikeda (池田大志)', 'MIT',
                'https://github.com/taishi-i/nagisa/blob/master/LICENSE.txt'
            ],
            # NLTK
            [
                'NLTK', 'http://www.nltk.org', '3.4.5',
                'Steven Bird, Liling Tan', 'Apache-2.0',
                'https://github.com/nltk/nltk/blob/develop/LICENSE.txt'
            ],
            # pymorphy2
            [
                'pymorphy2', 'https://github.com/kmike/pymorphy2', '0.8',
                'Mikhail Korobov', 'MIT',
                'https://github.com/kmike/pymorphy2/#pymorphy2'
            ],
            # PyThaiNLP
            [
                'PyThaiNLP', 'https://github.com/PyThaiNLP/pythainlp', '2.0.7',
                'Wannaphong Phatthiyaphaibun<br>(วรรณพงษ์ ภัททิยไพบูลย์)',
                'Apache-2.0',
                'https://github.com/PyThaiNLP/pythainlp/blob/dev/LICENSE'
            ],
            # razdel
            [
                'razdel', 'https://github.com/natasha/razdel', '0.4.0',
                'Alexander Kukushkin', 'MIT',
                'https://github.com/natasha/razdel#%D0%BB%D0%B8%D1%86%D0%B5%D0%BD%D0%B7%D0%B8%D1%8F'
            ],
            # Sacremoses
            [
                'Sacremoses', 'https://github.com/alvations/sacremoses',
                '0.0.35', 'Liling Tan', 'LGPL-2.1',
                'https://github.com/alvations/sacremoses#license'
            ],
            # spaCy
            [
                'spaCy', 'https://spacy.io', '2.2.3',
                'Matthew Honnibal, Ines Montani', 'MIT',
                'https://github.com/explosion/spaCy/blob/master/LICENSE'
            ],
            # syntok
            [
                'syntok', 'https://github.com/fnl/syntok', '1.2.2',
                'Florian Leitner', 'MIT',
                'https://github.com/fnl/syntok/blob/master/LICENSE'
            ],
            # Underthesea
            [
                'Underthesea', 'https://github.com/undertheseanlp/underthesea',
                '1.1.17', 'Vu Anh', 'GPL-3.0',
                'https://github.com/undertheseanlp/underthesea/blob/master/LICENSE'
            ]
        ]

        self.ACKS_LANG_DATA = [
            # extra-stopwords
            [
                'extra-stopwords', 'https://github.com/Xangis/extra-stopwords',
                'N/A', 'Jason Champion', 'MIT',
                'https://github.com/Xangis/extra-stopwords/blob/master/LICENSE'
            ],
            # grk-stoplist
            [
                'grk-stoplist',
                'https://github.com/pharos-alexandria/grk-stoplist', 'N/A',
                'Annette von Stockhausen', 'CC0-1.0',
                'https://github.com/pharos-alexandria/grk-stoplist/blob/master/LICENSE'
            ],
            # lemmalist-greek
            [
                'lemmalist-greek',
                'https://github.com/stenskjaer/lemmalist-greek', 'N/A',
                'Michael Stenskjær Christensen', 'GPL-3.0',
                'https://github.com/stenskjaer/lemmalist-greek/blob/master/LICENSE'
            ],
            # Lemmatization Lists
            [
                'Lemmatization Lists',
                'https://github.com/michmech/lemmatization-lists', 'N/A',
                'Michal Boleslav Měchura', 'ODbL',
                'https://github.com/michmech/lemmatization-lists/blob/master/LICENCE'
            ],
            # Stopwords ISO
            [
                'Stopwords ISO',
                'https://github.com/stopwords-iso/stopwords-iso', '0.4.0',
                'Gene Diaz', 'MIT',
                'https://github.com/stopwords-iso/stopwords-iso/blob/master/LICENSE'
            ]
        ]

        self.ACKS_PLOTTING = [
            # Matplotlib
            [
                'Matplotlib', 'https://matplotlib.org', '3.1.2',
                'Matplotlib Development Team', 'Matplotlib',
                'https://matplotlib.org/users/license.html'
            ],
            # NetworkX
            [
                'NetworkX', 'http://networkx.github.io', '2.4',
                'Aric Hagberg, Dan Schult, Pieter Swart', 'BSD-3-Clause',
                'https://github.com/networkx/networkx/blob/master/LICENSE.txt'
            ],
            # WordCloud
            [
                'WordCloud', 'https://amueller.github.io/word_cloud/', '1.6.0',
                'Andreas Christian Mueller', 'MIT',
                'https://github.com/amueller/word_cloud/blob/master/LICENSE'
            ]
        ]

        self.ACKS_MISC = [
            # Beautiful Soup
            [
                'Beautiful Soup',
                'https://www.crummy.com/software/BeautifulSoup/', '4.8.1',
                'Leonard Richardson', 'MIT',
                'https://bazaar.launchpad.net/~leonardr/beautifulsoup/bs4/view/head:/LICENSE'
            ],
            # cChardet
            [
                'cChardet', 'https://github.com/PyYoshi/cChardet', '2.1.5',
                'Yoshihiro Misawa', 'MPL-1.0/GPL-2.0/LGPL-2.1',
                'https://github.com/PyYoshi/cChardet/blob/master/COPYING'
            ],
            # chardet
            [
                'chardet', 'https://github.com/chardet/chardet', '3.0.4',
                'Daniel Blanchard', 'LGPL-2.1',
                'https://github.com/chardet/chardet/blob/master/LICENSE'
            ],
            # langdetect
            [
                'langdetect', 'https://github.com/Mimino666/langdetect',
                '1.0.7', 'Michal Mimino Danilak', 'Apache-2.0',
                'https://github.com/Mimino666/langdetect/blob/master/LICENSE'
            ],
            # langid.py
            [
                'langid.py', 'https://github.com/saffsd/langid.py', '1.1.6',
                'Marco Lui', 'BSD-2-Clause',
                'https://github.com/saffsd/langid.py/blob/master/LICENSE'
            ],
            # lxml
            [
                'lxml', 'https://lxml.de', '4.4.2', 'Stefan Behnel',
                'BSD-3-Clause',
                'https://github.com/lxml/lxml/blob/master/doc/licenses/BSD.txt'
            ],
            # NumPy
            [
                'NumPy', 'https://numpy.org', '1.17.4', 'NumPy Developers',
                'BSD-3-Clause', 'http://www.numpy.org/license.html'
            ],
            # openpyxl
            [
                'openpyxl', 'https://openpyxl.readthedocs.io/en/stable/',
                '3.0.2', 'Eric Gazoni, Charlie Clark', 'MIT',
                'https://bitbucket.org/openpyxl/openpyxl/src/5983d4ba5c18b85171185e8b1ca136876ec52864/LICENCE.rst'
            ],
            # python-docx
            [
                'python-docx', 'https://github.com/python-openxml/python-docx',
                '0.8.10', 'Steve Canny', 'MIT',
                'https://github.com/python-openxml/python-docx/blob/master/LICENSE'
            ],
            # requests
            [
                'requests', 'https://python-requests.org', '2.22.0',
                'Kenneth Reitz', 'Apache-2.0',
                'https://github.com/requests/requests/blob/master/LICENSE'
            ],
            # SciPy
            [
                'SciPy', 'https://www.scipy.org', '1.3.3', 'SciPy Developers',
                'BSD-3-Clause', 'https://www.scipy.org/scipylib/license.html'
            ],
            # xlrd
            [
                'xlrd', 'https://github.com/python-excel/xlrd', '1.2.0',
                'Stephen John Machin', 'BSD-3-Clause/BSD-4-Clause',
                'https://github.com/python-excel/xlrd/blob/master/LICENSE'
            ]
        ]

        self.label_acks = wordless_label.Wordless_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 = wordless_box.Wordless_Combo_Box(self)

        self.table_acks = wordless_table.Wordless_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 = wordless_layout.Wordless_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()