Loading
Rohan Kamble

AI Enthusiast

Data Engineer

Data Analyst

  • About
  • Past Projects
  • Expertise
  • Resume
  • Skills
  • Blog
  • Contact
Rohan Kamble

AI Enthusiast

Data Engineer

Data Analyst

Download CV

Sentiment Analysis of Song Lyrics

  • Created By: Rohan Kamble
  • Date: 07/08/2022
  • Client: Rohan
See Demo

The Song Lyrics Sentiment and Emotion Analyzer is a Flask-based web application that performs natural language processing (NLP) on song lyrics to determine their sentiment polarity, emotional composition, and overall mood.
By combining VADER Sentiment Analysis, TextBlob, and an emotion lexicon, this project provides a detailed interpretation of lyrical content β€” revealing whether a song is happy, sad, neutral, or emotionally complex.

Key Features

  1. 🎢 Song Sentiment Detection:
    Uses the VADER SentimentIntensityAnalyzer to classify lyrics as Positive, Negative, or Neutral based on polarity scores.

  2. πŸ’¬ Emotion Analysis:
    Reads an external emotion.csv file mapping words to emotions (like joy, anger, fear, etc.) and visualizes the emotional distribution using a matplotlib bar chart.

  3. 🧠 Text Preprocessing:

    • Converts lyrics to lowercase

    • Removes punctuation

    • Removes English stopwords

    • Tokenizes and lemmatizes words for clean analysis

  4. πŸ“Š Visualization:
    Displays a colorful bar graph showing the frequency of detected emotions in the song.

  5. 😊 Mood Classification:
    Based on TextBlob’s polarity, the app categorizes the song as:

    • Very Sad πŸ₯Ί

    • Sad πŸ˜₯

    • Cheerful πŸ™‚

    • Happy πŸ˜€

    • Neutral 😐

  6. πŸ–₯️ Web Interface:
    A user-friendly Flask frontend allows users to input a song title and lyrics, then view a detailed sentiment report.

Technologies Used

  • Python (Core Language)

  • Flask (Web Framework)

  • NLTK (Tokenization, Stopwords, Lemmatization)

  • TextBlob (Polarity & Sentiment Analysis)

  • VADER Sentiment Analyzer (Fine-grained Sentiment Scoring)

  • Matplotlib (Data Visualization)

  • HTML/CSS (Frontend templates: index.html, submit.html)

Workflow

  1. User enters the song title and lyrics in the input form.

  2. The app cleans and preprocesses the lyrics.

  3. Sentiment and emotion analysis are performed using NLP libraries.

  4. A compound sentiment score and emotion frequency graph are generated.

  5. Results are displayed in the output page, showing:

    • Song sentiment summary

    • Polarity percentage

    • Dominant and weakest emotions

    • Overall mood classification

Sample Output

  • Compound Sentiment Score: 78.2%

  • Detected Sentiment: Positive πŸ™‚

  • Dominant Emotion: JOY

  • Weakest Emotion: FEAR

  • Song Mood: Happy Song πŸ˜€

Use Cases

  • Music emotion research

  • Lyric-based mood categorization

  • Music recommendation systems

  • Educational NLP demonstration

Future Enhancements

  • Integration with APIs (e.g., Genius API) to fetch lyrics automatically

  • More detailed emotion lexicon with intensity scores

  • Word cloud visualization for emotional words

  • Model-based classification using deep learning

Tags: Application Software
Share:

Prev
Next

Β© 2025 – Present. Rohan Kamble. All Rights Reserved.