generate_search module¶

@author: iotarepeat (https://github.com/iotarepeat)

This file contains methods for base2p15 encoding,a custom encoding that uses unicode. This encoding uses 2^15 unicode characters. The goal is to make binary representation of Spectral Bloom Filter, to a JS string as small as possible.

generate_search.base2p15_decode(base2p15: str) → str¶

Encode/decode given base2p15 string as binary string

Parameters

base2p15 (str) – A base2p15 string, generated by base2p15_encode

Returns

A binary string e.g. 00001001

Return type

str

generate_search.base2p15_encode(bit_string: str) → str¶

Encode given bit_string to base2p15.

Parameters

bit_string (str) – A binary string e.g. 00001001

Returns

A base2p15 encoded string

Return type

str

generate_search.base2p15_get_range(base2p15: str, start: int, end: int) → str¶

Get a range of bits from [start,end)

Parameters
  • base2p15 (str) – A base2p15 string generated by base2p15_encode

  • start (int) – Starting number (inclusive)

  • end (int) – End number (exclusive)

Returns

A binary string e.g. 00001001

Return type

str

generate_search.gen_chunks(string: str, chunk_size: int, drop_remaining: bool = False) → Iterable[str]¶

Yields an iterator of chunks of specified size

If drop_remaining is specified, the iterator is guaranteed to have all chunks of same size.

>>> list(gen_counter_chunks('123456789A', 4)) == ['1234', '5678', '9A']
>>> list(gen_counter_chunks('123456789A', 4, drop_remaining = True)) == ['1234', '5678']

Sthir

Navigation

Contents:

  • static_site_search
    • CLI module
    • Test module
    • convert_2p15 module
    • convert_byte module
    • generate_search module
    • mmh3 module
    • parse module
    • scan module
    • spectral_bloom_filter module

Related Topics

  • Documentation overview
    • static_site_search
      • Previous: convert_byte module
      • Next: mmh3 module

Quick search

©2020, Parth Parikh, Mrunank Mistry, Dhruvam Kothari. | Powered by Sphinx 3.1.1 & Alabaster 0.7.12 | Page source