Skip to main content

A Part-of-Speech Tagger and Dialect Processing Toolkit for Bengali.

Project description

brnltk

brnltk is a Part-of-Speech (POS) tagging and dialect processing library for Bengali, supporting multiple regional dialects. It uses LSTM-based deep learning models, N-gram similarity, and rule-based stemming to provide accurate POS tagging, translation between Bengali dialects, tokenization, stemming, and sentence similarity checking.


Features

  • POS Tagging Train or load a POS tagging model for various Bengali dialects using LSTM with fallback mechanisms:

    • Dictionary lookup
    • Suffix-based normalization
    • N-gram similarity
  • Dialect Translation Translate Bengali sentences from one regional dialect to another using n-gram similarity between words.

  • Tokenization Word-level and sentence-level tokenization for Bengali text.

  • Stemming Light stemming of Bengali words using rule-based suffix removal.

  • Sentence Similarity Compute similarity scores between Bengali sentences using n-gram-based overlap.


Dialect Name Mapping

The library follows this AREA_MAPPING:

Short Name Full Column Name
Barishal Barishal_bangla_speech
Sylhet Sylhet_bangla_speech
Chittagong Chittagong_bangla_speech
Mymensingh Mymensingh_bangla_speech
Noakhali Noakhali_bangla_speech
General General

Example usage:

Dialect Translation
from brnltk import translate

original_sentence = "তুমি ভাত খাই"
translated_sentence = translate(
    sentence=original_sentence,
    from_area="General",
    to_area="Chittagong"
)

print("Original:", original_sentence)
print("Translated:", translated_sentence)

POS Tagging
from brnltk import run_pos_tagger

# Use the AREA_MAPPING keys directly
predict_func, _, _ = run_pos_tagger(column_name='Mymensingh', train=True)
sentence = "আমি শাকির"

result = predict_func(sentence, return_confidence=True)
for word, tag, conf in result:
    print(f"{word:<15} --> {tag:<10} (confidence: {conf:.2f})")


Tokenization
from brnltk import word_tokenize

text = "আমি ভাত খাই এবং কাজ করি।"
tokens = word_tokenize(text)
print("Tokens:", tokens)

Stemming
from brnltk import stem_sentence

sentence = "ছেলেটি খেলাধুলা করছে"
stemmed = stem_sentence(sentence)
print("Stemmed:", stemmed)

Sentence Similarity
from brnltk import overall_similarity

sentence1 = "আমি আজ স্কুলে যাই"
sentence2 = "আমি স্কুলে যাচ্ছি আজ"
score = overall_similarity(sentence1, sentence2)
print(f"Similarity Score: {score:.2f}")

Dataset Information

The library relies on a curated dataset containing Bengali words in multiple dialects, including:

General, English Translation, পদ (Google API), Updated Human, পদ (Human),
Barishal_bangla_speech, Sylhet_bangla_speech, Chittagong_bangla_speech,
Mymensingh_bangla_speech, Noakhali_bangla_speech


Use the AREA_MAPPING keys directly for all functions.

Contributing

Contributions are welcome! Please create a pull request or open an issue for any feature requests or bug reports.
"if any one want to update this dataset please emain mahmudulhaqueshakir@gmail.com"

License

MIT License © 2025 Shakir

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

brnltk-3.2.2.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

brnltk-3.2.2-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file brnltk-3.2.2.tar.gz.

File metadata

  • Download URL: brnltk-3.2.2.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for brnltk-3.2.2.tar.gz
Algorithm Hash digest
SHA256 7a72ae53f04bb78caa48c1ebb1f0e660daafa69675b45da3498d696cbc050ca4
MD5 fb92d09d9586fb95234fb38284e1d197
BLAKE2b-256 c52d1e0ff10642ba099c702908cd067247ee019320969733d8cd0becb9f2083e

See more details on using hashes here.

File details

Details for the file brnltk-3.2.2-py3-none-any.whl.

File metadata

  • Download URL: brnltk-3.2.2-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for brnltk-3.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6d577cf98d4a4d7f2055412c986be877b5a955d18b1526b4079825c01c3b3c77
MD5 eaa696b2b48ababea01eec4f8daf301e
BLAKE2b-256 d2c62486c07aafbce5a7f269110cf6705e088d4bc4f6aac11b52107097ebcb94

See more details on using hashes here.

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