Using the Linear Probing hash table to perform a frequency analysis

Task
Create a new class Freq that uses the Linear Probing hash table to perform a frequency analysis of a wt of files as follows. First, implement the method add_file(self , filename). which reads each word from the file inth the hash thble. in such a way- that the data associated to the word is its -occurrence con.”, i.e., the number of times the word has been “added” to the hash table (whith is the same as the number
‘This is known a* Ziplk law. You can read more at lattps://en.sikipedia.ors/siktrapEUTs_law
Edit & Create w She
of times it has already appeared in the file). The elms (and its methods) must keep tradc of the number of occurrena-s max for the most common word read. Then, implement a method rarity(self, word) that given a word, returns its rarity score. Download some ebooks as text files from https://ww.gutenberg.org/ and use Freq to sad that &la into your hash thble. At the end of this process the table will store the number of times each vaard appears in the texts. VVe wM consider the resulting hash table as a reasoruthly accurate representation of the frequency of words in the Eng. huiguage. Make sure you usv the data ynu collected in the previous tasks to sel.t an appropriate table size for the sel.ted text files. Also, modify setites_ to call rehash when the load of the hash table is above 0.5. rather than when .1 (this will not be used if you choose an appropriate table size. but is more realistic for cases where you do not know the number . size of the books being read).
Important: You must define tests for the add_file and rarity methods.

Sample Solution

ACED ESSAYS