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([])
Exemplo n.º 3
0
 def forceInspect(self, b):
     if os.path.exists(self.pathWidget.value()):
         if self.textType == 'csv':
             colDelim = codecs.getdecoder("unicode_escape")(self.columnDelimiterEdit.text())[0]
             if not colDelim:
                 colDelim = None
             atts, coldelim = inspect_csv(self.pathWidget.value(),
                     coldelim = colDelim)
             self.updateColumnFrame(atts)
         elif self.textType == 'ilg':
             number = self.lineNumberEdit.text()
             if number == '':
                 number = None
             else:
                 try:
                     number = int(number)
                 except:
                     number = None
             annotation_types = inspect_discourse_ilg(self.pathWidget.value(), number = number)
             self.columnFrame.updateColumnFrame(annotation_types)
Exemplo n.º 4
0
 def forceInspect(self, b):
     if os.path.exists(self.pathWidget.value()):
         if self.textType == 'csv':
             colDelim = codecs.getdecoder("unicode_escape")(
                 self.columnDelimiterEdit.text())[0]
             if not colDelim:
                 colDelim = None
             atts, coldelim = inspect_csv(self.pathWidget.value(),
                                          coldelim=colDelim)
             self.updateColumnFrame(atts)
         elif self.textType == 'ilg':
             number = self.lineNumberEdit.text()
             if number == '':
                 number = None
             else:
                 try:
                     number = int(number)
                 except:
                     number = None
             annotation_types = inspect_discourse_ilg(
                 self.pathWidget.value(), number=number)
             self.columnFrame.updateColumnFrame(annotation_types)
Exemplo n.º 5
0
def test_inspect_ilg(ilg_test_dir):
    basic_path = os.path.join(ilg_test_dir, 'test_basic.txt')
    annotypes = inspect_discourse_ilg(basic_path)
    assert (len(annotypes) == 2)
    assert (annotypes[1].delimiter == '.')
def test_inspect_ilg(ilg_test_dir):
    basic_path = os.path.join(ilg_test_dir, 'test_basic.txt')
    annotypes = inspect_discourse_ilg(basic_path)
    assert(len(annotypes) == 2)
    assert(annotypes[1].delimiter == '.')