to-schi / classify-lyrics

Find out to which artist a song most-likely belongs!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Find out to which artist a song most likely belongs!

Lyrics-classifier with command-line tools for:

1. Scraping of all lyrics of chosen artists from lyrics.com

2. Building a dataframe-file of all the scraped lyrics

3. Finding out to which of the artists a text-example most likely belongs (classify)


diagram

A Naive-Bayes Classification is used on a tf-idf-vectorized lyrics-corpus (bag-of-words) with filtered and lemmatized words.


You can use the tools in 3 steps:

1. Get Lyrics:

Choose 2-4 artists from Lyrics.com and copy the artist-urls.
Download the lyrics for each artist with:

# python get_lyrics.py "artist_name" "url"
python get_lyrics.py eminem https://www.lyrics.com/artist/Eminem/

This will create a folder "eminem_lyrics" with all lyrics available as txt-files. As a song can exist in multiple versions, there can be several lyrics-files for one song. For better results, duplicates may be deleted before proceeding. You can take a few files out of the folder to use them with the classifier later.
 

2. Add to Dataframe:

Add an artist's lyrics to the dataframe with:

# python add_to_dataframe.py "artist_name"
python add_to_dataframe.py eminem

Repeat for every chosen artist.
 

3. Find out to which of the artists a text-example most likely belongs:

python classify_lyrics.py "May I have your attention please? Will the real Slim Shady please stand up?"

or

python classify_lyrics.py songname.txt

A whole song will perform much better than a small text-sample.

 

This project was created during the Spiced Academy Data Science Bootcamp Nov/2021.

About

Find out to which artist a song most-likely belongs!


Languages

Language:Python 100.0%