repeats

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package repeats finds capabilities and rules that may repeat each other across areas, for a session to judge. It only finds candidates: it makes no judgment, and it works over plain values, so it reads no session, store or record.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Normal

func Normal(heading, body string) string

Normal is the exact-duplicate form of an entry: lower case, words only, with spacing and punctuation set aside. Lines that start with "Because:" are left out, since two entries may state one rule for different reasons.

Types

type Capability

type Capability struct {
	Name string `json:"name"`
	Area string `json:"area"`
}

Capability is a capability's name and the area that holds it.

type CapabilityGroup

type CapabilityGroup struct {
	Capabilities []Capability `json:"capabilities"`
	Evidence     []string     `json:"evidence"`
}

CapabilityGroup is capabilities in at least two areas that may be one promise, with the evidence that joined them.

func CapabilityGroups

func CapabilityGroups(caps []Capability, pairs []SuffixPair, groups []RuleGroup) []CapabilityGroup

CapabilityGroups groups capabilities, in different areas, that share a suffix pair or a rule repeat. Each group carries its evidence: the rename, or the headings of the repeated rules.

type Input

type Input struct {
	Capabilities []Capability
	Renamed      []Rename
	Rules        []Rule
}

Input is what the finders read.

type Rename

type Rename struct {
	Area string `json:"area"`
	From string `json:"from"`
	To   string `json:"to"`
}

Rename is a name the walk gave a capability because another area held the wanted one first: Area wanted From and was given To.

type Result

type Result struct {
	Pairs        []SuffixPair      `json:"pairs"`
	Rules        []RuleGroup       `json:"rules"`
	Capabilities []CapabilityGroup `json:"capabilities"`
}

Result is every candidate found.

func Find

func Find(in Input) Result

Find runs every finder over in. Its output is sorted and does not depend on the order of the input.

type Rule

type Rule struct {
	ID         string `json:"id"`
	Capability string `json:"capability"`
	Area       string `json:"area"`
	Kind       string `json:"kind"`
	Heading    string `json:"heading"`
	Body       string `json:"body"`
}

Rule is one entry of a capability's rules, decisions or questions.

type RuleGroup

type RuleGroup struct {
	Rules []Rule `json:"rules"`
	Exact bool   `json:"exact"`
}

RuleGroup is rules in at least two areas that repeat each other, exactly or nearly. Exact is true when every rule has the same Normal form.

func RuleGroups

func RuleGroups(rules []Rule) []RuleGroup

RuleGroups groups rules that repeat each other across areas, exactly (the same kind and the same Normal) or nearly (word overlap of at least 45 percent, each rule indexed by its rarest four words). A group whose rules all sit in one area is never returned.

type SuffixPair

type SuffixPair struct {
	Original Capability `json:"original"`
	Renamed  Capability `json:"renamed"`
	Reason   string     `json:"reason"`
}

SuffixPair is a capability the walk renamed, with the capability of another area that kept the original name.

func SuffixPairs

func SuffixPairs(caps []Capability, renamed []Rename) []SuffixPair

SuffixPairs pairs each renamed capability with the capability of another area that holds the original name. The walk's Renamed list is the source; the name pattern (walk, walk-2) only pairs a renamed name with its original.

Jump to

Keyboard shortcuts

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