Socket
Book a DemoInstallSign in
Socket

detectlanguage

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detectlanguage

Language Detection API Client

pipPyPI
Version
1.5.0
Maintainers
1

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.

Keywords

language

FAQs

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.