mirror of
https://github.com/neodyland/sbv2-api.git
synced 2026-01-06 14:32:57 +00:00
fix: type
This commit is contained in:
@@ -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(¤t_mora).unwrap(), tone));
|
results.push((
|
||||||
|
MORA_PHONEMES_TO_MORA_KATA
|
||||||
|
.get(¤t_mora)
|
||||||
|
.unwrap()
|
||||||
|
.to_string(),
|
||||||
|
tone,
|
||||||
|
));
|
||||||
current_mora = String::new();
|
current_mora = String::new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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(())
|
||||||
|
|||||||
Reference in New Issue
Block a user