bloomfilter

package module
v0.0.0-...-8f98fe7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

bloomfilter

Wiki

A simple implementation for bloomfilter

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCapacity  error = fmt.Errorf("bloomFilter: capacity must be greater than 0")
	ErrErrorRate error = fmt.Errorf("bloomFilter: error rate must be between 0 and 1")
)

Functions

This section is empty.

Types

type BloomFilter

type BloomFilter struct {
	Bitset  []bool
	HashFns []hash.Hash
}

BloomFilter is struct is a simple implementation for https://en.wikipedia.org/wiki/Bloom_filter This implementation is inspired from https://pypi.org/project/pybloom/

func New

func New(n int, e float64) (*BloomFilter, error)

New creates pointer of BloomFilter by given n as capacity, and e as error rate

func (*BloomFilter) Add

func (bf *BloomFilter) Add(sentence string)

Add stores sentence to the bitset word by word

func (*BloomFilter) Check

func (bf *BloomFilter) Check(sentence string) bool

Check checks if sentence exists in the bitset

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL