Continuing from the last week's assignment, I've used Musixmatch API to work with the lyrics of the songs. I will be using the lyrics of Best of You, a song by Foo Fighters, for the purpose of demonstration.
Preprocessing the lyrics.
I've removed some special characters and deleted the warning message at the bottom of the screen. Instead of the method shown in the class example, I used the RiTa library's concordance function to measure the frequency of words.
When printing Object.keys(counts) and Object.values(counts), the result is following:
Then, I used those values to map the size of the font and the color of the word with respect to its frequency. For the colors, I imagined the thermal map and how it transforms something invisible to visible. In this sketch, red indicates the most frequent words and blue is for the least frequent words.
Sample result after clicking the "click!" button
It's a nice surprise that Musixmatch API supports international songs. Below is the sample result I got from using Gangnam Style by PSY, probably the most well-known Korean song before BTS. As you can see the word Gangnam Style(Korean: 강남스타일) is the most frequent word in the lyrics.
More examples:
コメント