Esempio n. 1
0
]

for item in word_present:
    bloomf._add(item)

_size, _hash_count, _bytestring = bloomf._filter_array_for_storing()

#####################################
b_a = bitarray(0)
b_a.frombytes(_bytestring)

shuffle(word_present)
shuffle(word_absent)

test_words = word_present[:10] + word_absent
shuffle(test_words)
for word in test_words:
    if bloomf._check(word):
        if word in word_absent:
            print("'{}' is a false positive!".format(word))
        else:
            print("'{}' is probably present!".format(word))
    else:
        print("'{}' is definitely not present!".format(word))

size_, hash_count_, b_a_ = BloomFilter._filter_array_from_storing(
    _size, _hash_count, _bytestring)
bloomf1 = BloomFilter(n, p, None, b_a, b_a.length())

pass