<jupyter_start><jupyter_text>Grab the lyrics<jupyter_code>import string
with open('lyrics.txt') as f:
    # remove newlines and extraneous punctuation before splitting
    table = str.maketrans('\n', ' ', ',!')
    lyrics = f.read().translate(table).strip().split(" ")
    
print(lyrics)
plt.rcParams["figure.figsize"] = (25, 5)
unique_words = list(set(lyrics))
counts = [lyrics.count(word) for word in unique_words]
plt.bar(unique_words, counts)
plt.show()
from collections import OrderedDict
word_counts = OrderedDict()

# make it *exactly* 16:9 (inches)
plt.rcParams["figure.figsize"] = [16, 9]
plt.rcParams["xtick.labelsize"] = 10

for i, word in enumerate(lyrics):
    # aggregate word counts in order
    if word in word_counts:
        word_counts[word] += 1
    else:
        word_counts[word] = 1
    
    # get handles for figure and axes
    fig = plt.figure()
        
    # plot current word counts
    bars = plt.bar(word_counts.keys(), word_counts.values())
    
    # hide axes
    axes = fig.get_axes()
    axes[0].spines['top'].set_visible(False)
    axes[0].spines['right'].set_visible(False)
    
    # draw the count on top of each bar
    for bar in bars:
        height = bar.get_height()
        plt.text(bar.get_x() + bar.get_width() / 2, height, height, ha='center', va='bottom', fontsize=18)

    plt.savefig(f"out/{i}.png")

    # close the figure to save memory
    plt.close(fig)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13968033356497567, 'fraction_numerical': 0.01250868658790827, 'mean_word_length': 3.458204334365325, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '77708', 'license': 'MIT', 'n_tokens_mistral': 522, 'n_tokens_neox': 497, 'n_words': 120, 'path': 'main.ipynb', 'repo_name': 'kaine119/baby_shark_graphvis', 'size': '1439'}