struct

LexisMinhash::Signature

Inherits Struct < Value < Object

MinHash signature wrapper providing convenient serialization and similarity

Example:

sig = LexisMinhash::Signature.compute("Document text")
bytes = sig.to_blob
sig2 = LexisMinhash::Signature.from_blob(bytes)
sim = sig.similarity(sig2)

Constructors

compute(text : String, weights : Hash(String, Float64) | Nil) : Signature

Compute signature for a String with optional TF-IDF style weights

Source
compute(text : String) : Signature

Compute signature for a plain String using the Engine's default configuration

Source
from_blob(blob : Bytes) : Signature

Deserialize a BLOB back into a Signature. Raises ArgumentError for malformed input.

Source
new(data : Slice(UInt32))

Initialize from a pre-allocated Slice(UInt32). Prefer Signature.compute for common usage.

Source

Instance methods

data
Source
similarity(other : Signature) : Float64

Compute similarity against another Signature

Source
size

Number of hash values contained in this signature

Source
to_blob

Serialize signature to raw bytes suitable for storage (e.g., SQLite BLOB)

Source