Onyx logo

Previous topic

onyx.htkfiles.htkscoring – Quick test of scoring some acoustic models with feature data.

Next topic

Lexicon

This Page

onyx.htkfiles.htkmmf2native – Convert a model file from HTK’s mmf format to our native format

>>> module_dir, module_name = os.path.split(__file__)
>>> infilename = os.path.join(module_dir, "start.mmf")
>>> fd, outfilename = tempfile.mkstemp(prefix='tmp', suffix='.am')
>>> os.close(fd)
>>> htkmmf2native(infilename, outfilename)

Now test output

>>> with open(infilename) as f_in:
...     models_in, hmm_mgr_in, gmm_mgr_in = read_htk_mmf_file(f_in)
>>> with open(outfilename) as f_out:
...     models_out, gmm_mgr_out, hmm_mgr_out = hmm_mgr.read_acoustic_model(f_out)
>>> models_in == models_out
True
>>> gmm_mgr_in == gmm_mgr_out
True
>>> hmm_mgr_in == hmm_mgr_out
True
>>> #print(outfilename)
>>> os.unlink(outfilename)
>>> infilename = os.path.join(module_dir, "monophones.mmf")
>>> fd, outfilename = tempfile.mkstemp(prefix='tmp', suffix='.am')
>>> os.close(fd)
>>> htkmmf2native(infilename, outfilename)

Now test output

>>> with open(infilename) as f_in:
...     models_in, hmm_mgr_in, gmm_mgr_in = read_htk_mmf_file(f_in)
>>> with open(outfilename) as f_out:
...     models_out, gmm_mgr_out, hmm_mgr_out = hmm_mgr.read_acoustic_model(f_out)
>>> models_in == models_out
True
>>> gmm_mgr_in == gmm_mgr_out
True
>>> hmm_mgr_in == hmm_mgr_out
True
>>> #print(outfilename)
>>> os.unlink(outfilename)
onyx.htkfiles.htkmmf2native.htkmmf2native(htk_file_name, native_file_name)
onyx.htkfiles.htkmmf2native.usage(prog_name)