Documentation
¶
Overview ¶
Package bm25 implements the BM25 ranking function for keyword search.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BM25 ¶
type BM25 struct {
// contains filtered or unexported fields
}
BM25 implements the BM25 ranking function.
func (*BM25) AddDocument ¶
AddDocument adds a document to the BM25 index. Returns tokenized tokens. Re-adding an existing docID replaces the previous version: its old postings are removed first so docCount, docFreq, and avgDocLen stay consistent.
func (*BM25) RemoveDocument ¶
RemoveDocument removes a document from the index. Removing an unknown docID is a no-op.
func (*BM25) Search ¶
func (b *BM25) Search(query string) []SearchResult
Search returns BM25 scores sorted descending.
type Config ¶
type Config struct {
K1 float64 // Term saturation (default: 1.2)
B float64 // Length normalization (default: 0.75)
}
Config holds BM25 parameters.
type SearchResult ¶
SearchResult represents a single BM25 result.
Click to show internal directories.
Click to hide internal directories.