Skip to main content

Text language identifier

This package serves as a wrapper for the most performant text language identifier.

Currently it wraps fasttext (NLLB version).

Before detecting the language, it preprocesses the text to improve results.

Usage

%pip install textlangid

import textlangid

lang = textlangid.detect("This is some text.")

top_languages = TextLanguageIdentifier.detect(text, top_k=3)

top_languages_with_confidence = TextLanguageIdentifier.detect(
        text, top_k=3, return_confidence=True
    )

top_languages_with_threshold = TextLanguageIdentifier.detect(
        text, top_k=3, return_confidence=True, confidence_threshold=0.2
    )

The language is returned in a FLORES-200 language code. Full list available here.

Download files

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

Source Distribution

textlangid-0.0.7.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

textlangid-0.0.7-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file textlangid-0.0.7.tar.gz.

File metadata

  • Download URL: textlangid-0.0.7.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for textlangid-0.0.7.tar.gz
Algorithm Hash digest
SHA256 8ae0a84532bb5b1027fa4d2ca263d6e0cbcd00a94d39338a3d1a90672ac554cd
MD5 8e47b3c7d1c424df543c426a3430f06f
BLAKE2b-256 1d5abe0c24cc44f1218b5e41fce45c00c5b23c92d0942246516144e90c91a6e8

See more details on using hashes here.

File details

Details for the file textlangid-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: textlangid-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for textlangid-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7ff35369cdbe95bbc7d8e46ad7df00de75a1bff6e2f363041701e9b96ef38dea
MD5 40a2b7c1d0a8232d85f7057ebc70144b
BLAKE2b-256 264ca39fc77d359481297d04d565dd4b8952a7bdee23d3c429538ffcf965bd28

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.1

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