Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong parsing #11

Open
qo4on opened this issue Apr 3, 2020 · 1 comment
Open

Wrong parsing #11

qo4on opened this issue Apr 3, 2020 · 1 comment

Comments

@qo4on
Copy link

qo4on commented Apr 3, 2020

g2p module can't parse sentences like:

g2p("HTTP")
['T', 'AE1', 'P', 'T', 'IY1']

g2p("RFC")
['R', 'EH1', 'F', 'S', 'IY1']

and can't split words like taxidriver -> taxi driver.

Is it possible to tune predict function of g2p to get a correct grapheme to phoneme conversion for abbreviations and composite words?

@qo4on
Copy link
Author

qo4on commented Apr 12, 2020

The only workaround I found is to add this in __call__ function:

self.exceptions = {'http', 'https', 'rfc'}

elif word in self.exceptions:
  pron = []
  w_len = len(word)
  for i in range(w_len):
    pron.extend(self.cmu[word[i]][0])
    if i != w_len - 1: pron.extend([" "])

g2p("http, rfc")
['EY1', 'CH', ' ', 'T', 'IY1', ' ', 'T', 'IY1', ' ', 'P', 'IY1', ' ', ',', ' ', 'AA1', 'R', ' ', 'EH1', 'F', ' ', 'S', 'IY1']

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

No branches or pull requests

1 participant