Skip to content

Conversation

@veelion
Copy link

@veelion veelion commented Jan 5, 2023

For many technical terms, e.g. "AI", "GitHub", phonemes converted by seq2se2 are not the right pronunciation, so a custom dict is necessary.

The added method load_custom_phonemes(self, file_path) to G2p, reads a cmudict like file to self.cmu. usage:

from g2p_en import G2p

texts = [
        "AI is popular on GitHub.",
        ]
g2p = G2p()
for text in texts:
    out = g2p(text)
    print(out)

g2p.load_custom_phonemes('./z-custom')
for text in texts:
    out = g2p(text)
    print(out)

['AY1', ' ', 'IH1', 'Z', ' ', 'P', 'AA1', 'P', 'Y', 'AH0', 'L', 'ER0', ' ', 'AA1', 'N', ' ', 'G', 'IH1', 'TH', 'AH0', 'B', ' ', '.']
['EY1', 'AY1', ' ', 'IH1', 'Z', ' ', 'P', 'AA1', 'P', 'Y', 'AH0', 'L', 'ER0', ' ', 'AA1', 'N', ' ', 'G', 'IH0', 'T', 'HH', 'AH1', 'B', ' ', '.']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant