예제 #1
0
def data_path():
    return resources.sample_corpus_path('gtzan')
예제 #2
0
class TestTudaReader(rt.CorpusReaderTest):

    # SHORT aliases for speakers
    SPK_cf = 'cf372280-5606-4b05-9d24-3ab7805d8462'
    SPK_55 = '55065c47-1290-4974-997e-e77f24e7c72d'
    SPK_75 = '755d9b71-f36e-45a6-a437-edebcfaee08d'
    SPK_9e = '9e6a00c9-80f0-479d-8b36-4139a9571217'
    SPK_58 = '58b8b441-684f-4753-aa16-589f1e149fa0'
    SPK_2a = '2a0995a7-47d8-453f-9864-5940efd3c71a'
    SPK_40 = '40a95aaf-2d87-43dc-b00e-9a4ceb77c6db'

    SAMPLE_PATH = resources.sample_corpus_path('tuda')
    FILE_TRACK_BASE_PATH = SAMPLE_PATH

    EXPECTED_NUMBER_OF_TRACKS = 48
    EXPECTED_TRACKS = [
        # DEV
        rt.ExpFileTrack('2015-01-27-11-31-32_Kinect-Beam', 'dev/2015-01-27-11-31-32_Kinect-Beam.wav'),
        rt.ExpFileTrack('2015-01-27-11-31-32_Kinect-RAW', 'dev/2015-01-27-11-31-32_Kinect-RAW.wav'),
        rt.ExpFileTrack('2015-01-27-11-31-32_Realtek', 'dev/2015-01-27-11-31-32_Realtek.wav'),
        rt.ExpFileTrack('2015-01-27-11-31-32_Samson', 'dev/2015-01-27-11-31-32_Samson.wav'),
        rt.ExpFileTrack('2015-01-28-12-36-24_Yamaha', 'dev/2015-01-28-12-36-24_Yamaha.wav'),
        # TEST
        rt.ExpFileTrack('2015-01-27-12-34-36_Kinect-Beam', 'test/2015-01-27-12-34-36_Kinect-Beam.wav'),
        rt.ExpFileTrack('2015-01-27-12-34-36_Kinect-RAW', 'test/2015-01-27-12-34-36_Kinect-RAW.wav'),
        rt.ExpFileTrack('2015-01-27-12-34-36_Realtek', 'test/2015-01-27-12-34-36_Realtek.wav'),
        rt.ExpFileTrack('2015-01-27-12-34-36_Samson', 'test/2015-01-27-12-34-36_Samson.wav'),
        rt.ExpFileTrack('2015-01-27-12-34-36_Yamaha', 'test/2015-01-27-12-34-36_Yamaha.wav'),
        # TRAIN
        rt.ExpFileTrack('2014-03-17-10-26-07_Microsoft-Kinect-Raw',
                        'train/2014-03-17-10-26-07_Microsoft-Kinect-Raw.wav'),
        rt.ExpFileTrack('2014-03-17-10-26-07_Realtek', 'train/2014-03-17-10-26-07_Realtek.wav'),
        rt.ExpFileTrack('2014-03-17-10-26-07_Yamaha', 'train/2014-03-17-10-26-07_Yamaha.wav'),
        rt.ExpFileTrack('2014-03-17-13-03-33_Kinect-Beam', 'train/2014-03-17-13-03-33_Kinect-Beam.wav'),
        rt.ExpFileTrack('2014-03-17-13-03-33_Realtek', 'train/2014-03-17-13-03-33_Realtek.wav'),
        rt.ExpFileTrack('2014-03-17-13-03-33_Yamaha', 'train/2014-03-17-13-03-33_Yamaha.wav'),
        rt.ExpFileTrack('2014-03-19-15-01-56_Kinect-Beam', 'train/2014-03-19-15-01-56_Kinect-Beam.wav'),
        # NOT ALL LISTED
    ]

    EXPECTED_NUMBER_OF_ISSUERS = 7
    EXPECTED_ISSUERS = [
        rt.ExpSpeaker(SPK_cf, 8, issuers.Gender.MALE, issuers.AgeGroup.ADULT, 'deu'),
        rt.ExpSpeaker(SPK_55, 10, issuers.Gender.MALE, issuers.AgeGroup.ADULT, 'deu'),
        rt.ExpSpeaker(SPK_75, 7, issuers.Gender.MALE, issuers.AgeGroup.ADULT, 'deu'),
        rt.ExpSpeaker(SPK_9e, 5, issuers.Gender.FEMALE, issuers.AgeGroup.YOUTH, 'deu'),
        rt.ExpSpeaker(SPK_58, 10, issuers.Gender.FEMALE, issuers.AgeGroup.ADULT, 'deu'),
        rt.ExpSpeaker(SPK_2a, 5, issuers.Gender.MALE, issuers.AgeGroup.ADULT, 'deu'),
        rt.ExpSpeaker(SPK_40, 3, issuers.Gender.MALE, issuers.AgeGroup.ADULT, 'deu'),
    ]

    EXPECTED_NUMBER_OF_UTTERANCES = 48
    EXPECTED_UTTERANCES = [
        # DEV
        rt.ExpUtterance('2015-01-27-11-31-32_Kinect-Beam', '2015-01-27-11-31-32_Kinect-Beam', SPK_75, 0, float('inf')),
        rt.ExpUtterance('2015-01-27-11-31-32_Kinect-RAW', '2015-01-27-11-31-32_Kinect-RAW', SPK_75, 0, float('inf')),
        rt.ExpUtterance('2015-01-27-11-31-32_Realtek', '2015-01-27-11-31-32_Realtek', SPK_75, 0, float('inf')),
        rt.ExpUtterance('2015-01-27-11-31-32_Samson', '2015-01-27-11-31-32_Samson', SPK_75, 0, float('inf')),
        rt.ExpUtterance('2015-01-28-12-36-24_Yamaha', '2015-01-28-12-36-24_Yamaha', SPK_9e, 0, float('inf')),
        # TEST
        rt.ExpUtterance('2015-01-27-12-34-36_Kinect-Beam', '2015-01-27-12-34-36_Kinect-Beam', SPK_58, 0, float('inf')),
        rt.ExpUtterance('2015-01-27-12-34-36_Kinect-RAW', '2015-01-27-12-34-36_Kinect-RAW', SPK_58, 0, float('inf')),
        rt.ExpUtterance('2015-01-27-12-34-36_Realtek', '2015-01-27-12-34-36_Realtek', SPK_58, 0, float('inf')),
        rt.ExpUtterance('2015-01-27-12-34-36_Samson', '2015-01-27-12-34-36_Samson', SPK_58, 0, float('inf')),
        rt.ExpUtterance('2015-01-27-12-34-36_Yamaha', '2015-01-27-12-34-36_Yamaha', SPK_58, 0, float('inf')),
        # TRAIN
        rt.ExpUtterance('2014-03-17-10-26-07_Microsoft-Kinect-Raw',
                        '2014-03-17-10-26-07_Microsoft-Kinect-Raw', SPK_40, 0, float('inf')),
        rt.ExpUtterance('2014-03-17-10-26-07_Realtek', '2014-03-17-10-26-07_Realtek', SPK_40, 0, float('inf')),
        rt.ExpUtterance('2014-03-17-10-26-07_Yamaha', '2014-03-17-10-26-07_Yamaha', SPK_40, 0, float('inf')),
        rt.ExpUtterance('2014-03-17-13-03-33_Kinect-Beam', '2014-03-17-13-03-33_Kinect-Beam', SPK_cf, 0, float('inf')),
        rt.ExpUtterance('2014-03-17-13-03-33_Realtek', '2014-03-17-13-03-33_Realtek', SPK_cf, 0, float('inf')),
        rt.ExpUtterance('2014-03-17-13-03-33_Yamaha', '2014-03-17-13-03-33_Yamaha', SPK_cf, 0, float('inf')),
        rt.ExpUtterance('2014-03-19-15-01-56_Kinect-Beam', '2014-03-19-15-01-56_Kinect-Beam', SPK_cf, 0, float('inf')),
        # NOT ALL LISTED
    ]

    EXPECTED_LABEL_LISTS = {
        '2015-01-27-11-31-32_Samson': [
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT, 1),
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT_RAW, 1),
        ],
        '2015-01-27-11-31-32_Realtek': [
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT, 1),
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT_RAW, 1),
        ],
        '2014-03-17-10-26-07_Realtek': [
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT, 1),
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT_RAW, 1),
        ],
        # NOT ALL LISTED
    }

    EXPECTED_LABELS = {
        '2015-01-27-11-31-32_Samson': [
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT, 'Manche haben dass', 0, float('inf')),
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT_RAW, 'Manche haben , dass.', 0, float('inf')),
        ],
        '2015-01-27-11-31-32_Realtek': [
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT, 'Manche haben dass', 0, float('inf')),
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT_RAW, 'Manche haben , dass.', 0, float('inf')),
        ],
        '2014-03-17-13-03-33_Realtek': [
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT, 'Ich habe mich', 0, float('inf')),
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT_RAW, 'Ich habe mich.', 0, float('inf')),
        ],
        # NOT ALL LISTED
    }

    EXPECTED_NUMBER_OF_SUBVIEWS = 3 + 5 + 5 + 5 + 5
    EXPECTED_SUBVIEWS = [
        rt.ExpSubview('test', [
            '2015-01-27-12-34-36_Kinect-Beam',
            '2015-01-27-12-34-36_Kinect-RAW',
            '2015-01-27-12-34-36_Realtek',
            '2015-01-27-12-34-36_Samson',
            '2015-01-27-12-34-36_Yamaha',
            '2015-02-03-12-08-13_Kinect-Beam',
            '2015-02-03-12-08-13_Kinect-RAW',
            '2015-02-03-12-08-13_Realtek',
            '2015-02-03-12-08-13_Samson',
            '2015-02-03-12-08-13_Yamaha',
            '2015-02-10-14-31-52_Kinect-Beam',
            '2015-02-10-14-31-52_Kinect-RAW',
            '2015-02-10-14-31-52_Realtek',
            '2015-02-10-14-31-52_Samson',
            '2015-02-10-14-31-52_Yamaha',
        ]),
        rt.ExpSubview('kinect-raw', [
            '2014-03-17-10-26-07_Microsoft-Kinect-Raw',
            '2014-03-17-13-03-33_Microsoft-Kinect-Raw',
            '2014-03-19-15-01-56_Kinect-RAW',
            '2014-08-07-13-22-38_Kinect-RAW',
            '2014-08-14-14-52-00_Kinect-RAW',
            '2015-01-27-11-31-32_Kinect-RAW',
            '2015-01-27-12-34-36_Kinect-RAW',
            '2015-01-28-11-35-47_Kinect-RAW',
            '2015-01-28-12-36-24_Kinect-RAW',
            '2015-02-03-12-08-13_Kinect-RAW',
            '2015-02-10-14-31-52_Kinect-RAW',
        ]),
        rt.ExpSubview('train_samson', [
            '2014-08-07-13-22-38_Samson',
            '2014-08-14-14-52-00_Samson',
        ]),
        # NOT ALL LISTED
    ]

    def load(self):
        reader = io.TudaReader()
        ds = reader.load(self.SAMPLE_PATH)
        print(sorted(ds.subviews['kinect-raw'].utterances.keys()))
        return ds

    def test_get_ids_from_folder(self):
        reader = io.TudaReader()

        assert reader.get_ids_from_folder(os.path.join(self.SAMPLE_PATH, 'train'), 'train') == {
            '2014-03-17-10-26-07',
            '2014-03-17-13-03-33',
            '2014-03-19-15-01-56',
            '2014-08-05-11-08-34',
            '2014-08-07-13-22-38',
            '2014-08-14-14-52-00',
            '2015-04-17-11-26-07',
        }
        assert reader.get_ids_from_folder(os.path.join(self.SAMPLE_PATH, 'dev'), 'dev') == {
            '2015-01-27-11-31-32',
            '2015-01-28-11-35-47',
            '2015-01-28-11-49-53',
            '2015-01-28-12-36-24',
        }
        assert reader.get_ids_from_folder(os.path.join(self.SAMPLE_PATH, 'test'), 'test') == {
            '2015-01-27-12-34-36',
            '2015-02-03-12-08-13',
            '2015-02-10-14-31-52',
        }
