Skip to main content

Banglish Stopwords 🇧🇩

PyPI version License: MIT Python Version

Banglish Stopwords is a lightweight, high-performance Python library designed to filter out stopwords from Banglish text (Bengali written in Latin/English script). It includes a dataset of 900+ Bengali stopwords and their common chatting/typing variations.

✨ Features

  • 900+ Core Words: Covers almost all common Bengali stopwords and their romanized spelling variants.
  • Lazy Typing Support: Automatically handles repeated characters (e.g., naaaa -> na, hbeee -> hbe).
  • Punctuation Handling: Smartly cleans text while keeping punctuation intact where necessary.
  • Custom Stopwords: Add your own domain-specific stopwords, or exclude default ones you want to keep.
  • Layout Preserving: remove_stopwords() keeps your original spacing and line breaks intact.
  • Fast Lookup: Uses optimized Python sets for O(1) performance.

🚀 Installation

You can install the library directly from PyPI using pip:

pip install banglish-stopwords

📖 Usage

Basic filtering

from banglish_stopwords import BanglishStopwords

bn = BanglishStopwords()

# Check if a single word is a stopword
bn.is_stopword("ami")      # True
bn.is_stopword("laptop")   # False

# Filter stopwords out of a full sentence
text = "Ami r tmi ekhon bhalo achhiiiii, kintu hbeee naaa! apni abar ashen."
bn.remove_stopwords(text)
# -> "bhalo achhiiiii,      ashen."
# (note: gaps where stopwords were removed are preserved, not collapsed,
# so your original spacing/line breaks stay intact for the surviving words)

Custom stopwords

Add extra words, or exclude default ones, right when you create the object:

bn = BanglishStopwords(
    extra_stopwords=["laptop", "mobile"],   # treat these as stopwords too
    exclude_stopwords=["apni"],             # keep "apni", don't filter it out
)

Or change the stopword set at runtime:

bn = BanglishStopwords()

bn.add_stopwords(["laptop"])
bn.is_stopword("laptop")   # True

bn.remove_from_stopwords(["laptop"])
bn.is_stopword("laptop")   # False

Inspecting the full stopword set

bn.get_stopwords()   # returns the complete set[str] currently in use

🗂️ Project Structure

banglish_stopwords/
├── __init__.py     # public exports
├── core.py         # matching logic (BanglishStopwords class)
└── data.py         # the stopword dataset (STOPWORDS set)
tests/
└── test_core.py    # pytest test suite

🧪 Running Tests

pip install -e .
pip install pytest
pytest tests/ -v

🤝 Contributing

Found a missing stopword or a spelling variant that should be included? Open an issue or a pull request — the dataset lives in banglish_stopwords/data.py and is a plain, sorted Python set, so it's easy to review and extend.

📄 License

MIT

Metadata

Release files for banglish-stopwords 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for banglish-stopwords 0.1.2
File Size Uploaded
banglish_stopwords-0.1.2.tar.gz 7.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for banglish-stopwords 0.1.2
File Interpreter ABI Platform
banglish_stopwords-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 kB

Release files / banglish_stopwords-0.1.2.tar.gz

Download URL banglish_stopwords-0.1.2.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
845dc03bb7f6a4ccdbe40d2f3fa4f41c1b8682fc30e7e80b9f13d38f9febd723
BLAKE2b-256 checksum
How to use checksums
173f878cac46cf61680e016a8ae7aa45374b1f29646671eccbfb33aca3a29f34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / banglish_stopwords-0.1.2-py3-none-any.whl

Download URL banglish_stopwords-0.1.2-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f042b48918f6df19a7a2e05000982b26ce3bfcb0127d7e3c22aed3306db59ba
BLAKE2b-256 checksum
How to use checksums
2f3569e6ed252c6dc9aae1e6b63f7183f60236d1550fc00a80cc0df130a88518
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page