Skip to main content

heliport

License PyPi-version Python-version Supported-languages

A language identification tool which aims for both speed and accuracy, with support for 220 languages(or add your own languages!).

This tool is an efficient HeLI-OTS port to Rust, achieving 25x speedups while having almost identical output.

Installation

From PyPi

Install it in your environment

pip install heliport

NOTE: Since version 0.8 models do not need to be downloaded anymore.

From source

Install the requirements:

Clone the repo, build the package and binarize the model

git clone https://github.com/ZJaume/heliport
cd heliport
pip install .

Usage

CLI

Just run the heliport identify command that reads lines from stdin

cat sentences.txt | heliport identify
eng
cat
rus
...
Identify languages of input text

Usage: heliport identify [OPTIONS] [INPUT_FILE] [OUTPUT_FILE]

Arguments:
  [INPUT_FILE]   Input file, default: stdin
  [OUTPUT_FILE]  Output file, default: stdout

Options:
  -j, --threads <THREADS>                Number of parallel threads to use.
                                         0 means no multi-threading
                                         1 means running the identification in a separated thread
                                         >1 run multithreading [default: 0]
  -b, --batch-size <BATCH_SIZE>          Number of text segments to pre-load for parallel processing [default:
                                         100000]
  -c, --ignore-confidence                Ignore confidence thresholds. Predictions under the thresholds will not be
                                         labeled as 'und'
  -s, --print-scores                     Print confidence score (higher is better) or raw score (lower is better) in
                                         case '-c' is provided
  -n, --not-strict                       Do not be strict when loading confidence thresholds (do not fail if one
                                         language is missing)
  -p, --precision <PRECISION>            Number of decimals precision when printing scores [default: 4]
  -m, --model-dir <MODEL_DIR>            Model directory containing binarized model or plain text model. Default is
                                         Python module path or './LanguageModels' if relevant languages are requested
  -l, --relevant-langs <RELEVANT_LANGS>  Load only relevant languages. Specify a comma-separated list of language
                                         codes. Needs plain text model directory
  -h, --help                             Print help

Python package

>>> from heliport import Identifier
>>> i = Identifier()
>>> i.identify("L'aigua clara")
'cat'

For further information of the avaliable functions and parameters, please take a look at the module docs:

>>> import heliport
>>> help(heliport)

Rust crate

use std::path::PathBuf;
use heliport::identifier::Identifier;
use heliport::lang::Lang;

