selfcases

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package selfcases samples label-free retrieval cases from an index: a documented symbol plus the query built from its own docstring. Shared by cmd/selfsweep (scores them) and cmd/confcal (uses them as positives whose answer definitely exists).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstSentence

func FirstSentence(doc string) string

FirstSentence extracts the leading prose sentence and strips the comment syntax the indexer stored with it. Queries must not contain "//" — the stored docstring does, which would hand lexical search a literal substring of the answer.

func StripLeadingName

func StripLeadingName(sentence, name string) string

StripLeadingName removes the Go-doc leading symbol name ("Foo returns..." -> "returns...").

Types

type Case

type Case struct {
	Name      string // bare symbol name
	Qualified string // qualified name, the retrieval target
	Sentence  string // first docstring sentence, comment markers stripped
}

Case is one symbol and the queries derived from its docstring.

func Sample

func Sample(indexPath string, opt Options) ([]Case, int, error)

DECISION(2026-07): behavioral kinds only by default. Const/type docs in the Go convention restate the name ("DefaultAuthMode is the default authentication mode"), so a name-stripped query is a subject-less predicate no agent would type — those cases measure grammar, not retrieval.

func (Case) Paraphrase

func (c Case) Paraphrase() string

Paraphrase is Sentence with the leading symbol name removed, so lexical search cannot match the answer by name alone.

type Options

type Options struct {
	N      int    // sample size (stride over all qualifying symbols)
	MinDoc int    // minimum docstring length
	Kinds  string // comma-separated kinds; "all" disables the filter
}

Options controls sampling.

Jump to

Keyboard shortcuts

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