/
interface.go
30 lines (24 loc) · 998 Bytes
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Package score allows to sort matched records according to their relevancy.
package score
import (
"fmt"
"github.com/gnames/gnames/ent/verifier"
vlib "github.com/gnames/gnlib/ent/verifier"
)
// Score inteface implements methods for finding best-matching record,
// according to its score, as well as return best matching records from the
// selected data-sources.
type Score interface {
fmt.Stringer
// SortResults takes a pointer for verifier.MatchRecord calculates the score
// for all MatachResults and sorts them in reverse order according to
// the calculated score. The highest-scored record is the first, and the
// lowest-scored record is the last.
SortResults(*verifier.MatchRecord)
// BestResult returns the pointer to the best result according to score
// altorithm.
BestResult(*verifier.MatchRecord) *vlib.ResultData
// Results returns the best-scoring result for each of the
// given selected data-sources.
Results(mr *verifier.MatchRecord) []*vlib.ResultData
}