funcwj / pydecoder

A python wrapper for kaldi-online-decoder using Cython

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

very simple python wrapper for kaldi-decoder in nnet3 setup.

TODO

  • Add nnet2/nnet3 online-decoder wrappers using Cython
  • Add tools parsing BNF description into a text file in the AT&T FSM format

Requirements

  • python2.7
  • openfst 1.6.1 (official supported)
  • Cython 0.26
  • numpy

Prepare

  1. directory conf is generated by steps/online/prepare_online_decoding.sh
  2. kaldi-command parameters should be configured in corresponding file, for example, add decoding configure in conf/online.conf
# decode config
--min-active=200 
--max-active=7000 
--beam=11.0 
--lattice-beam=6.0 
--acoustic-scale=0.1
--frames-per-chunk=20 
--extra-left-context-initial=0
  1. resources needed by pydecoder listed here:
├── conf
│   ├── ivector_extractor.conf
│   ├── mfcc.conf
│   ├── online_cmvn.conf
│   ├── online.conf
│   ├── online_pitch.conf
│   └── splice.conf
├── final.mdl
├── HCLG.fst
├── ivector_extractor
│   ├── final.dubm
│   ├── final.ie
│   ├── final.mat
│   ├── global_cmvn.stats
│   ├── online_cmvn.conf
│   └── splice_opts
└── words.txt

Example

import pydecoder
# import ...
# args setting...
# config the decoder
decoder = pydecoder.PyOnlineNnet3Decoder(args.config, args.model, args.graph)
# decode whole file
decoder.decode_wavefile(args.wave)
# and get result sequence
print decoder.get_decode_sequence(args.words)

more see decoder_test

About

A python wrapper for kaldi-online-decoder using Cython


Languages

Language:C++ 67.1%Language:Python 18.9%Language:CMake 10.0%Language:Shell 4.0%