Skip to main content

# lang-detect: a tool to detect language

Detecting the language for a small piece of unicode text without any dependency to other libraries.

Currently we support detecting de, en, es, fr, it, ja, nl, pl, ru, zh-hans, zh-hant, and zh-yue.

After some simple testing, we found that the result for long sentence is better.

## Method

We focus on the Basic Multilingual Plane in unicode encoding, and current language support set could be extended.

For each language, we use a uniformed ngram vector to represent the language itself. This vector can be seen at the data folder.

When we detect a text, we generate the uniformed ngram vector for this text, and just comparing the cosine value of the angle between the text vector and the language vector.

To get the language vector, we use feature articles on Wikipedia as corpus.

## Usage

cd to the project root

bin/langdetect YOUR_SENTENCE_HERE

Metadata

Release files for lang-detect 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for lang-detect 0.0.1
File Interpreter ABI Platform
lang_detect-0.0.1-py2.6.egg Legacy Egg format - - Details

Release files / lang_detect-0.0.1-py2.6.egg

Download URL lang_detect-0.0.1-py2.6.egg
Size 1.4 kB
Tags Egg
SHA-256 checksum
How to use checksums
c1fa4a594eab61f1d2cbf9fece10f91cd5b507a7155410764c8b579c4c6e8a09
BLAKE2b-256 checksum
How to use checksums
ce63a28dd6e7a709c6d758d70cc6690b834dc769300960affd1621cbacd170c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page