Lingua-franca

Latest version: v0.4.3

Safety actively analyzes 619231 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

0.4.2

**v0.4.2** contains no breaking changes.

Features

New Languages

* Farsi support added by HKalbasi

0.4.1

**v0.4.1** is an administrative release. It contains no code changes.

On pypi, it also contains the skipped v0.4.0 release. v0.4.0 release notes follow:


**v0.4.0** drops support for Python 3.5, which is EOL. On current versions of Python, this release contains no breaking changes.

Features

New Languages
* Catalan support added by jmontane
* Slovenian formatters added by filips123

Functionality
* `lingua_franca.config` - **will break in v0.5.0** (see note)
- Adds a `config` file, currently containing one variable, `load_langs_on_demand`
- When `lingua_franca.config.load_langs_on_demand` is `True`, LF will allow you to call functions in languages which aren't loaded. In those cases, it will load the language you've called, run the function, and then unload the language. This has pros and cons. Memory consumption is reduced, and you can call LF functions without knowing the language ahead of time, but it's computationally slower than loading the language up front. This is not intended for voice assistants, though a skill or a plugin might use it at its peril.

**NOTE**: `lingua_franca.config` was originally proposed as a proper API, in issue 128. It was temporarily introduced this way because the absence of `load_langs_on_demand` was blocking certain use cases. Work on the full interface has already begun, and is slated for release in LF v0.5.0. Implementations needing this functionality should expect and be prepared for the interface to change in the future.

For reference, the permanent API is represented in PR 185, and will likely be: `lingua_franca.config.set('load_langs_on_demand', True)`

* **(Internal/localization API)** New decorator:`lingua_franca.internal.lookup_variant()` (`lookup_variant(...)`)

Native support for enum parameters in localized functions

A sane parameter in the wrapped function, specified by a sane parameter in the wrapper, will be mapped to an enum, permitting downstream users to call the function without examining a localization's source. The original use case was for localizations that have many ways of expressing the time; coders should be able to specify this using sensibly-named strings, rather than learning about an internal `TimeVariant` enum and its possible values.

See the docstring for a clearer demonstration, and lang/format_ca.py for an example in action.

Language-specific:
* French: Adds support for `extract_duration()` and datetime formatters (courtesy bboutier)
* Dutch: Improves support for `extract_duration()` (courtesy bartdw)
* Polish: Adds support for relative dates, improves support for datetime-related terms (courtesy r0d0dendr0n)
* English: Improves support for ordinal numbers: `extract_number(n, ordinals=True)` returns more intuitive output. Improvements ongoing.

Bugfixes
* Fixed: `parse.extract_datetime()` was not normalizing numbers
* Fixed: `parse.extract_duration()` was not preserving case
* Fixed: English normalizer mishandled multi-word numbers, especially as digits ("four thirty seven" --> 437, not [4, 30, 7])
* Fixed: Localized function wrapper was performing an unnecessary, mildly expensive sanity check every time it was called, even though it only needs to be run when a certain parameter is a nondefault value

Housekeeping
* Lingua Franca CI moved to GitHub Actions
* Lingua Franca will no longer install its tests at setup, nor package them on pypi. They remain in source distributions.

Credits
Any contributors to this release who were not mentioned inline should contact the maintainers, so we can edit these release notes (where possible) to reflect your contributions!

Core maintainers for this release cycle were:
krisgesling
JarbasAl
ChanceNCounter

0.4.0

**v0.4.0** drops support for Python 3.5, which is EOL. On current versions of Python, this release contains no breaking changes.

Features

New Languages
* Catalan support added by jmontane
* Slovenian formatters added by filips123

Functionality
* `lingua_franca.config` - **will break in v0.5.0** (see note)
- Adds a `config` file, currently containing one variable, `load_langs_on_demand`
- When `lingua_franca.config.load_langs_on_demand` is `True`, LF will allow you to call functions in languages which aren't loaded. In those cases, it will load the language you've called, run the function, and then unload the language. This has pros and cons. Memory consumption is reduced, and you can call LF functions without knowing the language ahead of time, but it's computationally slower than loading the language up front. This is not intended for voice assistants, though a skill or a plugin might use it at its peril.

**NOTE**: `lingua_franca.config` was originally proposed as a proper API, in issue 128. It was temporarily introduced this way because the absence of `load_langs_on_demand` was blocking certain use cases. Work on the full interface has already begun, and is slated for release in LF v0.5.0. Implementations needing this functionality should expect and be prepared for the interface to change in the future.

