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 ¶
const AdapterVersionJump = "version-jump"
AdapterVersionJump is the source adapter of the entries Jumps adds.
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. An upgrade guide gives one entry per heading instead. Entries under an ignored section are dropped.
type Entry ¶
type Entry struct {
ID string `json:"id,omitempty"` // set by the digest; see report.EntryID
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.
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.