예제 #1
0
    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)
예제 #2
0
파일: test_reader.py 프로젝트: bootphon/tde
    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)
예제 #3
0
 def test_annotate(self):
     assert (self.clsdict_a == annotate_classes(
         read_classfile(self.tiny_classes),
         tokenlists_to_corpus(read_annotation(self.tiny_corpus))))
예제 #4
0
 def test_corpus(self):
     assert (self.corpus == tokenlists_to_corpus(
         read_annotation(self.tiny_corpus)))
예제 #5
0
def phone():
    return tokenlists_to_corpus(read_annotation(_phone))
예제 #6
0
def word():
    return tokenlists_to_corpus(read_annotation(_word))
예제 #7
0
파일: test_reader.py 프로젝트: bootphon/tde
 def test_annotate(self):
     assert (self.clsdict_a ==
             annotate_classes(read_classfile(self.tiny_classes),
                              tokenlists_to_corpus(read_annotation(self.tiny_corpus))))
예제 #8
0
파일: test_reader.py 프로젝트: bootphon/tde
 def test_corpus(self):
     assert (self.corpus ==
             tokenlists_to_corpus(read_annotation(self.tiny_corpus)))