Exemplo n.º 1
0
    def inspect(self):
        if self.textType is not None and os.path.exists(self.pathWidget.value()):
            if self.textType == 'csv':
                try:
                    atts, coldelim = inspect_csv(self.pathWidget.value())
                except PCTError:
                    self.columnFrame.updateColumnFrame([])
                    return
                self.columnDelimiterEdit.setText(coldelim.encode('unicode_escape').decode('utf-8'))
                self.columnFrame.updateColumnFrame(atts)
            else:
                if self.textType == 'textgrid':
                    anno_types = inspect_discourse_textgrid(self.pathWidget.value())
                elif self.textType == 'ilg':
                    anno_types = inspect_discourse_ilg(self.pathWidget.value())
                    self.lineNumberEdit.setText(str(len(anno_types)))
                elif self.textType == 'transcription':
                    anno_types = inspect_discourse_transcription(self.pathWidget.value())
                elif self.textType == 'spelling':
                    anno_types = inspect_discourse_spelling(self.pathWidget.value())
                elif self.textType in ['buckeye','timit']:

                    anno_types = inspect_discourse_multiple_files(self.pathWidget.value(), self.textType)
                self.columnFrame.updateColumnFrame(anno_types)

        else:
            self.columnFrame.updateColumnFrame([])
Exemplo n.º 2
0
    def inspect(self):
        if self.textType is not None and os.path.exists(
                self.pathWidget.value()):
            if self.textType == 'csv':
                try:
                    atts, coldelim = inspect_csv(self.pathWidget.value())
                except PCTError:
                    self.columnFrame.updateColumnFrame([])
                    return
                self.columnDelimiterEdit.setText(
                    coldelim.encode('unicode_escape').decode('utf-8'))
                self.columnFrame.updateColumnFrame(atts)
            else:
                if self.textType == 'textgrid':
                    anno_types = inspect_discourse_textgrid(
                        self.pathWidget.value())
                elif self.textType == 'ilg':
                    anno_types = inspect_discourse_ilg(self.pathWidget.value())
                    self.lineNumberEdit.setText(str(len(anno_types)))
                elif self.textType == 'transcription':
                    anno_types = inspect_discourse_transcription(
                        self.pathWidget.value())
                elif self.textType == 'spelling':
                    anno_types = inspect_discourse_spelling(
                        self.pathWidget.value())
                elif self.textType in ['buckeye', 'timit']:

                    anno_types = inspect_discourse_multiple_files(
                        self.pathWidget.value(), self.textType)
                self.columnFrame.updateColumnFrame(anno_types)

        else:
            self.columnFrame.updateColumnFrame([])
def test_load_spelling_ignore(text_test_dir):
    spelling_path = os.path.join(text_test_dir, 'test_text_spelling.txt')
    a = inspect_discourse_spelling(spelling_path)
    a[0].ignored_characters = set(["'",'.'])
    c = load_discourse_spelling('test',spelling_path, a)

    assert(c.lexicon['ab'].frequency == 3)
    assert(c.lexicon['cabd'].frequency == 1)
Exemplo n.º 4
0
def test_load_spelling_ignore(text_test_dir):
    spelling_path = os.path.join(text_test_dir, 'test_text_spelling.txt')
    a = inspect_discourse_spelling(spelling_path)
    a[0].ignored_characters = set(["'", '.'])
    c = load_discourse_spelling('test', spelling_path, a)

    assert (c.lexicon['ab'].frequency == 3)
    assert (c.lexicon['cabd'].frequency == 1)