CRF++是条件随机场(crf)算法用C语言实现的工具包,使用它可以实现实体识别等序列标注任务,现就CRF++安装过程进行介绍:
step1:git clone https://github.com/taku910/crfpp.git (从GitHub上下载安装包)
step2:cd crfpp (下载后,进入crfpp文件目录)
step3:./configure
# 若该步骤提示错误:configure: error: Your compiler is not powerful enough to compile CRF++. If it should be, see config.log for more information of why it failed.
则安装g++
centos: yum install gcc-c++
ubantu: apt-get install g++
step4:sed -i '/#include "winmain.h"/d' crf_test.cpp
step5:sed -i '/#include "winmain.h"/d' crf_learn.cpp
step6:sudo make install
以上是就是CRF++安装过程,若需要安装它对应的python的接口CFRPP包,需要:
step1: cd python (该目录存在于crf++文件夹下面)
step2: python setup.py build
step3:python setup.py install
#可能存在的问题:CRFPP_wrap.cxx:149:20: fatal error: Python.h: No such file or directory
#解决方法:yum install python-devel
step4:import CRFPP (在python下)
若step4没报错,则表明安装成功,就可以在python文件中调用
若提示出现的错误ImportError:libcrfpp.so.0: cannot open shared object file: No such file or directory
解决方法:
ln -s /usr/local/lib/libcrfpp.so.0 /usr/lib/
ldconfig
![](https://img.haomeiwen.com/i20501870/65f2e17aa4a3f005.jpg)
网友评论