Skip to main content

A Python wrapper around the NLPIR/ICTCLAS Chinese segmentation software.

Project description

PyNLPIR is a Python wrapper around the NLPIR/ICTCLAS Chinese segmentation software.

Easily segment text using NLPIR, one of the most widely-regarded Chinese text analyzers:

import pynlpir
pynlpir.open()

s = '欢迎科研人员、技术工程师、企事业单位与个人参与NLPIR平台的建设工作。'
pynlpir.segment(s)

[('欢迎', 'verb'), ('科研', 'noun'), ('人员', 'noun'), ('、', 'punctuation mark'), ('技术', 'noun'), ('工程师', 'noun'), ('、', 'punctuation mark'), ('企事业', 'noun'), ('单位', 'noun'), ('与', 'conjunction'), ('个人', 'noun'), ('参与', 'verb'), ('NLPIR', 'noun'), ('平台', 'noun'), ('的', 'particle'), ('建设', 'verb'), ('工作', 'verb'), ('。', 'punctuation mark')]

Features

  • Helper functions for common use cases

  • English/Chinese part of speech mapping

  • Support for UTF-8, GBK, and BIG5 encoded strings (and unicode of course!)

  • Access to NLPIR’s C functions via ctypes

  • No third-party dependencies (PyNLPIR includes a copy of NLPIR)

  • Runs on Python 2.7 and 3

Install

NLPIR supports Windows and GNU/Linux. PyNLPIR will install, but not run, on other platforms (e.g. OS X).

Just use pip:

$ pip install pynlpir

That’s it! Everything is shipped with PyNLPIR – there are no external dependencies.

Documentation

PyNLPIR has documentation. It features an installation guide, tutorial, and API reference.

Support

If you encounter a bug, have a feature request, or need help using PyNLPIR, then use PyNLPIR’s GitHub Issues page to get in touch.

License

PyNLPIR is released under the OSI-approved MIT License. See the file LICENSE.txt for more information. This license doesn’t apply to the included copies of NLPIR’s data directory and shared libraries.

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

PyNLPIR-0.1.1.tar.gz (12.5 MB view details)

Uploaded Source

File details

Details for the file PyNLPIR-0.1.1.tar.gz.

File metadata

  • Download URL: PyNLPIR-0.1.1.tar.gz
  • Upload date:
  • Size: 12.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyNLPIR-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9c9c8cb47dafc43c98cbf4ea1d42e73e180b4dd7586725fa9389c1bfe49a85e6
MD5 167950a13867c19a68fb6c6071c87499
BLAKE2b-256 5c4a37fb64eef5ade7865270cfe5bbcc1586ba94790ea6244d3c70cfb443ffac

See more details on using hashes here.

Supported by

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