Skip to main content

Language Technology Platform

Project description

LTP VERSION CODE SIZE CONTRIBUTORS LAST COMMIT Documentation Status

LTP 4

LTP(Language Technology Platform) 提供了一系列中文自然语言处理工具,用户可以使用这些工具对于中文文本进行分词、词性标注、句法分析等等工作。

快速使用

from ltp import LTP
ltp = LTP() # 默认加载 Small 模型
# ltp = LTP(path = "base|small|tiny")
# sent_list = ltp.sent_split(inputs, flag="all", limit=510)
segment, hidden = ltp.seg(["他叫汤姆去拿外衣。"])
pos = ltp.pos(hidden)
ner = ltp.ner(hidden)
srl = ltp.srl(hidden)
dep = ltp.dep(hidden)
sdp = ltp.sdp(hidden)

模型

模型下载

模型 大小
Base(v2) 531MB
Small(v2) 170MB
Tiny(v2) 34MB
Small(v1) 170MB
Tiny(v1) 34MB

备注: Tiny模型使用electra前三层进行初始化, 4.0.3.post1 版本包含对v1模型的fix,新版本请使用v2模型

V2 指标

模型 分词 词性 命名实体 语义角色 依存句法 语义依存 速度(句/S)
LTP 4.0 (Base) 98.7 98.5 95.4 80.6 89.5 75.2
LTP 4.0 (Small) 98.4 98.2 94.3 78.4 88.3 74.7 12.58
LTP 4.0 (Tiny) 96.8 97.1 91.6 70.9 83.8 70.1 29.53

备注: 本版本SDP采用 CCL2020语义依存分析 语料,其他语料同V1

V1 指标

模型 分词 词性 命名实体 语义角色 依存句法 语义依存 速度(句/S) 模型大小
LTP 3.X 97.8 98.3 94.1 77.92(Gold Pi) 81.1 78.9 2.75 1940M
LTP 4.0 (Small) 98.4 98.2 94.3 77.2(端到端) 88.0 79.9 12.58 171M
LTP 4.0 (Tiny) 96.8 97.2 91.6 68.1(端到端) 82.6 75.5 29.53 34M

测试环境如下:

  • Python 3.7
  • LTP 4.0 Batch Size = 1
  • Centos 3.10.0-1062.9.1.el7.x86_64
  • Intel(R) Xeon(R) CPU E5-2640 v4 @ 2.40GHz

备注: 速度数据在人民日报命名实体测试数据上获得,速度计算方式均为所有任务顺序执行的结果。另外,语义角色标注与语义依存新旧版采用的语料不相同,因此无法直接比较(新版语义依存使用Semeval 2016语料,语义角色标注使用CTB语料)。

模型算法

  • 分词: Electra Small1 + Linear
  • 词性: Electra Small + Linear
  • 命名实体: Electra Small + Relative Transformer2 + Linear
  • 依存句法: Electra Small + BiAffine + Eisner3
  • 语义依存: Electra Small + BiAffine
  • 语义角色: Electra Small + BiAffine + CRF

构建 Wheel 包

python setup.py sdist
python -m twine upload dist/*

作者信息

开源协议

  1. 语言技术平台面向国内外大学、中科院各研究所以及个人研究者免费开放源代码,但如上述机构和个人将该平台用于商业目的(如企业合作项目等)则需要付费。
  2. 除上述机构以外的企事业单位,如申请使用该平台,需付费。
  3. 凡涉及付费问题,请发邮件到 car@ir.hit.edu.cn 洽商。
  4. 如果您在 LTP 基础上发表论文或取得科研成果,请您在发表论文和申报成果时声明“使用了哈工大社会计算与信息检索研究中心研制的语言技术平台(LTP)”. 同时,发信给car@ir.hit.edu.cn,说明发表论文或申报成果的题目、出处等。

脚注

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ltp-4.0.4.tar.gz (67.1 kB view details)

Uploaded Source

Built Distribution

ltp-4.0.4-py3-none-any.whl (103.1 kB view details)

Uploaded Python 3

File details

Details for the file ltp-4.0.4.tar.gz.

File metadata

  • Download URL: ltp-4.0.4.tar.gz
  • Upload date:
  • Size: 67.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

File hashes

Hashes for ltp-4.0.4.tar.gz
Algorithm Hash digest
SHA256 d4ed10178900a894058a0c87eb1a1ba5474dc2808f5509c88199ca612fba43c3
MD5 1756891f05318a38509cd304c64f11b7
BLAKE2b-256 a4f1bcf29eb4e1c53e3fac67e8ce8e5a0317a7acb4ebb694a581e587fce3f7c3

See more details on using hashes here.

File details

Details for the file ltp-4.0.4-py3-none-any.whl.

File metadata

  • Download URL: ltp-4.0.4-py3-none-any.whl
  • Upload date:
  • Size: 103.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

File hashes

Hashes for ltp-4.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c4aae63b97df59a4dbe62882301c2458001bdd49a9dd19065a36d6df452eea9a
MD5 c0f7b9e6c3bf704a401a9c76b4931e02
BLAKE2b-256 f6bcbaa6259dfddf6fc3b8bcd9c1414795097d0f94ce6cd7925b1d2e3f83f157

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page