Skip to content

Instantly share code, notes, and snippets.

@SnowMasaya
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save SnowMasaya/21c14d24e973b6ef6e98 to your computer and use it in GitHub Desktop.

Select an option

Save SnowMasaya/21c14d24e973b6ef6e98 to your computer and use it in GitHub Desktop.
Kaldiに関する処理を日本語のドキュメントでまとめてみた(グラフ作成編)5 ref: http://qiita.com/GushiSnow/items/8e1c25b1d2eda8c1f2c3
"--mono" #モノフォン
"--quinphone" #クインフォン
"--reverse" #逆順
"--transition-scale" #スケール変換
"--self-loop-scale" #自己学習の回数スケール
fsttablecompose $lang/L_disambig.fst $lang/G.fst |
fstdeterminizestar --use-log=true|
fstminimizeencoded | fstarcsort --sort_type=ilabel > $lang/tmp/LG.fst
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."
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment