jieba: Segment Chinese Text in Python

Summary
jieba is a Python library for segmenting Chinese text into words, including text that does not use spaces as word boundaries. It offers configurable segmentation modes, custom dictionaries, part-of-speech tagging, and keyword extraction.
At a glance
- Language
- Python
- License
- MIT
- Stars
- 35.2k
- Forks
- 6.7k
- Added to OSRepos
- March 31, 2026
- Last analyzed
- October 3, 2026
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Overview
jieba is a Python library for Chinese word segmentation. It addresses the challenge of finding word boundaries in Chinese text, supporting workflows such as text analysis and search indexing.
Its dictionary-and-probability-based approach offers several segmentation modes and lets developers adapt vocabulary and tokenization behavior. The repository also includes tools for part-of-speech tagging, keyword extraction, and command-line use.
Key Features
- Accurate mode aims for a single, precise segmentation; full mode returns possible dictionary matches; search mode further splits longer words for retrieval.
- Uses a word-frequency dictionary, dynamic programming, and an HMM with Viterbi decoding for unknown words.
- Supports custom dictionaries and runtime vocabulary adjustments.
- Provides part-of-speech tagging and keyword extraction with TF-IDF or TextRank.
- Can return token offsets and offers a command-line interface.
- Includes optional PaddlePaddle-based segmentation and tagging, which requires installing
paddlepaddle-tiny.
Use Cases
- NLP practitioners can prepare Chinese text for downstream analysis when whitespace does not mark word boundaries.
- Search developers can use fine-grained search-mode tokens to build or improve text indexing.
- Teams working with domain-specific terms can load a custom dictionary to guide segmentation.
- Analysts can extract keywords or attach part-of-speech labels as part of text-processing workflows.
Project Facts
- Language: Python
- License: MIT
- Stars: 35.2k
- Forks: 6.7k
- Topics: none listed
- Archived: false
Getting Started
Install from PyPI and import the package:
pip install jieba
import jieba
words = jieba.cut("?????????")
See the README for usage details, configuration, and optional dependencies.
Considerations
- Segmentation quality depends on the dictionary and word frequencies. Domain terms may need a custom dictionary or frequency adjustments.
- HMM-based unknown-word discovery can affect results. The README documents how to disable it when needed.
- Paddle mode requires the separate
paddlepaddle-tinydependency. - The repository reports 700 open issues, so review current project activity and open issues when evaluating it for a new dependency.
Source repository
Open the original repository on GitHub.
17 counted GitHub visits
Related repositories
Similar repositories that may be relevant next.

agentevals: Evaluate AI Agents from OpenTelemetry Traces
October 4, 2026
agentevals scores AI agent behavior from existing OpenTelemetry traces, without rerunning agents or making extra model calls. It suits teams building instrumented agents that need local evaluation, golden-set checks, or CI quality gates.

web-design: Create Consistent Web Pages with a Claude Code Skill
October 3, 2026
web-design is a Claude Code skill that turns product briefs, reference URLs, or screenshots into an editable design specification before generating web code. It is suited to developers and designers who want a repeatable, spec-led workflow for building consistent pages.

oomwoo: Build a DIY Robot Vacuum
October 2, 2026
OOMWOO is a planned, hackable robot vacuum built around Raspberry Pi, ROS2 and 2D LiDAR. It is aimed at makers who want to build and customize a locally controlled vacuum, but its hardware and build instructions are still in development.

shepherd: Supervise Agents with Reversible Execution Traces
October 2, 2026
Shepherd records agent work as inspectable, reversible execution traces and keeps changes as proposals for review. It is aimed at developers building systems that supervise, replay, or manage the work of other agents.