fix: type

This commit is contained in:
Masato Kikuchi
2025-03-27 13:23:53 +09:00
parent e8dbf956e1
commit 07637f587d
2 changed files with 10 additions and 5 deletions

View File

@@ -79,13 +79,13 @@ static LONG_PATTERN: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\w)(ー*)").unwrap
fn phone_tone_to_kana(phones: Vec<String>, tones: Vec<i32>) -> Vec<(String, i32)> { fn phone_tone_to_kana(phones: Vec<String>, tones: Vec<i32>) -> Vec<(String, i32)> {
let mut results = Vec::new(); let mut results = Vec::new();
let mut current_mora = String::new(); let mut current_mora = String::new();
for ((phone, next_phone), (tone, next_tone)) in phones for ((phone, next_phone), (&tone, &next_tone)) in phones
.iter() .iter()
.zip(phones.iter().skip(1)) .zip(phones.iter().skip(1))
.zip(tones.iter().zip(tones.iter().skip(1))) .zip(tones.iter().zip(tones.iter().skip(1)))
{ {
if PUNCTUATIONS.contains(&phone.clone().as_str()) { if PUNCTUATIONS.contains(&phone.clone().as_str()) {
results.push((phone, tone)); results.push((phone.to_string(), tone));
continue; continue;
} }
if CONSONANTS.contains(&phone.clone()) { if CONSONANTS.contains(&phone.clone()) {
@@ -94,7 +94,13 @@ fn phone_tone_to_kana(phones: Vec<String>, tones: Vec<i32>) -> Vec<(String, i32)
current_mora = phone.to_string() current_mora = phone.to_string()
} else { } else {
current_mora += phone; current_mora += phone;
results.push((MORA_PHONEMES_TO_MORA_KATA.get(&current_mora).unwrap(), tone)); results.push((
MORA_PHONEMES_TO_MORA_KATA
.get(&current_mora)
.unwrap()
.to_string(),
tone,
));
current_mora = String::new(); current_mora = String::new();
} }
} }

View File

@@ -30,8 +30,7 @@ fn main_inner() -> anyhow::Result<()> {
} }
} }
let audio = let audio = tts_holder.easy_synthesize(ident, text, 0, 0, tts::SynthesizeOptions::default())?;
tts_holder.easy_synthesize(ident, text, 0, 0, tts::SynthesizeOptions::default())?;
fs::write("output.wav", audio)?; fs::write("output.wav", audio)?;
Ok(()) Ok(())