Skip to main content

Current PyPI packages

UD-Chinese

Tokenizer, POS-Tagger, and Dependency-Parser for Chinese (简体/繁體/文言文), working on Universal Dependencies.

Basic usage

>>> import udchinese
>>> zh=udchinese.load()
>>> s=zh("我把这本书看完了。吾既讀是書也。")
>>> print(s)
# newdoc
# newpar
# sent_id = 1
# text = 我把这本书看完了。
1	我	我	PRON	n,代名詞,人称,止格	Person=1|PronType=Prs	6	nsubj	_	SpaceAfter=No
2	把	把	ADP	BB	_	5	case	_	SpaceAfter=No
3	这	這	DET	DT	_	4	det	_	SpaceAfter=No
4	本	本	NOUN	n,名詞,描写,形質	_	5	clf	_	SpaceAfter=No
5	书	書	NOUN	n,名詞,主体,書物	_	6	obl:patient	_	SpaceAfter=No
6	看	看	VERB	v,動詞,行為,動作	_	0	root	_	SpaceAfter=No
7	完	完	VERB	v,動詞,変化,性質	_	6	flat:vv	_	SpaceAfter=No
8	了	了	PART	UH	_	6	discourse	_	SpaceAfter=No
9	。	。	PUNCT	s,記号,句点,*	_	6	punct	_	SpacesAfter=\n

# sent_id = 2
# text = 吾既讀是書也。
1	吾	吾	PRON	n,代名詞,人称,起格	Person=1|PronType=Prs	3	nsubj	_	SpaceAfter=No
2	既	既	ADV	v,副詞,時相,完了	AdvType=Tim|Aspect=Perf	3	advmod	_	SpaceAfter=No
3	讀	讀	VERB	v,動詞,行為,動作	_	0	root	_	SpaceAfter=No
4	是	是	PRON	n,代名詞,指示,*	PronType=Dem	5	det	_	SpaceAfter=No
5	書	書	NOUN	n,名詞,主体,書物	_	3	obj	_	SpaceAfter=No
6	也	也	PART	p,助詞,句末,*	_	3	discourse:sp	_	SpaceAfter=No
7	。	。	PUNCT	s,記号,句点,*	_	3	punct	_	SpacesAfter=\n

Usage via spaCy

If you have already installed spaCy 2.1.0 or later, you can use UD-Chinese via spaCy Language pipeline.

>>> import udchinese.spacy
>>> zh=udchinese.spacy.load()
>>> d=zh("我把这本书看完了。吾既讀是書也。")
>>> print(type(d))
<class 'spacy.tokens.doc.Doc'>
>>> print(udchinese.spacy.to_conllu(d))
# text = 我把这本书看完了。
1	我	我	PRON	n,代名詞,人称,止格	_	6	nsubj	_	SpaceAfter=No
2	把	把	ADP	BB	_	5	case	_	SpaceAfter=No
3	这	這	DET	DT	_	4	det	_	SpaceAfter=No
4	本	本	NOUN	n,名詞,描写,形質	_	5	clf	_	SpaceAfter=No
5	书	書	NOUN	n,名詞,主体,書物	_	6	obl:patient	_	SpaceAfter=No
6	看	看	VERB	v,動詞,行為,動作	_	0	root	_	SpaceAfter=No
7	完	完	VERB	v,動詞,変化,性質	_	6	flat:vv	_	SpaceAfter=No
8	了	了	PART	UH	_	6	discourse	_	SpaceAfter=No
9	。	。	PUNCT	s,記号,句点,*	_	6	punct	_	_

# text = 吾既讀是書也。
1	吾	吾	PRON	n,代名詞,人称,起格	_	3	nsubj	_	SpaceAfter=No
2	既	既	ADV	v,副詞,時相,完了	_	3	advmod	_	SpaceAfter=No
3	讀	讀	VERB	v,動詞,行為,動作	_	0	root	_	SpaceAfter=No
4	是	是	PRON	n,代名詞,指示,*	_	5	det	_	SpaceAfter=No
5	書	書	NOUN	n,名詞,主体,書物	_	3	obj	_	SpaceAfter=No
6	也	也	PART	p,助詞,句末,*	_	3	discourse:sp	_	SpaceAfter=No
7	。	。	PUNCT	s,記号,句点,*	_	3	punct	_	_

Installation for Linux

Binary-wheel is available for Linux, and is installed by default when you use pip:

pip install udchinese

Installation for Cygwin

Make sure to get gcc-g++ python37-pip python37-devel packages, and then:

pip3.7 install udchinese

Use python3.7 command in Cygwin instead of python.

Installation for Jupyter Notebook (Google Colaboratory)

!pip install udchinese

Author

Koichi Yasuoka (安岡孝一)

Release files for udchinese 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for udchinese 0.6.1
File Interpreter ABI Platform
udchinese-0.6.1-py3-none-any.whl Python 3 none any Details

Release files / udchinese-0.6.1-py3-none-any.whl

Download URL udchinese-0.6.1-py3-none-any.whl
Size 28.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ca80aefe3e8e7e8734438d19cf6ff0edd809657271d38da8d499afed7f5a7c18
BLAKE2b-256 checksum
How to use checksums
96838ae6c250e668fafd2a542e7dba99c4d1f84d2961f531ba6b01a3a2eb99a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.6.1 This release

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page