From 07637f587d7536629b2d9773686a4632f17aa1e5 Mon Sep 17 00:00:00 2001 From: Masato Kikuchi Date: Thu, 27 Mar 2025 13:23:53 +0900 Subject: [PATCH] fix: type --- crates/sbv2_core/src/jtalk.rs | 12 +++++++++--- crates/sbv2_core/src/main.rs | 3 +-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/sbv2_core/src/jtalk.rs b/crates/sbv2_core/src/jtalk.rs index 705e066..7ef7232 100644 --- a/crates/sbv2_core/src/jtalk.rs +++ b/crates/sbv2_core/src/jtalk.rs @@ -79,13 +79,13 @@ static LONG_PATTERN: Lazy = Lazy::new(|| Regex::new(r"(\w)(ー*)").unwrap fn phone_tone_to_kana(phones: Vec, tones: Vec) -> Vec<(String, i32)> { let mut results = Vec::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() .zip(phones.iter().skip(1)) .zip(tones.iter().zip(tones.iter().skip(1))) { if PUNCTUATIONS.contains(&phone.clone().as_str()) { - results.push((phone, tone)); + results.push((phone.to_string(), tone)); continue; } if CONSONANTS.contains(&phone.clone()) { @@ -94,7 +94,13 @@ fn phone_tone_to_kana(phones: Vec, tones: Vec) -> Vec<(String, i32) current_mora = phone.to_string() } else { current_mora += phone; - results.push((MORA_PHONEMES_TO_MORA_KATA.get(¤t_mora).unwrap(), tone)); + results.push(( + MORA_PHONEMES_TO_MORA_KATA + .get(¤t_mora) + .unwrap() + .to_string(), + tone, + )); current_mora = String::new(); } } diff --git a/crates/sbv2_core/src/main.rs b/crates/sbv2_core/src/main.rs index 36ea49b..d635a4f 100644 --- a/crates/sbv2_core/src/main.rs +++ b/crates/sbv2_core/src/main.rs @@ -30,8 +30,7 @@ fn main_inner() -> anyhow::Result<()> { } } - let audio = - tts_holder.easy_synthesize(ident, text, 0, 0, tts::SynthesizeOptions::default())?; + let audio = tts_holder.easy_synthesize(ident, text, 0, 0, tts::SynthesizeOptions::default())?; fs::write("output.wav", audio)?; Ok(())