Skip to content
This repository was archived by the owner on Sep 8, 2024. It is now read-only.

Issues-2534 - language fallback fix #2535

Merged
merged 2 commits into from
Apr 15, 2020

Conversation

luca-vercelli
Copy link
Contributor

Description

Fixes #2534

How to test

Run mycroft-core with language it-it, and use Google Voice as TTS

Contributor license agreement signed?

CLA

@devs-mycroft
Copy link
Collaborator

Hello, @luca-vercelli, thank you for helping with the Mycroft project! We welcome everyone
into the community and greatly appreciate your help as we work to build an AI
for Everyone.

To protect yourself, the project, and users of Mycroft technologies we require
a Contributor Licensing Agreement (CLA) before accepting any code
contribution. This agreement makes it crystal clear that along with your
code you are offering a license to use it within the confines of this project.
You retain ownership of the code, this is just a license.

Please visit https://mycroft.ai/cla to initiate this one-time signing. Thank
you!

@devs-mycroft devs-mycroft added the CLA: Needed Need signed CLA from https://mycroft.ai/cla label Apr 13, 2020
@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

Copy link
Collaborator

@forslund forslund left a comment

Choose a reason for hiding this comment

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

Thank you for contributing this!

I found a minor issue but apart from that this looks good. I'll try it out for real tomorrow but it looks good for merging after the issue is fixed and CLA is signed.

@pep8speaks
Copy link

pep8speaks commented Apr 13, 2020

Hello @luca-vercelli! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-04-15 10:47:49 UTC

@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

1 similar comment
@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

@forslund
Copy link
Collaborator

Tested it with swedish and works great!

I had one thought when viewing it offline, it might be cleaner to have the language change done in the __init__() instead of every time a sentence is parsed:

The __init__() would become

    def __init__(self, lang, config):                                           
        super(GoogleTTS, self).__init__(lang, config, GoogleTTSValidator(       
            self), 'mp3')                                                       
        langs = tts_langs()                                                     
        if self.lang.lower() not in langs:                                      
            if self.lang[:2].lower() in langs:                                  
                self.lang = self.lang[:2]                                       
            else:                                                               
                raise ValueError("Language not supported by gTTS: {}"           
                                 .format(self.lang))

What do you think?

@luca-vercelli
Copy link
Contributor Author

I agree, you are right.
Moreover, I have just seen a method "validate_lang" a few lines below... with a "TODO" annotation... maybe that's the right place to put the code?

@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

@forslund
Copy link
Collaborator

Hmmm, not sure really, the "validate" in the method name indicates that it is a check and should not do any modifications.

I would split it up and do the modification in the __init__() or set to None if no lang can be determined. Then raise the exception in the validate_lang method.

@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

@devops-mycroft
Copy link

Voight Kampff Integration Test Failed (Results)

@krisgesling krisgesling added CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) and removed CLA: Needed Need signed CLA from https://mycroft.ai/cla labels Apr 14, 2020
@krisgesling
Copy link
Contributor

CLA received, but looks like this may still be in progress.

@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

update the lang value if currently set language doesn't exist.
@forslund
Copy link
Collaborator

I think this looks good, I'll rebase it and squash the pep8 / typo fixes into their parent commits to make the commit history cleaner and then I'll merge it.

@forslund forslund force-pushed the bugfix/issue-2534 branch from f5147af to a9cfa51 Compare April 15, 2020 10:47
@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

@forslund forslund merged commit 0ea97df into MycroftAI:dev Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Italian language with Google TTS
6 participants