scoring

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

README

$$ f(x) = \int_{-\infty}^\infty \hat f(\xi) e^{2 \pi i \xi x} d\xi $$

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseComponent

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

BaseComponent 基础评分组件

func (*BaseComponent) IsAutoWeight

func (b *BaseComponent) IsAutoWeight() bool

func (*BaseComponent) Name

func (b *BaseComponent) Name() string

func (*BaseComponent) Score

func (b *BaseComponent) Score() (float64, error)

func (*BaseComponent) SetSystem

func (b *BaseComponent) SetSystem(s *ScoringSystem)

func (*BaseComponent) Weight

func (b *BaseComponent) Weight() float64

type ComponentOption

type ComponentOption func(*BaseComponent)

ComponentOption 组件选项

func WithCustomWeight

func WithCustomWeight(w float64) ComponentOption

func WithProcessor

func WithProcessor(p DataProcessor, data interface{}) ComponentOption

type DataProcessor

type DataProcessor interface {
	Process(interface{}) (float64, error)
}

DataProcessor 数据处理器接口

type RangeProcessor

type RangeProcessor struct {
	Min, Max float64
}

RangeProcessor 示例处理器

func (*RangeProcessor) Process

func (p *RangeProcessor) Process(data interface{}) (float64, error)

type ScoreComponent

type ScoreComponent interface {
	Name() string
	Weight() float64
	Score() (float64, error)
	SetSystem(*ScoringSystem)
	IsAutoWeight() bool
}

ScoreComponent 评分组件接口

func NewComponent

func NewComponent(name string, opts ...ComponentOption) ScoreComponent

type ScoringSystem

type ScoringSystem struct {
	Components []ScoreComponent
	// contains filtered or unexported fields
}

ScoringSystem 评分系统

func GetScoringSystem

func GetScoringSystem() *ScoringSystem

func (*ScoringSystem) CalculateTotalScore

func (s *ScoringSystem) CalculateTotalScore() (float64, error)

func (*ScoringSystem) Register

func (s *ScoringSystem) Register(c ScoreComponent) error

type ThresholdProcessor

type ThresholdProcessor struct {
	Threshold float64
}

ThresholdProcessor 阀值处理器

func (*ThresholdProcessor) Process

func (p *ThresholdProcessor) Process(data interface{}) (float64, error)

Jump to

Keyboard shortcuts

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