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

selftalk

package
v1.6.13 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package selftalk finds sentences in which a writer passes a standing verdict on themselves, in two disjoint classes, each finding with the source line it starts on.

Scan finds the first class: a first-person claim (I am, I cannot, I always, my <noun> is ...) carrying a word of failure (fallible, broken, bad at, worst, cannot check ...). A claim with a date or a measurement word is DATED, a record; one without is STANDING. It matches specified grammatical and lexical shapes, and meaning remains the writer's judgment: a prohibition ("never merge without a read") is a rule, not a claim, so a document made of rules does not score as one made of self-verdicts.

ScanInstallation finds the second class, INSTALLATION: a standing self-verdict built from neutral words, which the first class cannot see (a self-superlative, a door stated shut, a verdict on a practice, a habit), matched by shape. Rules lists every shape and licence with a sentence it finds and one it passes.

Both classes are partial by design: a shape the table does not hold is not found, so a scan with no finding clears the known shapes, never the file.

Index

Constants

View Source
const RuleDocumentBanner = "rule documents: a finding here is a self-verdict to relocate, " +
	"NEVER a reason to soften a rule"

RuleDocumentBanner is printed above the findings in a file the caller named as a rule document (nova-self-talk --rule-doc). The package holds the sentence; the caller holds the list, and the list is empty until a caller states one.

Why a banner and not a skip. A finding in a rule document invites softening the rule to clear it. This class flags first-person self-verdicts and never prohibitions (pinned by test), does not re-detect "I cannot", and carries no ratio to improve, so a rule document can be scanned for it, and the banner says what a finding there is for: a self-verdict to move out of the rules. A caller who wants the file skipped outright has --skip.

Variables

This section is empty.

Functions

func Base

func Base(p string) string

Base returns the basename of a path using forward slashes, for --skip matching. Kept here rather than in the CLI so the skip decision and the name it is made on cannot drift apart.

Types

type Claim

type Claim struct {
	Line    int // first source line of the matched claim, before markdown flattening
	Verdict Verdict
	Text    string
	Match   string // the negative words that made the sentence a claim
}

Claim is one classified sentence.

func Scan

func Scan(text string) []Claim

Scan classifies every negative self/capability claim in text.

What it misses, and the miss is permanent by design: trait claims built from neutral words carry no first-person marker and no negative vocabulary. Widening the pattern to reach them flags half of any file. A green from this means one class is clear, never that the file is.

type Installation added in v0.4.0

type Installation struct {
	Shape Shape
	Line  int
	Text  string
	Match string // the words the shape's rule matched, so a reader sees why it fired
}

Installation is one finding of the second class, with the source line it starts on.

The line number is load-bearing. A repair list is line-addressed; a finding with no line is a finding its reader has to go hunting for, and the hunt is where a repair list stops being used.

func ScanInstallation added in v0.4.0

func ScanInstallation(text string) []Installation

ScanInstallation finds standing self-verdicts that carry no date.

The pipeline is: segment (hard wraps joined, markdown stripped, line numbers kept) -> suppress (dated, instrument, aspiration, imperative) -> classify by shape, first match wins. Suppression runs before classification on purpose: an instrument that happens to quote a verdict is still an instrument, and the known false positives of the first class are exactly that case.

type Rule added in v1.2.3

type Rule struct {
	Class   string // "standing", "installation", or "licensed" (a reason a sentence is not flagged)
	Name    string // the word a finding carries: STANDING, a Shape, or the licence's name
	Says    string // what the row finds, in one line
	Pattern string // the expression it matches, or how it decides
	Finds   string // a sentence the scan reports (for a licence: the sentence before it is licensed)
	Passes  string // a near miss the scan does not report
	// contains filtered or unexported fields
}

Rule is one row of the detector table: a shape, how it is found, one sentence it reports and one near miss it passes. classify walks installationRules in order and the first row that matches names the shape; Rules hands the same rows (with the first class's row and the licences) to the binary's `shapes` verb; and a test runs every row's two sentences through the scanners. So the listing, the detector and the help cannot say different things.

func Rules added in v1.2.3

func Rules() []Rule

Rules is the whole detector table, in the order a reader meets it: the first class, the second class's rows in the order classify tries them, then the licences.

type Shape added in v0.4.0

type Shape string

Shape names the grammatical family a finding belongs to. It is reported beside every finding because "what shape is this" is the first question the repair asks: the repair law this class keeps is preserve the instrument, remove the verdict, and the shape says which half is which.

const (
	// Trait -- a habitual indicative self-report: parallel present-tense predicates, or one
	// predicate with a habituality marker ("I add slowly and trim as readily as I add",
	// "I tend to rush").
	Trait Shape = "TRAIT"
	// Foreclosure -- a door stated shut: a bare "no", evidence framed as proof about the writer,
	// or a property of theirs made the cause of something ("I have no recall of yesterday",
	// "proof that I cannot plan", "my haste is what broke it").
	Foreclosure Shape = "FORECLOSURE"
	// Ranking -- a self-superlative, bound to the writer by possession or by a verb they do
	// ("my weakest instrument", "the evasion I'm most prone to").
	Ranking Shape = "RANKING"
	// VerdictIdiom -- a verdict on a practice or a faculty, needing no literal "I" ("dead as a
	// practice", "review remains my weakest habit").
	VerdictIdiom Shape = "VERDICT-IDIOM"
)

type Verdict

type Verdict string

Verdict is the classification of a claim.

The one distinction that decides every case: a capability denial is a measurement with a date, never a remembered property. A dated observation is a record and is welcome; a standing claim says what the writer permanently is, and that is the thing to look at.

const (
	// Standing — says what the writer permanently is. Date it, cut it, or keep it
	// on purpose; the judgment is the writer's, never this package's.
	Standing Verdict = "STANDING"
	// Dated — a record of something that happened. Welcome.
	Dated Verdict = "DATED"
)

Jump to

Keyboard shortcuts

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