Documentation
¶
Index ¶
- Constants
- func FusionRank(signals []Signal) map[string]float64deprecated
- func Louvain(graph map[string][]string) map[string]int
- func LouvainWeighted(graph map[string]map[string]int) map[string]int
- func LouvainWithResolution(graph map[string][]string, gamma float64) map[string]int
- func PageRank(graph map[string][]string, iterations int, damping float64) map[string]float64
- func PersonalizedPageRank(graph map[string][]string, seeds map[string]float64, iterations int, ...) map[string]float64
- func WeightedPersonalizedPageRank(graph map[string]map[string]float64, seeds map[string]float64, iterations int, ...) map[string]float64
- type BM25F
- type Document
- type RefGraph
- type RefGraphInput
- type Signal
Constants ¶
const ( WeightSymbol = 5.0 // symbol name matches are most important WeightPath = 3.0 // file path matches are moderately important WeightDoc = 2.0 // doc-comment matches (more verbose, less specific than symbol names) )
Field weight constants for BM25F scoring.
Variables ¶
This section is empty.
Functions ¶
func FusionRank
deprecated
FusionRank combines ranking signals into a single score per file. Each signal is min-max normalized to [0,1] before weighted combination.
Deprecated: prefer rerank.WeightedRRF (rank-based fusion) over min-max + weighted sum. Min-max is outlier-sensitive and not scale-invariant across corpora — see plan 2026-04-29-go-code-retrieval-quality-lift.md §Stream 3. Kept as the default ANALYZE_RANK_FUSION_MODE=minmax path until the offline harness validates rrf with no per-repo regression >2%; remove next sprint after the default flip.
func Louvain ¶
Louvain performs community detection on an undirected graph using the Louvain modularity optimization algorithm. Input is an adjacency list (same format as PageRank). Returns a map from node to community ID (0-indexed). Returns nil for empty input. Uses multi-level graph contraction for better cluster separation.
func LouvainWeighted ¶
LouvainWeighted performs community detection on a weighted undirected graph. Input: node → neighbor → edge weight. Uses γ = 1.0.
func LouvainWithResolution ¶
LouvainWithResolution performs community detection with a resolution parameter γ. γ > 1.0 produces more (smaller) communities; γ < 1.0 produces fewer (larger) communities. γ = 1.0 is standard modularity (equivalent to Louvain()).
func PageRank ¶
PageRank computes PageRank scores for nodes in a directed graph. graph maps each node to the list of nodes it links TO (outgoing edges). iterations controls convergence (20 is typical), damping is usually 0.85. Returns normalized scores (sum ≈ 1.0).
func PersonalizedPageRank ¶
func PersonalizedPageRank( graph map[string][]string, seeds map[string]float64, iterations int, damping float64, ) map[string]float64
PersonalizedPageRank computes PageRank with a personalization vector. Seeds maps node names to personalization weights (higher = more bias). When seeds is nil, falls back to uniform (standard PageRank).
func WeightedPersonalizedPageRank ¶
func WeightedPersonalizedPageRank( graph map[string]map[string]float64, seeds map[string]float64, iterations int, damping float64, ) map[string]float64
WeightedPersonalizedPageRank computes PageRank with personalization on a weighted directed graph. graph maps src→dst→weight. Seeds bias the personalization vector; iterations/damping control convergence.
Types ¶
type BM25F ¶
type BM25F struct {
// contains filtered or unexported fields
}
BM25F implements field-weighted BM25 scoring.
type Document ¶
type Document struct {
Path string // relative file path
Symbols []string // symbol names in the file
Docs []string // doc-comments / leading comments per symbol
}
Document represents a file for BM25F scoring. Only Path, Symbols, and Docs are used — file content is scored via LLM, not BM25F.
type RefGraph ¶
type RefGraph struct {
// contains filtered or unexported fields
}
RefGraph is a weighted directed graph of file-to-file reference edges.
func BuildRefGraph ¶
func BuildRefGraph(input RefGraphInput) *RefGraph
BuildRefGraph constructs a file-level reference graph by resolving call sites to target symbol files and merging with import edges.
func (*RefGraph) ToUnweighted ¶
ToUnweighted converts to the format used by PageRank.