skillfed

spacy-pkuseg

Chinese word segmentation toolkit for spaCy (fork of pkuseg-python)

spacy-pkuseg v1.0.1 702.7K downloads/30d#5,283 on PyPI71
Permissive license MIT Active released

What it is and what it does

spacy-pkuseg is a spaCy-integrated fork of the pkuseg Chinese word segmentation toolkit. It provides domain-aware tokenization for Chinese text across five pretrained models: a mixed-domain default, plus specialized models for news, web, medicine, and tourism text. The package wraps the underlying segmentation engine (unmodified from the original pkuseg) and simplifies both installation and model serialization for spaCy workflows.

The toolkit supports optional part-of-speech tagging alongside segmentation, batch processing of files with multiprocessing, and user-defined custom dictionaries. It depends on numpy and srsly for numerical and serialization operations. Installation is straightforward via pip with precompiled wheels for modern Python versions and common platforms, though it carries medium friction due to compiled components.

Use it for:

  • Segment Chinese news articles or web text where domain-specific accuracy matters more than generic tokenization.
  • Build spaCy NLP pipelines for Chinese that need both word boundaries and part-of-speech labels in one step.
  • Process medical or tourism domain Chinese documents with models trained on domain-specific corpora.
  • Batch-process large Chinese text files with multiprocessing to split into words and optionally tag parts of speech.
  • Extend spaCy's Chinese support with a higher-accuracy alternative to generic tokenizers when domain context is known.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Chinese word segmentation for spaCy with domain-specific models (news, web, medicine, tourism) and optional part-of-speech tagging.

Yes, if you need Chinese word segmentation in a spaCy pipeline or want domain-specific accuracy. The package is actively maintained, has no known vulnerabilities, supports modern Python versions, and offers pretrained models for multiple domains. Install friction is moderate but manageable. Not necessary if you only need generic Chinese tokenization or are not using spaCy.

Install

spacy-pkuseg on PyPI

pip

pip install spacy-pkuseg

uv

uv add spacy-pkuseg

poetry

poetry add spacy-pkuseg

Installing spacy-pkuseg

Before you install

Medium install friction due to compiled wheels, but well-supported across Python 3.9–3.13 and major platforms (Linux, macOS, Windows). Active maintenance with recent commits and stable release history.

License in practice

MIT license permits commercial and private use with minimal restrictions; no copyleft obligations.

Quickstart

pip install spacy-pkuseg
import spacy_pkuseg
seg = spacy_pkuseg.pkuseg()
text = seg.cut('我爱北京天安门')
print(text)

Requires Python 3.9 or later; precompiled wheels available for Linux, macOS, and Windows x86_64/ARM64.

Verify before relying

  • Whether spaCy itself must be installed separately or is pulled in as a transitive dependency.
  • Performance benchmarks comparing this fork to the original pkuseg-python on the same hardware.
  • Whether domain models (medicine, tourism, etc.) auto-download or require manual setup when used via spaCy.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies 2 — numpy, srsly
Maintenance actively maintained — 396 days since the last release
Last repo commit
First released
Downloads 702,717/month — #5,283 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: spacy_pkuseg-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl; spacy_pkuseg-1.0.1-cp310-cp310-macosx_11_0_arm64.whl; spacy_pkuseg-1.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; spacy_pkuseg-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; spacy_pkuseg-1.0.1-cp310-cp310-musllinux_1_2_aarch64.whl; spacy_pkuseg-1.0.1-cp310-cp310-musllinux_1_2_x86_64.whl; spacy_pkuseg-1.0.1-cp310-cp310-win_amd64.whl; spacy_pkuseg-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl; spacy_pkuseg-1.0.1-cp311-cp311-macosx_11_0_arm64.whl; spacy_pkuseg-1.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; spacy_pkuseg-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; spacy_pkuseg-1.0.1-cp311-cp311-musllinux_1_2_aarch64.whl; spacy_pkuseg-1.0.1-cp311-cp311-musllinux_1_2_x86_64.whl; spacy_pkuseg-1.0.1-cp311-cp311-win_amd64.whl; spacy_pkuseg-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl; spacy_pkuseg-1.0.1-cp312-cp312-macosx_11_0_arm64.whl; spacy_pkuseg-1.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; spacy_pkuseg-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; spacy_pkuseg-1.0.1-cp312-cp312-musllinux_1_2_aarch64.whl; spacy_pkuseg-1.0.1-cp312-cp312-musllinux_1_2_x86_64.whl

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: CythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Scientific/Engineering

Tags

chinese word segmentationchinese nlp tokenizationspacy chinese segmentationpkuseg domain segmentationchinese text processingmulti-domain word segmentationchinese pos tagging
chinese-nlpspacy-integrationdomain-segmentation

More Scientific/Engineering packages