Skip to main content

Low Resource NLTK

Project description

LowResNLTK

A low-resource Natural Language Processing toolkit.

Quick Inference Without Training

Pretrained model achieved an F1 Score of 97% in all classes.

POS Tagging

from lowresnltk import POSTagger

# Simple usage
tags = POSTagger.tag('আমি ভালো আছি')

Sentence Classification

from lowresnltk import SentenceClassifier

# Simple usage
label = SentenceClassifier.classify('আমি ভালো আছি')

Training Custom Models

Data Format Requirements

Column Description Example
Sentence Full Bengali sentence সন্ধ্যায় পাখিরা বাসায় ফেরে
Labels Sentence type Simple
POS List of POS tags ['ক্রিয়া', 'বিশেষ্য', 'বিশেষ্য', 'অব্যয়']
Words List of words ['সন্ধ্যায়', 'পাখিরা', 'বাসায়', 'ফেরে']

Example Dataset: https://huggingface.co/datasets/abkafi1234/POS-Sentence-Type

The code is Language Agnostic So Any Language will work. if the proper structure is followed

Train POS Tagger

import pandas as pd
from lowresnltk import POSTagger

# Load your data
data = pd.read_csv('Bangla.csv')

# Initialize and train
pt = POSTagger(data)
pt.train()

# Test prediction
result = pt.predict('আমি ভালো আছি')

Train Sentence Classifier

from lowresnltk import SentenceClassifier

# Load your data
data = pd.read_csv('Bangla.csv')

# Initialize and train
sc = SentenceClassifier(data=data)
sc.train()
result = sc.predict('আমি ভালো আছি')

Text Normalization Evaluator

A Unified Multi-Metric Framework for Evaluating Semantic Fidelity in Text Normalization*

Evaluate how stemming or lemmatization algorithms affect your text both structurally and semantically, beyond just compression ratios.

Python Example

from lowresnltk import NormalizationEvaluator
from sentence_transformers import SentenceTransformer
from sklearn.ensemble import RandomForestClassifier

# 1. Prepare your parallel datasets and labels
original_texts = ["The quick brown foxes are jumping.", "Beautifully painted canvases."]
normalized_texts = ["The quick brown fox be jump.", "Beauti paint canvas."]
labels = [0, 1]

# 2. Setup your evaluation models
classifiers = [RandomForestClassifier()]
embedding_model = SentenceTransformer("csebuetnlp/banglabert") 

# 3. Initialize and run the evaluator
evaluator = NormalizationEvaluator(
    texts_original=original_texts,
    texts_normalized=normalized_texts,
    labels=labels,
    classifiers=classifiers,
    embedding_model=embedding_model
)

# Returns CR, IRS, AES, ANLD, and MPD scores
results = evaluator.evaluate_all()
print(results)

Model Configuration

Default model paths:

  • POS Tagger: ~/.lowresnltk/POSModel/
  • Classifier: ~/.lowresnltk/ClassifierModel/

Installation

pip install lowresnltk

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lowresnltk-1.1.9.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lowresnltk-1.1.9-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file lowresnltk-1.1.9.tar.gz.

File metadata

  • Download URL: lowresnltk-1.1.9.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lowresnltk-1.1.9.tar.gz
Algorithm Hash digest
SHA256 53f8f8ce7d0b2c390ad97b8702d238085789f46e4bc4544674386c37abc7815a
MD5 f1b7c985bc9136917f800f6af2e1b8ca
BLAKE2b-256 16516d31962ca43b63f864b3501bcd9c816d3f1498afaa81218812b47e7215a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for lowresnltk-1.1.9.tar.gz:

Publisher: main.yml on abkafi1234/lowresnltk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lowresnltk-1.1.9-py3-none-any.whl.

File metadata

  • Download URL: lowresnltk-1.1.9-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lowresnltk-1.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 0f3e9fbd0086a5bffc04538fe54bfc57ea42a6a3e46ce68b5cd62eee1c33e39c
MD5 da238fe5acf36a864aefc60ba019d943
BLAKE2b-256 579f4c317c821e0b90ce2849910a558fec4cd4dc1fb0953d8e175da1f91c7d2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lowresnltk-1.1.9-py3-none-any.whl:

Publisher: main.yml on abkafi1234/lowresnltk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page