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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53f8f8ce7d0b2c390ad97b8702d238085789f46e4bc4544674386c37abc7815a
|
|
| MD5 |
f1b7c985bc9136917f800f6af2e1b8ca
|
|
| BLAKE2b-256 |
16516d31962ca43b63f864b3501bcd9c816d3f1498afaa81218812b47e7215a1
|
Provenance
The following attestation bundles were made for lowresnltk-1.1.9.tar.gz:
Publisher:
main.yml on abkafi1234/lowresnltk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lowresnltk-1.1.9.tar.gz -
Subject digest:
53f8f8ce7d0b2c390ad97b8702d238085789f46e4bc4544674386c37abc7815a - Sigstore transparency entry: 956419789
- Sigstore integration time:
-
Permalink:
abkafi1234/lowresnltk@021a3c95eb8f0ec2271a6036549752a6da6fcf2b -
Branch / Tag:
refs/tags/update3 - Owner: https://github.com/abkafi1234
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@021a3c95eb8f0ec2271a6036549752a6da6fcf2b -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f3e9fbd0086a5bffc04538fe54bfc57ea42a6a3e46ce68b5cd62eee1c33e39c
|
|
| MD5 |
da238fe5acf36a864aefc60ba019d943
|
|
| BLAKE2b-256 |
579f4c317c821e0b90ce2849910a558fec4cd4dc1fb0953d8e175da1f91c7d2c
|
Provenance
The following attestation bundles were made for lowresnltk-1.1.9-py3-none-any.whl:
Publisher:
main.yml on abkafi1234/lowresnltk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lowresnltk-1.1.9-py3-none-any.whl -
Subject digest:
0f3e9fbd0086a5bffc04538fe54bfc57ea42a6a3e46ce68b5cd62eee1c33e39c - Sigstore transparency entry: 956419797
- Sigstore integration time:
-
Permalink:
abkafi1234/lowresnltk@021a3c95eb8f0ec2271a6036549752a6da6fcf2b -
Branch / Tag:
refs/tags/update3 - Owner: https://github.com/abkafi1234
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@021a3c95eb8f0ec2271a6036549752a6da6fcf2b -
Trigger Event:
release
-
Statement type: