New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

oknlp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oknlp

OKNLP

  • 0.0.5
  • PyPI
  • Socket score

Maintainers
1

OKNLP

Test Linux Test Mac OS Test Windows PyPI Documentation Status codecov

安装方法

CPU only

$ pip install "oknlp[cpu]"

GPU

请参考 安装 - OKNLP文档

系统支持

WindowsLinuxMac 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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc