starfuzz/resolver

A module providing declarative entity resolution matching capabilities. Structured records can be compared using weighted components, outputting matched status and confidence levels (High, Medium, Low) for each candidate.

Types

Represents the matching confidence category.

pub type Confidence {
  High
  Medium
  Low
}

Constructors

  • High
  • Medium
  • Low

A resolved entity match result.

pub type Resolution(candidate) {
  Resolution(
    candidate: candidate,
    score: Float,
    components: List(rank.ComponentScore),
    confidence: Confidence,
    matched: Bool,
  )
}

Constructors

An entity resolver configuration matching a query to candidates.

pub type Resolver(query, candidate) {
  Resolver(
    scorer: fn(query, candidate) -> List(rank.ComponentScore),
    threshold: Float,
    confidence_thresholds: #(Float, Float),
  )
}

Constructors

  • Resolver(
      scorer: fn(query, candidate) -> List(rank.ComponentScore),
      threshold: Float,
      confidence_thresholds: #(Float, Float),
    )

Values

pub fn component(
  name: String,
  weight: Float,
  score: Float,
) -> rank.ComponentScore

Helper function to construct a ComponentScore inside the resolver scorer.

pub fn new(
  scorer: fn(query, candidate) -> List(rank.ComponentScore),
) -> Resolver(query, candidate)

Creates a new Resolver with a composite scoring function. Defaults to a threshold of 0.7, medium confidence at 0.75, and high confidence at 0.9.

pub fn resolve(
  resolver: Resolver(query, candidate),
  query: query,
  candidates: List(candidate),
) -> Result(List(Resolution(candidate)), rank.RankError)

Resolves a query entity against a list of candidates. Returns resolution records sorted descending by composite score, with stable ordering.

pub fn with_confidence_thresholds(
  resolver: Resolver(q, c),
  medium: Float,
  high: Float,
) -> Resolver(q, c)

Configures the thresholds for Medium and High confidence tiers.

pub fn with_threshold(
  resolver: Resolver(q, c),
  threshold: Float,
) -> Resolver(q, c)

Configures the minimum score threshold to consider a record “matched”.

Search Document