#tts #open-j-talk #library

jlabel

HTS-style full-context label structure and parser/serializer from/to string

5 releases

0.1.4 Mar 25, 2024
0.1.3 Mar 2, 2024
0.1.2 Feb 6, 2024
0.1.1 Feb 4, 2024
0.1.0 Jan 25, 2024

#439 in Encoding

Download history 577/week @ 2024-07-30 482/week @ 2024-08-06 343/week @ 2024-08-13 57/week @ 2024-08-20 380/week @ 2024-08-27 614/week @ 2024-09-03 583/week @ 2024-09-10 785/week @ 2024-09-17 1910/week @ 2024-09-24 1290/week @ 2024-10-01 1073/week @ 2024-10-08 1060/week @ 2024-10-15 698/week @ 2024-10-22 967/week @ 2024-10-29 575/week @ 2024-11-05 588/week @ 2024-11-12

2,929 downloads per month
Used in 5 crates (4 directly)

BSD-3-Clause

31KB
629 lines

jlabel

Structure for HTS-style full-context label and parser/serializer from/to String.

Usage

Put the following in Cargo.toml

[dependencies]
jlabel = "0.1.4"

License

BSD-3-Clause

API Reference


lib.rs:

HTS-style full-context label structure and parser/serializer from/to string.

use jlabel::{Label, Mora, Phoneme, Word};

use std::str::FromStr;

let label_str = concat!(
    "sil^n-i+h=o",
    "/A:-3+1+7",
    "/B:xx-xx_xx",
    "/C:02_xx+xx",
    "/D:02+xx_xx",
    "/E:xx_xx!xx_xx-xx",
    "/F:7_4#0_xx@1_3|1_12",
    "/G:4_4%0_xx_1",
    "/H:xx_xx",
    "/I:3-12@1+2&1-8|1+41",
    "/J:5_29",
    "/K:2+8-41"
);
let label: Label = label_str.parse()?;

assert_eq!(
    label.phoneme,
    Phoneme {
        p2: Some("sil".to_string()),
        p1: Some("n".to_string()),
        c: Some("i".to_string()),
        n1: Some("h".to_string()),
        n2: Some("o".to_string()),
    }
);
assert_eq!(
    label.mora,
    Some(Mora {
        relative_accent_position: -3,
        position_forward: 1,
        position_backward: 7,
    })
);
assert_eq!(
    label.word_next,
    Some(Word {
        pos: Some(2),
        ctype: None,
        cform: None,
    })
);
assert_eq!(label.breath_group_prev, None);
#

Dependencies

~230–740KB
~17K SLoC