Skip to main content

hinglish-nlp 🇮🇳

A powerful NLP toolkit for Hinglish (Roman Hindi + English) text analysis.

PyPI version Python 3.9+ License: MIT


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

Metadata

Release files for hinglish-nlp 0.2.0

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

Source distribution (sdist)

Source distribution for hinglish-nlp 0.2.0
File Size Uploaded
hinglish_nlp-0.2.0.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hinglish-nlp 0.2.0
File Interpreter ABI Platform
hinglish_nlp-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / hinglish_nlp-0.2.0.tar.gz

Download URL hinglish_nlp-0.2.0.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
765af6d6c7dc99910a0c2071b83dded813248c5e3e916d43858efc50d2f9d55f
BLAKE2b-256 checksum
How to use checksums
037de1be677725281211e13bdf85bdca0dcb5980607b668e7618ed04500aa4dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / hinglish_nlp-0.2.0-py3-none-any.whl

Download URL hinglish_nlp-0.2.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52e47d10b59f45de3c48d26a52b3ad3c44821da9bfd22a2569c95417de9c7832
BLAKE2b-256 checksum
How to use checksums
84c1cfc18baede1072dd8044281ee6605e4d94fb341aa668f620b957a4798373
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.2.0 This release

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