Crate mecrab

Crate mecrab 

Source
Expand description

MeCrab - A high-performance morphological analyzer compatible with MeCab

Copyright 2026 COOLJAPAN OU (Team KitaSan)

§Overview

MeCrab is a pure Rust implementation of a morphological analyzer that is compatible with MeCab dictionaries (IPADIC format). It provides:

  • Zero-copy parsing where possible
  • Memory-mapped dictionary loading via memmap2
  • Thread-safe design using Rust’s ownership model
  • Double-Array Trie (DAT) for fast dictionary lookups
  • Viterbi algorithm for optimal path finding
  • SIMD-accelerated cost calculations using portable SIMD

§Example

use mecrab::MeCrab;

let mecrab = MeCrab::new()?;
let result = mecrab.parse("すもももももももものうち")?;
println!("{}", result);

Re-exports§

pub use error::Error;
pub use error::Result;

Modules§

bench
Benchmarking and profiling utilities for MeCrab
debug
Debug session for lattice visualization and analysis
dict
Dictionary module for MeCrab
error
Error types for MeCrab
lattice
Lattice module for building the word graph
normalize
Text normalization for Japanese text processing
phonetic
Phonetic transduction for Japanese text
semantic
Semantic enrichment for morphological analysis
stream
Streaming text processing for morphological analysis
vectors
Zero-copy word vector storage and operations
viterbi
Viterbi algorithm implementation for finding the optimal path

Structs§

AnalysisResult
Analysis result containing a sequence of morphemes
MeCrab
The main MeCrab morphological analyzer
MeCrabBuilder
Builder for configuring MeCrab instance
Morpheme
A single morpheme (token) in the analysis result

Enums§

OutputFormat
Output format for morphological analysis results