Skip to content

Commit

Permalink
Make dictionary non-necessary for character input
Browse files Browse the repository at this point in the history
  • Loading branch information
xd009642 committed Apr 22, 2024
1 parent f3c8b8c commit b467d0c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,15 @@ pub struct XdTts {

impl XdTts {
pub fn new(tacotron2: &Path, phoneme_input: bool) -> anyhow::Result<Self> {
let mut dict = CmuDictionary::open("data/cmudict-0.7b.txt")?;
if let Ok(custom) = CmuDictionary::open("resources/custom_dict.txt") {
dict.merge(custom);
}
let dict = if phoneme_input {
let mut dict = CmuDictionary::open("data/cmudict-0.7b.txt")?;
if let Ok(custom) = CmuDictionary::open("resources/custom_dict.txt") {
dict.merge(custom);
}
dict
} else {
CmuDictionary::default()
};
let model = Tacotron2::load(tacotron2)?;
let vocoder = create_griffin_lim()?;
Ok(Self {
Expand Down

0 comments on commit b467d0c

Please sign in to comment.