Metadata-Version: 2.4
Name: banglish-stopwords
Version: 0.1.2
Summary: A high-performance library to filter Banglish stopwords from text.
Home-page: https://github.com/b-a-sabbir/banglish-stopwords
Author: Benjir Ahammed Sabbir
Author-email: bengirahammedsabbir123@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Intended Audience :: Developers
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python
Dynamic: summary

# Banglish Stopwords 🇧🇩

[![PyPI version](https://badge.fury.io/py/banglish-stopwords.svg)](https://pypi.org/project/banglish-stopwords/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![Python Version](https://img.shields.io/badge/python-3.6%2B-blue)

**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:

```bash
pip install banglish-stopwords
```

## 📖 Usage

### Basic filtering

```python
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:

```python
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:

```python
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

```python
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

```bash
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
