Skip to main content

inputx_nihongo/
lib.rs

1//! Japanese input engine — pluggable third-source for Inputx.
2//!
3//! # Scope (v0.1)
4//! - Romaji → hiragana / katakana conversion (Hepburn primary, kunrei
5//!   alternates accepted). Whole-buffer rendering: every keystroke
6//!   re-renders the kana from scratch.
7//! - Single-kanji lookup by on-yomi: when the user's romaji buffer is
8//!   exactly a valid on-yomi reading (e.g. `ka`, `kou`), surface the
9//!   kanji that read that way — restricted to kanji whose Unicode
10//!   codepoint is identical to a Simplified-Chinese hanzi (the codepoint-
11//!   identity check is baked into [`kanji::KANJI_TABLE`]; new entries
12//!   must be hand-verified before adding).
13//!
14//! # Not in v0.1
15//! - Compound conversion (e.g. `nihon` → 日本) — the engine produces
16//!   hiragana/katakana for multi-syllable input but does not assemble
17//!   kanji compounds.
18//! - okurigana / verb inflection
19//! - User-learning / pin / freq-tuning
20//! - Per-kanji frequency ordering — candidates are returned in declaration
21//!   order from `KANJI_TABLE`.
22//!
23//! # Plugin-style integration
24//! This crate is self-contained — no dependency on `inputx-wubi` /
25//! `inputx-pinyin`. The consumer (typically `inputx-core::composite`)
26//! holds an optional [`JapaneseEngine`] and routes keystrokes to it
27//! based on the `enable_japanese` flag. When disabled the engine is
28//! never constructed and JP has zero runtime cost on the hot path.
29//!
30//! See [`engine::JapaneseEngine`] for the main entry point.
31
32#![forbid(unsafe_code)]
33
34pub mod engine;
35pub mod jukugo;
36pub mod kanji;
37pub mod romaji;
38
39pub use engine::{Candidate, JapaneseEngine, KanaKind};