bhasha-kit
Offline Python utilities for cleaning, detecting, transliterating, spelling, and analyzing Hindi, Bengali, and English text.
bhasha-kit runs locally, uses only the Python standard library at runtime, and makes no external API calls.
Features
- Unicode NFC text cleaning, optional URL and emoji removal, and script-aware digit conversion.
- Lightweight Hindi (
hi), Bengali (bn), and English (en) script detection with language shares. - Rule-based Roman ↔ Devanagari and Roman ↔ Bengali transliteration.
- Integer-to-words and rupee/paise amount conversion using Indian number groups.
- Level 4 (done): offline lexicon-based sentiment analysis and frequency-based keyword extraction.
- Python 3.9+ support with no third-party runtime dependencies.
Installation
Install directly from GitHub:
python -m pip install git+https://github.com/solodevelopersai/bhasha-kit.git
For local development:
git clone https://github.com/solodevelopersai/bhasha-kit.git
cd bhasha-kit
python -m pip install -e ".[dev]"
Usage
Every function is available from the bhasha_kit package:
from bhasha_kit import (
clean_text, normalize_digits, detect_language, detect_languages,
to_devanagari, to_roman, to_bengali, to_roman_bengali,
number_to_words, number_to_rupees,
tokenize, analyze_sentiment, extract_keywords,
)
clean_text("नमस्ते 😀 दोस्तों")
# 'नमस्ते दोस्तों'
normalize_digits("১২৩")
# '123'
detect_language("বাংলা")
# 'bn'
detect_languages("नম hi")
# {'hi': 0.25, 'bn': 0.25, 'en': 0.5}
to_devanagari("namaste")
# 'नमस्ते'
to_roman("नमस्ते")
# 'namaste'
to_bengali("aamaar naam rahim")
# 'আমার নাম রহিম'
to_roman_bengali("আমার")
# 'aamaar'
number_to_words(1250, "hi")
# 'एक हज़ार दो सौ पचास'
number_to_rupees("1250.50")
# 'एक हज़ार दो सौ पचास रुपये पचास पैसे'
analyze_sentiment("यह फिल्म बहुत अच्छी है")
# {'label': 'positive', 'score': 1.0, 'lang': 'hi'}
analyze_sentiment("this is not good")
# {'label': 'negative', 'score': -1.0, 'lang': 'en'}
extract_keywords("The film was good and the story was excellent.")
# [('film', 1), ('good', 1), ('story', 1), ('excellent', 1)]
clean_text normalizes whitespace and Unicode by default; set remove_urls=True
or lowercase=True to enable those options. normalize_digits accepts
to="ascii", to="devanagari", or to="bengali". The language detector returns
shares only for scripts found in the input, and returns an empty dictionary for
text with no countable letters. Sentiment and keyword functions detect the
dominant script unless a language code ("hi", "bn", or "en") is supplied.
Known limitations
Transliteration is deliberately rule-based and approximate. It uses simple Roman spelling conventions, cannot infer pronunciation or resolve all ambiguities, and is not a substitute for a full language-specific transliteration system. Language detection is based on Unicode script ranges, not linguistic semantics. Sentiment is lexicon-based, uses a small word list, and does not understand sarcasm or context.
Roadmap
- Level 5: REST API and a web demo.
Contributing
See CONTRIBUTING.md for development setup, testing, and pull request guidance.
License
Released under the MIT License. See LICENSE.
Metadata
Release files for bhasha-kit 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bhasha_kit-0.2.0.tar.gz | 20.7 kB | Without provenance | Details for bhasha_kit-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bhasha_kit-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for bhasha_kit-0.2.0-py3-none-any.whl |
Total release size: 38.8 kB
Release files / bhasha_kit-0.2.0.tar.gz
| Download URL | bhasha_kit-0.2.0.tar.gz |
|---|---|
| Size | 20.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab5f23cb36d64eda44ad0e4d6c0307d264f09abf250bce33aa1e3f85e4c99863
|
|
BLAKE2b-256 checksum How to use checksums |
65af22fcaaa4feaa0dd25c3ba24f286d490fa79352d7c2662406d487980af501
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / bhasha_kit-0.2.0-py3-none-any.whl
| Download URL | bhasha_kit-0.2.0-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0586b7e8d93e24ea36964c62cd9d0955f01597ac790219865636849ea2f21d9f
|
|
BLAKE2b-256 checksum How to use checksums |
ad2a7ee70437045222c97cdd2f493a4a063e1e02057eb1a35fc3fb69969243fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for bhasha-kit 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.