Skip to main content

ftlid

A simple answer to your language identification needs, powered by fastText. It wraps the language identification model in a small Python package for easier use.

Install

pip install ftlid

Example

from ftlid import identify_language, load_model

# prints 'en'
print(identify_language('Hello, how are you?'))

# prints (['en'], array([0.99987388]))
print(identify_language('Hello, how are you?', with_prob=True))

# prints ['en', 'de']
print(identify_language('And then he said "Ich liebe dich"!', k=2))

# prints (['en', 'de'], array([0.50208992, 0.30427793]))
print(identify_language('And then he said "Ich liebe dich"!', with_prob=True, k=2))

# if you want to use your custom model
print(identify_language('Hello, how are you?', model_path='model.ftz'))

# if you would like to pass the model yourself or prevent it from being loaded on every request
model = load_model('model.ftz')
print(identify_language('Hello, how are you?', model=model))

License

Licensed under the MIT license (see LICENSE file for more details).

Metadata

Release files for ftlid 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ftlid 0.1.2
File Size Uploaded
ftlid-0.1.2.tar.gz 782.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ftlid 0.1.2
File Interpreter ABI Platform
ftlid-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 1.6 MB

Release files / ftlid-0.1.2.tar.gz

Download URL ftlid-0.1.2.tar.gz
Size 782.3 kB
Tags Source
SHA-256 checksum
How to use checksums
746c1cdbb3fc921b19ad355f41e63857793a66fa3a4d836216627eb2afeeca6a
BLAKE2b-256 checksum
How to use checksums
8117e7373a81b508f8db6878dbf97b010f2c0ef336006a4e5115c667409c5f53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.17 CPython/3.7.4 Linux/5.4.12-200.fc31.x86_64

Release files / ftlid-0.1.2-py3-none-any.whl

Download URL ftlid-0.1.2-py3-none-any.whl
Size 780.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cad346581d795399dc2341f199d9ffc70c61182c8ce72da0c626a18e38353646
BLAKE2b-256 checksum
How to use checksums
108ee52fd090d8f1801da24b85aeca3b4c40d3e6327b3ce08440515655ccd04b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.17 CPython/3.7.4 Linux/5.4.12-200.fc31.x86_64

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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