예제 #3
0
def data_path():
    return resources.sample_corpus_path('timit')
예제 #4
0
class TestCommonVoiceReader(rt.CorpusReaderTest):

    SAMPLE_PATH = resources.sample_corpus_path('common_voice')
    FILE_TRACK_BASE_PATH = os.path.join(SAMPLE_PATH, 'clips')

    EXPECTED_NUMBER_OF_TRACKS = 9
    EXPECTED_TRACKS = [
        rt.ExpFileTrack('c4b', 'c4b.mp3'),
        rt.ExpFileTrack('8ea', '8ea.mp3'),
        rt.ExpFileTrack('67c', '67c.mp3'),
        rt.ExpFileTrack('f08', 'f08.mp3'),
        rt.ExpFileTrack('b5c', 'b5c.mp3'),
        rt.ExpFileTrack('8f4', '8f4.mp3'),
        rt.ExpFileTrack('7f4', '7f4.mp3'),
        rt.ExpFileTrack('059', '059.mp3'),
        rt.ExpFileTrack('d08', 'd08.mp3'),
    ]

    EXPECTED_NUMBER_OF_ISSUERS = 7
    EXPECTED_ISSUERS = [
        rt.ExpSpeaker('17e', 1, issuers.Gender.MALE, issuers.AgeGroup.SENIOR, None),
        rt.ExpSpeaker('cb3', 2, issuers.Gender.MALE, issuers.AgeGroup.ADULT, None),
        rt.ExpSpeaker('aa3', 2, issuers.Gender.FEMALE, issuers.AgeGroup.ADULT, None),
        rt.ExpSpeaker('90a', 1, issuers.Gender.MALE, issuers.AgeGroup.ADULT, None),
        rt.ExpSpeaker('b0f', 1, issuers.Gender.UNKNOWN, issuers.AgeGroup.UNKNOWN, None),
        rt.ExpSpeaker('5ec', 1, issuers.Gender.UNKNOWN, issuers.AgeGroup.UNKNOWN, None),
        rt.ExpSpeaker('72d', 1, issuers.Gender.UNKNOWN, issuers.AgeGroup.UNKNOWN, None),
    ]

    EXPECTED_NUMBER_OF_UTTERANCES = 9
    EXPECTED_UTTERANCES = [
        rt.ExpUtterance('c4b', 'c4b', '17e', 0, float('inf')),
        rt.ExpUtterance('8ea', '8ea', 'cb3', 0, float('inf')),
        rt.ExpUtterance('67c', '67c', 'cb3', 0, float('inf')),
        rt.ExpUtterance('f08', 'f08', 'aa3', 0, float('inf')),
        rt.ExpUtterance('b5c', 'b5c', 'aa3', 0, float('inf')),
        rt.ExpUtterance('8f4', '8f4', '90a', 0, float('inf')),
        rt.ExpUtterance('7f4', '7f4', 'b0f', 0, float('inf')),
        rt.ExpUtterance('059', '059', '5ec', 0, float('inf')),
        rt.ExpUtterance('d08', 'd08', '72d', 0, float('inf')),
    ]

    EXPECTED_LABEL_LISTS = {
        'c4b': [
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT, 1),
        ],
        'f08': [
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT, 1),
        ],
        '8f4': [
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT, 1),
        ],
        'd08': [
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT, 1)
        ],
    }

    EXPECTED_LABELS = {
        'c4b': [
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT, 'Man sollte', 0, float('inf')),
        ],
        'f08': [
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT, 'Valentin', 0, float('inf')),
        ],
        '8f4': [
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT, 'Es', 0, float('inf')),
        ],
        '7f4': [
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT, 'Zieht euch', 0, float('inf')),
        ],
    }

    EXPECTED_NUMBER_OF_SUBVIEWS = 3

    EXPECTED_SUBVIEWS = [
        rt.ExpSubview('train', [
            'c4b',
            '8ea',
            '67c',
            'f08',
            'b5c',
        ]),
        rt.ExpSubview('dev', [
            '8f4',
            '7f4',
            '059',
            'd08',
        ]),
        rt.ExpSubview('validated', [
            '8f4',
        ]),
    ]

    def load(self):
        reader = common_voice.CommonVoiceReader()
        return reader.load(self.SAMPLE_PATH)
