Documentation
¶
Overview ¶
Package score computes relevance scores for decision and learning entries based on recency and keyword overlap with active tasks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTaskKeywords ¶
ExtractTaskKeywords extracts meaningful keywords from task text.
Splits task text on whitespace and punctuation, lowercases, and filters out stop words and words shorter than 3 characters. Deduplicates results.
Parameters:
- tasks: Active task strings (e.g., "- [ ] Implement feature X")
Returns:
- []string: Unique lowercase keywords
func RecencyScore ¶
func RecencyScore(eb *index.EntryBlock, now time.Time) float64
RecencyScore returns a score based on the entry's age.
Scoring brackets:
- 0-7 days: 1.0
- 8-30 days: 0.7
- 31-90 days: 0.4
- 90+ days: 0.2
Parameters:
- eb: Entry block to score
- now: Current time for age calculation
Returns:
- float64: Recency score between 0.2 and 1.0
func RelevanceScore ¶
func RelevanceScore(eb *index.EntryBlock, keywords []string) float64
RelevanceScore computes keyword overlap between an entry and active tasks.
Counts how many task keywords appear in the entry's title and body. Normalized to 1.0 at 3+ matches.
Parameters:
- eb: Entry block to score
- keywords: Lowercase keywords extracted from active tasks
Returns:
- float64: Relevance score between 0.0 and 1.0
func ScoreEntry ¶
ScoreEntry computes the combined relevance score for an entry block.
Superseded entries always get score 0.0. All other entries get recency and task relevance (range 0.0-2.0).
Parameters:
- eb: Entry block to score
- keywords: Task keywords for relevance matching
- now: Current time for recency calculation
Returns:
- float64: Combined score (0.0-2.0), or 0.0 if superseded
Types ¶
type Entry ¶
type Entry struct {
index.EntryBlock
Score float64
Tokens int
}
Entry is an entry block with a computed relevance score.
func ScoreEntries ¶
ScoreEntries scores and sorts entry blocks by relevance.
Parameters:
- blocks: Parsed entry blocks from a knowledge file
- keywords: Task keywords for relevance matching
- now: Current time for recency scoring
Returns:
- []ScoredEntry: Entries sorted by score descending, with token estimates