Skip to content

Commit

Permalink
OjtPhoneme::{start,end}を消す
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip committed Sep 19, 2024
1 parent 97e1c76 commit 210f7b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
14 changes: 5 additions & 9 deletions crates/voicevox_core/src/engine/acoustic_feature_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ static PHONEME_MAP: LazyLock<HashMap<&str, i64>> = LazyLock::new(|| {
#[derive(Debug, Clone, PartialEq, new, Default, Getters)]
pub(crate) struct OjtPhoneme {
phoneme: String,
// FIXME: derive-getters(多分)が警告を覆い隠しているが、以下の二つは使っていないはず。`Debug`用
// に持つというのはありかもしれないが…
start: f32,
end: f32,
}

impl OjtPhoneme {
Expand Down Expand Up @@ -114,8 +110,8 @@ mod tests {
fn base_hello_hiho() -> Vec<OjtPhoneme> {
STR_HELLO_HIHO
.split_whitespace()
.enumerate()
.map(|(i, s)| OjtPhoneme::new(s.into(), i as f32, (i + 1) as f32))
.map(ToOwned::to_owned)
.map(OjtPhoneme::new)
.collect()
}

Expand Down Expand Up @@ -155,9 +151,9 @@ mod tests {
}

#[rstest]
#[case(ojt_hello_hiho(), 9, OjtPhoneme::new("a".into(), 9., 10.), true)]
#[case(ojt_hello_hiho(), 9, OjtPhoneme::new("k".into(), 9., 10.), false)]
#[case(ojt_hello_hiho(), 9, OjtPhoneme::new("a".into(), 10., 11.), false)]
#[case(ojt_hello_hiho(), 9, OjtPhoneme::new("a".into()), true)]
#[case(ojt_hello_hiho(), 9, OjtPhoneme::new("k".into()), false)]
#[case(ojt_hello_hiho(), 9, OjtPhoneme::new("a".into()), false)]
fn test_ojt_phoneme_equality(
#[case] ojt_phonemes: Vec<OjtPhoneme>,
#[case] index: usize,
Expand Down
5 changes: 3 additions & 2 deletions crates/voicevox_core/src/synthesizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1079,8 +1079,9 @@ pub(crate) mod blocking {
OjtPhoneme::convert(
phoneme_str_list
.iter()
.enumerate()
.map(|(i, s)| OjtPhoneme::new(s.as_ref().to_string(), i as f32, i as f32 + 1.))
.map(AsRef::as_ref)
.map(ToOwned::to_owned)
.map(OjtPhoneme::new)
.collect::<Vec<OjtPhoneme>>()
.as_slice(),
)
Expand Down

0 comments on commit 210f7b1

Please sign in to comment.