jp-deinflector

Crates.iojp-deinflector
lib.rsjp-deinflector
version0.2.1
created_at2025-01-25 14:32:40.945381+00
updated_at2025-03-03 18:01:58.994944+00
descriptionA package for deinflecting Japanese words
homepage
repositoryhttps://github.com/btrkeks/jp-deinflector
max_upload_size
id1530641
size176,102
Daniel (btrkeks)

documentation

README

Crates.io Documentation Codecov Dependency status

jp-deinflector

Introduction

This is a Rust crate for deinflecting Japanese words optimized for maximum performance. Currently, it has a function deinflect(word: &str) -> Vec<String> that will output a list of possible deinflections for the input word. Since it doesn't do any dictionary lookups, it cannot guarantee that the returned words are actual Japanese words, but the deinflection will always be correct (i.e. if the word were to be a real word it would be deinflected correctly).

This crate is meant for use in dictionary applications to obtain a list of possible deinflections that can then be looked up in a dictionary.

There is also a function kata_to_hira(kata: &str) that converts all katakana characters in kata into their hiragana counterparts.

Performance

This crate uses a perfect hash table to store the deinflection rules, which means that lookup can be performed very quickly in constant time. The time required for a single deinflection is usually in the nanosecond range.

Commit count: 107

cargo fmt