<jupyter_start><jupyter_text>zipf<jupyter_code>wlist = sorted(list(wdict.items()), key=lambda x: x[1], reverse=True)
wlist = [(i[0], i[1], k+1) for k, i in enumerate(wlist)]
wlist[:10]
import numpy as np

ws, freq, rank = np.array(wlist).T
freq = [int(i) for i in freq]
rank = [int(i) for i in rank]
plt.style.use('fivethirtyeight')
plt.plot(rank,freq,'b-s')
plt.ylabel('$Frequency$', fontsize = 20)
plt.xlabel('$Rank$', fontsize = 20)
plt.xscale('log')
plt.yscale('log')
plt.title('Zipf Distribution', fontsize = 20)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2007168458781362, 'fraction_numerical': 0.021505376344086023, 'mean_word_length': 6.657534246575342, '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': '15527', 'license': 'MIT', 'n_tokens_mistral': 255, 'n_tokens_neox': 235, 'n_words': 51, 'path': 'Counting the frequency of words in The Great Gatsby/counting the frequency of words in The Great Gatsby.ipynb', 'repo_name': 'chenjia-zhang/chenjia-zhang.github.io', 'size': '558'}