예제 #1
0
def acoustic_config(graph_db, textgrid_test_dir):
    config = CorpusConfig('acoustic', **graph_db)

    acoustic_path = os.path.join(textgrid_test_dir, 'acoustic_corpus.TextGrid')
    with CorpusContext(config) as c:
        c.reset()
        parser = inspect_textgrid(acoustic_path)
        c.load(parser, acoustic_path)
    config.pitch_algorithm = 'acousticsim'
    config.formant_source = 'acousticsim'
    return config
예제 #2
0
def acoustic_config(graph_db, textgrid_test_dir):
    config = CorpusConfig('acoustic', **graph_db)

    acoustic_path = os.path.join(textgrid_test_dir, 'acoustic_corpus.TextGrid')
    with CorpusContext(config) as c:
        c.reset()
        parser = inspect_textgrid(acoustic_path)
        c.load(parser, acoustic_path)
    config.pitch_algorithm = 'acousticsim'
    config.formant_algorithm = 'acousticsim'
    return config
예제 #3
0
def acoustic_utt_config(graph_db, textgrid_test_dir):
    config = CorpusConfig('acoustic utt', **graph_db)

    acoustic_path = os.path.join(textgrid_test_dir, 'acoustic_corpus.TextGrid')
    with CorpusContext(config) as c:
        c.reset()
        parser = inspect_textgrid(acoustic_path)
        c.load(parser, acoustic_path)

        c.encode_pauses(['sil'])
        c.encode_utterances(min_pause_length = 0)

    config.pitch_algorithm = 'acousticsim'
    config.formant_algorithm = 'acousticsim'
    return config
예제 #4
0
def acoustic_utt_config(graph_db, textgrid_test_dir):
    config = CorpusConfig('acoustic utt', **graph_db)

    acoustic_path = os.path.join(textgrid_test_dir, 'acoustic_corpus.TextGrid')
    with CorpusContext(config) as c:
        c.reset()
        parser = inspect_textgrid(acoustic_path)
        c.load(parser, acoustic_path)

        c.encode_pauses(['sil'])
        c.encode_utterances(min_pause_length=0)

    config.pitch_algorithm = 'acousticsim'
    config.formant_algorithm = 'acousticsim'
    return config
예제 #5
0
def overlapped_config(graph_db, textgrid_test_dir, acoustic_syllabics):
    config = CorpusConfig('overlapped', **graph_db)

    acoustic_path = os.path.join(textgrid_test_dir, 'overlapped_speech')
    with CorpusContext(config) as c:
        c.reset()
        parser = inspect_mfa(acoustic_path)
        c.load(parser, acoustic_path)

        c.encode_pauses(['sil'])
        c.encode_utterances(min_pause_length=0)
        c.encode_syllabic_segments(acoustic_syllabics)
        c.encode_syllables()

    config.pitch_algorithm = 'acousticsim'
    config.formant_source = 'acousticsim'
    return config
예제 #6
0
    'graph_port': 7474,
    'graph_user': '******',
    'graph_password': '******'
}

praat = r'C:\Users\michael\Documents\Praat\praatcon.exe'

reaper = r'D:\Dev\Tools\REAPER-master\reaper.exe'

speaker_info_path = r'D:\Data\VIC\SpeakerInfo.txt'

config = CorpusConfig('buckeye', **graph_db)

config.reaper_path = reaper
config.praat_path = praat
config.pitch_algorithm = 'praat'


def call_back(*args):
    args = [x for x in args if isinstance(x, str)]
    if args:
        print(' '.join(args))


if __name__ == '__main__':
    with CorpusContext(config) as g:
        g.reset_acoustics()
        if not 'utterance' in g.annotation_types:
            g.encode_pauses('^[{<].*', call_back=call_back)
            g.encode_utterances(min_pause_length=0.15, call_back=call_back)
        if not g.hierarchy.has_speaker_property('gender'):