CKIP Classic NLP Tools
Project description
Introduction
A Linux Python wrapper for CKIP classic tools — CKIP Word Segmentation and CKIP Parser.
Git
PyPI
Documentation
Contributers
Yin-Hsiang Liao at CKIP (Maintainer)
Wei-Yun Ma at CKIP (Maintainer)
External Links
Requirements
Note that one should have CKIPWS/CKIPParser for this project:
CKIP Word Segmentation Linux version 20190524+
CKIP Parser Linux version 20190725+
Academic License (Online Version)
Installation
Offline Version
Download CKIPWS and/or CKIPParser from above links. Denote <ckipws-linux-root> as the folder containing CKIPWS, and <ckipparser-linux-root> as the folder containing CKIPParser.
pip install --force-reinstall --upgrade ckip-classic \
--install-option='--ws' \
--install-option='--ws-dir=<ckipws-linux-root>' \
--install-option='--parser' \
--install-option='--parser-dir=<ckipparser-linux-root>'
Ignore ws/parser options if one doesn’t have CKIPWS/CKIPParser.
Online Version
Register an account at http://parser.iis.sinica.edu.tw/v1/reg.exe
pip install --upgrade ckip-classic
Installation Options
Option |
Detail |
Default Value |
---|---|---|
--[no-]ws |
Enable/disable CKIPWS. |
False |
--[no-]parser |
Enable/disable CKIPParser. |
False |
--ws-dir=<ws-dir> |
CKIPWS root directory. |
|
--ws-lib-dir=<ws-lib-dir> |
CKIPWS libraries directory |
<ws-dir>/lib |
--ws-share-dir=<ws-share-dir> |
CKIPWS share directory |
<ws-dir> |
--parser-dir=<parser-dir> |
CKIPParser root directory. |
|
--parser-lib-dir=<parser-lib-dir> |
CKIPParser libraries directory |
<parser-dir>/lib |
--parser-share-dir=<parser-share-dir> |
CKIPParser share directory |
<parser-dir> |
--data2-dir=<data2-dir> |
“Data2” directory |
<ws-share-dir>/Data2 |
--rule-dir=<rule-dir> |
“Rule” directory |
<parser-share-dir>/Rule |
--rdb-dir=<rdb-dir> |
“RDB” directory |
<parser-share-dir>/RDB |
Usage
See https://ckip-classic.readthedocs.io/ for API details.
CKIPWS
CKIP Word Segmentation offline driver.
import ckip_classic.ws
print(ckip_classic.__name__, ckip_classic.__version__)
ws = ckip_classic.ws.CkipWs(logger=False)
print(ws('中文字喔'))
for l in ws.apply_list(['中文字喔', '啊哈哈哈']): print(l)
ws.apply_file(ifile='sample/sample.txt', ofile='output/sample.tag', uwfile='output/sample.uw')
with open('output/sample.tag') as fin:
print(fin.read())
with open('output/sample.uw') as fin:
print(fin.read())
CKIPParser
CKIP Parser offline driver.
import ckip_classic.parser
print(ckip_classic.__name__, ckip_classic.__version__)
ps = ckip_classic.parser.CkipParser(logger=False)
print(ps('中文字喔'))
for l in ps.apply_list(['中文字喔', '啊哈哈哈']): print(l)
ps.apply_file(ifile='sample/sample.txt', ofile='output/sample.tree')
with open('output/sample.tree') as fin:
print(fin.read())
CKIPParserClient
CKIP Parser online client.
import ckip_classic.client
print(ckip_classic.__name__, ckip_classic.__version__)
ps = ckip_classic.client.CkipParserClient(username='USERNAME', password='PASSWORD')
print(ps('中文字(Na) 耶(T) ,(COMMACATEGORY)'))
for l in ps.apply_list(['中文字(Na) 耶(T) ,(COMMACATEGORY)', '啊(I) 哈(D) 哈(D) 哈(D) 。(PERIODCATEGORY)']): print(l)
FAQ
License
Copyright (c) 2018-2023 CKIP Lab under the GPL-3.0 License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file ckip-classic-1.2.3.tar.gz
.
File metadata
- Download URL: ckip-classic-1.2.3.tar.gz
- Upload date:
- Size: 28.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f5f6b907464188fd44a795a044ee1b2859525185671f1e3bcbfce0c71bf9d95 |
|
MD5 | b969ff928ec0861602a9d7144ec90113 |
|
BLAKE2b-256 | c2ead161cc7ee615f3f66d7783bf7dcb4486a0650f1f752fac5c4a305ef9da11 |