Help us shape the future of Go! Take the 2026 Go Developer Survey

wording

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package wording decides whether two short rule/note pairs say the same thing. It is the deterministic restatement check behind proposal deduplication (internal/distill) and ambient pin budgeting (internal/reviews) — two importers that must reach one answer, which is why the logic lives in a leaf package neither owns.

The check is calibrated, not guessed: thresholds were tuned against a real pin file where 23% of 65 applied pins restated something already pinned — every hand-identified duplicate cluster is caught, and no distinct pin is merged (the calibration set lives in wording_test.go).

Index

Constants

View Source
const MaxRuleLen = 40

MaxRuleLen bounds a normalized rule label — long enough for any honest kebab slug, short enough that a label echoed into prompts and terminals can never blow a budget. Exported because prompt-budget arithmetic downstream stands on this exact bound.

Variables

This section is empty.

Functions

func CleanRule

func CleanRule(s string) string

CleanRule normalizes a label to pin-safe kebab-case: lowercased, spaces to hyphens, everything outside [a-z0-9-] stripped, length capped. Labels are echoed back — into agent prompts and onto terminals — and pins are hand-written in committed config, which on a cloned repo is no more trusted than a review comment: unnormalized, a multiline rule would inject lines into a prompt's instruction block.

Types

type Topic

type Topic struct {
	// contains filtered or unexported fields
}

Topic is the comparable form of one pattern: its label and guidance reduced to topic words.

func New

func New(rule, note string) Topic

New builds a Topic from a pattern's rule label and guidance note. The label is normalized through CleanRule; matching reads the raw text — words() lowercases and drops punctuation itself, so normalization changes nothing about which patterns restate each other.

func (Topic) Label

func (t Topic) Label() string

Label returns the normalized (prompt- and terminal-safe) rule label.

func (Topic) Restates

func (t Topic) Restates(o Topic) bool

Restates reports whether two patterns say the same thing.

Jump to

Keyboard shortcuts

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