Library / SDK
rime/librime avatar
rime/librime

librime: The Core Engine Behind Rime's Keystroke-to-Character Pipeline

Rime Input Method Engine, the core library. RIME: Rime Input Method Engine === Rime with your keystrokes.

4,609 stars729 forksC++BSD-3-Clause

At a glance

What is it?
librime is a cross-platform C++ library that turns keystrokes into Chinese text through schema-driven rules. This review examines its architecture, build process, and the trade-offs of adopting it for your own input method project.
Who is it for?
Adopt librime if you are building a cross-platform Chinese input method and want schema-driven customization, spelling algebra, and OpenCC integration without writing your own engine. Avoid it if you need a lightweight, dependency-light solution or a ready-to-use GUI; librime is a library, not an app.
Can I use it commercially?
Yes. BSD-3-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 3 days ago.
What is it written in?
Mainly C++, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 14, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What librime Solves for Input Method Developers

librime addresses a specific problem: building a Chinese input method engine from scratch is a large, repetitive effort. The library centralizes the core logic of converting keystrokes into characters, handling both shape-based and phonetic-based input methods. It is for developers who want to create or customize an input method without reimplementing the engine. The README positions it as a modular, extensible engine in cross-platform C++ code, built on open-source technologies. It is not a standalone application; it is the core library that frontends like ibus-rime, Squirrel, and Weasel use. If you are building a frontend for a new platform, librime provides the engine, while you handle the user interface and system integration.

The Schema DSL and Spelling Algebra: The Heart of Customization

The most distinctive feature is the Rime input schema, a DSL in YAML syntax. This lets you define how keystrokes map to candidates, including complex rules for phonetic input. The README highlights Spelling Algebra as a mechanism to create variant spellings, especially for Chinese dialects. This is not a simple key-to-character map; it is a rule engine that can transform input sequences. For example, you can define rules that convert a sequence of letters into a phonetic representation, then into Chinese characters. The schema is the point of customization. A developer can experiment with new input method designs by editing YAML files, without touching C++ code. This lowers the barrier for trying innovative ideas, as the README states. The trade-off is that the schema language has its own learning curve, and debugging a complex schema can be harder than debugging code.

How librime is Built and What It Depends On

Building librime on Linux is straightforward: the README gives two commands, `make` and `sudo make install`. But the build dependencies are substantial. You need a C++17 compiler, CMake 3.12 or newer, Boost 1.74 or newer, LevelDB, marisa-trie, OpenCC 1.0.2 or newer, and yaml-cpp 0.5 or newer. glog and gtest are optional. These are not trivial dependencies. LevelDB is used for persistent storage of user dictionaries and settings. marisa-trie is a space-efficient trie library, likely used for fast lookup of dictionary entries. OpenCC handles Traditional to Simplified Chinese conversion and other regional standards. yaml-cpp parses the schema files. If you are on macOS or Windows, the README points to separate build instructions, but the core dependencies are the same. The optional nature of glog and gtest suggests you can build a leaner version, but you cannot avoid the other four libraries.

The Frontend Ecosystem: Where librime Gets Used

librime has a wide range of frontends, both official and community-driven. The official ones are ibus-rime for Linux, Squirrel for macOS, and Weasel for Windows. The community list is long and spans many platforms: Android (Trime, fcitx5-android, YuyanIme), iOS (Hamster), web (My RIME), Vim (coc-rime, rime.nvim, fcitx5.nvim), Emacs (emacs-rime), and even Tmux and Zsh. This breadth is a sign of the library's portability, but it also means that when you adopt librime, you are not just adopting a library; you are joining an ecosystem with many moving parts. Each frontend has its own maintenance status and quirks. For a developer, this is both a resource and a risk: you can find a frontend for almost any platform, but you may need to verify that the one you choose is actively maintained. The README lists these frontends without endorsing any, so you must evaluate them separately.

Plugins and the Deprecation Trap

librime supports plugins, but the README flags two as deprecated: librime-charcode and librime-legacy. The latter is explicitly noted as containing GPL-licensed code. This is a licensing red flag. If you use librime-legacy, you may be pulling GPL code into your project, which could affect your distribution terms. The other plugins, like librime-lua, librime-octagram, and librime-predict, are not marked deprecated, but they are separate projects with their own maintenance. The plugin mechanism itself is not detailed in the README, so you would need to look at each plugin's repository to understand how to integrate it. The takeaway is that the plugin ecosystem is uneven: some plugins are stale, and one has a license that may conflict with your goals. Before relying on any plugin, check its license and activity.

A Real Limitation: It Is an Engine, Not a Product

librime does not provide a user interface. It is a library that you must integrate into a frontend. The README lists many frontends, but if you are building for a niche platform, you may need to write your own. That is a significant amount of work. Also, the library's dependency stack is heavy. For a simple input method, you might not need LevelDB or OpenCC, but they are required. This makes librime a poor choice for a minimal, embedded system. Another limitation is that the schema DSL, while powerful, is not trivial to master. The README mentions Spelling Algebra for dialects, but it does not explain how to use it. You must learn the YAML schema format, which is documented elsewhere, not in the README. If you are not willing to invest in that learning, librime will feel opaque.

Alternatives: Comparing with Other Engines

The main alternative is to build your own engine or use a platform-specific input method framework. For example, on Linux, IBus and Fcitx5 provide their own input method frameworks, and you could write a simple engine that uses a lookup table instead of librime. The difference is in approach: librime is schema-driven and data-driven, while a custom engine is code-driven. With librime, you define behavior in YAML and use Spelling Algebra to handle complex phonetic rules. With a custom engine, you write C or C++ code to handle every keystroke. The trade-off is flexibility versus effort. A custom engine gives you complete control, but you must implement everything, including dictionary storage and conversion. librime gives you those pieces, but you must conform to its schema and dependency model. For a quick prototype, librime is faster; for a deeply integrated, minimal solution, a custom engine may be better.

Maintenance and Upgrade Costs

librime has an active release schedule, with a 1.17.0 release in June 2026 and a nightly build as of August 2026. That suggests ongoing maintenance. However, the README does not provide a changelog or migration guide. When a new version comes out, you may need to check the repository history or release notes to see what changed. The dependencies also evolve: OpenCC, Boost, and LevelDB all have their own release cycles. Upgrading librime may force you to upgrade those libraries, which can affect your entire system. The optional glog and gtest reduce the build footprint, but the core dependencies are mandatory. The license is BSD-3-Clause, which is permissive and allows commercial use, but the GPL-licensed legacy plugin is a separate concern. You should verify that your use of librime does not inadvertently bundle GPL code through a plugin.

Editorial conclusion

Adopt librime if you are building a cross-platform Chinese input method and want schema-driven customization, spelling algebra, and OpenCC integration without writing your own engine. Avoid it if you need a lightweight, dependency-light solution or a ready-to-use GUI; librime is a library, not an app. Before committing, verify your target platforms against the build instructions for macOS and Windows, confirm the version of OpenCC you need, and check the licensing of any plugins you plan to use, since some are deprecated and may carry GPL code.

Official sources

  1. Official documentation
  2. Official README
  3. Project repository
  4. Release notes
Community notes

Community notes