| Crates.io | jpreprocess |
| lib.rs | jpreprocess |
| version | 0.12.0 |
| created_at | 2023-06-02 22:51:06.864504+00 |
| updated_at | 2025-02-16 10:53:25.15167+00 |
| description | Japanese text preprocessor for Text-to-Speech application (OpenJTalk rewrite in rust language). |
| homepage | |
| repository | https://github.com/jpreprocess/jpreprocess |
| max_upload_size | |
| id | 881260 |
| size | 80,145 |
Japanese text preprocessor for Text-to-Speech application.
This project is a rewrite of OpenJTalk in Rust language.
Put the following in Cargo.toml
[dependencies]
jpreprocess = "0.12.0"
It may be necessary to add jpreprocess-njd and/or jpreprocess-jpcommon if you want control over how njd and jpcommon are processed.
In this example, jpreprocess takes a lindera dictionary and preprocesses a text into jpcommon labels.
use jpreprocess::*;
let config = JPreprocessConfig {
dictionary: SystemDictionaryConfig::File(path),
user_dictionary: None,
};
let jpreprocess = JPreprocess::from_config(config)?;
let jpcommon_label = jpreprocess
.extract_fullcontext("日本語文を解析し、音声合成エンジンに渡せる形式に変換します.")?;
assert_eq!(
jpcommon_label[2].to_string(),
concat!(
"sil^n-i+h=o",
"/A:-3+1+7",
"/B:xx-xx_xx",
"/C:02_xx+xx",
"/D:02+xx_xx",
"/E:xx_xx!xx_xx-xx",
"/F:7_4#0_xx@1_3|1_12",
"/G:4_4%0_xx_1",
"/H:xx_xx",
"/I:3-12@1+2&1-8|1+41",
"/J:5_29",
"/K:2+8-41"
)
);
Other examples can be found at GitHub.
This software includes source code from:
BSD-3-Clause