kenlm过去只能在Linux下使用,windows下安装困难重重,分享一下我遇到的几个问题
首先
https://github.com/kpu/kenlm下载到本地,运行python setup.py install
不要下载https://github.com/kpu/kenlm/archive/windows.zip
虽然看起来它才是windows版本
报错一
KENLM_MAX_ORDER未定义,
在./lm/max_order.cc文件中前部添加static int KENLM_MAX_ORDER = 6;
报错二
unistd.h未找到,在你的c1.exe所在环境的include文件夹下添加一个unistd.h文件,其内容如下:
ifndef _UNISTD_H
define _UNISTD_H
include <io.h>
include <process.h>
endif /* _UNISTD_H */
报错三
“max”: 不是“std”的成员,在报错文件前加入#include <algorithm>
报错四
无法打开包含文件getopt.h
http://ieng6.ucsd.edu/~cs12x/vc08install/getopt9.zip
把压缩文件中的getopt.h头文件和getopt.lib库文件拷贝到你的计算机中,.h在include文件夹下.lib在lib文件夹下
结果
成功.