예제 #5
0
class TestGtzanReader(rt.CorpusReaderTest):

    SAMPLE_PATH = resources.sample_corpus_path('gtzan')
    FILE_TRACK_BASE_PATH = SAMPLE_PATH

    EXPECTED_NUMBER_OF_TRACKS = 4
    EXPECTED_TRACKS = [
        rt.ExpFileTrack('bagpipe', os.path.join('music_wav', 'bagpipe.wav')),
        rt.ExpFileTrack('ballad', os.path.join('music_wav', 'ballad.wav')),
        rt.ExpFileTrack('acomic', os.path.join('speech_wav', 'acomic.wav')),
        rt.ExpFileTrack('acomic2', os.path.join('speech_wav', 'acomic2.wav')),
    ]

    EXPECTED_NUMBER_OF_ISSUERS = 0

    EXPECTED_NUMBER_OF_UTTERANCES = 4
    EXPECTED_UTTERANCES = [
        rt.ExpUtterance('bagpipe', 'bagpipe', None, 0, float('inf')),
        rt.ExpUtterance('ballad', 'ballad', None, 0, float('inf')),
        rt.ExpUtterance('acomic', 'acomic', None, 0, float('inf')),
        rt.ExpUtterance('acomic2', 'acomic2', None, 0, float('inf')),
    ]

    EXPECTED_LABEL_LISTS = {
        'ballad': [
            rt.ExpLabelList(corpus.LL_DOMAIN, 1),
        ],
        'bagpipe': [
            rt.ExpLabelList(corpus.LL_DOMAIN, 1),
        ],
        'acomic': [
            rt.ExpLabelList(corpus.LL_DOMAIN, 1),
        ],
        'acomic2': [
            rt.ExpLabelList(corpus.LL_DOMAIN, 1),
        ],
    }

    EXPECTED_LABELS = {
        'bagpipe': [
            rt.ExpLabel(corpus.LL_DOMAIN, corpus.LL_DOMAIN_MUSIC, 0,
                        float('inf')),
        ],
        'ballad': [
            rt.ExpLabel(corpus.LL_DOMAIN, corpus.LL_DOMAIN_MUSIC, 0,
                        float('inf')),
        ],
        'acomic': [
            rt.ExpLabel(corpus.LL_DOMAIN, corpus.LL_DOMAIN_SPEECH, 0,
                        float('inf')),
        ],
        'acomic2': [
            rt.ExpLabel(corpus.LL_DOMAIN, corpus.LL_DOMAIN_SPEECH, 0,
                        float('inf')),
        ],
    }

    EXPECTED_NUMBER_OF_SUBVIEWS = 0

    def load(self):
        return io.GtzanReader().load(self.SAMPLE_PATH)
