赞
踩
将srilm-1.7.2解压到tools目录下面,重命名为srilm
1.修改srilm目录下Makefile文件
找到此行: # SRILM = /home/speech/stolcke/project/srilm/devel,另起一行输入srilm的安装路径,SRILM = (自己的路径)
2.编译srilm
切换到srilm目录下,执行
make World
3.测试
make test
出现如下信息:
.........
*** Running test ngram-prune ***
11.17user 2.35system 0:14.20elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+15816outputs (0major+31653minor)pagefaults 0swaps
ngram-prune: stdout output IDENTICAL.
ngram-prune: stderr output IDENTICAL.
*** Running test ngram-server ***
0.21user 0.72system 0:06.56elapsed 14%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+8outputs (0major+2559minor)pagefaults 0swaps
ngram-server: stdout output IDENTICAL.
ngram-server: stderr output IDENTICAL.
*** Running test ppl-counts ***
0.10user 0.24system 0:00.32elapsed 104%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+16outputs (0major+4724minor)pagefaults 0swaps
ppl-counts: stdout output IDENTICAL.
ppl-counts: stderr output IDENTICAL.
*** Running test tagged-ngram ***
0.00user 0.05system 0:00.11elapsed 51%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+24outputs (0major+1789minor)pagefaults 0swaps
tagged-ngram: stdout output IDENTICAL.
tagged-ngram: stderr output IDENTICAL.
*** Running test vocab-aliases ***
0.27user 0.24system 0:01.65elapsed 31%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+16outputs (0major+5845minor)pagefaults 0swaps
vocab-aliases: stdout output IDENTICAL.
vocab-aliases: stderr output IDENTICAL.
需要等待一段时间,如果出现多是IDENTICAL,很少的DIFFERS,就证明srilm编译成功了!
4.先在 .bashrc下添加路径
export PATH="/home/xxt/kaldi/tools/srilm/bin/i686-m64:$PATH"
export PATH="/home/xxt/kaldi/tools/srilm/bin:$PATH"
就可以在任意路径下计算语言模型
ngram-count -text zangzichunwenben -order 3 -write 1.count
ngram-count -read 1.count -order 3 -lm word.3gram.lm -interpolate -kndiscount
或
ngram-count -read 1.count -order 3 -lm word.3gram.lm -interpolate -wbdiscount
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。