Bamboo Core (Rust)
A high-performance Vietnamese input method engine (IME) core written in Rust, inherited and optimized from the original bamboo-core in Go.
🚀 Version 0.3.5: High-Performance Snapshot
This version marks a significant milestone in efficiency and stability, achieving a Zero-Allocation Hot Path while maintaining absolute linguistic correctness.
Key Enhancements:
- Zero-Allocation Processing: Replaced
Vecwith stack-allocatedTransformationStackfor all intermediate processing, making the engine ideal for WASM and embedded systems. - Lazy JIT DFA Engine: 20x performance improvement (~490µs -> ~23µs per processing cycle) through dynamic state caching.
- Robust State Recovery: Completely refactored
remove_last_charand backspace logic to ensure the internal DFA state and transformation targets are always perfectly synchronized. - Pre-compilation Support: New
Engine::warm_up()method to pre-populate the DFA with common Vietnamese syllables. - Optimized Validation: High-performance single-pass O(N) spelling and syllable validation.
💡 Origin & Philosophy
This project is a high-performance Rust port of the Bamboo Vietnamese engine, originally developed by Luong Thanh Lam.
Bamboo provides a flexible Vietnamese typing solution based on rule-based transformations. This approach allows the engine to easily adapt to various typing styles (Telex, VNI, VIQR) and support modern features like free-style typing and intelligent spell checking.
The core philosophy is inspired by:
- bogo.js: Pioneering the transformation model.
- GoTiengViet: The gold standard for accuracy and user experience.
- NexusKey: Modern state machine and array optimization techniques.
📦 Installation
Add this to your Cargo.toml:
[]
= "0.3.3"
🛠️ Quick Start
use ;
👥 Credits
- Rust Port & Optimization: Dao Trong Nguyen (@nguyen10t2)
- Original Author (Go): Luong Thanh Lam (@lamtq)
- Technical Consultant: Mai Thanh Phát (@phatMT97) - Author of NexusKey.
📜 License
This project is licensed under the MIT License. See LICENSE for details.