Ejemplo n.º 1
0
def test_existing_pron_dict_using_use_existing(tmpdir):
    """
    Use the use_existing parameter to load configurations from existing pron dict.
    """
    kaldi = KaldiInterface(f'{tmpdir}/state')
    pd1 = kaldi.new_pron_dict('x')
    pd1_hash = pd1.hash
    pd2 = kaldi.new_pron_dict('x', use_existing=True)
    assert len(kaldi.list_pron_dicts()) == 1
    assert pd1_hash == pd2.hash
    assert pd1.path == pd2.path
    return
Ejemplo n.º 2
0
def test_existing_pron_dict_using_override(tmpdir):
    """
    Use override to delete a pron dict with the same name and create a totally
    new pron dict with the same name.
    """
    kaldi = KaldiInterface(f'{tmpdir}/state')
    pd1 = kaldi.new_pron_dict('pronunciation dictionary')
    pd1_hash = pd1.hash
    pd2 = kaldi.new_pron_dict('pronunciation dictionary', override=True)
    # note pd1 can no longer be used
    assert len(kaldi.list_pron_dicts()) == 1
    assert pd1_hash != pd2.hash
    return