Skip to main content
Pre-release

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

Lang Classifier Classics

This package provides OVOS language-detection plugins for four classic algorithms:

  • google/cld3: CLD3 is a neural network model for language identification.
  • aboSamoor/pycld2: CLD2 is a Naive Bayesian classifier. It detects over 80 languages.
  • kootenpv/fastlang: built on the NLTK stopword lists, without depending on NLTK itself.
  • Mimino666/langdetect: detects the language of a text with a naive Bayesian filter.

The package also provides a VotingLangDetectPlugin. This plugin runs the other plugins and averages their predictions. Each model has a different bias, so the average is usually more accurate than any single model. See docs/algorithms.md for details on each algorithm and the voting logic.

To use the plugins above, run pip install ovos-lang-detector-classics-plugin[all]. If you only need the voter plugin, skip the [all] flag.

NOTE: The voter plugin works with any lang-detect plugin, not only the ones listed above.

Configuration

Add this to mycroft.conf:

  "language": {
    "detection_module": "ovos-lang-detector-plugin-voter",
    
    "ovos-lang-detector-plugin-voter": {
        "weights": {
            "ovos-lang-detector-plugin-cld3": 0.8,
            "ovos-lang-detector-plugin-cld2": 0.8,
            "ovos-lang-detector-plugin-lingua-podre": 1.0,
            "ovos-lang-detector-plugin-langdetect": 1.0,
            "ovos-lang-detector-plugin-fastlang": 1.0,
        }
    }
    
  },

Usage

weights = {
    "ovos-lang-detector-plugin-cld3": 0.8,
    "ovos-lang-detector-plugin-cld2": 0.8,
    "ovos-lang-detector-plugin-lingua-podre": 1.0,
    "ovos-lang-detector-plugin-langdetect": 1.0,
    "ovos-lang-detector-plugin-fastlang": 1.0,
}
p = VotingLangDetectPlugin(config={"weights": weights})

for utt in ["hello world",
            "olá mundo",
            "hola mundo",
            "once upon a time there was a voice assistant",
            "era uma vez um assistente de voz"]:
    print(p.detect(utt))

Credits

The bundled plugins originally came from NeonGeckoCom but were never published on their own.

License

Apache-2.0

Metadata

Release files for ovos-lang-detector-classics-plugin 0.0.2a3

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-lang-detector-classics-plugin 0.0.2a3
File Size Uploaded
ovos_lang_detector_classics_plugin-0.0.2a3.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ovos-lang-detector-classics-plugin 0.0.2a3
File Interpreter ABI Platform
ovos_lang_detector_classics_plugin-0.0.2a3-py3-none-any.whl Python 3 none any Details

Total release size: 13.9 kB

Release files / ovos_lang_detector_classics_plugin-0.0.2a3.tar.gz

Download URL ovos_lang_detector_classics_plugin-0.0.2a3.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f80e4f566f8efbf9ce4e9ef22c1c923af6deb9d24f45c776024d43b0d4d5c05a
BLAKE2b-256 checksum
How to use checksums
a55beb626440f4ed3308db9af33b8d053596c78f12295d240c1556c282fae39f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ovos_lang_detector_classics_plugin-0.0.2a3-py3-none-any.whl

Download URL ovos_lang_detector_classics_plugin-0.0.2a3-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a94be6f38b2416e46ed6623c87ed996b4b9ae32187b3659b0d511f033ee79bb2
BLAKE2b-256 checksum
How to use checksums
b782bcef049287928fc5f85dbbaa055d74a089193a5908a33deb3433a76c4462
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