windows下安装kenlm步骤记录
启用适用于linux的windows子模式
Microsoft store 安装 Ubuntu后,打开Ubuntu使用以下命令
1、sudo apt-get update
安装kenlm
1、wget -O - http://kheafield.com/code/kenlm.tar.gz |tar xz
2、mkdir kenlm/build
3、cd kenlm/build
4、cmake …
error: cmake not found
5、sudo apt-get install cmake
6、cmake …
error:cmake_cxx_compiler not found
7、sudo apt-get install cmake gcc g++
8、cmake …
error:could not find boost
9、sudo apt install libboost-dev libboost-test-dev
10、cmake …
error:counld not find a package in boost
11、sudo apt-get install libboost-all-dev
12、cmake …
error:could not find Eigen3
error:could not find BZip2
error:could not find LibLZMA
13、sudo apt install libeigen3-dev
14、sudo apt install libbz2-dev
15、sudo apt install liblzma-dev
16、cmake …
17、make -j 4
训练模型
cd $home
cd kenlm
build/bin/lmplz -o 3 --verbose_header --text segment.txt --arpa result/segment_3-gram.arpa
arpa转化为二进制文件加快模型读取速度
build/bin/build_binary ./result/segment_3-gram.arpa ./result/segment_3-gram.klm