classify

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 11 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 classify splits release notes into entries and gives each a kind (breaking, feature, fix and so on) with a confidence. Kinds come from the headings an entry sits under.

Index

Constants

View Source
const AdapterVersionJump = "version-jump"

AdapterVersionJump is the source adapter of the entries Jumps adds.

View Source
const (
	ConfidenceOther = 0.3 // no rule matched

)

Confidence of each rule priority (classification spec).

Variables

This section is empty.

Functions

This section is empty.

Types

type Classifier

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

Classifier turns source.VersionNotes into entries.

func New

func New(o Options) (*Classifier, error)

New returns a classifier with the built-in rules and those in o.

func (*Classifier) Classify

func (c *Classifier) Classify(headings []string, text string) (Kind, float64)

Classify returns the kind and confidence of an entry's Markdown text under headings (outermost first), taking the first rule that matches in the spec's priority order.

func (*Classifier) Entries

func (c *Classifier) Entries(n source.VersionNotes) []Entry

Entries splits n into entries: one per list item and one per run of other blocks. Entries under an ignored section are dropped.

type Entry

type Entry struct {
	Version    string     `json:"version"`
	Kind       Kind       `json:"kind"`
	Confidence float64    `json:"confidence"`
	Text       string     `json:"text"` // Markdown
	Source     source.Ref `json:"source"`
}

Entry is one item of release notes.

func Jumps

func Jumps(
	s version.Scheme,
	from version.V,
	versions []version.Version,
	entries []Entry,
	urls map[string]string,
) []Entry

Jumps returns a breaking entry for each version that starts a new major line (a new minor in 0.x) and has no breaking entry of its own. versions are oldest first; urls maps a version to its release page.

type Kind

type Kind string

Kind is the category of an entry.

const (
	KindBreaking    Kind = "breaking"
	KindDeprecation Kind = "deprecation"
	KindSecurity    Kind = "security"
	KindFeature     Kind = "feature"
	KindFix         Kind = "fix"
	KindOther       Kind = "other"
)

Entry kinds.

func Kinds

func Kinds() []Kind

Kinds lists every kind in display order, most urgent first.

type Options

type Options struct {
	BreakingMarkers []string // regular expressions that make an entry breaking
	IgnoreSections  []string // headings, or "A › B" paths, whose entries are dropped
}

Options adds a tool's registry rules to the built-in ones.

Jump to

Keyboard shortcuts

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