Hinglish (Roman Hindi + English) NLP toolkit - Sentiment, Emotion, Sarcasm & more
Project description
hinglish-nlp 🇮🇳
A powerful NLP toolkit for Hinglish (Roman Hindi + English) text analysis.
Installation
pip install hinglish-nlp
Features
| Feature | Description |
|---|---|
| ✅ Sentiment Analysis | Positive / Negative / Neutral / Mixed |
| ✅ Emotion Detection | Joy, Anger, Sadness, Fear, Surprise, Disgust |
| ✅ Sarcasm Detection | Pattern + contradiction based |
| ✅ Language Mix Detection | Hinglish vs English ratio |
| ✅ Transliteration | Roman Hindi → Devanagari |
| ✅ Batch Processing | Multiple texts at once |
| ✅ Key Phrase Extraction | Important phrases from text |
| ✅ Intensity Score | 0.0 to 1.0 scale |
| ✅ Confidence Score | How sure the model is |
Usage
Basic Sentiment Analysis
from hinglish import analyze
result = analyze("yaar bahut mast movie thi!")
print(result["mood"]) # positive
print(result["emoji"]) # 😊
print(result["intensity"]) # 0.45
print(result["confidence"]) # 0.75
Emotion Detection
from hinglish import detect_emotion
emotions = detect_emotion("mujhe bahut gussa aa raha hai!")
print(emotions) # {'anger': 0.35}
emotions = detect_emotion("aaj bahut khushi hui yaar!")
print(emotions) # {'joy': 0.7}
Sarcasm Detection
from hinglish import is_sarcastic
result = is_sarcastic("haan bilkul, bahut accha hai na!!")
print(result)
# {'is_sarcastic': True, 'confidence': 0.6}
Language Mix Detection
from hinglish import detect_language
mix = detect_language("yaar ye movie bahut boring thi")
print(mix)
# {'hinglish': 0.5, 'english': 0.33, 'unknown': 0.17}
Transliteration (Roman → Devanagari)
from hinglish import transliterate
text = transliterate("mera naam lalit hai")
print(text) # मेरा नाम ललित है
Batch Processing
from hinglish import analyze_batch
texts = [
"yaar mast movie thi!",
"bilkul bakwaas tha yaar",
"theek thak tha, kuch khaas nahi"
]
results = analyze_batch(texts)
for r in results:
print(r["mood"], r["emoji"])
# positive 😊
# negative 😠
# neutral 😐
Full Analysis
from hinglish import analyze
result = analyze("Phone ki battery toh bekar hai but camera mast hai")
print(result)
# {
# 'mood': 'mixed',
# 'intensity': 0.3,
# 'confidence': 0.75,
# 'emoji': '🤨',
# 'sentiment': 'mixed',
# 'key_phrases': ['Phone ki battery toh bekar hai but camera mast hai'],
# 'sarcasm': False,
# 'sarcasm_confidence': 0.0,
# 'language_mix': {'hinglish': 0.36, 'english': 0.55, 'unknown': 0.09},
# 'category': 'mixed',
# 'summary': 'A detailed Hinglish message expressing mixed sentiment...',
# 'emotions': {'disgust': 0.35},
# 'word_count': 11,
# 'positive_words_found': ['mast'],
# 'negative_words_found': ['bekar'],
# 'transliteration': 'Phone की battery तो bekar है but camera मस्त है'
# }
Output Fields
| Field | Type | Description |
|---|---|---|
mood |
str | positive / negative / neutral / mixed |
intensity |
float | 0.0 – 1.0 |
confidence |
float | 0.0 – 1.0 |
emoji |
str | Visual mood indicator |
sentiment |
str | Same as mood |
key_phrases |
list | Important phrases |
sarcasm |
bool | Is text sarcastic? |
sarcasm_confidence |
float | Sarcasm confidence score |
language_mix |
dict | hinglish / english / unknown ratio |
category |
str | praise / complaint / casual / mixed |
summary |
str | Short summary of the text |
emotions |
dict | Detected emotions with scores |
word_count |
int | Total word count |
positive_words_found |
list | Positive words detected |
negative_words_found |
list | Negative words detected |
transliteration |
str | Roman → Devanagari |
Author
Lalit — lalitpal2206
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hinglish_nlp-0.2.0.tar.gz
(8.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hinglish_nlp-0.2.0.tar.gz.
File metadata
- Download URL: hinglish_nlp-0.2.0.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
765af6d6c7dc99910a0c2071b83dded813248c5e3e916d43858efc50d2f9d55f
|
|
| MD5 |
e9727083be7962c25db37ba30660d5c4
|
|
| BLAKE2b-256 |
037de1be677725281211e13bdf85bdca0dcb5980607b668e7618ed04500aa4dc
|
File details
Details for the file hinglish_nlp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: hinglish_nlp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52e47d10b59f45de3c48d26a52b3ad3c44821da9bfd22a2569c95417de9c7832
|
|
| MD5 |
e412cb63d937aa753ec1297d1325571d
|
|
| BLAKE2b-256 |
84c1cfc18baede1072dd8044281ee6605e4d94fb341aa668f620b957a4798373
|