GithubHelp home page GithubHelp logo

V4 Wishlist about stringzilla HOT 3 OPEN

ashvardanian avatar ashvardanian commented on July 22, 2024 4
V4 Wishlist

from stringzilla.

Comments (3)

happysalada avatar happysalada commented on July 22, 2024 2

Reading the readme, it doesn't mention about processing files that are compressed.
Of course, the file can be decompressed first in some other way, but it would be nice to have a way to process a compressed file without having to load it first in memory.
Let me be more specific, here is how you could process line by line with python

import gzip

with gzip.open('input.gz','rt') as f:
    for line in f:

but what if I'm going to ignore several lines anyways.
Having some form of efficient search through compressed files would be nice.
Thank you for making this project open source!

from stringzilla.

ashvardanian avatar ashvardanian commented on July 22, 2024 2

@happysalada, search through compressed data is an attractive feature proposition. I've been thinking about it a lot over the years, but it's not trivial for most compression types. Will keep in mind.

@0xqd, we currently implement Rabin-style hashing and fingerprinting documented here. The header file also provides some details:

/**
* @brief Computes the Karp-Rabin rolling hashes of a string supplying them to the provided `callback`.
* Can be used for similarity scores, search, ranking, etc.
*
* Rabin-Karp-like rolling hashes can have very high-level of collisions and depend
* on the choice of bases and the prime number. That's why, often two hashes from the same
* family are used with different bases.
*
* 1. Kernighan and Ritchie's function uses 31, a prime close to the size of English alphabet.
* 2. To be friendlier to byte-arrays and UTF8, we use 257 for the second function.
*
* Choosing the right ::window_length is task- and domain-dependant. For example, most English words are
* between 3 and 7 characters long, so a window of 4 bytes would be a good choice. For DNA sequences,
* the ::window_length might be a multiple of 3, as the codons are 3 (nucleotides) bytes long.
* With such minimalistic alphabets of just four characters (AGCT) longer windows might be needed.
* For protein sequences the alphabet is 20 characters long, so the window can be shorter, than for DNAs.
*
* @param text String to hash.
* @param length Number of bytes in the string.
* @param window_length Length of the rolling window in bytes.
* @param window_step Step of reported hashes. @b Must be power of two. Should be smaller than `window_length`.
* @param callback Function receiving the start & length of a substring, the hash, and the `callback_handle`.
* @param callback_handle Optional user-provided pointer to be passed to the `callback`.
* @see sz_hashes_fingerprint, sz_hashes_intersection
*/
SZ_DYNAMIC void sz_hashes(sz_cptr_t text, sz_size_t length, sz_size_t window_length, sz_size_t window_step, //
sz_hash_callback_t callback, void *callback_handle);

I am looking into alternative algorithms as well, but want the primary hash and the rolling hash to use the same schema.

from stringzilla.

0xqd avatar 0xqd commented on July 22, 2024 1

hi there, I would love to know what is the current hashing algos? And on automata-based fuzzy searching, will it perform better than current string search algo on paper and design? Thanks!

from stringzilla.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.