Skip to main content

Language Detection API Client

Project description

Detect Language API Python Client

PyPI version Build Status

Detects language of given text. Returns detected language codes and scores.

Before using Detect Language API client you have to setup your personal API key. You can get it by signing up at https://detectlanguage.com

Installation

pip install detectlanguage

Upgrading

When upgrading please check changelog for breaking changes.

Configuration

import detectlanguage

detectlanguage.configuration.api_key = "YOUR API KEY"

# You can use proxy if needed
# detectlanguage.configuration.proxies = {'https': 'https://user:pass@proxy:8080'}

Usage

Detect language

detectlanguage.detect("Dolce far niente")

Result

[{'language': 'it', 'score': 0.5074}]

Detect single code

If you need just a language code you can use detect_code.

detectlanguage.detect_code("Dolce far niente")

Result

'it'

Batch detection

It is possible to detect language of several texts with one request. This method is faster than doing one request per text.

detectlanguage.detect_batch(["Dolce far niente", "Hello world"])

Result

Result is array of detections in the same order as the texts were passed.

[[{'language': 'it', 'score': 0.5074}], [{'language': 'en', 'score': 0.9098}]]

Get your account status

detectlanguage.account_status()

Result

{ 'status': 'ACTIVE', 'daily_requests_limit': 5000, 'daily_bytes_limit': 1048576,
  'bytes': 3151, 'plan': 'FREE', 'date': '2014-03-29', 'requests': 263,
  'plan_expires': None }

Get list of supported languages

detectlanguage.languages()

Result

[{'code': 'aa', 'name': 'Afar'}, {'code': 'ab', 'name': 'Abkhazian'}, ...]

License

Detect Language API Python Client is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.

Project details


Download files

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

Source Distribution

detectlanguage-2.0.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

detectlanguage-2.0.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file detectlanguage-2.0.0.tar.gz.

File metadata

  • Download URL: detectlanguage-2.0.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for detectlanguage-2.0.0.tar.gz
Algorithm Hash digest
SHA256 2746b629744b9603156df4bd528e09506be49c00edaa2ee02310181ba221c76c
MD5 c2975297660c880dd8bb098fe0d8cb00
BLAKE2b-256 d2673a3b478b85a4f989062a9d2f16e26c4a2e358e60fb62a606c75b4b64e8db

See more details on using hashes here.

Provenance

The following attestation bundles were made for detectlanguage-2.0.0.tar.gz:

Publisher: publish.yml on detectlanguage/detectlanguage-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file detectlanguage-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: detectlanguage-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for detectlanguage-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24fe10946284e113d34267b8026c388df291e1d94f922d2c55b6a79fedaed68d
MD5 0754538a442b0e6219cf4eef37012c5c
BLAKE2b-256 8bcb18fa7f4451855645a70c2d757c22eeaed8b23a3c633b150db11d85f874c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for detectlanguage-2.0.0-py3-none-any.whl:

Publisher: publish.yml on detectlanguage/detectlanguage-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page