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-plugin-voter[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))

Related projects

Credits

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

License

Apache-2.0

Download files

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

Source Distribution

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_detector_classics_plugin-0.0.2a1.tar.gz.

File metadata

File hashes

Hashes for ovos_lang_detector_classics_plugin-0.0.2a1.tar.gz
Algorithm Hash digest
SHA256 f5693916fbbf657ce92b8ddde1e15f50d0cc2a97e40ffe5a30d2620d65191005
MD5 7fcc92cbb3df445fbe25a7ce45448a10
BLAKE2b-256 dccb2a06894a3c65a1220c605275a8a09440855d183edc4c47b2bd29baaf9b34

See more details on using hashes here.

File details

Details for the file ovos_lang_detector_classics_plugin-0.0.2a1-py3-none-any.whl.

File metadata

File hashes

Hashes for ovos_lang_detector_classics_plugin-0.0.2a1-py3-none-any.whl
Algorithm Hash digest
SHA256 1cfc4867ce32e05b66514b74a811ed2bc2c23a53220b5b40440fa3f596c2a95b
MD5 74a84535471d98063ce291df0b14b053
BLAKE2b-256 2e291edc3ff00f196209f7fb6a2da1b79d257b50823ae23ecf4fd2877a285dbb

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2a1 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