Language Detection API Client
Project description
Detect Language API Python Client
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2746b629744b9603156df4bd528e09506be49c00edaa2ee02310181ba221c76c
|
|
| MD5 |
c2975297660c880dd8bb098fe0d8cb00
|
|
| BLAKE2b-256 |
d2673a3b478b85a4f989062a9d2f16e26c4a2e358e60fb62a606c75b4b64e8db
|
Provenance
The following attestation bundles were made for detectlanguage-2.0.0.tar.gz:
Publisher:
publish.yml on detectlanguage/detectlanguage-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
detectlanguage-2.0.0.tar.gz -
Subject digest:
2746b629744b9603156df4bd528e09506be49c00edaa2ee02310181ba221c76c - Sigstore transparency entry: 413545146
- Sigstore integration time:
-
Permalink:
detectlanguage/detectlanguage-python@83010d555bf454f2a2e0c7dbb55d1d580fe803e3 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/detectlanguage
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@83010d555bf454f2a2e0c7dbb55d1d580fe803e3 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24fe10946284e113d34267b8026c388df291e1d94f922d2c55b6a79fedaed68d
|
|
| MD5 |
0754538a442b0e6219cf4eef37012c5c
|
|
| BLAKE2b-256 |
8bcb18fa7f4451855645a70c2d757c22eeaed8b23a3c633b150db11d85f874c8
|
Provenance
The following attestation bundles were made for detectlanguage-2.0.0-py3-none-any.whl:
Publisher:
publish.yml on detectlanguage/detectlanguage-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
detectlanguage-2.0.0-py3-none-any.whl -
Subject digest:
24fe10946284e113d34267b8026c388df291e1d94f922d2c55b6a79fedaed68d - Sigstore transparency entry: 413545157
- Sigstore integration time:
-
Permalink:
detectlanguage/detectlanguage-python@83010d555bf454f2a2e0c7dbb55d1d580fe803e3 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/detectlanguage
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@83010d555bf454f2a2e0c7dbb55d1d580fe803e3 -
Trigger Event:
release
-
Statement type: