LTP制定了基于XML的语言处理结果表示,并在此基础上提供了一整套自底向上的中文语言处理模块,以及基于动态链接库(Dynamic Link Library, DLL)的应用程序接口、可视化工具,并且能够以网络服务(Web Service)的形式进行使用。
(LTP-server)
开源代码:https://github.com/HIT-SCIR/ltp
在线文档:https://ltp.readthedocs.io/zh_CN/latest/ltptest.html
使用方式、开源代码:https://github.com/HIT-SCIR/pyltp
在线文档:https://pyltp.readthedocs.io/zh_CN/latest/
【error】
在ubuntu下pip install ptltp时遇到如下错误:error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Collecting pyltp Using cached https://files.pythonhosted.org/packages/aa/72/2d88c54618cf4d8916832950374a6f265e12289fa9870aeb340800a28a62/pyltp-0.2.1.tar.gz Building wheels for collected packages: pyltp Running setup.py bdist_wheel for pyltp ... error Complete output from command /home/ubuntu/sunzhuo/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-75f5gd58/pyltp/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-6vt7zt3j --python-tag cp35: running bdist_wheel running build running build_ext building 'pyltp' extension creating build creating build/temp.linux-x86_64-3.5 creating build/temp.linux-x86_64-3.5/src creating build/temp.linux-x86_64-3.5/ltp creating build/temp.linux-x86_64-3.5/ltp/thirdparty creating build/temp.linux-x86_64-3.5/ltp/thirdparty/boost creating build/temp.linux-x86_64-3.5/ltp/thirdparty/boost/libs creating build/temp.linux-x86_64-3.5/ltp/thirdparty/boost/libs/regex creating build/temp.linux-x86_64-3.5/ltp/thirdparty/boost/libs/regex/src creating build/temp.linux-x86_64-3.5/ltp/thirdparty/boost/libs/program_options creating build/temp.linux-x86_64-3.5/ltp/thirdparty/boost/libs/program_options/src creating build/temp.linux-x86_64-3.5/ltp/thirdparty/boost/libs/serialization creating build/temp.linux-x86_64-3.5/ltp/thirdparty/boost/libs/serialization/src creating build/temp.linux-x86_64-3.5/ltp/thirdparty/boost/libs/smart_ptr creating build/temp.linux-x86_64-3.5/ltp/thirdparty/boost/libs/smart_ptr/src creating build/temp.linux-x86_64-3.5/ltp/thirdparty/dynet creating build/temp.linux-x86_64-3.5/ltp/thirdparty/dynet/dynet creating build/temp.linux-x86_64-3.5/ltp/thirdparty/maxent creating build/temp.linux-x86_64-3.5/ltp/src creating build/temp.linux-x86_64-3.5/ltp/src/splitsnt creating build/temp.linux-x86_64-3.5/ltp/src/segmentor creating build/temp.linux-x86_64-3.5/ltp/src/postagger creating build/temp.linux-x86_64-3.5/ltp/src/ner creating build/temp.linux-x86_64-3.5/ltp/src/parser.n creating build/temp.linux-x86_64-3.5/ltp/src/srl creating build/temp.linux-x86_64-3.5/ltp/src/srl/common creating build/temp.linux-x86_64-3.5/ltp/src/srl/common/model creating build/temp.linux-x86_64-3.5/ltp/src/srl/common/structure creating build/temp.linux-x86_64-3.5/ltp/src/srl/include creating build/temp.linux-x86_64-3.5/ltp/src/srl/include/base creating build/temp.linux-x86_64-3.5/ltp/src/srl/Srl creating build/temp.linux-x86_64-3.5/ltp/src/srl/Srl/model creating build/temp.linux-x86_64-3.5/patch creating build/temp.linux-x86_64-3.5/patch/libs creating build/temp.linux-x86_64-3.5/patch/libs/python creating build/temp.linux-x86_64-3.5/patch/libs/python/src creating build/temp.linux-x86_64-3.5/patch/libs/python/src/object creating build/temp.linux-x86_64-3.5/patch/libs/python/src/converter x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iltp/include/ -Iltp/thirdparty/boost/include/ -Iltp/thirdparty/dynet/ -Iltp/thirdparty/eigen/ -Iltp/thirdparty/maxent/ -Iltp/src/ -Iltp/src/splitsnt -Iltp/src/segmentor/ -Iltp/src/postagger/ -Iltp/src/ner/ -Iltp/src/parser.n/ -Iltp/src/srl/ -Iltp/src/srl/common/ -Iltp/src/srl/include/ -Iltp/src/srl/Pi/ -Iltp/src/srl/Srl/ -Iltp/src/srl/tool/ -Iltp/src/utils/ -Ipatch/include/ -I/usr/include/python3.5m -I/home/ubuntu/sunzhuo/include/python3.5m -c src/pyltp.cpp -o build/temp.linux-x86_64-3.5/src/pyltp.o -std=c++0x cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ In file included from patch/include/boost/python/detail/prefix.hpp:13:0, from patch/include/boost/python/args.hpp:8, from patch/include/boost/python.hpp:11, from src/pyltp.cpp:15: patch/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: 没有那个文件或目录 # include <pyconfig.h> ^ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- Command "/home/ubuntu/sunzhuo/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-75f5gd58/pyltp/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-us_a884o/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/sunzhuo/include/site/python3.5/pyltp" failed with error code 1 in /tmp/pip-install-75f5gd58/pyltp/
查到原因为:没有将依赖包装全,这个错误很可能是安装某个东西时,缺少相关的依赖环境
解决方案为:sudo apt-get install python3.5-dev
为什么要安装python-dev:参考https://www.cnblogs.com/cj2014/p/3848673.html
以LTP为基础的云服务:https://www.ltp-cloud.com/intro#ltp_cloud
使用方法 参考博客:https://blog.csdn.net/churximi/article/details/51173297