daac-tools/vibrato: A Viterbi Tokenizer for Japanese That Beats MeCab on Large Dictionaries
🎤 vibrato: Viterbi-based accelerated tokenizer
At a glance
- What is it?
- Vibrato is a Rust reimplementation of MeCab with cache-efficient id mappings, and it ships precompiled dictionaries so you can tokenize Japanese in two commands. The trade-off is that its defaults do not match MeCab output, and the compression it distributes is not handled by its own API.
- Who is it for?
- Adopt vibrato if you are doing Japanese morphological analysis in Rust and want MeCab-style output without MeCab's dictionary loading cost, or if you need to train dictionary costs from your own corpus. Do not adopt it if your pipeline expects MeCab-identical output by default, or if you need a tokenizer that handles languages other than Japanese.
- Can I use it commercially?
- Yes. Apache-2.0 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 32 days ago.
- What is it written in?
- Mainly Rust, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.
Star history
- daac-tools/vibrato430 ★ · +8
| Repository | 2026-09-17 | 2026-11-25 |
|---|---|---|
| daac-tools/vibrato | 422 | 430 |
8 Stars in the last 69 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What vibrato solves, and why MeCab users should care
MeCab has been the default Japanese morphological analyzer for years, and its dictionaries have grown. The README points at unidic-cwj-3.1.1, whose connection matrix is 459 MiB. Loading and walking a matrix that size is mostly a memory-access problem, and MeCab's data layout was not designed around CPU caches. Vibrato is a Rust reimplementation of the same Viterbi algorithm with the id mappings rearranged to be cache-efficient, which is where the speed difference comes from rather than from a different algorithm.
The audience is narrow and specific. If you are writing Rust and need Japanese segmentation, vibrato is a library you can call directly, and the repository is a Cargo workspace with the library in vibrato/, a CLI in tokenize/, a dictionary compiler in compile/, and training and evaluation crates alongside them. If you are not in Rust, the README points to a separate Python wrapper, python-vibrato, and to a Wasm demo that loads a model in the browser (the README warns it takes a little time to load).
What it is not: a general tokenizer. The topics list japanese, morphology and segmentation, and every dictionary path in the README is a Japanese resource. Nothing in the README suggests it handles other languages.
How the Viterbi pass and the dictionary layout fit together
The mechanism is the standard minimum-cost path search. A sentence is split into candidate words according to the dictionary and character categories, each candidate carries a cost, and the Viterbi pass picks the sequence with the lowest total. Vibrato keeps that algorithm and changes how the candidates are looked up and how the costs are laid out in memory.
The workspace layout shows how the pieces are separated. The map/ member holds the id mapping layer, compile/ builds a system dictionary, dictgen/ generates dictionaries, train/ estimates costs, and evaluate/ measures results. tokenize/ is the CLI that ties a system dictionary to input text. The README's own reference list links two NLP2023 papers by the authors, one on CPU cache efficiency in minimum-cost morphological analysis and one on splitting score computation in a CRF-based analyzer to trade model size against speed. Those papers are the technical explanation for why the id mapping matters; the README does not reproduce their contents.
One design decision is visible in the dictionary format. Distributed models are zstd-compressed, and the README states plainly that if you load them through the vibrato API you must decompress them yourself. The CLI handles the compressed file, the library does not. That is a deliberate split, and it means a library user has to add zstd or ruzstd as a dependency.
Installing vibrato and tokenizing your first sentence
You need rustc and cargo first, following the official Rust instructions. Then download a precompiled dictionary from the Releases page. The README uses mecab-ipadic v2.7.0 as the example and tells you to substitute a vibrato release tag for VERSION, such as v0.5.0.
wget https://github.com/daac-tools/vibrato/releases/download/VERSION/ipadic-mecab-2_7_0.tar.xz
tar xf ipadic-mecab-2_7_0.tar.xzAfter extraction you get a directory containing system.dic.zst. Clone the repository and run the tokenize binary through cargo, pointing -i at that file. The README's example sentence is 本とカレーの街神保町へようこそ。
echo '本とカレーの街神保町へようこそ。' | cargo run --release -p tokenize -- -i ipadic-mecab-2_7_0/system.dic.zstExpect one token per line in MeCab format, with the surface form, a comma-separated feature list, and a final EOS line. If you want space-separated output instead of the feature columns, add -O wakati.
echo '本とカレーの街神保町へようこそ。' | cargo run --release -p tokenize -- -i ipadic-mecab-2_7_0/system.dic.zst -O wakatiThat prints 本 と カレー の 街 神保 町 へ ようこそ 。 with no feature columns. For a user dictionary, the format is CSV with surface, left-id, right-id, cost, then optional features, and you pass the file with -u. The README's example user.csv defines 神保町 and 本とカレーの街 as custom nouns and ようこそ with extra feature columns in several languages, and running the same sentence with -u user.csv merges 本とカレーの街 into a single token.
If you are calling the library rather than the CLI, the README shows the decompression step explicitly.
// Requires zstd crate or ruzstd crate
let reader = zstd::Decoder::new(File::open("path/to/system.dic.zst")?)?;
let dict = Dictionary::read(reader)?;The MeCab compatibility gap is a real default, not a footnote
Vibrato's defaults are not MeCab's defaults, and the README is direct about it. MeCab ignores characters classified as SPACE in char.def; vibrato emits them as tokens. Feed mens second bag through MeCab and you get three tokens. Feed it through vibrato with default settings and you get five, with 記号,空白 entries for each space.
To reproduce MeCab you pass two flags together: -S to ignore spaces and -M 24 to set the maximum grouping length for unknown words. The README also notes corner cases where results diverge because of cost tiebreakers, and calls this not an essential problem. That is a reasonable position for a reimplementation, but it matters if you are diffing output against an existing MeCab pipeline or if downstream code assumes a fixed token count. A tokenizer that inserts whitespace tokens will shift every index after the first space, which breaks alignment with annotated data.
The -M 24 value is worth pausing on. It is the number that makes the example match, and it is tied to the unknown-word grouping behavior of that particular dictionary. The README does not claim it is universal, so treat it as a starting point to verify against your own corpus rather than a constant to copy.
Where vibrato is the wrong choice
The clearest case against it is anything outside Japanese. The dictionary format, the character categories, and the training documentation are all built around Japanese resources, and the README never presents a non-Japanese dictionary. If you need segmentation for Chinese, Korean or Thai, this is not the tool, regardless of how the Viterbi core performs.
A second case is a project that cannot take a Rust dependency. The Python wrapper exists, but it is a separate repository, and the README gives it one line and a link. If your team is Python-only and wants a maintained binding with the same release cadence, you are depending on a project the README does not describe in any depth.
Third, the API does not transparently load the distributed models. A user who grabs ipadic-mecab-2_7_0.tar.xz and calls Dictionary::read on the .zst file directly will get a decompression error, because the README requires you to wrap the file in a zstd decoder first. That is a small amount of code, but it is a step people miss, and the error will not explain itself.
Finally, if your workload is small, the cache-efficiency argument does not apply. The README frames the speed advantage around large matrices such as unidic-cwj-3.1.1 at 459 MiB. With a small dictionary, the difference between vibrato and MeCab is likely to be dominated by other parts of your pipeline.
Alternatives and the difference in approach
The obvious alternative is MeCab itself, and the difference is not the algorithm. Both run Viterbi over a dictionary with connection costs. MeCab is C++ with a long history and a wide set of bindings; vibrato is Rust with a reorganized id mapping and a simplified implementation, and the README's speed claim is specifically about cache behavior on large matrices. Choosing between them is mostly about your host language and whether the large-dictionary case is your bottleneck.
A different kind of alternative is a neural or CRF-based segmenter, and the repository itself points at one: the second reference paper is about a CRF-based analyzer where score computation is split to trade model size against analysis speed. That is a different design space. A Viterbi dictionary tokenizer has no training phase at inference time and no model weights beyond the dictionary, which makes it predictable and cheap to deploy. A CRF or neural model can generalize to unknown words and domain vocabulary that a dictionary misses, at the cost of a model file and more compute per sentence. If your text is full of product names and slang, the dictionary approach will lean on the user dictionary mechanism, which means you maintain the entries yourself.
Vibrato does offer a middle path that MeCab users will recognize: training parameters or costs in dictionaries from your own corpora, documented in docs/train.md. That keeps the Viterbi architecture while adapting costs to your domain, and it is the reason the train/ crate is in the workspace.
Maintenance, releases and licence
The repository is not archived, and the last push was on 2026-09-03. The release history is uneven: v0.5.0 in February 2023, v0.5.1 in May 2023, then v0.5.2 in March 2025. Commits and tagged releases do not move at the same pace, so if you pin to a crates.io version, check whether the fix or feature you want is in a release or only on main. The README's dictionary instructions tell you to match the release tag in the download URL to the vibrato version you build, which is a real constraint: a dictionary compiled for a different version is not guaranteed to load.
Licensing is dual, Apache-2.0 or MIT, at your option. Both are permissive and impose no copyleft on your own code. One thing to check before shipping: the precompiled dictionaries are built from third-party resources such as mecab-ipadic and unidic-cwj, and each of those carries its own licence terms. The vibrato repository licence covers vibrato's code, not necessarily the dictionary contents you redistribute. That is a question for whoever handles your legal review, not something the README resolves.
Upgrade cost is low at the API level. The public surface shown in the README is Dictionary::read plus the tokenize CLI flags, and the library is a workspace member rather than a monolith. The friction is on the data side: a version bump may require a matching dictionary rebuild, and if you trained custom costs, those need regenerating too.
Editorial conclusion
Adopt vibrato if you are doing Japanese morphological analysis in Rust and want MeCab-style output without MeCab's dictionary loading cost, or if you need to train dictionary costs from your own corpus. Do not adopt it if your pipeline expects MeCab-identical output by default, or if you need a tokenizer that handles languages other than Japanese. Before committing, check three things: whether the precompiled dictionary on the Releases page matches the vibrato version you build, whether your input contains spaces or other characters that MeCab treats as SPACE, and whether you can decompress the .zst dictionary outside the API, because the vibrato API does not do it for you.
Frequently asked questions
What is vibrato?
Vibrato is a Rust implementation of tokenization, or morphological analysis, based on the Viterbi algorithm. The README describes it as a reimplementation of the fast tokenizer MeCab, simplified and optimized for faster tokenization, with a Python wrapper available in a separate repository.
How do I install vibrato and tokenize a sentence?
Install rustc and cargo, then download a precompiled dictionary from the Releases page and extract the .tar.xz so you have system.dic.zst. Run the tokenize binary with cargo run --release -p tokenize -- -i ipadic-mecab-2_7_0/system.dic.zst and pipe a sentence into it; tokens come out in MeCab format ending with EOS.
Does vibrato produce the same output as MeCab?
Not with the default settings. MeCab ignores characters classified as SPACE, while vibrato emits them as tokens, so the README shows mens second bag producing five tokens instead of three. Passing -S and -M 24 gives MeCab-compatible output in that example, though the README notes corner cases where cost tiebreakers still cause differences.
Can I use my own words with vibrato?
Yes, through a user dictionary in CSV format with the columns surface, left-id, right-id, cost, and optional features after that. You pass the file with the -u argument, and the README's example shows a custom entry merging 本とカレーの街 into a single token.
Why does loading a distributed vibrato dictionary fail in my Rust code?
The distributed models are compressed in zstd format, and the README states that if you want to load them with the vibrato API you must decompress them outside of the API, for example by wrapping the file in a zstd decoder before calling Dictionary::read. The CLI handles the compressed file; the library does not.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/daac-tools-vibrato)Star history chart for your README
[](https://hysenlabs.com/projects/daac-tools-vibrato)Was this useful?