Skip to main content

A Python Client for CKIP Chinese Word Segmentation System

Project description

CKIP Client

A Python client for the Chinese Word Segmentation System (see ckipsvr.iis.sinica.edu.tw) provided by Academia Sinica Chinese Knowledge and Information Processing (CKIP) Group.

Installation

Simply run tho following command:

pip install ckip-client

If pip is not available, you can also download it manually from PyPI.

Note: Currently only Python 3+ is supported.

Example

In order to use the Chinese Word Segmentation System, you should register an account on ckipsvr.iis.sinica.edu.tw. You will get the server’s IP address and port number when you finish the registration process.

Replace CKIP_* with your real arguments.

from ckipclient import CKIPClient

sample_text = '第二屆內地搖滾音樂祭將在 9 月 24 日登場!今年共有五十五組獨立樂團'\
              '參與演出,包含曾獲得金曲獎的「舒米恩」、「滅火器」等,陣容十分堅強。'

ckip = CKIPClient(CKIP_IP, CKIP_PORT, CKIP_USERNAME, CKIP_PASSWORD)
sample_results = ckip.segment(sample_text)

for sentence in sample_results:
    print('/'.join(' '.join(word) for word in sentence))

The code above will output:

第二 DET/屆 M/內地 N/搖滾 N/音樂 N/祭 Vt/將 ADV/在 P/9 DET/月 N/24 DET/日 M/登場 Vi/! EXCLAMATIONCATEGORY
今年 N/共有 Vt/五十五 DET/組 M/獨立 Vi/樂團 N/參與 Vt/演出 N/, COMMACATEGORY
包含 Vt/曾 ADV/獲得 Vt/金曲獎 N/的 T/「 PARENTHESISCATEGORY/舒米恩 N/」 PARENTHESISCATEGORY/、 PAUSECATEGORY/「 PARENTHESISCATEGORY/滅火器 N/」 PARENTHESISCATEGORY/等 POST/, COMMACATEGORY
陣容 N/十分 ADV/堅強 Vi/。 PERIODCATEGORY

For more details, please refer to the documentation.

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

ckip-client-0.2.0.post1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

ckip_client-0.2.0.post1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file ckip-client-0.2.0.post1.tar.gz.

File metadata

File hashes

Hashes for ckip-client-0.2.0.post1.tar.gz
Algorithm Hash digest
SHA256 452a9e87797cdb0662f7bf0a50b0fd56d85e912ce7471a9d84e35b39bde484c5
MD5 d7f2a59711e42b7e9a2c6d40d70e5bba
BLAKE2b-256 2caee1433001ff89114143c654aae65b1df2f54fae6c54389a7539e4f7d1ef85

See more details on using hashes here.

File details

Details for the file ckip_client-0.2.0.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for ckip_client-0.2.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 f379e323926e58e3f79ef56b68d8be29793225a5caf9dd171da0851a32780824
MD5 c839d9832adeba597f49048f1e63aa23
BLAKE2b-256 282cf59c3345f9d4ed9289de78746c7a4c120badb764342c3692556ebdd539a8

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