6 releases (breaking)
0.6.0 | Nov 17, 2024 |
---|---|
0.5.0 | Mar 16, 2024 |
0.4.0 | Jan 18, 2023 |
0.3.0 | Jan 13, 2020 |
0.1.0 | Jul 23, 2017 |
#273 in Text processing
126 downloads per month
605KB
708 lines
Contains (WOFF font, 120KB) docs/Heuristica-Italic.woff, (WOFF font, 90KB) docs/FiraSans-Medium.woff, (WOFF font, 92KB) docs/FiraSans-Regular.woff, (WOFF font, 56KB) docs/SourceCodePro-Regular.woff, (WOFF font, 56KB) docs/SourceCodePro-Semibold.woff, (WOFF font, 49KB) docs/SourceSerifPro-Bold.woff and 1 more.
kelp
Convert tool for Japanese.
This is a porting from jaconv(python) written in Rust.
About
- Convert characters between full-width and half-width
- From full-width to half-width
- From half-width to full-width
- Convert characters between hiragana and katakana
- From hiragana to katakana
- From katakana to hiragana
Usage
Add kelp
as a dependency in your Cargo.toml
cargo add kelp
[dependencies]
kelp = "0.6"
Quick Example
First, you should build ConvOption
.
ConvOption
has flags of conversion method.
After building ConvOption
, you can convert characters with functions
of kelp
.
extern crate kelp;
use kelp::*;
use kelp::conv_option::ConvOption;
fn main() {
// All flags are disabled in default
let option = ConvOption::build()
.enable_ascii() // Convert ascii
.enable_digit() // Convert digit
.enable_kana() // Convert kana
.finalize(); // Returns ConvOption with specified flags
// From hiragana to katakana(full-width)
println!("{}", hira2kata("あいうえお", option)); // アイウエオ
// From hiragana to katakana(half-width)
println!("{}", hira2hkata("あいうえお", option)); // アイウエオ
// From katakana(full-width) to hiragana
println!("{}", kata2hira("アイウエオ", option)); // あいうえお
// From half-width to full-width
println!("{}", h2z("abc123アイウ", option)); // ABC123アイウ
// From full-width to half-width
println!("{}", z2h("ABC123アイウ", option)); // ABC123アイウ
}
Dependencies
~1.1–1.7MB
~32K SLoC