Skip to main content
Pre-release

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

ovos-lang-detect-plugin-lingonnx

An OVOS language-detection plugin. It wraps lingonnx, which runs the TigreGotico/glotlid-onnx export of GlotLID on onnxruntime, CPU-only, no torch.

Install

pip install ovos-lang-detect-plugin-lingonnx

The model downloads from HuggingFace on first use and is cached under ~/.cache/lingonnx/models/<model_id>/. Constructing the plugin does not trigger this download; it happens on the first call to detect, detect_probs, or available_languages.

Configuration

{
  "language_detection": {
    "module": "ovos-lang-detect-plugin-lingonnx",
    "ovos-lang-detect-plugin-lingonnx": {
      "model": "glotlid-int8",
      "collapse_varieties": true,
      "min_confidence": 0.0,
      "lang": "en-US"
    }
  }
}
  • model: "glotlid-int8" (default, quantized, 419 MB) or "glotlid" (fp32, 1.68 GB). Both cover the same 2102 GlotLID labels; the int8 model has no measured accuracy loss, so there is no reason to prefer the fp32 one unless you need it for some other purpose.
  • collapse_varieties: see below.
  • min_confidence: if the model's top confidence is below this, detect() returns self.config.get("lang", "en-US") instead of the detected tag. Default 0.0, meaning no fallback ever triggers.
  • lang: the fallback tag used when min_confidence isn't met. Default "en-US".

Language varieties

GlotLID identifies individual language varieties, not macrolanguages. Casual Arabic text comes back as e.g. ajp-Arab (South Levantine) rather than ar, and some Chinese text comes back as yue-Hani (Cantonese) rather than zh.

lingonnx itself defaults to reporting these varieties as-is, since that fine-grained answer is useful on its own (free dialect identification). This plugin flips the default to collapse varieties onto their macrolanguage (ajp-Arab -> ar), because the two things OVOS actually does with a detected language tag - picking a TTS voice, picking a translation target - only know macrolanguages. A caller getting ajp-Arab back from a pipeline that only ships ar voices would read it as unsupported.

Set collapse_varieties: false in the plugin config to get lingonnx's native per-variety fidelity instead.

Credits

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ovos_lang_detect_plugin_lingonnx-0.1.0a1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file ovos_lang_detect_plugin_lingonnx-0.1.0a1.tar.gz.

File metadata

File hashes

Hashes for ovos_lang_detect_plugin_lingonnx-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 e58de1be5e1a6bff417638b9b97e7894494af0d55633b5b8f91d257c8394bbd2
MD5 81cdb04fce3c1e398ff41f9d70459611
BLAKE2b-256 f4c0ad9e8b5568af4f8c70cdb3edc098c7f7df9a3e0ebc6500e31e8ff535b6af

See more details on using hashes here.

File details

Details for the file ovos_lang_detect_plugin_lingonnx-0.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for ovos_lang_detect_plugin_lingonnx-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 7325cf477386b17cc343ca3caeafd815bbf52ca53ee3e2645e84458096b1c0e3
MD5 ce2e51615a974b8d3c0e28b5ab372df6
BLAKE2b-256 71eca6b5dda095ddaaef336f66ddbee27ff36f01f6c942106c68ec4bb16dcf37

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0a1 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page