-
Notifications
You must be signed in to change notification settings - Fork 79
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
Move runtime config (default language, localization settings, etc) to a stateful object #128
Comments
Short scale is only for insecure rich people who need to feel even richer than they already are. It should be abolished! But back to the real issue. Would an example be Would this need to be changed on the fly or only when a language is loaded? Presumably this would override the normal default for each method, but if it's intentionally passed in a method call then the Skill (or code) that called it can override the user defined config? eg:
|
I think the goal is to make it changeable at runtime, but we don't need to get fancy with the data structures. Just provide some getters and setters so that the implementation can fix things up from its config files.
In practice, I figure (for example) that Mycroft would call those functions when it imports LF, shortly after loading languages. Some kind of for loop over the relevant config values. I saw another FOSS assistant project, with some familiar faces ❤️, eyeing Lingua Franca. I don't know if they actually adopted us, but, if so, their config files will surely look different from Mycroft's; as long as we stick to get/sets, that won't matter to LF! |
And, probably goes without saying, if Mycroft has an intent to fine-tune settings like that, it can just call the same get/setters. After the refactor, depending how we implement the logic, this might, at most, require a quick LF refresh. Probably not. My thinking throughout all of this is that, no matter how bloated the resource files become, LF should at worst become part of the same progress bar that loads and unloads language modules in a complex project. Switching your Name Brand voice assistant to another language takes up to a few minutes, between the voice models, hotwords, offline vocab, and other stuff that has to load. I'd like implementations to be able to stick us right in that loop without thinking about it. |
i think this is a great idea |
On reflection, probably |
Yeah good plan, personally I'd be opting for the dict based:
Then any number of attributes can be passed in. Also like that the relationship between key and value is explicit rather than implicit. |
Discovered: Mycroft is currently wrapping I think one good metric here might be replacing downstream wrappers with downstream . |
Adds config.py to hold this variable (see also: MycroftAI/lingua-franca/MycroftAI#128)
Recently identified candidates for config settings:
|
Consider a decorator enabling e.g. skill authors to ensure certain defaults for snippets of code, then return LF settings to their original state. That is, decorate a function to specify decimal numbers, and LF is reconfigured to use decimal numbers by default for the duration of the decorated function. Use context in the decorator to ensure that LF settings go back to their initial state afterward. This way, skill authors will be able to fine-tune output even when LF has been abstracted away. |
This is a technically-working implementation of #128, which creates an object, exposed at runtime as lingua_franca.config, which descends from dict. More robust get/set methods to follow. The implementation is extensible to support full use of localization and 'full lang codes'. Either that or hooking it up to the functions will be next.
Hear me out 😛
The module is (or will soon be) thoroughly respectful of a given language's default rules (for instance, short vs. long scale numbers.) We've also got some, and will obviously extend, support for full localization (en_US, en_GB, etc.)
But what if the user only wants some of their language's "default" rules? It's easy to look at this as an implementation detail, but the values in question are effectively default parameters to our functions. If we read this information onto a stateful object, the implementation (such as Mycroft) could nitpick on the fly from end-user config files.
For instance, Italian uses the long scale, but it's entirely possible that an Italian speaker will prefer the short scale, especially if they're working bilingually. They want to override just the one default parameter. Should it really be the implementation's problem to repeatedly and explicitly pass that information to each parser and formatter? It's particularly problematic for skill authors, who are invoking LF functions by lang code, and relying on Mycroft to know the details, which then relies on LF.
The text was updated successfully, but these errors were encountered: