tanya

package
v1.43.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IntentUpdate         Intent = "update"
	IntentExplain        Intent = "explain"
	IntentHowTo          Intent = "how_to"
	IntentDefinition     Intent = "definition"
	IntentComparison     Intent = "comparison"
	IntentRecommendation Intent = "recommendation"
	IntentTroubleshoot   Intent = "troubleshoot"
	IntentLocation       Intent = "location"
	IntentTime           Intent = "time"
	IntentPrice          Intent = "price"
	IntentContact        Intent = "contact"
	IntentQuestion       Intent = "question" // general fallback
	IntentOther          Intent = "other"

	MatchTypeContains    MatchType = "contains"
	MatchTypeStarts      MatchType = "starts"
	MatchTypeEnds        MatchType = "ends"
	MatchTypeTokenSuffix MatchType = "token_suffix" // nolint:gosec
)

Intent and MatchType constants

Variables

This section is empty.

Functions

func IsQuestion

func IsQuestion(q string) bool

IsQuestion returns true if a query is a question

Types

type Intent

type Intent string

Intent is the intent of a query

func ClassifyIntent

func ClassifyIntent(q string) Intent

ClassifyIntent returns the most likely intent for the given query

type IntentSpec

type IntentSpec struct {
	Intent   Intent
	Priority int
	Rules    []Rule
}

IntentSpec is a specification for intent

type MatchType

type MatchType string

MatchType is the type of match

type Rule

type Rule struct {
	Terms       []string
	Weight      int
	MatchType   MatchType
	MinTokenLen int // optional: for token_suffix; <=0 => default 4
}

Rule is a rule for matching a query to intent

Jump to

Keyboard shortcuts

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