import probables from sizer import getsize from probables import (BloomFilter) blm = BloomFilter(est_elements=25000000, false_positive_rate=0.05) line_ = 0 with open('war_and_peace.txt', 'r') as fp: for line in fp: getsizeof(line) for word in line.split(): blm.add(word.lower()) # add each word to the bloom filter line_+=1 print("\nline",str(line_),"\nblm size:",blm.export_size(),"\nCFPR:",blm.current_false_positive_rate())
est_elements_planned = stock_exists_bf.estimated_elements stocks_added = len(stock_symbol_dist) est_unique_elements = stock_exists_bf.estimate_elements() process_file.write(str(est_elemnts_added_bf)) process_file.write("," + str(est_elements_planned)) process_file.write("," + str(stocks_added)) process_file.write("," + str(est_unique_elements)) process_file.write("," + str(false_postive_count)) process_file.write("," + str(false_postive_count/est_unique_elements)) process_file.write("," + str(stock_exists_bf.bloom_length)) process_file.write("," + str(stock_exists_bf.number_hashes)) process_file.write("," + str(no_of_record)) process_file.write("," + str(stock_exists_bf.false_positive_rate)) process_file.write("," + str(stock_exists_bf.current_false_positive_rate())) process_file.write("," + str(stock_exists_bf.number_bits)) process_file.write("," + str(stock_exists_bf.export_size())) process_file.write("," + str(check_stock_symbol_count)) process_file.write("," + str(prob_present_count)) process_file.write("," + str(present_count)) process_file.write("," + str(not_present_count)) process_file.write("," + str(bfadd_time)) process_file.write("," + bf_starttime + "," + bf_endtime) process_file.write("," + stock_trade_filename + ',' + stock_exists_bf_filename + "\n") process_file.write("\n") process_file.close()