Skip to content
/ oknlp Public

Open and Knowledgeable NLP Toolkit including CWS, POS Tagging, NER, and Entity Typing

License

Notifications You must be signed in to change notification settings

thunlp/oknlp

Repository files navigation

OKNLP

Test Linux Test Mac OS Test Windows PyPI Documentation Status codecov

安装方法

CPU only

$ pip install "oknlp[cpu]"

GPU

请参考 安装 - OKNLP文档

系统支持

Windows Linux Mac OS
Python3.6
Python3.7
Python3.8
Python3.9

快速入门

中文分词

import oknlp

if __name__ == "__main__":
    model = oknlp.cws.get_by_name("thulac")
    model([
        "我爱北京天安门"
    ])
    # [['我', '爱', '北京', '天安门']]

完整文档请参考 中文分词 - OKNLP文档

命名实体识别

import oknlp

if __name__ == "__main__":
    model = oknlp.ner.get_by_name("bert")
    model([
        "我爱北京天安门"
    ])
    # [[{'type': 'LOC', 'begin': 2, 'end': 4}, {'type': 'LOC', 'begin': 4, 'end': 7}]]

完整文档请参考 命名实体识别 - OKNLP文档

词性标注

import oknlp

if __name__ == "__main__":
    model = oknlp.postagging.get_by_name("bert")
    model([
        "我爱北京天安门"
    ])
    # [[('我', 'PN'), ('爱', 'VV'), ('北京', 'NR'), ('天安门', 'NR')]]

完整文档请参考 词性标注 - OKNLP文档

细粒度实体分类

import oknlp

if __name__ == "__main__":
    model = oknlp.typing.get_by_name("bert")
    model([
        ("我爱北京天安门", (2, 4))
    ])
    # [[('location', 0.7169095873832703), ('place', 0.8128180503845215), ('city', 0.6188656687736511), ('country', 0.12475886940956116)]]

完整文档请参考 细粒度实体分类 - OKNLP文档

贡献者列表

@a710128

@Yumiko-188

@HuShaoRu

相关合作

本项目由腾讯 oteam 部门提供技术与数据支持。

About

Open and Knowledgeable NLP Toolkit including CWS, POS Tagging, NER, and Entity Typing

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages