rank

package
v0.0.0-...-b7c488f Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MIT Imports: 39 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	H = fnv.New32a()
)
View Source
var MESH, _ = meshexp.Default()

Functions

func CLF

CLF performs coordination-level fusion given a query. This wrapper function performs some pre-processing steps before actually ranking the documents for the query.

func Rank

Types

type BM25Scorer

type BM25Scorer struct {
	K1 float64
	B  float64
	// contains filtered or unexported fields
}

func (*BM25Scorer) Score

func (s *BM25Scorer) Score(query, pmid string, fields ...string) (float64, error)

type CLFOptions

type CLFOptions struct {
	CLF            bool `json:"clf"`
	RankCLM        bool `json:"rank_clm"`
	RankCLF        bool `json:"rank_clf"`
	QueryExpansion bool `json:"query_expansion"`

	PubMedBaseline bool `json:"pubmed_baseline"`

	ScorePubMed     bool `json:"score_pubmed"`
	OnlyScorePubMed bool `json:"only_score_pubmed"`

	RetrievalModel bool    `json:"retrieval_model"`
	Cutoff         float64 `json:"cutoff"`

	CLFVariations    bool   `json:"clf_variations"`
	VariationsOutput string `json:"variations_output"`
	PMIDS            string `json:"pmids"`
	Qrels            string `json:"qrels"`

	Titles  string `json:"titles"`
	Headway *headway.Client
	// contains filtered or unexported fields
}

func (CLFOptions) SetVariationOptions

func (o CLFOptions) SetVariationOptions(vector cui2vec.Embeddings, mapping cui2vec.Mapping, cache quickumlsrest.Cache) CLFOptions

type DirichletTermProbScorer

type DirichletTermProbScorer struct {
	Mu float64
	// contains filtered or unexported fields
}

func (DirichletTermProbScorer) Score

func (s DirichletTermProbScorer) Score(query, pmid string, fields ...string) (float64, error)

type DocLenScorer

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

func (DocLenScorer) Score

func (s DocLenScorer) Score(query, pmid string, fields ...string) (float64, error)

type IDFScorer

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

func (*IDFScorer) Score

func (s *IDFScorer) Score(query, pmid string, fields ...string) (float64, error)

type LnL2Scorer

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

func (LnL2Scorer) Score

func (s LnL2Scorer) Score(query, pmid string, fields ...string) (float64, error)

type PosScorer

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

func (PosScorer) Score

func (s PosScorer) Score(query, pmid string, fields ...string) (float64, error)

type Posting

type Posting struct {
	// Term -> Field -> PMID -> TF
	Index map[uint32]map[uint32]map[uint32]Statistics
	// PMID -> Field -> DocLen
	DocLens   map[string]map[uint32]float64
	DocDates  map[uint32]int64
	TermIdx   map[uint32]int
	MaxDocLen float64
	// contains filtered or unexported fields
}

func Index

func Index(documents guru.MedlineDocuments) (*Posting, error)

func (*Posting) AvgDocLen

func (p *Posting) AvgDocLen(field string) float64

func (*Posting) CollectionTermProbability

func (p *Posting) CollectionTermProbability(term, field string) float64

func (*Posting) DirichlectTermProbability

func (p *Posting) DirichlectTermProbability(term, field, pmid string, mu float64) float64

func (*Posting) DocLen

func (p *Posting) DocLen(field string, pmid string) float64

func (*Posting) DocumentTermProbability

func (p *Posting) DocumentTermProbability(term, field, pmid string) float64

func (*Posting) DocumentVector

func (p *Posting) DocumentVector(pmid uint32) []float64

func (*Posting) Pos

func (p *Posting) Pos(term, field, pmid string) float64

func (*Posting) TTf

func (p *Posting) TTf(term, field string) float64

func (*Posting) Tf

func (p *Posting) Tf(term, field, pmid string) float64

func (*Posting) VocabSize

func (p *Posting) VocabSize(field string) float64

type PubDateScorer

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

func (PubDateScorer) Score

func (s PubDateScorer) Score(query, pmid string, fields ...string) (float64, error)

type QueryOptimiser

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

type Runner

type Runner struct {
	stats.EntrezStatisticsSource
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(cache string, queries, fields []string, e stats.EntrezStatisticsSource, scorer Scorer) Runner

func (Runner) Run

func (r Runner) Run() ([]ScoredDocuments, error)

type ScoredDocument

type ScoredDocument struct {
	PMID  string
	Score float64
	Rank  float64
}

type ScoredDocuments

type ScoredDocuments struct {
	Docs []ScoredDocument
}

type Scorer

type Scorer interface {
	Score(query, pmid string, fields ...string) (float64, error)
	// contains filtered or unexported methods
}

type Statistics

type Statistics struct {
	Tf  float64
	Pos float64
}

type SumIDFScorer

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

func (SumIDFScorer) Score

func (s SumIDFScorer) Score(query, pmid string, fields ...string) (float64, error)

type SumTFScorer

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

func (SumTFScorer) Score

func (s SumTFScorer) Score(query, pmid string, fields ...string) (float64, error)

type TFIDFScorer

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

func (*TFIDFScorer) Score

func (s *TFIDFScorer) Score(query, pmid string, fields ...string) (float64, error)

type TitleAbstractScorer

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

func (TitleAbstractScorer) Score

func (s TitleAbstractScorer) Score(query, pmid string, fields ...string) (float64, error)

type VectorSpaceScorer

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

func (VectorSpaceScorer) Score

func (s VectorSpaceScorer) Score(query, pmid string, fields ...string) (float64, error)

Jump to

Keyboard shortcuts

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