-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Upgrade to Lingua Franca 0.3+ #2772
Conversation
Hello @ChanceNCounter! 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 2021-02-01 06:50:20 UTC |
65f187d
to
326abb2
Compare
yeap. i'm about ready to kill my git extension. |
2937ac8
to
65f187d
Compare
Voight Kampff Integration Test Succeeded (Results) |
Co-authored-by: Kris Gesling <kris.gesling@mycroft.ai>
65f187d
to
2ad8e7b
Compare
Voight Kampff Integration Test Succeeded (Results) |
Per MycroftAI/lingua-franca#174, before moving to LF0.4 (unreleased but ready) a setting should be added to In the long run, when language switching is more robust, I think it would be better if the Skill API provided for "fallback languages." The issue was raised by a user who upgraded to LF0.3.1 against current mycroft-core/dev, and encountered a hardcoded fallback to English in the weather skill. This PR currently works around the problem by simply loading English alongside the user's primary language. If Mycroft wants to support falling back to languages other than English, the Skill API will need to adapt; in the meantime, it's only possible with |
Voight Kampff Integration Test Failed (Results). |
I confirm that applying this commit gives Mycroft a proper fallback to English, without the need to override I am currently developing a skill that I use to play with my son. It speaks the sound of an animal we name (https://github.com/r0d0dendr0n/skill-animal-say). It's a work in progress, but Polish version is quite functional. Because the functions list is not closed, I don't want do too much translating at the moment. This decision however makes it harder to share this skill with anyone not native to English or Polish, because their Mycroft would be set to their native language and English. Even if they know Polish, they won't be able to use it without changing Mycroft's primary language. |
Yep. Stuff like that comes up a lot. These changes to Lingua Franca were partially intended to facilitate that, but they're only one part of the puzzle. The Trying to fall back on languages other than English first, and sort of go down a list, is an important notion for situations where skills are supported in what might be an "intermediate" language for the user (this most recently came up with respect to Catalan speakers, most of whom live in Spain, and are therefore more likely to understand Castillian Spanish than English.) But you begin with an interesting problem and add more problems from there: how do you make it easy for users to set up STT and TTS modules on a per-language basis, config-wise? Do you limit this functionality to STT and TTS engines that can support multiple languages, or use different engines where one is more suitable? How jarring would it be for Mycroft to speak in a completely different voice when you ask it a question in Polish versus English? And how do you handle that fallback stuff? Should Mycroft start by trying to parse STT in the default language, then try the next language if it detects junk? Should it try them all every time, returning confidence values? That'll either be slow or computationally expensive. These are solvable problems, but there are a lot of moving parts, only some of which are actually made by MycroftAI or this community. I'd certainly encourage you to join the neverending brainstorm over there on Mattermost. |
I think that the user should provide a configuration with priorities to TTS and STT engines, along with their supported languages. Something like this: STT is more tricky than TTS. I don't have a "the way to go" solution but I can propose some fantasies.
I guess I should check out Mycroft's Mattermost. |
Hey Chance, I get one other error on this for extracting timezone data. What do you think of comparing datetime objects created from the tzinfo instead of the tz itself? def test_extract_timezone(self):
"""Check that extract_datetime returns the expected timezone."""
default_tz = default_timezone()
dt, _ = extract_datetime("today")
# As default_timezone() returns tzlocal() and extract_datetime() may
# return a tzfile we cannot directly compare dt.tzinfo to default_tz.
self.assertEqual(dt, dt.astimezone(default_tz)) I'm also going to close and re-open this to trigger the new tests. |
Just remembered the Python3.5 issues. Wondering if we abandon the attempt to get it in 20.08. We can cut a 20.08.1 release and then we can start merging in breaking changes. Edit: and jump straight to 0.4 - I think you suggested this already. |
Voight Kampff Integration Test Failed (Results). |
Yeah, I think straight to 0.4.0 is a good idea. I don't mind holding the release, but there are languages waiting on 0.4, so the sooner the better at this point. I can't speak to the error because I have absolutely no idea what I'm looking at:
|
the catalan community did a sprint hoping to get support for their language, they translated everything in less than 1 month, i feel we shouldn't tell them to hold out 8 more months until next release... |
Hey to clarify, I mean do the v20.8.1 release, then add this for 21.2.0 where we have officially dropped support for Python 3.5 Definitely not waiting a whole extra release cycle. |
right, i sometimes get confused with the versioning scheme..... if it makes it into the next major release that would be great 👍 |
Close in favor of #2890 |
WIP
Upgrades Lingua Franca to v0.3.1 (current pypi release.) This includes a major refactor, in which @JarbasAl has reorganized and standardized naming conventions. After that, I overhauled the way Lingua Franca handles localized code. The lib now crawls itself whenever a module is imported, caches localized functions in loaded languages, and imports them dynamically.
Furthermore (as implied above) Lingua Franca no longer loads any of its important functions by default. Instead, a given language's functions must be loaded by calling
lingua_franca.load_language(<lang code>)
, or by passing a list of language codes tolingua_franca.load_languages()
. Lastly, one can change the "default" language - the one which Lingua Franca will use if a language is not specified when you call a function - usinglingua_franca.set_default_lang(<lang code>)
. This will load the specified language, if it isn't already loaded.This PR adds or alters Mycroft-core's wrappers around certain LF functions, to reflect the fact that passing
lang=None
to parsers and formatters is deprecated, and will be unsupported in a future version. Skill authors are encouraged to omit the lang parameter entirely, so that their skills will always use the currently-set default language.At the moment, up to two languages are loaded: the user's configured language from mycroft.conf, and English. Both are loaded along with the Skill Manager. The Skill Manager was chosen simply because it's a component that will be running before Mycroft has the opportunity to call other LF functions.