bengali-nlp
What it does
This tool helps process Bengali (Bangla) text. It ensures text is displayed and stored correctly, separates words, and handles language-specific numbers and characters.
When to use it
- ✓When you have Bengali text to analyze.
- ✓When building apps for Bengali speakers.
- ✓When working with Bengali educational content.
Skill link
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/bengali-nlp/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Please process this Bengali text for me: 'আমি বাংলায় গান গাই।'”
5 new skills a week. 1 minute to read.
How it works
The tool uses specific rules to organize Bengali characters, correctly separating words and handling Bengali-formatted numbers. It also ensures the text is in a standard format to avoid issues.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Bengali (Bangla) NLP Patterns
Best practices for processing, storing, and displaying Bengali text in software applications and AI systems.
When to Activate
- Working with Bengali/Bangla text data
- Building apps targeting Bengali-speaking users
- Processing NCTB (National Curriculum and Textbook Board) educational content
- Implementing Bengali search, autocomplete, or text input
- Training or fine-tuning LLMs on Bengali data
- Building Bengali chatbots or conversational AI
- Handling mixed Bengali-English (Banglish) text
Bengali Unicode and Script Handling
Unicode Range
Bengali script occupies U+0980–U+09FF. Key character classes:
U+0981–U+0983 Chandrabindu, Anusvara, Visarga
U+0985–U+0994 Independent vowels (অ আ ই ঈ উ ঊ ঋ ঌ এ ঐ ও ঔ)
U+0995–U+09B0 Consonants (ক–র)
U+09B2 ল
U+09B6–U+09B9 শ ষ স হ
U+09DC, U+09DD, U+09DF Additional consonants (ড়, ঢ়, য়)
U+09BC Nukta
U+09BE–U+09C8 Dependent vowel signs (কার): া ি ী ু ূ ৃ ে ৈ
U+09CB–U+09CC Dependent vowel signs: ো ৌ
U+09CD Hasanta (virama) — forms conjuncts
U+09CE Khanda Ta (ৎ)
U+09D7 AU length mark
U+09E0–U+09E3 Extended vowels
U+09E6–U+09EF Bengali digits: ০১২৩৪৫৬৭৮৯
U+09F0–U+09F1 Assamese letters: ৰ (ra with middle diagonal), ৱ (ra with lower diagonal)
U+09F2–U+09F3 Rupee mark ৲ and rupee sign ৳
U+09F4–U+09F9 Historic currency numerators ৴ ৵ ৶ ৷ ৸ and denominator ৹
U+09FA Isshar ৺
Normalization
Always normalize Bengali text to NFC before comparison, storage, or search:
import unicodedata
def normalize_bangla(text: str) -> str:
"""Normalize Bengali text to NFC form."""
return unicodedata.normalize("NFC", text)
# NFC composes characters: base + combining marks -> precomposed
text_nfd = "ক\u09C7\u09BE" # decomposed form of "কো"
text_nfc = normalize_bangla(text_nfd)
assert text_nfc == "কো"
assert text_nfc == normalize_bangla(text_nfc) # idempotent
// JavaScript
function normalizeBangla(text) {
return text.normalize('NFC');
}
Conjunct Consonants (যুক্তবর্ণ)
Bengali conjuncts are formed with Hasanta (্) between consonants:
ক + ্ + ষ = ক্ষ (ksha)
স + ্ + ত = স্ত (sta)
ন + ্ + ত + ্ + র = ন্ত্র (ntra)
Never split strings in the middle of a conjunct. Use grapheme cluster boundaries:
import regex # pip install regex
def grapheme_length(text: str) -> int:
"""Count user-perceived characters (grapheme clusters)."""
return len(regex.findall(r"\X", text))
# "ক্ষ" is 1 grapheme but 3 code points (ক + ্ + ষ)
assert grapheme_length("ক্ষ") == 1
assert len("ক্ষ") == 3 # code point count — wrong for display
// JavaScript — use Intl.Segmenter for grapheme-safe operations
function graphemeLength(text) {
const segmenter = new Intl.Segmenter('bn', { granularity: 'grapheme' });
return [...segmenter.segment(text)].length;
}
Bengali Digits
Handle both Bengali (০-৯) and ASCII (0-9) digits:
BANGLA_DIGITS = "০১২৩৪৫৬৭৮৯"
ASCII_DIGITS = "0123456789"
def bangla_to_ascii_digits(text: str) -> str:
table = str.maketrans(BANGLA_DIGITS, ASCII_DIGITS)
return text.translate(table)
def ascii_to_bangla_digits(text: str) -> str:
table = str.maketrans(ASCII_DIGITS, BANGLA_DIGITS)
return text.translate(table)
Tokenization
Word Boundary Detection
Bengali uses spaces between words, but compound words and postpositions can complicate tokenization:
import re
def tokenize_bangla(text: str) -> list[str]:
"""Basic Bengali tokenizer — split on whitespace and punctuation."""
# Remove Bengali and ASCII punctuation, but preserve decimal points
text = re.sub(r'(?<!\d)\.|\.(?!\d)|[।,;:!?\-\'"()\[\]{}]', ' ', text)
return [token for token in text.split() if token]
# For production, use a trained tokenizer:
# - bnlp (pip install bnlp_toolkit)
# - stanza with Bengali model
# - spaCy with Bengali pipeline
Using bnlp Toolkit
from bnlp import NLTKTokenizer
tokenizer = NLTKTokenizer()
tokens = tokenizer.word_tokenize("আমি বাংলায় গান গাই।")
# ['আমি', 'বাংলায়', 'গান', 'গাই', '।']
Handling Postpositions and Case Markers
Bengali postpositions attach to nouns. Tokenizers should be aware of common suffixes:
-এর (possessive), -তে (locative), -কে (accusative)
-র (possessive after vowel), -য় (locative variant)
Text Processing Patterns
Script Detection
import re
def is_bangla(text: str) -> bool:
…
FAQ
What is text normalization?
Normalization is the process of ensuring Bengali text is in a consistent format, combining characters that might be written differently but mean the same thing.
What are 'conjuncts'?
Conjuncts are Bengali letters that join together to form a single sound or character, like 'ক্ষ'. The tool makes sure these letters are treated as one unit.
Why do I need to worry about Bengali numbers?
Bengali has its own digits (০১২৩৪৫৬৭৮৯). This tool can convert these numbers to the ones we normally use (0-9) and back if needed.
Details
Original description by the author
Bengali (Bangla) text processing patterns including Unicode normalization, script detection, tokenization, conjunct handling, and Bangla-specific NLP best practices for AI applications.
repo: affaan-m/ECC
Popularity
- GitHub stars
- 280k
- Ranking position
- #143
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
accessibility
280kHelps your agent create interfaces that everyone can use. Ensures websites and apps work well for people with disabilities, like those who are blind or have reduced mobility.
agent-architecture-audit
280kMakes your agent check if everything is working correctly. It finds and fixes problems in AI systems, ensuring they perform as expected.
agent-eval
280kHelps your agent compare different AI coding tools. It measures which one is faster, cheaper, and more reliable for specific tasks.
agent-harness-construction
280kMakes your agent better understand how to perform tasks. It optimizes the tools and instructions the agent uses to increase its chances of success.
Similar skills
writing-skills
311kTeaches your agent to write new skills and test each one first, checking that the skill actually changes how the agent behaves.
writing-for-agents
310kExplains how to write clear instructions for AI agents, including skills, AGENTS.md, and CLAUDE.md files, so the agent behaves predictably.
dspy
260kHelps your agent build AI programs by declaring inputs and outputs instead of writing every prompt by hand, then tuning the prompts from example data.