Skip to content

Commit

Permalink
Fix some 's' cases for IPA G2P (#4460)
Browse files Browse the repository at this point in the history
Signed-off-by: Jocelyn Huang <[email protected]>

Co-authored-by: Eric Harper <[email protected]>
  • Loading branch information
redoctopus and ericharper authored Jun 30, 2022
1 parent 6219718 commit bb5c59f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions nemo/collections/tts/torch/g2ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def parse_one_word(self, word: str):
):
if word[-3] == 'T':
# Case like "airport's"
return self.phoneme_dict[word[:-2]][0] + ["t", "s"], True
return self.phoneme_dict[word[:-2]][0] + ["s"], True
elif word[-3] == 'S':
# Case like "jones's"
return self.phoneme_dict[word[:-2]][0] + ["ɪ", "z"], True
Expand All @@ -420,14 +420,11 @@ def parse_one_word(self, word: str):
and (word[:-1] in self.phoneme_dict)
and (not self.ignore_ambiguous_words or self.is_unique_in_phoneme_dict(word[:-1]))
):
if word[-3] == 'T':
# Case like "airport's"
return self.phoneme_dict[word[:-2]][0] + ["t", "s"], True
elif word[-3] == 'S':
# Case like "jones's"
return self.phoneme_dict[word[:-2]][0] + ["ɪ", "z"], True
if word[-2] == 'T':
# Case like "airports"
return self.phoneme_dict[word[:-1]][0] + ["s"], True
else:
return self.phoneme_dict[word[:-2]][0] + ["z"], True
return self.phoneme_dict[word[:-1]][0] + ["z"], True

# Phoneme dict lookup for unique words (or default pron if ignore_ambiguous_words=False)
if word in self.phoneme_dict and (not self.ignore_ambiguous_words or self.is_unique_in_phoneme_dict(word)):
Expand Down

0 comments on commit bb5c59f

Please sign in to comment.