예제 #6
0
class TestAEDReader(rt.CorpusReaderTest):

    SAMPLE_PATH = resources.sample_corpus_path('aed')
    FILE_TRACK_BASE_PATH = SAMPLE_PATH

    EXPECTED_NUMBER_OF_TRACKS = 10
    EXPECTED_TRACKS = [
        rt.ExpFileTrack('acoustic_guitar_16',
                        os.path.join('test', 'acoustic_guitar_16.wav')),
        rt.ExpFileTrack('footstep_300', os.path.join('test',
                                                     'footstep_300.wav')),
        rt.ExpFileTrack('violin_36', os.path.join('test', 'violin_36.wav')),
        rt.ExpFileTrack('airplane_1',
                        os.path.join('train', 'airplane', 'airplane_1.wav')),
        rt.ExpFileTrack('airplane_23',
                        os.path.join('train', 'airplane', 'airplane_23.wav')),
        rt.ExpFileTrack('airplane_33',
                        os.path.join('train', 'airplane', 'airplane_33.wav')),
        rt.ExpFileTrack('footstep_16',
                        os.path.join('train', 'footstep', 'footstep_16.wav')),
        rt.ExpFileTrack(
            'helicopter_9',
            os.path.join('train', 'helicopter', 'helicopter_9.wav')),
        rt.ExpFileTrack('tone_12', os.path.join('train', 'tone',
                                                'tone_12.wav')),
        rt.ExpFileTrack('tone_35', os.path.join('train', 'tone',
                                                'tone_35.wav')),
    ]

    EXPECTED_NUMBER_OF_ISSUERS = 0

    EXPECTED_NUMBER_OF_UTTERANCES = 10
    EXPECTED_UTTERANCES = [
        rt.ExpUtterance('acoustic_guitar_16', 'acoustic_guitar_16', None, 0,
                        float('inf')),
        rt.ExpUtterance('footstep_300', 'footstep_300', None, 0, float('inf')),
        rt.ExpUtterance('violin_36', 'violin_36', None, 0, float('inf')),
        rt.ExpUtterance('airplane_1', 'airplane_1', None, 0, float('inf')),
        rt.ExpUtterance('airplane_23', 'airplane_23', None, 0, float('inf')),
        rt.ExpUtterance('airplane_33', 'airplane_33', None, 0, float('inf')),
        rt.ExpUtterance('footstep_16', 'footstep_16', None, 0, float('inf')),
        rt.ExpUtterance('helicopter_9', 'helicopter_9', None, 0, float('inf')),
        rt.ExpUtterance('tone_12', 'tone_12', None, 0, float('inf')),
        rt.ExpUtterance('tone_35', 'tone_35', None, 0, float('inf')),
    ]

    EXPECTED_LABEL_LISTS = {
        'airplane_23': [rt.ExpLabelList(corpus.LL_SOUND_CLASS, 1)],
        'tone_12': [rt.ExpLabelList(corpus.LL_SOUND_CLASS, 1)],
        'acoustic_guitar_16': [rt.ExpLabelList(corpus.LL_SOUND_CLASS, 1)],
    }

    EXPECTED_LABELS = {
        'airplane_23': [
            rt.ExpLabel(corpus.LL_SOUND_CLASS, 'airplane', 0, float('inf')),
        ],
        'tone_12': [
            rt.ExpLabel(corpus.LL_SOUND_CLASS, 'tone', 0, float('inf')),
        ],
        'acoustic_guitar_16': [
            rt.ExpLabel(corpus.LL_SOUND_CLASS, 'acoustic_guitar', 0,
                        float('inf')),
        ],
    }

    EXPECTED_NUMBER_OF_SUBVIEWS = 2
    EXPECTED_SUBVIEWS = [
        rt.ExpSubview('train', [
            'airplane_1',
            'airplane_23',
            'airplane_33',
            'footstep_16',
            'helicopter_9',
            'tone_12',
            'tone_35',
        ]),
        rt.ExpSubview('test', [
            'acoustic_guitar_16',
            'footstep_300',
            'violin_36',
        ]),
    ]

    def load(self):
        reader = io.AEDReader()
        return reader.load(self.SAMPLE_PATH)
