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.11.tar.gz (15.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.11-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for lowresnltk-1.1.11.tar.gz
Algorithm Hash digest
SHA256 36c17fdfcd175d61f551a95dfc0a7dc1e7ff5436c7af90cf15d39a3b1054c047
MD5 67997021f0be52ce47656d4e7175a909
BLAKE2b-256 71bd4697d3cb0e09e620f422e59852b281c45a57a5c195d77f8833d686ebe576

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for lowresnltk-1.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 002264855d2171f884f72b01270549a38c28656a45c4b82ef1783f1a7d085c16
MD5 d79ca6d1fa5410dcc03c71994bc36c60
BLAKE2b-256 c10ca1032513ef91cce2abf6fac239ed091593ceb5e9b64695a450dcd032fa0a

See more details on using hashes here.

Provenance

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