Skip to main content
Pre-release

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

ovos-lang-detect-plugin-linguonnx

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

Install

pip install ovos-lang-detect-plugin-linguonnx

The model downloads from HuggingFace on first use and is cached under ~/.cache/linguonnx/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-linguonnx",
    "ovos-lang-detect-plugin-linguonnx": {
      "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.

linguonnx 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 linguonnx'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_linguonnx-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_linguonnx-0.1.0a1.tar.gz.

File metadata

File hashes

Hashes for ovos_lang_detect_plugin_linguonnx-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 4e44b5d38618fae7f642916f4b682ad1046275198ebf8e16facf798d385499f0
MD5 1146c91ed3215bd184db7a1ff80cba66
BLAKE2b-256 b09f85abfddec6ccdf273f15329938c20c7344c70b20ae0d77e5a4fdc7beda11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ovos_lang_detect_plugin_linguonnx-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 167507d3de84828cb22e3187f1f1acfe79785830676c0c7080b4ceef8e8172cd
MD5 855b5cd6fda0e311fa2e8c3729a9b687
BLAKE2b-256 b621cd33c5860d75b11ea224c01412b98ed26b53db29079b1265d4cef576891a

See more details on using hashes here.

Supported by

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