예제 #7
0
class TestTatoebaReader:

    SAMPLE_PATH = resources.sample_corpus_path('tatoeba')
    FILE_TRACK_BASE_PATH = os.path.join(SAMPLE_PATH, 'audio')

    EXPECTED_NUMBER_OF_TRACKS = 5
    EXPECTED_TRACKS = [
        rt.ExpFileTrack('141', os.path.join('eng', '141.mp3')),
        rt.ExpFileTrack('247', os.path.join('fra', '247.mp3')),
        rt.ExpFileTrack('1355', os.path.join('deu', '1355.mp3')),
        rt.ExpFileTrack('1881', os.path.join('deu', '1881.mp3')),
        rt.ExpFileTrack('6921520', os.path.join('eng', '6921520.mp3')),
    ]

    EXPECTED_NUMBER_OF_ISSUERS = 4
    EXPECTED_ISSUERS = [
        rt.ExpSpeaker('BraveSentry', 1, issuers.Gender.UNKNOWN,
                      issuers.AgeGroup.UNKNOWN, None),
        rt.ExpSpeaker('gretelen', 1, issuers.Gender.UNKNOWN,
                      issuers.AgeGroup.UNKNOWN, None),
        rt.ExpSpeaker('Nero', 1, issuers.Gender.UNKNOWN,
                      issuers.AgeGroup.UNKNOWN, None),
        rt.ExpSpeaker('CK', 2, issuers.Gender.UNKNOWN,
                      issuers.AgeGroup.UNKNOWN, None),
    ]

    EXPECTED_NUMBER_OF_UTTERANCES = 5
    EXPECTED_UTTERANCES = [
        rt.ExpUtterance('141', '141', 'BraveSentry', 0, float('inf')),
        rt.ExpUtterance('247', '247', 'gretelen', 0, float('inf')),
        rt.ExpUtterance('1355', '1355', 'Nero', 0, float('inf')),
        rt.ExpUtterance('1881', '1881', 'CK', 0, float('inf')),
        rt.ExpUtterance('6921520', '6921520', 'CK', 0, float('inf')),
    ]

    EXPECTED_LABEL_LISTS = {
        '141': [rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT_RAW, 1)],
        '247': [rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT_RAW, 1)],
        '1355': [rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT_RAW, 1)],
        '1881': [rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT_RAW, 1)],
        '6921520': [rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT_RAW, 1)],
    }

    EXPECTED_LABELS = {
        '141': [
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT,
                        'I want you to tell me why you did that.', 0,
                        float('inf'))
        ],
        '247': [
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT,
                        'Comment ça, je suis trop vieille pour ce poste ?', 0,
                        float('inf'))
        ],
        '1355': [
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT,
                        'Wer will heiße Schokolade?', 0, float('inf'))
        ],
        '1881': [
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT, 'Das ist zu teuer!', 0,
                        float('inf'))
        ],
        '6921520': [
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT,
                        'He washes his car at least once a week.', 0,
                        float('inf'))
        ],
    }

    EXPECTED_NUMBER_OF_SUBVIEWS = 0

    def load(self):
        return io.TatoebaReader().load(self.SAMPLE_PATH)
