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.10.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.10-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lowresnltk-1.1.10.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.10.tar.gz
Algorithm Hash digest
SHA256 640e67554bd6316ac80dc519fa84485f9eeda41d6eb4e9ad1c1e95e80a2e1769
MD5 2550ecf43a2992e5a548ae72e5e0484e
BLAKE2b-256 07d372636fa1f0cf3311b0b9648248b0f2dc525fadbba29f29b43c01006b1a3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for lowresnltk-1.1.10.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.10-py3-none-any.whl.

File metadata

  • Download URL: lowresnltk-1.1.10-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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 5f8f4b8754dd2c333a9fd0a225f14227bc7cb77dda4abb5d1b031516e5a3e944
MD5 f0696847877d05e4be7f381af625086b
BLAKE2b-256 971ba13eba1bd8c1e87dc9df45184c4ff2861c3148f5ec748e46d41042abad81

See more details on using hashes here.

Provenance

The following attestation bundles were made for lowresnltk-1.1.10-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