Documentation
¶
Index ¶
Constants ¶
View Source
const EnvPrefix = "LSH"
Variables ¶
View Source
var ( ErrShingleResultIsEmpty = errors.New("error shingle result is empty") ErrEmptyInputString = errors.New("empty input string") )
Functions ¶
func EstimateJaccard ¶
Types ¶
type Config ¶
type Config struct {
lsh.Config
ShingleSize int `env:"_SHINGLE_SIZE" envDefault:"3"`
JaccardThreshold float64 `env:"_JAC_THRESHOLD" envDefault:"0.6"`
}
func GetConfigFromEnv ¶
func (*Config) CalculateApproximateThreshold ¶
CalculateApproximateThreshold computes s ~ (1/B)^(1/R) — the Jaccard similarity where the LSH collision probability transitions sharply.
func (*Config) HashVersion ¶
HashVersion computes a deterministic prefix from group + all config fields.
type Hasher ¶
type Hasher struct {
// contains filtered or unexported fields
}
func (*Hasher) ComputeSignature ¶
func (h *Hasher) ComputeSignature(tokens set.GenericDataSet[string], sig []uint64)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repo repositories.Storage, config *Config) (*Service, error)
func (*Service) WithMetrics ¶
func (s *Service) WithMetrics(m *lsh.Instruments)
WithMetrics injects pre-built OpenTelemetry instruments. If not called, metrics are silently skipped.
Click to show internal directories.
Click to hide internal directories.