Question: Please help with code only after #your code here ( fixing the code I wrote there will be priority, if none of my code work,

Please help with code only after #your code here (fixing the code I wrote there will be priority, if none of my code work, please kindly provide your code). Code will be tested with the great gatsby and war and peace txt. I would also like to know how to fix the error (TypeError: 'tuple' object is not callable). Thanks in advance.
Problem 2: Using a Bloom Filter to Count Common Words.
In this problem, we will implement a Bloom filter to count how many elements of longe r_words_wp (the words of length 5 or more in War and Peace)
appear in the Great-Gatsby novel. To do so, we will do the following:
Instantiate a Bloom filter with number of bits n and number of hash functions k.
Insert all words from great-gatsby into the filter.
For each word from war and peace, check membership in the Bloom filter and count the number of yes answers.def __init__(self, nbits, nhash): self.m = nbits ## get k randdom hash functions# Function to insert a word in a Bloom filter. # your code here index = hash_fn(word)# Check if a word belongs to the Bloom Filter # your code here index = hash_fn(word) return True
In [11]:
##o the exact countthis operation finishes very quickly.
all_words_gg = set(longer_words_gg)
exact_common_wc =0
for word in longer_words_wp: exact_common_wc = exact_common_wc +1
print(f'Exact common word count ={exact_common_wc}')
Exact common word count =124595
In [16]:bf = BloomFilter(100000,5)
for word in longer_words_gg:for word in longer_words_gg:common_word_count =0
for word in longer_words_wp: common_word_count= common_word_count +1
print(f'Number of common words of length >==5 equals : {common_word_count}
assert ( common_word_count >= exact_common_wc)
print('All. Tests Passed: 10 points')
TypeError Traceback (most recent call last)
 Please help with code only after #your code here (fixing the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!