def test_read_small(self): contents = """f1 0.000 0.100 a f1 0.100 0.200 r f1 0.200 0.300 m f1 0.300 0.400 s f1 0.400 0.500 a f1 0.700 0.800 w f1 0.800 0.900 o f1 0.900 1.000 r f1 1.000 1.100 m f1 1.100 1.200 s f1 1.200 1.300 a f2 0.100 0.200 w f2 0.200 0.300 o f2 0.300 0.400 r f2 0.400 0.500 d f2 0.500 0.600 s """ tokens = [ FragmentToken('f1', Interval(0.0, 0.1), 'a'), FragmentToken('f1', Interval(0.1, 0.2), 'r'), FragmentToken('f1', Interval(0.2, 0.3), 'm'), FragmentToken('f1', Interval(0.3, 0.4), 's'), FragmentToken('f1', Interval(0.4, 0.5), 'a'), FragmentToken('f1', Interval(0.7, 0.8), 'w'), FragmentToken('f1', Interval(0.8, 0.9), 'o'), FragmentToken('f1', Interval(0.9, 1.0), 'r'), FragmentToken('f1', Interval(1.0, 1.1), 'm'), FragmentToken('f1', Interval(1.1, 1.2), 's'), FragmentToken('f1', Interval(1.2, 1.3), 'a'), FragmentToken('f2', Interval(0.1, 0.2), 'w'), FragmentToken('f2', Interval(0.2, 0.3), 'o'), FragmentToken('f2', Interval(0.3, 0.4), 'r'), FragmentToken('f2', Interval(0.4, 0.5), 'd'), FragmentToken('f2', Interval(0.5, 0.6), 's') ] corpus = Corpus([ SegmentAnnotation('f1', tokens[0:5]), SegmentAnnotation('f1', tokens[5:11]), SegmentAnnotation('f2', tokens[11:]) ]) assert ([tokens[0:5], tokens[5:11], tokens[11:]] == read_annotation(contents)) assert (tokenlists_to_corpus(read_annotation(contents)) == corpus)
def test_read_small(self): contents = """f1 0.000 0.100 a f1 0.100 0.200 r f1 0.200 0.300 m f1 0.300 0.400 s f1 0.400 0.500 a f1 0.700 0.800 w f1 0.800 0.900 o f1 0.900 1.000 r f1 1.000 1.100 m f1 1.100 1.200 s f1 1.200 1.300 a f2 0.100 0.200 w f2 0.200 0.300 o f2 0.300 0.400 r f2 0.400 0.500 d f2 0.500 0.600 s """ tokens = [FragmentToken('f1', Interval(0.0, 0.1), 'a'), FragmentToken('f1', Interval(0.1, 0.2), 'r'), FragmentToken('f1', Interval(0.2, 0.3), 'm'), FragmentToken('f1', Interval(0.3, 0.4), 's'), FragmentToken('f1', Interval(0.4, 0.5), 'a'), FragmentToken('f1', Interval(0.7, 0.8), 'w'), FragmentToken('f1', Interval(0.8, 0.9), 'o'), FragmentToken('f1', Interval(0.9, 1.0), 'r'), FragmentToken('f1', Interval(1.0, 1.1), 'm'), FragmentToken('f1', Interval(1.1, 1.2), 's'), FragmentToken('f1', Interval(1.2, 1.3), 'a'), FragmentToken('f2', Interval(0.1, 0.2), 'w'), FragmentToken('f2', Interval(0.2, 0.3), 'o'), FragmentToken('f2', Interval(0.3, 0.4), 'r'), FragmentToken('f2', Interval(0.4, 0.5), 'd'), FragmentToken('f2', Interval(0.5, 0.6), 's')] corpus = Corpus([SegmentAnnotation('f1', tokens[0:5]), SegmentAnnotation('f1', tokens[5:11]), SegmentAnnotation('f2', tokens[11:])]) assert ([tokens[0:5], tokens[5:11], tokens[11:]] == read_annotation(contents)) assert (tokenlists_to_corpus(read_annotation(contents)) == corpus)
def test_annotate(self): assert (self.clsdict_a == annotate_classes( read_classfile(self.tiny_classes), tokenlists_to_corpus(read_annotation(self.tiny_corpus))))
def test_corpus(self): assert (self.corpus == tokenlists_to_corpus( read_annotation(self.tiny_corpus)))
def phone(): return tokenlists_to_corpus(read_annotation(_phone))
def word(): return tokenlists_to_corpus(read_annotation(_word))
def test_annotate(self): assert (self.clsdict_a == annotate_classes(read_classfile(self.tiny_classes), tokenlists_to_corpus(read_annotation(self.tiny_corpus))))
def test_corpus(self): assert (self.corpus == tokenlists_to_corpus(read_annotation(self.tiny_corpus)))