Skip to content

harshini-200612/nlp_emotion_aware_encryption_python

Repository files navigation

#Emotion-Aware Text Processing and Style Transfer System

An intelligent system that detects emotions from speech or text and rewrites content in an appropriate emotional style using NLP and deep learning models.


##📌Table of contents


Overview

This project is an Emotion-Aware Text Processing and Style Transfer System that intelligently analyzes spoken or written input by converting speech to text, detecting the underlying emotions using a pre-trained emotion classification model (via Hugging Face Transformers), and performing sentiment analysis using both TextBlob and VADER. It evaluates the dominant emotion, its intensity, and the overall sentiment to categorize the emotional tone of the input. Based on the detected emotional state—such as anger, sadness, or neutrality—it recommends and applies appropriate style transfer techniques (e.g., transforming angry text into a calmer tone or sad text into encouraging language). This system enables emotionally intelligent communication and can be extended for use in mental health tools, empathetic chatbots, or user experience enhancement platforms.


Problem Statement

Modern communication systems often fail to detect or respond to the emotional state of the user, leading to robotic or insensitive interactions. There is a need for a system that can understand user emotions and adapt the content accordingly to improve empathy, clarity, and response tone.


Dataset

  • Emotion Detection: Pre-trained transformer model (distilbert-base-uncased-emotion) trained on datasets like GoEmotions.
  • Sentiment Analysis: No external dataset required; uses lexicon-based models (VADER, TextBlob).
  • Speech Input: Uses live microphone input via speech_recognition for converting voice to text.
  • Style Transfer : Future enhancement can integrate datasets like PARAA, GYAFC for style transfer fine-tuning.

Tools & Technologies

  • Programming Language: Python
  • Libraries: transformers, speech_recognition, textblob, vaderSentiment, nltk, torch, sklearn
  • Development: Jupyter Notebook / Google Colab / VS Code
  • Deployment Tools : Streamlit, Flask
  • Model Source: Hugging Face Transformers

Project Structure

Emotion_Aware_Encrypted_Voice_Messaging_System/ │ ├── Emotion_Aware_Encrypted_Voice_Messaging_System.ipynb # Main notebook for running and testing the system │ ├── scripts/ # Folder containing all core Python scripts │ ├── audio_to_speech.py
│ ├── sentimental_analysis.py │ ├── style_transfer.py
│ ├── encryption.py
│ ├── speech_to_audio.py
│ ├── main_pipeline.py
│ ├── requirements.txt # Python dependencies for the project ├── README.md # Project overview and setup instructions └── output/ # Folder to store outputs, visualizations, logs


Data Cleaning & Preparation

  • Handled contractions and special characters in text.
  • Normalized text casing.
  • Removed unwanted filler words from voice-to-text output.
  • Ensured consistency in punctuation for accurate emotion classification.

Methods

  • Speech Recognition: Converts voice input into text using speech_recognition.
  • Emotion Detection: Classifies emotion using a transformer-based pre-trained model.
  • Sentiment Analysis: Extracts sentiment polarity and subjectivity.
  • Emotion Intensity Calculation: Combines emotion confidence and sentiment score.
  • Style Transfer: Suggests and applies style changes based on emotional analysis (e.g., angry → calm, sad → encouraging).
  • Result Display: Shows detected emotion, intensity, sentiment, and rewritten text.

Key Insights

  • Emotional intensity and sentiment polarity combined give a stronger indication of the user’s state.
  • Transformer models are significantly more accurate for emotion detection than traditional methods.
  • Dynamic text rewriting enhances engagement and empathy in responses.

Model Output

  • Primary Emotion + Confidence
  • Sentiment Polarity & Intensity
  • Emotion Intensity Score
  • Recommended Style Transfer
  • Emotionally Rewritten Text

recommendation

  • Integrate the system into chatbots or email response tools to dynamically adjust tone.
  • Use as an assistive writing tool for emotionally intelligent content creation.
  • Customize with company-specific emotional tone guidelines (e.g., calming tone for healthcare, enthusiastic for marketing).
  • Add multilingual support and real-time visual dashboard for broader accessibility.

Result & Conclusion

  • Achieved reliable detection of emotions like anger, sadness, happiness, etc., with >90% accuracy using the pre-trained transformer.
  • VADER and TextBlob added robustness for nuanced sentiment understanding.
  • Style transfer suggestions were contextually relevant and transformed the tone effectively.
  • The system bridges the gap between emotionless text processing and empathetic communication.

Future Work

  • Integrate with a real-time chatbot or voice assistant (like Alexa/Siri clones).
  • Add support for multilingual emotion detection.
  • Train custom emotion style transfer models using transformer-based text-to-text models (e.g., T5, BART).
  • Visualize emotion trends in a dashboard using Streamlit or Flask.
  • Expand to detect sarcasm, humor, or passive-aggressive tones.

Author & Contact

MJS. Harshini 📨Email: harshinimogadala@gmail.com

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published