Skip to main content

Low-Resource NLP Toolkit

Python tools for multilingual text preparation, code-switching analysis, emotion labels, and classification evaluation.

Version: 0.4.0.

Installation

From the source directory:

python -m pip install .
low-resource-nlp --version

Routing

Define the languages you want to recognise in a JSON profile. Give each language a code and a name, then add words or distinctive characters to match. Describe the material used to build the profiles and check its reuse conditions.

The example at examples/profiles.json defines two routes, a and b, using a small test vocabulary:

low-resource-nlp route "alpha amber" --profiles examples/profiles.json
low-resource-nlp audit "alpha beta" --profiles examples/profiles.json

Replace the example path with the path to your language profiles when processing your text. The Python API reads the same JSON format:

from low_resource_nlp import LexicalLanguageRouter, audit_code_switching, load_profiles

router = LexicalLanguageRouter(load_profiles("examples/profiles.json"))
route = router.route_selectively("alpha amber", min_score_margin=0.75)
result = audit_code_switching("alpha beta", router=router)
print(route.accepted_language_code)
print(result.to_aggregate_dict())

With mixed-language text, you can see which words match each language profile and where the suggested language changes within a sentence. Test your profiles and thresholds against labelled examples from the setting where you plan to use the toolkit.

Text and emotion labels

low-resource-nlp normalise "ALPHA @user https://example.org"
low-resource-nlp label joy
low-resource-nlp label '0.5#0.7' --scale-min 0 --scale-max 1 --source 'my dataset' --perspective reader

Category names remain distinct unless a caller supplies a mapping. Dimensional ratings require a scale, source, and annotation perspective. See Emotion labels and ratings.

Evaluation

classification_report reports class-level metrics and a confusion matrix. selective_classification_report reports coverage and accuracy among accepted records. Undefined metrics use None in Python and null in JSON. The corpus tutorial describes routing a CSV or JSONL file.

The evaluate command requires a non-empty CSV or JSONL file with label and prediction fields. Use --truth-field and --prediction-field for other column names. Missing, null, blank, structured, or non-finite labels are rejected before scoring; numeric zero is a valid label.

Migration

The route and audit commands take a --profiles path. In Python, construct LexicalLanguageRouter(load_profiles(path)) and pass the router to audit_code_switching. Replace calls to LexicalLanguageRouter.default() with this pattern. Use aliases for category mappings and coordinates with a RatingScale for dimensional values. Remove imports of the old category-list constant.

Earlier benchmark results concern version 0.3.0. See the historical benchmark for the original version and sources.

Checks

make check
mkdocs build --strict
python -m build

Metadata

Release files for low-resource-nlp-toolkit 0.4.0

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

Source distribution (sdist)

Source distribution for low-resource-nlp-toolkit 0.4.0
File Size Uploaded Provenance Actions
low_resource_nlp_toolkit-0.4.0.tar.gz 46.3 kB Without provenance Details for low_resource_nlp_toolkit-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for low-resource-nlp-toolkit 0.4.0
File Interpreter ABI Platform Actions
low_resource_nlp_toolkit-0.4.0-py3-none-any.whl Python 3 none any Details for low_resource_nlp_toolkit-0.4.0-py3-none-any.whl

Total release size: 67.3 kB

Release files / low_resource_nlp_toolkit-0.4.0.tar.gz

Download URL low_resource_nlp_toolkit-0.4.0.tar.gz
Size 46.3 kB
Tags Source
SHA-256 checksum
How to use checksums
396d4cd3a2148b665274343e3742e81f6d30de08e87a045a8d445d8fb0cbf67d
BLAKE2b-256 checksum
How to use checksums
0c231c474d5fb6ad28635222c01295f19f81fce48a185b5e5eb0c8458aef9f70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / low_resource_nlp_toolkit-0.4.0-py3-none-any.whl

Download URL low_resource_nlp_toolkit-0.4.0-py3-none-any.whl
Size 21.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
705dc66b19a4cdeb54c9d6ad2598699014c4068fd76cb8b119d2e03b53954911
BLAKE2b-256 checksum
How to use checksums
970049f1c2e5b229aa139839f060cc2f289c4314da09a0545c213512ad8287fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for low-resource-nlp-toolkit 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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