Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/HIT-SCIR/pyltp
pyltp: the python extension for LTP
https://github.com/HIT-SCIR/pyltp
chinese-nlp python
Last synced: 4 months ago
JSON representation
pyltp: the python extension for LTP
- Host: GitHub
- URL: https://github.com/HIT-SCIR/pyltp
- Owner: HIT-SCIR
- Fork: true (HuangFJ/pyltp)
- Created: 2014-06-12T02:53:42.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-07-24T04:04:34.000Z (over 2 years ago)
- Last Synced: 2024-05-07T18:17:21.115Z (10 months ago)
- Topics: chinese-nlp, python
- Language: C++
- Homepage:
- Size: 8.76 MB
- Stars: 1,523
- Watchers: 70
- Forks: 353
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.rst
Awesome Lists containing this project
README
# pyltp
[](https://badge.fury.io/py/pyltp)
[](http://pyltp.readthedocs.io/)
[](https://travis-ci.org/HIT-SCIR/pyltp)
[](https://ci.appveyor.com/project/Oneplus/pyltp/branch/master)
[](https://pypi.python.org/pypi/pyltp)pyltp 是 [语言技术平台(Language Technology Platform, LTP)](https://github.com/HIT-SCIR/ltp)的 Python 封装。
在使用 pyltp 之前,您需要简要了解 [语言技术平台(LTP)](http://ltp.readthedocs.org/zh_CN/latest/) 能否帮助您解决问题。
**目前基于Pytorch的LTP4 已经发布,而PyLTP将会只有非常有限的维护,请大家移步使用**[LTP 4]([LTP 4](https://github.com/HIT-SCIR/ltp))
## 依赖支持情况
Python 2.7, 3.x, and PyPy (PyPy2.7 >= 5.7)
## 一个简单的例子
下面是一个使用 pyltp 进行分词的例子
```python
# -*- coding: utf-8 -*-
from pyltp import Segmentor
segmentor = Segmentor("/path/to/your/cws/model")
words = segmentor.segment("元芳你怎么看")
print("|".join(words))
segmentor.release()
```
除了分词之外,pyltp 还提供词性标注、命名实体识别、依存句法分析、语义角色标注等功能。详细使用方法可以参考 [example](example/example.py)
## 安装
* 第一步,安装 pyltp
使用 pip 安装
```
$ pip install pyltp
```
或从源代码安装```
$ git clone https://github.com/HIT-SCIR/pyltp
$ cd pyltp
$ git submodule init
$ git submodule update
$ python setup.py install
```+ Mac系统出现版本问题使用 MACOSX_DEPLOYMENT_TARGET=10.7 python setup.py install
+ 编译时间较长(约5分钟左右),请耐心等待* 第二步,下载模型文件
[七牛云](http://ltp.ai/download.html),当前模型版本 3.4.0
## 制作安装包
```
git submodule init
git submodule update
python setup.py bdist_wheel
```## 版本对应
* pyltp 版本:0.4.0
* LTP 版本:3.4.0
* 模型版本:3.4.0## 作者
* 冯云龙 << [email protected] >> 2020-7-30 重写代码,换用 Pybind11
* 徐梓翔 << [email protected] >> 2015-01-20 解决跨平台运行问题
* 刘一佳 << [email protected] >> 2014-06-12 重组项目
* HuangFJ << [email protected] >> 本项目最初作者