Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

OVOS Bidirectional Translation Plugin

This package holds two OVOS plugins: a UtteranceTransformer and a DialogTransformer. Together they let OVOS understand and answer in any language, even one the installed skills do not support directly.

This plugin is still in alpha.

Install

pip install ovos-bidirectional-translation-plugin

Language support in OVOS

This section is a refresher on how OVOS handles language.

  • A default language is set in mycroft.conf. This is the OVOS primary language. All skills, TTS plugins, and STT plugins must support it.
  • Extra languages can also be set in mycroft.conf. STT and TTS plugins in use must support these languages too. If an installed skill does not support one of them, OVOS ignores that skill for that language. Support can also be partial, per intent.
  • Skills register intents for each supported language. Together these intents define the languages OVOS can speak.
  • Each utterance carries an assigned language, through the session (message.context). OVOS picks this language from, in order of preference:
    • the default language, if nothing else is set
    • the wake word used
    • the language detected in speech (functional plugins for this exist, work is ongoing)
    • the language of a recognized user (not yet implemented)
    • the language set by the client application, for example a HiveMind satellite
{
  // Primary Language
  // Code is a BCP-47 identifier (https://tools.ietf.org/html/bcp47), lowercased
  "lang": "en-us",

  // Secondary languages will also have their resource files loaded into memory
  // but intents will only be considered if that lang is tagged with the utterance at STT step
  "secondary_langs": []
}

How it works

The ovos-utterance-translation-plugin plugin can detect the language of an utterance. When "verify_lang": true is set, it compares the detected language against the session language. This handles cases such as a chat platform where a user can write in any language and the session language may be wrong.

When "ignore_invalid_langs": true is set, the plugin ignores a detected language that is not one of the configured native languages, to guard against false detections. Otherwise, it fixes the session language to the detected one.

Language tags are compared by tag distance, the same rule the rest of OVOS applies. A regional variant counts as one of the native languages, so ar-SA is native when the system supports ar, and pt-BR is native when the system supports pt-PT. A macrolanguage member such as arz is a different language and is translated.

If the session language is not one of the native languages, the plugin translates the utterance to the primary language, so OVOS can understand it.

When "bidirectional": true is set, the ovos-dialog-translation-plugin plugin then translates OVOS dialogs back to the original session language. Otherwise OVOS answers in its primary language, even if the user spoke in a different one.

Prerequisites

This plugin needs a language detection plugin and a language translation plugin configured beforehand.

In ovos-docker, install this plugin in both ovos-core and ovos-audio, together with the translation plugins.

Recommended plugins:

{
  "language": {
    "detection_module": "ovos-lang-detect-ngram-lm",
    "translation_module": "ovos-translate-plugin-nllb",
    "ovos-translate-plugin-nllb": {
      "model": "nllb-200_600M_int8"
    }
  }
}

Configuration

{
  "utterance_transformers": {
    "ovos-utterance-translation-plugin": {
      "bidirectional": true,
      "verify_lang": false,
      "ignore_invalid_langs": true,
      "translate_secondary_langs": false
    }
  },
  "dialog_transformers": {
    "ovos-dialog-translation-plugin": {}
  }
}

Related projects

License

Apache-2.0. See LICENSE.

Release files for ovos-bidirectional-translation-plugin 0.1.4a2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ovos-bidirectional-translation-plugin 0.1.4a2
File Size Uploaded
ovos_bidirectional_translation_plugin-0.1.4a2.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ovos-bidirectional-translation-plugin 0.1.4a2
File Interpreter ABI Platform
ovos_bidirectional_translation_plugin-0.1.4a2-py3-none-any.whl Python 3 none any Details

Total release size: 21.9 kB

Release files / ovos_bidirectional_translation_plugin-0.1.4a2.tar.gz

Download URL ovos_bidirectional_translation_plugin-0.1.4a2.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
304dcce422bef9ee4b54af59cd54b14149a1421a5eac3635b3344e9d3a8a6087
BLAKE2b-256 checksum
How to use checksums
c9a09eb06181eea6288c18850bc98aaf5220f27f3823320dc4095601694492c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ovos_bidirectional_translation_plugin-0.1.4a2-py3-none-any.whl

Download URL ovos_bidirectional_translation_plugin-0.1.4a2-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6712ba0809ae9abd3c4fd6b7e6ddc5f693e7d8e602b3add28859a75290f7d7a4
BLAKE2b-256 checksum
How to use checksums
291bd2cb01ea8203c3272d751ad090e930a6e7213f979706ecd000bd4693ab9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page