For reference, the permanent API is represented in PR 185, and will likely be: `lingua_franca.config.set('load_langs_on_demand', True)`

* **(Internal/localization API)** New decorator:`lingua_franca.internal.lookup_variant()` (`lookup_variant(...)`)

Native support for enum parameters in localized functions

A sane parameter in the wrapped function, specified by a sane parameter in the wrapper, will be mapped to an enum, permitting downstream users to call the function without examining a localization's source. The original use case was for localizations that have many ways of expressing the time; coders should be able to specify this using sensibly-named strings, rather than learning about an internal `TimeVariant` enum and its possible values.

See the docstring for a clearer demonstration, and lang/format_ca.py for an example in action.

Language-specific:
* French: Adds support for `extract_duration()` and datetime formatters (courtesy bboutier)
* Dutch: Improves support for `extract_duration()` (courtesy bartdw)
* Polish: Adds support for relative dates, improves support for datetime-related terms (courtesy r0d0dendr0n)
* English: Improves support for ordinal numbers: `extract_number(n, ordinals=True)` returns more intuitive output. Improvements ongoing.

Bugfixes
* Fixed: `parse.extract_datetime()` was not normalizing numbers
* Fixed: `parse.extract_duration()` was not preserving case
* Fixed: English normalizer mishandled multi-word numbers, especially as digits ("four thirty seven" --> 437, not [4, 30, 7])
* Fixed: Localized function wrapper was performing an unnecessary, mildly expensive sanity check every time it was called, even though it only needs to be run when a certain parameter is a nondefault value

Housekeeping
* Lingua Franca CI moved to GitHub Actions
* Lingua Franca will no longer install its tests at setup, nor package them on pypi. They remain in source distributions.

Credits
Any contributors to this release who were not mentioned inline should contact the maintainers, so we can edit these release notes (where possible) to reflect your contributions!

Core maintainers for this release cycle were:
krisgesling
JarbasAl
ChanceNCounter

0.3.1

**Hotfix**: Patches a severe bug in v0.3.0 causing default arguments to throw DeprecationWarnings.

**Also fixed**:
- Czech tests were re-running tests from other languages (Tony763)
- Hard-to-reach bug in a warning routine
- Ensure key files are included in source distribution packages

0.3.0

v0.3.0 of Lingua Franca brings a significant restructure to the code base courtesy of ChanceNCounter. This provides a strong basis for adding new languages and expanding the available functions.

Anyone interested in contributing to Lingua Franca, please see the new [project-structure.md](https://github.com/MycroftAI/lingua-franca/blob/master/project-structure.md). This covers the new file structure, how to add localized versions of existing functions, and how to add new top-level functions. The primary [README.md](https://github.com/MycroftAI/lingua-franca/blob/master/readme.md#lingua-franca) also contains a detailed step by step guide to get started contributing to the project.

This version also brings initial support for the Polish language, courtesy of rafaljanicki.

**Breaking change:**
- You must now explicitly load one or more languages. Functions will default to whichever language is loaded first, unless a new default is specified.

python3
lingua_franca.load_language('en') 'primary' lang code (package's terminology)
lingua_franca.load_language('pt-pt') full lang code
lingua_franca.load_languages(['en', 'es']) multiple languages at once, first will be default
lingua_franca.set_default_lang('es') self-explanatory

**Deprecated:**
- Explicitly passing `None` for arguments (eg `lang=None`) in order to fallback to a default is no longer supported. This was previously included to handle some edge case in Mycroft-core that no longer exists. If no `lang` is passed then the default language will be used.
- Direct imports from `lingua_franca.lang` have been deprecated. Getter and setter methods are now available to perform these functions.

**Other:**
- Code is now tested against Python 3.9. Please note that Python 3.5 support will soon be dropped as it has reached end of life.
- Thanks also to YuukanOO for improvements to `extract_number()` across a number of languages.

0.2.3

This is the final v0.2.x release and provides a few improvements and fixes that are fully compatible with prior versions. The next v0.3.0 release will include a major refactor so upgrades from this release should be well tested.

Improvements:
* `extract_duration()` runtime reduced by combining regexes (fixed by maxbachmann in PR 124)
* Installation instructions clarified to suggest the users install `wheel` and `pytest` (by adocampo in PR 115)

Fixes:
* A debug print left in the code by mistake (fixed by maxbachmann in PR 123)
* SyntaxWarning caused by inappropriate use of 'is' in a formatter (fixed by PureTryOut in PR 127)

Typos:
* German translations of "eighteen" and "eighty" were misspelled (fixed by domcross in PR 129)

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.