LoginSignup
2
0

More than 5 years have passed since last update.

Kaldiに関する処理を日本語のドキュメントでまとめてみた(グラフ作成編)5

Last updated at Posted at 2015-04-16

前回

1:http://qiita.com/GushiSnow/items/cc1440e0a8ea199e78c5

2:http://qiita.com/GushiSnow/items/a24cad7231de341738ee

3:http://qiita.com/GushiSnow/items/e099baf9d1c2e72cb3d1

4:http://qiita.com/GushiSnow/items/d431a5c49dc4206def2d

グラフ作成

デコーディング前の作業でグラフ作成作業がある。

下記のオプションで指定可能

"--mono"       #モノフォン   
"--quinphone"  #クインフォン
"--reverse"    #逆順
"--transition-scale" #スケール変換
"--self-loop-scale"  #自己学習の回数スケール

LGのグラフ(言語モデルと音素のモデルの結合)を作成

LGのグラフ(言語モデルと音素のモデルの結合)を作成
epsilonsの除去と決定
FST after encodingの最小化

fsttablecompose $lang/L_disambig.fst $lang/G.fst |

fstdeterminizestar --use-log=true|

fstminimizeencoded | fstarcsort --sort_type=ilabel > $lang/tmp/LG.fst

CLGのグラフを作成

文脈依存のLGグラフを作成
それぞれの経路に対してソート

fstcomposecontext --context-size=$N --central-position=$P --read-disambig-syms=$lang/phones/disambig.int --write-disambig-syms=$lang/tmp/disambig_ilabels_${N}_${P}.int $lang/tmp/ilabels_${N}_${P} < $lang/tmp/LG.fst|

fstarcsort --sort_type=ilabel > $clg

fstisstochastic $clg  || echo "[info]: CLG not stochastic."

文脈、単語、音素に加えてHMMの要素も加えたHCLGを作成する。

if [[ ! -s $dir/Ha.fst || $dir/Ha.fst -ot $model  \
    || $dir/Ha.fst -ot $lang/tmp/ilabels_${N}_${P} ]]; then
  if $reverse; then
    make-h-transducer --reverse=true --push_weights=true \
      --disambig-syms-out=$dir/disambig_tid.int \
      --transition-scale=$tscale $lang/tmp/ilabels_${N}_${P} $tree $model \
      > $dir/Ha.fst  || exit 1;
  else
    make-h-transducer --disambig-syms-out=$dir/disambig_tid.int \
      --transition-scale=$tscale $lang/tmp/ilabels_${N}_${P} $tree $model \
       > $dir/Ha.fst  || exit 1;
  fi
fi

if [[ ! -s $dir/HCLGa.fst || $dir/HCLGa.fst -ot $dir/Ha.fst || \
      $dir/HCLGa.fst -ot $clg ]]; then
  fsttablecompose $dir/Ha.fst $clg | fstdeterminizestar --use-log=true \
    | fstrmsymbols $dir/disambig_tid.int | fstrmepslocal | \
     fstminimizeencoded > $dir/HCLGa.fst || exit 1;
  fstisstochastic $dir/HCLGa.fst || echo "HCLGa is not stochastic"
fi

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0