All Projects → brentp → pybloomfaster

brentp / pybloomfaster

Licence: other
fast bloomfilter

Programming Languages

c
50402 projects - #5 most used programming language
python
139335 projects - #7 most used programming language
C++
36643 projects - #6 most used programming language

bloomfaster: fast bloomfilter

Author:Brent Pedersen (brentp)
Email:[email protected]
License:MIT

Implementation

Simple cython wrapper to the C-code from Bloom::Faster perl module. It's called 'Elf' because 'ELF' is an early flowering mutant in Arabidopsis. So Bloom Fast => Early Flowering => Elf.

It is tune-able for the number of false positives.

Usage

>>> from bloomfaster import Elf

>>> expected_size = 1000
>>> e = Elf(expected_size, error_rate=1e-10)
>>> e.add("ASDF")
>>> "ASDF" in e
True

>>> e.addmany(("A", "B", "C", "D", "E", "F"))
>>> "B" in e
True

serialization:

>>> e.save("some.elf")
>>> f = Elf.load("some.elf")

>>> "ASDF" in f
True
>>> "AA" in f
False

Tests

$ python setup.py test

or with nose:

$ nosetests --with-doctest --doctest-extension="pyx" --doctest-extension="rst"
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].