示例#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([])
示例#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_transcription_morpheme(text_test_dir):
    transcription_morphemes_path = os.path.join(text_test_dir, 'test_text_transcription_morpheme_boundaries.txt')
    ats = inspect_discourse_transcription(transcription_morphemes_path)
    ats[0].morph_delimiters = set('-=')
    c = load_discourse_transcription('test',transcription_morphemes_path, ats)

    assert(c.lexicon['cab'].frequency == 2)
    assert(str(c.lexicon['cab'].transcription) == 'c.a-b')
示例#4
0
def test_load_transcription_morpheme(text_test_dir):
    transcription_morphemes_path = os.path.join(
        text_test_dir, 'test_text_transcription_morpheme_boundaries.txt')
    ats = inspect_discourse_transcription(transcription_morphemes_path)
    ats[0].morph_delimiters = set('-=')
    c = load_discourse_transcription('test', transcription_morphemes_path, ats)

    assert (c.lexicon['cab'].frequency == 2)
    assert (str(c.lexicon['cab'].transcription) == 'c.a-b')