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.2a4

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.2a4
File Size Uploaded
ovos_lang_detector_classics_plugin-0.0.2a4.tar.gz 6.2 kB Details

Built distribution (wheel)

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

Total release size: 13.9 kB

Release files / ovos_lang_detector_classics_plugin-0.0.2a4.tar.gz

Download URL ovos_lang_detector_classics_plugin-0.0.2a4.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0649ee72b4ff3da7b3c3007f14682eb7ee11c093b09ea9541180aec7e16432a4
BLAKE2b-256 checksum
How to use checksums
b1e5042334460e656892a9bbf778b2fada7d286bd6d96c73cc08017785e8b195
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.2a4-py3-none-any.whl

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