<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>
{'fraction_non_alphanumeric': 0.18563432835820895, 'fraction_numerical': 0.0065298507462686565, 'mean_word_length': 6.609929078014185, 'pattern_counts': {'":': 6, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '123397', 'license': 'MIT', 'n_tokens_mistral': 404, 'n_tokens_neox': 381, 'n_words': 87, 'path': 'notebooks/basic_EDA.ipynb', 'repo_name': 'nazariinyzhnyk/nlp-beatles-lyrics-modeling', 'size': '1072'}