v0.4.2: Romaji overhaul
Breaking changes
- ib-matcher: No breaking changes
- ib-romaji: Some functions' input type is changed from
&(impl ?Sized + AsRef<str>)toimpl Into<Input<'h>>. Most code should still work.
ib-romaji v0.2.0
- Fully support n apostrophe
- Fully support single kanji noma
- convert: add hepburn_ime
- matcher:
partial_wordat kana boundary by default - Word dictionary size is reduced by 3%, so init time (and binary size) should be ~3% smaller.
- Overall size (with matcher) is reduced by 108 KiB.
Update docs:
- Support the following romanization systems:
- Hepburn romanization system
- Hepburn's convenient IME variant:
n'andtch*can be alternatively written asnnandcch*respectively.
- Support handling of
n'(n apostrophe, e.g.n'yaforんや). - Support handling of 々(noma).
ib-matcher v0.4.2
MatchConfigaddmatcher()for convenient.- syntax::glob: allow logos v0.16
- macros: add
assert_match!()for tests
Update docs:
MatchConfig and Japanese romaji matching examples:
// cargo add ib-matcher --features romaji,macros
use ib_matcher::{assert_match, matcher::MatchConfig};
let c = MatchConfig::builder().romaji(Default::default()).build();
// kya n
assert_match!(c.matcher("kyan").find("キャン"), Some((0, 9)));
// kya ni
assert_match!(c.matcher("kyan").find("キャニ"), None);
// Partial match (`b.is_pattern_partial()`) is disabled by default.
// kya n(n'/nn) i se kai nyo nyo
assert_match!(c.matcher("nisekainyonyo" ).find("キャンヰ世界ニョニョ"), None);
assert_match!(c.matcher("n'isekainyonyo").find("キャンヰ世界ニョニョ"), Some((6, 24)));
assert_match!(c.matcher("nnisekainyonyo").find("キャンヰ世界ニョニョ" ), Some((6, 24)));
// shu u se i pa tchi/cchi
assert_match!(c.matcher("shuuseipatchi").find("修正パッチ"), Some((0, 15)));
assert_match!(c.matcher("shuuseipacchi").find("集成パッチ"), Some((0, 15)));
// shi ka no ko no ko no ko ko shi ta n ta n
assert_match!(c.matcher("shikanokonokonokokoshitantan").find("鹿乃子のこのこ虎視眈々"), Some((0, 33)));Partial matches
Many Japanese words are composed of multiple kanas (Japanese letters), while each kana's romaji may be composed of multiple English letters. So unlike pinyin, there are three partial matching options in romaji matching:
-
No partial matching.
This is the default before v0.4.2, ib-romaji v0.2.
To use this option, you can set
RomajiMatchConfigBuilder::partial_word(false). But it's probably not what users would want as some words can be pretty long. -
Partially match words, but not kanas.
The became the default after v0.4.2, since the former default is confusing to new users.
TODO: Due to the current implementation, this may partially match a kanji.
-
Partially match both words and kanas.
To use this option, set
IbMatcherBuilder::is_pattern_partial(true), which also works the same for pinyin matching.
ib-pinyin-ahk2 v0.4.2
- Smaller binary size (x86-64 -0.5 KiB → 488/660 KiB)