Metadata-Version: 2.4
Name: ovos-plugin-linguonnx
Version: 0.3.2a2
Summary: OVOS language detection and translation plugins using linguonnx (ONNX, offline)
Author-email: jarbasAi <jarbasai@mailfence.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/OpenVoiceOS/ovos-plugin-linguonnx
Project-URL: linguonnx, https://github.com/OpenVoiceOS/linguonnx
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: linguonnx>=0.12.0a1
Requires-Dist: ovos-plugin-manager<3.0.0,>=2.1.0
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Dynamic: license-file

# ovos-plugin-linguonnx

OVOS language plugins built on
[`linguonnx`](https://github.com/OpenVoiceOS/linguonnx). One package, two
plugins, both CPU-only on `onnxruntime`, both fully offline after the models
are cached, neither needs torch:

| Plugin | Entry point group | Plugin id |
|---|---|---|
| `LinguONNXLangDetectPlugin` | `opm.lang.detect` | `ovos-lang-detect-plugin-linguonnx` |
| `LinguONNXTranslatePlugin` | `opm.lang.translate` | `ovos-translate-plugin-linguonnx` |

## Install

```bash
pip install ovos-plugin-linguonnx
```

Models download from HuggingFace on first use and are cached under
`~/.cache/linguonnx/models/<model_id>/`. Constructing either plugin does not
trigger a download; the first real call does. On a server, prefetch instead —
see [Prefetching](docs/translation.md#prefetching).

## Usage

```python
from ovos_plugin_linguonnx import LinguONNXLangDetectPlugin, LinguONNXTranslatePlugin

det = LinguONNXLangDetectPlugin()
det.detect("bom dia")   # 'pt'

tx = LinguONNXTranslatePlugin()
tx.translate("Good morning", target="gl", source="en")
```

## Documentation

- [docs/language-detection.md](docs/language-detection.md) — detection
  config, model choice, and language varieties.
- [docs/translation.md](docs/translation.md) — translation config, routing,
  and prefetching.
- [docs/configuration.md](docs/configuration.md) — the full translation
  config reference, including the size/fallback routing budget.
- [docs/docker.md](docs/docker.md) — running both plugins as a server image.
- [docs/deployment.md](docs/deployment.md) — cache mounts, prefetching, memory
  sizing, and the verification checklist for a production service.
- [docs/errors.md](docs/errors.md) — what `translate()` raises and how to
  map it to HTTP status codes.

## Credits

- [linguonnx](https://github.com/OpenVoiceOS/linguonnx) — the detection and
  translation engine this package wraps.
- [TigreGotico/glotlid-onnx](https://huggingface.co/TigreGotico/glotlid-onnx) —
  the ONNX export of GlotLID that `linguonnx` runs for detection.
