Skip to main content

A small and fast language identification model powered by fastText

Project description

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.


pip install ftlid


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))


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

Project details

Download files

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

Files for ftlid, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size ftlid-0.1.2-py3-none-any.whl (780.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size ftlid-0.1.2.tar.gz (782.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page