예제 #8
0
class TestKaldiReader(rt.CorpusReaderTest):

    SAMPLE_PATH = resources.sample_corpus_path('kaldi')
    FILE_TRACK_BASE_PATH = os.path.join(SAMPLE_PATH, 'files')

    EXPECTED_NUMBER_OF_TRACKS = 4
    EXPECTED_TRACKS = [
        rt.ExpFileTrack('file-1', 'wav_1.wav'),
        rt.ExpFileTrack('file-2', 'wav_2.wav'),
        rt.ExpFileTrack('file-3', 'wav_3.wav'),
        rt.ExpFileTrack('file-4', 'wav_4.wav'),
    ]

    EXPECTED_NUMBER_OF_ISSUERS = 3
    EXPECTED_ISSUERS = [
        rt.ExpSpeaker('speaker-1', 2, issuers.Gender.MALE,
                      issuers.AgeGroup.UNKNOWN, None),
        rt.ExpSpeaker('speaker-2', 2, issuers.Gender.MALE,
                      issuers.AgeGroup.UNKNOWN, None),
        rt.ExpSpeaker('speaker-3', 1, issuers.Gender.FEMALE,
                      issuers.AgeGroup.UNKNOWN, None),
    ]

    EXPECTED_NUMBER_OF_UTTERANCES = 5
    EXPECTED_UTTERANCES = [
        rt.ExpUtterance('utt-1', 'file-1', 'speaker-1', 0, float('inf')),
        rt.ExpUtterance('utt-2', 'file-2', 'speaker-1', 0, float('inf')),
        rt.ExpUtterance('utt-3', 'file-3', 'speaker-2', 0, 15),
        rt.ExpUtterance('utt-4', 'file-3', 'speaker-2', 15, 25),
        rt.ExpUtterance('utt-5', 'file-4', 'speaker-3', 0, float('inf')),
    ]

    EXPECTED_LABEL_LISTS = {
        'utt-1': [
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT, 1),
        ],
        'utt-2': [
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT, 1),
        ],
        'utt-3': [
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT, 1),
        ],
        'utt-4': [
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT, 1),
        ],
        'utt-5': [
            rt.ExpLabelList(corpus.LL_WORD_TRANSCRIPT, 1),
        ],
    }

    EXPECTED_LABELS = {
        'utt-4': [
            rt.ExpLabel(corpus.LL_WORD_TRANSCRIPT, 'who are they', 0,
                        float('inf')),
        ],
    }

    EXPECTED_NUMBER_OF_SUBVIEWS = 0

    def load(self):
        return io.KaldiReader().load(self.SAMPLE_PATH)