scorer

package
v0.9.0-dev.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package scorer holds the CONFIGURED scoring engine: it carries the user's weight table and answers the two questions callers outside the search domain ask, what does this subtitle score and which tier is that score.

It is deliberately separate from internal/search/scoring, which holds the pure matching and weighting rules, and the near-identical names were examined rather than left as an accident. They are two concerns, and the usage proves it: internal/search reaches 14 distinct scoring symbols across 23 call sites while this package uses exactly one, so the pure half belongs where its consumer is, and three packages outside the search domain (the composition root, internal/server, internal/wiring) hold this one. A merge in either direction therefore either buries search's own rules behind a facade it does not use or makes the server import a search subpackage. Neither name states a category and neither shadows anything, so the pair is a reading cost, not a rule violation, and renaming would churn 126 call sites to fix a confusion a package doc can resolve.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine is a configured scorer.

func New

func New(scores *subflux.Scores) *Engine

New creates a scorer engine with the given weights.

func (*Engine) Score

func (e *Engine) Score(sub subflux.SubtitleInfo, matches subflux.MatchSet) (score, scoreNoHash int)

Score calculates the score for a subtitle's match set. The input matches struct is not modified.

Verifiable hash match returns the hash weight directly (typically 100). Otherwise, only release attribute keys contribute to the score. Non-verifiable hash adds the hash weight on top of release attributes.

func (*Engine) ScoreToTier

func (*Engine) ScoreToTier(score int) subflux.ScoreTier

ScoreToTier returns the named tier for a given score.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL