How nervouna/inkflow works
InkFlow is a local macOS Pinyin input method. Its main workflow routes keystrokes from the host application through the InputMethodKit controller into the Rime engine, presents candidates, and inserts the selected text. Separate capabilities support on-device dictation, optional AI suggestions and voice polishing, dictionary updates, and personal-data management. The README documents these product branches; the sampled source confirms parts of input routing, engine interaction, and voice delivery, so unsampled subsystem wiring is shown only where documented.
Main entry points: InputController.swift Input controller · Engine.swift Rime engine · InputControllerVoice.swift Voice input · DictionaryCoordinator.swift Dictionary updates
Components 28
Input runtime
- Input controller
macOS/Sources/InputController.swift - Key routing
macOS/Sources/InputControllerCore.swift - Key translation
macOS/Sources/EngineEvent.swift - Candidate presentation
macOS/Sources/CandidatePresentation.swift
Rime engine
- Rime engine
Core/Sources/InkFlowRime/Engine.swift - Native Rime bridge
Core/Sources/InkFlowRimeNative/InkFlowRimeNative.cpp - Input domain
Core/Sources/InkFlowDomain/InputPreferences.swift
Personalization
- Voice learning
Core/Sources/InkFlowDomain/VoiceLearningCoordinator.swift - Custom phrases
macOS/Sources/CustomPhrases.swift - Personal learning
Core/Sources/InkFlowRime/EnginePersonalLearning.swift - Personal data backup
macOS/Sources/PersonalDataBackup.swift - Input quality records
Core/Sources/InkFlowRime/QualityRecorder.swift - Quality store
Core/Sources/InkFlowRime/QualityStore.swift
Optional assistance
- Voice input
macOS/Sources/InputControllerVoice.swift - Speech recognition
macOS/Sources/AppleVoiceRecognizer.swift - AI suggestions
macOS/Sources/AISuggestionCoordinator.swift - Voice polishing
macOS/Sources/VoiceCorrectionClient.swift
Settings and maintenance
- Dictionary updates
Core/Sources/InkFlowRime/DictionaryCoordinator.swift - Dictionary worker
macOS/DictionaryWorker/main.swift - Dictionary state
Core/Sources/InkFlowRime/DictionaryStore.swift - Input settings
macOS/Sources/Settings.swift - Installer
macOS/Installer/InstallerCoordinator.swift - System input sources
macOS/Shared/InputSourceManager.swift
Other components
- Host app
- Configured AI service
- Apple speech services
- User data directory
- GitHub
Connections 37
- Host app → Input controller: sends keystrokes
- Input controller → Key routing: routes events
- Key routing → Key translation: translates keys
- Key translation → Rime engine: processes input
- Input controller → Rime engine: reads state
- Input controller → Candidate presentation: presents candidates
- Candidate presentation → Host app: inserts selection
- Rime engine → Native Rime bridge: calls native API
- Rime engine → Input domain: uses preferences
- Input controller → Input settings: reads settings
- Input settings → Rime engine: applies options
- Input controller → Voice input: handles voice gestures
- Voice input → Speech recognition: transcribes audio
- Speech recognition → Apple speech services: uses on-device recognition
- Voice input → Host app: previews and inserts text
- Voice input → Voice polishing: requests polishing
- Voice polishing → Configured AI service: sends transcript
- Voice input → Voice learning: coordinates learning
- Voice learning → Personal learning: updates learned entries
- Input controller → AI suggestions: offers input context
- AI suggestions → Configured AI service: requests suggestions
- AI suggestions → Rime engine: records adoption
- Input controller → Custom phrases: manages phrases
- Custom phrases → Rime engine: loads phrases
- Input controller → Personal learning: manages learned entries
- Input controller → Input quality records: records input outcomes
- Input quality records → Quality store: writes records
- Quality store → User data directory: persists locally
- Personal learning → User data directory: stores learning data
- Custom phrases → User data directory: stores phrases
- Personal data backup → User data directory: backs up or restores
- Input controller → Dictionary updates: exposes dictionary controls
- Dictionary updates → Dictionary worker: dispatches work
- Dictionary updates → Dictionary state: reads and writes state
- Dictionary updates → GitHub: downloads updates
- Installer → System input sources: registers and enables
- Installer → Host app: installs input method