let identifier = Identifier::load(
    PathBuf::from("/path/to/model_dir",
    None,
    );
let lang, score = identifier.identify("L'aigua clara");
assert_eq!(lang, Lang::cat);

Differences with HeLI-OTS

Although heliport currently uses the same models as HeLI-OTS 2.0 and the identification algorithm is almost the same, there are a few differences (mainly during pre-processing) that may cause different results. However, in most case, these should not deacrease accuracy and should not happen frequently.

Note: Both tools have a pre-processing step for each identified text to remove all non-alphabetic characters.

The implementation differences that can change results are:

  • HeLI during preprocessing removes urls and words beginning with @, while heliport does not.
  • Since 1.5, during preprocessing, HeLI repeats every word that does not start with capital letter, This is probably to penalize proper nouns. However, in our tests, we have not find a significant improvement with this. Therefore,to avoid multiplying the cost of prediction by almost x2, this has not been implemented. In the future it might end up being implemented if there is need for it and can be implemented efficiently.
  • Rust and Java implementations have small precision differences due to Rust accumulating probabilities with double precision floats.

Benchmarks

Speed benchmarks with 100k random sentences from OpenLID, all the tools running single-threaded:

tool time (s)
CLD2 1.12
HeLI-OTS 60.37
lingua all high preloaded 56.29
lingua all low preloaded 23.34
fasttext openlid193 8.44
heliport 2.33

Connecting Europe Facility

All documents and software contained in this repository reflect only the authors' view. The Innovation and Networks Executive Agency of the European Union is not responsible for any use that may be made of the information it contains.

Metadata

Release files for heliport 1.0.0

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

Built distributions (wheels)

Table of built distributions (wheels) for heliport 1.0.0
File
heliport-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
heliport-1.0.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
heliport-1.0.0-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details
heliport-1.0.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
heliport-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
heliport-1.0.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
heliport-1.0.0-cp311-cp311-macosx_10_12_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64 Details
heliport-1.0.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
heliport-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details

Total release size: 785.4 MB

Release files / heliport-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL heliport-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 87.4 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
530172e48b8d0be22a5086b330c40b229b54c9f0735c8f81659bee66a8db4e68
BLAKE2b-256 checksum
How to use checksums
8f6c49f984c4f60a5e146da4ba4b260f822aed144b2cec4027d22bce35822cdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / heliport-1.0.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL heliport-1.0.0-cp312-cp312-macosx_11_0_arm64.whl
Size 87.2 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f6677a372191a782055206ba4eea3b7f2901211be4f2d6ac4420ac424965f0b4
BLAKE2b-256 checksum
How to use checksums
8687f26cd5985f69bee69ac1ecc49e0b4d6e10112511b2a43cd2f618fbdd7ed6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / heliport-1.0.0-cp312-cp312-macosx_10_12_x86_64.whl

Download URL heliport-1.0.0-cp312-cp312-macosx_10_12_x86_64.whl
Size 87.3 MB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5734ada2021a6a706a82f969d7044df2a28f6a214550f9890a5d458c325a215c
BLAKE2b-256 checksum
How to use checksums
7eec1da453ad2efe898666e58ea758c6d01e58b3264f31abf1e26019b2cc5176
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / heliport-1.0.0-cp311-cp311-win_amd64.whl

Download URL heliport-1.0.0-cp311-cp311-win_amd64.whl
Size 87.1 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
223d72e6d2820d29182eba865e3db3d0c5eb1cc2b45cf42f7c85d4ea466923d7
BLAKE2b-256 checksum
How to use checksums
0e49d700c6dfa43706f0c7f622cb57b9959c83d33a022644715d24783f605171
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / heliport-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL heliport-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 87.4 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e06b3a160bddcc54baf59341db27ba88bb38905a0bd692889ce33e5af714a5bf
BLAKE2b-256 checksum
How to use checksums
fef545aa963b13efeeecd1f908bcabd67f44cb092e55c58b7bb0eac066dfb4cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / heliport-1.0.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL heliport-1.0.0-cp311-cp311-macosx_11_0_arm64.whl
Size 87.2 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
dd724271af661dd671cd174c031eb625d7cb67c31ff3f4581df276d53954cd6d
BLAKE2b-256 checksum
How to use checksums
351e7af90f613dd4d08e5a258160df6fab4cde8e208a37c16786a771f4d2869d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / heliport-1.0.0-cp311-cp311-macosx_10_12_x86_64.whl

Download URL heliport-1.0.0-cp311-cp311-macosx_10_12_x86_64.whl
Size 87.3 MB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0957021def05fe3bb558686e03c5d9c4770060ed8afb550ae5f9dd63355919ed
BLAKE2b-256 checksum
How to use checksums
a991fc5f754744cf1ece6ffe2ae241b8f7e5bb7b13074ef0326bae5eb7cb47c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / heliport-1.0.0-cp310-cp310-win_amd64.whl

Download URL heliport-1.0.0-cp310-cp310-win_amd64.whl
Size 87.1 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
e044b8bc3e62d7a4fb5b86493893cf0bf48786f315e2b4a7fa987ff5777da219
BLAKE2b-256 checksum
How to use checksums
9da829d3129da892f8244c906b5d8f31755592b91345410c4fe7371cff4f022b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / heliport-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL heliport-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 87.4 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d2643ca2a6e635949186a51bf1d820e8ed0779d2d8647074e8c54f91516569a1
BLAKE2b-256 checksum
How to use checksums
ae2710dd91ca8d7c5425a5bb09556daee81140d271cce5f2627e0c7707089e96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

1.0.1

13 release files

This release

1.0.0 This release

9 release files

0.7.0

8 release files

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