Crates.io | pinyin-translator |
lib.rs | pinyin-translator |
version | 0.2.3 |
source | src |
created_at | 2022-04-27 10:34:36.324783 |
updated_at | 2023-06-30 02:43:06.793593 |
description | Chinese charator translate as pinyin |
homepage | |
repository | https://github.com/duguying/pinyin-translator.git |
max_upload_size | |
id | 575977 |
size | 2,479,680 |
将中文翻译为拼音。内嵌字词库,支持多音词。
fn main() {
let content = "わたしわ阿飞, and my English name is Rex Lee. 网名是独孤影! ^_^。下面是一段多音分词歧义测试,这个人无伤无臭味。".to_string();
let pt = pinyin_translator::PinyinTranslator::new();
let result = pt.translate(content.clone());
println!("{}", result);
let vec = pt.translate_as_slice(content.clone());
println!("{:?}", vec);
}
输出
わたしわāfēi, and my English name is Rex Lee. wǎngmíngshìdúgūyǐng! ^_^。xiàmiànshìyīduànduōyīnfēncíqíyìcèshì,zhègèrénwúshāngwúchòuwèi。
["わ", "た", "し", "わ", "ā", "fēi", ",", " ", "a", "n", "d", " ", "m", "y", " ", "E", "n", "g", "l", "i", "s", "h", " ", "n", "a", "m", "e", " ", "i", "s", " ", "R", "e", "x", " ", "L", "e", "e", ".", " ", "wǎng", "míng", "shì", "dú", "gū", "yǐng", "!", " ", "^", "_", "^", "。", "xià", "miàn", "shì", "yī", "d"duō", "yīn", "fēn", "cí", "qí", "yì", "cè", "shì", ",", "zhè", "gè", "rén", "wú", "shāng", "wú", "chòu", "wèi", "。"]
MIT License