<jupyter_start><jupyter_text>So, we have 2 duplicate songs in 2 separate albums<jupyter_code>df_gb_song = df.groupby('song').count()
df_gb_song[df_gb_song.text != 1]
df[df.song == 'All_You_Need_Is_Love.txt']
df[df.song == 'Yellow_Submarine.txt']<jupyter_output><empty_output><jupyter_text>We have to consider this fact when building models -> to not use same texts twice!  Just for fun: let's count frequencies of search pattern words in one of the songs<jupyter_code>song = list(df[(df['song'] == 'All_You_Need_Is_Love.txt') & (df['album'] == 'MagicalMysteryTour')].text)[0]
rep = {",": "", ".": "", "(": "", ")": ""} # define desired replacements here
rep = dict((re.escape(k), v) for k, v in rep.items()) 
pattern = re.compile("|".join(rep.keys()))
song = pattern.sub(lambda m: rep[re.escape(m.group(0))], song)
words = np.array([word.lower() for word in song.split(' ')])
unique, counts = np.unique(words, return_counts=True)
freq_df = pd.DataFrame({"word": unique, "count": counts})
freq_df.sort_values('count', ascending=False).head(10)<jupyter_output><empty_output>