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 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 pronunciation_variants_corpus(textgrid_test_dir): path = os.path.join(textgrid_test_dir, 'pronunc_variants_corpus.TextGrid') annotypes = inspect_discourse_textgrid(path) annotypes[0].attribute.name = 'spelling' annotypes[1].attribute.name = 'transcription' annotypes[2].attribute.name = 'transcription' annotypes[2].token = True return load_discourse_textgrid('test', path, annotypes)
def pronunciation_variants_corpus(textgrid_test_dir): path = os.path.join(textgrid_test_dir, 'pronunc_variants_corpus.TextGrid') annotypes = inspect_discourse_textgrid(path) annotypes[0].attribute.name = 'spelling' annotypes[1].attribute.name = 'transcription' annotypes[2].attribute.name = 'transcription' annotypes[2].token = True return load_discourse_textgrid('test', path, annotypes)