How qingjian-team/qingjian works
Qingjian is a cross-platform Chinese input method that turns typed input into candidate text, with optional translations alongside candidates. The main user path is platform key handling, server-side dispatch and core conversion, then candidate display and text commit. Local language models and learned word frequencies improve ordering; optional cloud prediction and translation add separate capabilities. Settings and usage statistics support configuration and learning. The README documents these capabilities; sampled source confirms several protocol, CLI, and prediction details, but not every platform wiring path.
Main entry points: session.rs Conversion engine · main.rs Core CLI · window.rs Candidate display · server.rs Platform protocol
Components 23
Input platforms
- macOS IMK
apps/macos/src/imk/client.rs - Windows TSF client
apps/windows/tsf/src/client/engine.rs - Linux Fcitx5
apps/linux/fcitx5/src/qingjian.cpp - Linux server
apps/linux/server/src/main.rs - Windows server
apps/windows/server/src/main.rs - Platform protocol
crates/qingjian-platform/src/protocol/server.rs - Candidate display
apps/macos/src/candidates/window.rs - Text rendering
crates/qingjian-render/src/renderer/mod.rs
Input engine
- Conversion engine
crates/qingjian-core/src/engine/session.rs - Dictionary lookup
crates/qingjian-dictionary/src/dictionary/mod.rs - Local language model
crates/qingjian-lm/src/bigram_model.rs
Learning features
- Candidate translations
crates/qingjian-translate/src/glossary/storage.rs - Usage and vocabulary
crates/qingjian-learning/src/vocabulary_book.rs
Settings and services
- Preferences UI
apps/macos/src/preferences/mod.rs - Windows settings
apps/windows/settings/src/panel/mod.rs - Input configuration
crates/qingjian-platform/src/config/mod.rs - Cloud prediction
crates/qingjian-predict/src/chat_client.rs - Update checks
crates/qingjian-update/src/checker/mod.rs
Developer tools
- Core CLI
apps/cli/src/main.rs - CLI candidate display
apps/cli/src/display.rs - Input evaluation
apps/cli/src/eval/mod.rs - Rescoring tools
apps/cli/src/tuning.rs
Other components
- Input user
Connections 25
- Input user → macOS IMK: types into
- Input user → Windows TSF client: types into
- Input user → Linux Fcitx5: types into
- macOS IMK → Conversion engine: sends input
- Windows TSF client → Platform protocol: sends key events
apps/windows/tsf/src/client/engine.rs - Windows server → Platform protocol: sends replies
crates/qingjian-platform/src/protocol/server.rs - Platform protocol → Conversion engine: dispatches input
- Linux Fcitx5 → Linux server: communicates with
- Linux server → Conversion engine: dispatches input
- Conversion engine → Dictionary lookup: looks up words
- Conversion engine → Local language model: ranks sentences
- Conversion engine → Candidate translations: loads translations
- Conversion engine → Usage and vocabulary: learns locally
- Conversion engine → Candidate display: provides candidates
- Candidate display → Text rendering: renders text
- Candidate display → Input user: shows candidates
- Preferences UI → Input configuration: edits settings
- Windows settings → Input configuration: edits settings
- Input configuration → Cloud prediction: configures optional use
- Conversion engine → Cloud prediction: requests predictions
- Input user → Update checks: may check updates
- Core CLI → Conversion engine: builds engine
apps/cli/src/main.rs - Core CLI → CLI candidate display: shows typing
apps/cli/src/main.rs - Core CLI → Input evaluation: runs evaluation
apps/cli/src/main.rs - Core CLI → Rescoring tools: offers tuning
apps/cli/src/main.rs