
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
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
pip install detectlanguage
When upgrading please check changelog for breaking changes.
import detectlanguage
detectlanguage.configuration.api_key = "YOUR API KEY"
# You can use proxy if needed
# detectlanguage.configuration.proxies = {'https': 'https://user:pass@proxy:8080'}
detectlanguage.detect("Dolce far niente")
[{'language': 'it', 'score': 0.5074}]
If you need just a language code you can use detect_code
.
detectlanguage.detect_code("Dolce far niente")
'it'
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 is array of detections in the same order as the texts were passed.
[[{'language': 'it', 'score': 0.5074}], [{'language': 'en', 'score': 0.9098}]]
detectlanguage.account_status()
{ 'status': 'ACTIVE', 'daily_requests_limit': 5000, 'daily_bytes_limit': 1048576,
'bytes': 3151, 'plan': 'FREE', 'date': '2014-03-29', 'requests': 263,
'plan_expires': None }
detectlanguage.languages()
[{'code': 'aa', 'name': 'Afar'}, {'code': 'ab', 'name': 'Abkhazian'}, ...]
Detect Language API Python Client is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
FAQs
Language Detection API Client
We found that detectlanguage demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.