LoginSignup
2
1

More than 5 years have passed since last update.

pythonのCounterを使用してMr.TalkBoxの英語歌詞の単語を出現数順にソートした記録

Posted at

目的

以前からMr.TalkBoxの曲が大好きでした。
pythonで歌詞の単語から出現数が多い順でソートすれば、もっと歌詞の意味の深い部分を知れるかもと思い歌詞分析を行いました。(分析というか単語のソートのみ)

Mr.Talkbox
https://www.mrtalkbox.com/

準備

TalkBoxの歌詞(今回はSomethin' Good - Mr. Talkbox)

Somethin' Good - Mr. Talkbox
https://www.youtube.com/watch?v=TZFaD5nuzLQ

+pythonの実行環境

コード

こちらを参考にさせて頂き、
歌詞から単語の出現数をカウントしてソートするコードを用意します。

sample.py
import re
from collections import Counter

target_text = """
I feel something 
feel something 
I feel something 
feel something good inside
I feel something 
feeling something 
I feel something 
feel something 

There is something that I’m going try to explain
/*以下省略 youtube参照 */
"""

words = re.split(r'\s|\,|\.|\(|\)', target_text.lower())
counter = Counter(words)
for word, count in counter.most_common():
    if len(word) > 0:
        print("%s,%d" % (word, count))

テスト

$ python sample.py 
feel,40
i,30
something,28
to,17
just,10
got,10
me,9
good,8
that,8
you,8
it,8
baby,8
the,7
this,7
funky,7
inside,6
beat,6
don’t,6
music,6
up,6
and,6
is,5
now,5
makes,5
all,5
my,5
cus,4
so,4
have,4
worry,4
feet,4
we,4
there,3
im,3
turn,3
move,3
check,3
out,3
take,3
dance,3
feeling,2
i’m,2
a,2
need,2
want,2
what,2
your,2
come,2
talking,2
about,2
free,2
girl,2
on,2
in,2
get,2
going,1
try,1
explain,1
minute,1
saying,1
when,1
then,1
tight,1
right,1
make,1
spirit,1
alive,1
everybody,1
funk,1
rock,1
roll,1
help,1
us,1
its,1
time,1
joy,1
bomb,1
around,1
streets,1
with,1
melody,1
set,1
wat,1
wait,1
man,1
let,1
flip,1
thing,1
shoo,1
can,1
yah,1
hands,1
over,1
too,1

I feel somethingの単語が合わせて98個出てきており、
何かを感じ続けろとのメッセージを頂いたような気がします。すごくcoolです。

参考

Mr.Talkbox
Somethin' Good - Mr. Talkbox
英語論文から単語を抽出&登場回数順にソートし、さらに意味も載った単語帳まで作ってみた。
英単語帳作成~その2~

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1