diff --git a/sbv2_api/build.rs b/sbv2_api/build.rs index 96890be..31c9987 100644 --- a/sbv2_api/build.rs +++ b/sbv2_api/build.rs @@ -2,4 +2,4 @@ fn main() { if cfg!(feature = "coreml") { println!("cargo:rustc-link-arg=-fapple-link-rtlib"); } -} \ No newline at end of file +} diff --git a/sbv2_bindings/src/sbv2.rs b/sbv2_bindings/src/sbv2.rs index a6c9380..378e5e3 100644 --- a/sbv2_bindings/src/sbv2.rs +++ b/sbv2_bindings/src/sbv2.rs @@ -1,6 +1,6 @@ use pyo3::prelude::*; use pyo3::types::PyBytes; -use sbv2_core::tts::{TTSModelHolder, SynthesizeOptions}; +use sbv2_core::tts::{SynthesizeOptions, TTSModelHolder}; use crate::style::StyleVector; diff --git a/sbv2_core/src/jtalk.rs b/sbv2_core/src/jtalk.rs index 7217e61..738769d 100644 --- a/sbv2_core/src/jtalk.rs +++ b/sbv2_core/src/jtalk.rs @@ -376,14 +376,33 @@ impl JTalkProcess { phones.push(p3.clone()); } - let a1 = numeric_feature_by_regex(&JTALK_G2P_G_A1_PATTERN, &label.to_string()); - let a2 = numeric_feature_by_regex(&JTALK_G2P_G_A2_PATTERN, &label.to_string()); - let a3 = numeric_feature_by_regex(&JTALK_G2P_G_A3_PATTERN, &label.to_string()); + let a1 = if let Some(mora) = &label.mora { + mora.relative_accent_position as i32 + } else { + -50 + }; + let a2 = if let Some(mora) = &label.mora { + mora.position_forward as i32 + } else { + -50 + }; + let a3 = if let Some(mora) = &label.mora { + mora.position_backward as i32 + } else { + -50 + }; - let f1 = numeric_feature_by_regex(&JTALK_G2P_G_F1_PATTERN, &label.to_string()); + let f1 = if let Some(accent_phrase) = &label.accent_phrase_curr { + accent_phrase.mora_count as i32 + } else { + -50 + }; - let a2_next = - numeric_feature_by_regex(&JTALK_G2P_G_A2_PATTERN, &labels[i + 1].to_string()); + let a2_next = if let Some(mora) = &labels[i + 1].mora { + mora.position_forward as i32 + } else { + -50 + }; if a3 == 1 && a2_next == 1 && "aeiouAEIOUNcl".contains(&p3) { phones.push("#".to_string());