intent

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package intent classifies query intent to route graph traversal. Based on MAGMA (arxiv:2601.03236): intent-aware retrieval boosts the right edge types, improving LoCoMo score from 0.58 to 0.70.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EdgeWeights

type EdgeWeights struct {
	CausedBy   float64
	LedTo      float64
	Supersedes float64
	LearnedIn  float64
	PartOf     float64
	RelatesTo  float64
	DependsOn  float64
	Touches    float64
}

EdgeWeights maps edge types to boost multipliers for a given intent. Higher = more likely to traverse this edge type. Based on MAGMA's adaptive weight vector w_Tq.

func Weights

func Weights(i Intent) EdgeWeights

Weights returns edge traversal weights for the given intent.

func (EdgeWeights) EdgeWeight

func (w EdgeWeights) EdgeWeight(edgeType string) float64

EdgeWeight returns the boost for a specific edge type given intent weights.

type Intent

type Intent int

Intent represents the detected query intent.

const (
	IntentGeneral Intent = iota // default: balanced traversal
	IntentWhy                   // causal: "why", "reason", "cause", "because"
	IntentWhen                  // temporal: "when", "since", "before", "after", "timeline"
	IntentWho                   // entity: "who", "which library", "what tool"
	IntentHow                   // procedural: "how", "steps", "process", "workflow"
	IntentWhat                  // spec/fact: "what is", "describe", "explain"
)

func Classify

func Classify(query string) Intent

Classify detects query intent from natural language using keyword scoring. The intent with the most keyword matches wins, breaking ties by priority.

func (Intent) String

func (i Intent) String() string

String returns a human-readable intent name.

Jump to

Keyboard shortcuts

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