How fxsjy/jieba works
Jieba is a Python Chinese text-processing library. Its main workflow accepts text, segments it using a dictionary-backed DAG and probability-based path selection, and returns tokens; optional HMM or Paddle inference handles additional segmentation, while search mode refines token granularity. Separate capabilities provide part-of-speech tagging, parallel segmentation, token offsets, and TF-IDF/TextRank keyword extraction, plus a Whoosh analyzer. The graph follows documented capabilities and sampled imports/calls; some resource and parallel-mode wiring is documented but not shown in source excerpts.
Main entry points: posseg/__init__.py POS tagger · jieba/__init__.py Tokenizer · finalseg/__init__.py HMM segmentation · predict.py Paddle predictor
Components 25
Segmentation
- Tokenizer
jieba/__init__.py - Main dictionary
jieba/dict.txt - Parallel segmentation
jieba/__init__.py - Offset tokens
jieba/__init__.py
Sequence Models
- HMM segmentation
jieba/finalseg/__init__.py - HMM start scores
jieba/finalseg/prob_start.py - HMM transition scores
jieba/finalseg/prob_trans.py - HMM emission scores
jieba/finalseg/prob_emit.py - Paddle predictor
jieba/lac_small/predict.py - Paddle input reader
jieba/lac_small/reader_small.py - Model creator
jieba/lac_small/creator.py - BiGRU CRF network
jieba/lac_small/nets.py - Paddle model weights
jieba/lac_small/model_baseline
Language Features
- POS tagger
jieba/posseg/__init__.py - POS Viterbi
jieba/posseg/viterbi.py - Character states
jieba/posseg/char_state_tab.py - POS start scores
jieba/posseg/prob_start.py - POS transition scores
jieba/posseg/prob_trans.py - POS emission scores
jieba/posseg/prob_emit.py - Compatibility helpers
jieba/_compat.py
Text Analysis
- TF-IDF keywords
jieba/analyse/tfidf.py - TextRank keywords
jieba/analyse/textrank.py - Whoosh analyzer
jieba/analyse/analyzer.py - IDF corpus
jieba/analyse/idf.txt
Other components
- Text caller
Connections 28
- Text caller → Tokenizer: submits text
README.md - Tokenizer → Main dictionary: uses dictionary
README.md - Tokenizer → HMM segmentation: recognizes unknowns
jieba/__init__.py - HMM segmentation → HMM start scores: loads scores
jieba/finalseg/__init__.py - HMM segmentation → HMM transition scores: loads scores
jieba/finalseg/__init__.py - HMM segmentation → HMM emission scores: loads scores
jieba/finalseg/__init__.py - Tokenizer → Paddle predictor: dispatches mode
jieba/__init__.py - Paddle predictor → Paddle input reader: builds input
jieba/lac_small/predict.py - Paddle predictor → Model creator: creates model
jieba/lac_small/predict.py - Model creator → BiGRU CRF network: defines network
jieba/lac_small/creator.py - Paddle predictor → Paddle model weights: loads checkpoint
jieba/lac_small/predict.py - POS tagger → Tokenizer: uses tokenizer
jieba/posseg/__init__.py - POS tagger → POS Viterbi: calls
jieba/posseg/__init__.py - POS tagger → Character states: loads states
jieba/posseg/__init__.py - POS tagger → POS start scores: loads scores
jieba/posseg/__init__.py - POS tagger → POS transition scores: loads scores
jieba/posseg/__init__.py - POS tagger → POS emission scores: loads scores
jieba/posseg/__init__.py - Text caller → Parallel segmentation: requests parallel mode
README.md - Text caller → Offset tokens: requests offsets
README.md - Text caller → TF-IDF keywords: requests keywords
README.md - TF-IDF keywords → Tokenizer: segments text
jieba/analyse/tfidf.py - TF-IDF keywords → POS tagger: filters by POS
jieba/analyse/tfidf.py - TF-IDF keywords → IDF corpus: loads IDF
jieba/analyse/tfidf.py - Text caller → TextRank keywords: requests keywords
README.md - TextRank keywords → POS tagger: segments with tags
jieba/analyse/textrank.py - Text caller → Whoosh analyzer: uses analyzer
README.md - Whoosh analyzer → Offset tokens: requests search tokens
jieba/analyse/analyzer.py - Tokenizer → Compatibility helpers: uses helpers
jieba/__init__.py