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

Update gruut to version 2.0 #882

Merged
merged 1 commit into from
Oct 31, 2021
Merged

Update gruut to version 2.0 #882

merged 1 commit into from
Oct 31, 2021

Conversation

synesthesiam
Copy link
Contributor

Minimal modifications for the update to gruut 2.0.

  • eSpeak phoneme databases have been re-built with the changes discussed here
  • Whitespace is now preserved as per the discussion here

For the future: gruut's text processing has been greatly expanded in 2.0, and the current text cleaners in 🐸 TTS interfere. For example, the sentence:

It is 4pm on 1/2/2013.

gets expanded via phoneme_cleaners to:

It is fourpm on one/two/twenty thirteen.

One way to solve this problem would be to use gruut itself as a text cleaner:

import gruut

def gruut_cleaner(text: str, lang: str = "en-us"):
    return " ".join(
        s.text_with_ws for s in gruut.sentences(text, lang=lang, phonemes=False, pos=False)
    )

which gets you:

>>> gruut_cleaner("It is 4pm on 1/2/2013.")
'It is four P M  on January second, twenty thirteen.'

@synesthesiam
Copy link
Contributor Author

Python 3.6 bug was fixed in gruut 2.0.1. Re-running the checks should pass now.

1 similar comment
@synesthesiam
Copy link
Contributor Author

Python 3.6 bug was fixed in gruut 2.0.1. Re-running the checks should pass now.

word_phonemes = []

for word_phoneme in word.phonemes:
word_phonemes.append(IPA.without_stress(word_phoneme).translate(GRUUT_TRANS_TABLE))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can make "stress" use optional by reflecting it to the model configs.

@erogol erogol changed the base branch from main to dev October 18, 2021 15:53
@erogol
Copy link
Member

erogol commented Oct 25, 2021

@synesthesiam do you plan to address the linter issue?

@erogol
Copy link
Member

erogol commented Oct 25, 2021

@synesthesiam do you have any docs about what is diff in Gruut 2.0 to link from the release notes?

@synesthesiam
Copy link
Contributor Author

Sure, the release notes give a very brief summary of the changes. The docs go into detail, but don't contrast with v1.

Internally, gruut has changed significantly. I haven't written up anything about it yet, but I'd be happy to if you think any TTS users would find it useful.

@erogol
Copy link
Member

erogol commented Oct 27, 2021

I think it'd be useful to know what changed internally

@synesthesiam
Copy link
Contributor Author

I've written up a small example here: https://rhasspy.github.io/gruut/#how-it-works

@erogol
Copy link
Member

erogol commented Oct 29, 2021

I'll merge this after fixing a couple of bugs

@erogol
Copy link
Member

erogol commented Oct 29, 2021

@synesthesiam I guess due to my force push, you have recurring commits in your commit tree. Can you rebase the code to remove them? Sorry for the inconvenience.


# Use gruut for phonemization
ph_list = []
for sentence in gruut.sentences(text, lang=language, espeak=use_espeak_phonemes):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TTS used to have similar phonemization for times builtin, have those been removed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am talking about TTS/tts/utils/text/time.py

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.

3 participants