verdict

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 11 Imported by: 3 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 verdict gives the verdict of an answer slot and of an item on the values read in them, by the check kinds of the module format and their normalization, with the reason of a value that cannot be read and the trap of a wrong one (format/README.md, section 15). It also joins the observations of two readers into one, answer slot by answer slot, and gives the verdict on the joined observation (contracts/README.md, section 10; R86 spec). api calls it on a learner's work, and tutor's eval runner on the truth of a sample's markup (R95 spec); the check of a module reads by it the rules of a task that the check of an answer slot sees itself.

It holds so far the check kinds number, fraction and choice: OfItem and OfSlot give the verdict on values as they are written, Same compares two values as a check does, and UnicodeVersion names the version of Unicode that the normalization follows (R27). A rubric gives no verdict. The predicate comes with the sandbox of Starlark, and the joining of two readings after it (R16).

Index

Constants

View Source
const UnicodeVersion = norm.Version

UnicodeVersion is the version of Unicode that the normalization follows: that of the tables of NFKC the library is built with, which its tests hold equal to those of the standard library's package unicode. The format leaves the version to the reader's release, and this is where a release of module-kit names it (format/README.md, section 15; R27).

Variables

View Source
var ErrNoVerdict = errors.New("a rubric gives no verdict")

ErrNoVerdict is what the check of a rubric gives: a rubric gives feedback by its criteria, and the item it checks has no verdict.

View Source
var ErrPlaceholder = errors.New("the check holds the placeholder of a template, which an instance replaces with a number")

ErrPlaceholder is what the check of a number or a fraction gives when its key or a trap value holds the placeholder of a template: the check is a template's, and an instance of it replaces the placeholder with a number (format/README.md, section 23).

Functions

func Same

func Same(slot AnswerSlot, a, b string) bool

Same says whether the check of an answer slot compares two values equal, as it compares a value with a trap value, after the same normalization (format/README.md, section 15): for a choice, the same normal form, an option or not, empty too; for a number and a fraction, two values in the kind's notation, of one value; for a predicate, the same integer. A rubric compares nothing, and a value that is not UTF-8 is equal to none.

A value out of a number's notation is equal to nothing here. The joining of two readings joins such values by their normal forms, and keeps apart a value out of the notation from one in it, which its normal form can spell, as 1/100000000000000 does (contracts/README.md, section 10).

Types

type AnswerSlot

type AnswerSlot struct {
	Binding string
	Check   formatv0.Check
	Options []formatv0.Text
}

AnswerSlot is an answer slot of an item as its check reads it: its binding as the format writes it — anywhere, sheet, zone, choice or box (format/README.md, section 14) — its check, and, when it is bound choice, its options, of which the learner taps one.

func AnswerSlots

func AnswerSlots(item formatv0.Item) []AnswerSlot

AnswerSlots gives the answer slots of an item, in their order: on a handwriting sheet its answer_slots, on a workbook the boxes of its line (format/README.md, section 14).

func (AnswerSlot) ChoiceOptions

func (s AnswerSlot) ChoiceOptions() []formatv0.Text

ChoiceOptions gives the options of a choice as written: the answer slot's when it is bound choice, and the check's own otherwise (format/README.md, section 15).

type ItemVerdict

type ItemVerdict struct {
	Verdict Verdict
	Slots   []SlotVerdict
}

ItemVerdict is the verdict of an item, made of the verdicts of its answer slots, which it holds in their order.

func OfItem

func OfItem(ctx context.Context, item formatv0.Item, values []*string) (ItemVerdict, error)

OfItem gives the verdict of an item on the values read in its answer slots, one for each, in the order of AnswerSlots: a value as it is written, or nil when nothing was read (format/README.md, section 15). An error gives no verdict: ctx is done, the item has no answer slots, the values are not one for each answer slot, or OfSlot gives one for an answer slot — ErrNoVerdict for an item that a rubric checks.

type Reason

type Reason string

Reason is why an answer slot is unreadable, as the format writes it. These are the reasons that a check kind gives itself; those that a reading gives before the value is judged come with the observation (contracts/README.md, section 10).

const (
	Blank    Reason = "blank"    // nothing was read, or nothing is left once the value is normalized
	Notation Reason = "notation" // the value is not in the kind's notation
)

The reasons that a check kind gives.

type SlotVerdict

type SlotVerdict struct {
	Verdict Verdict
	Reason  Reason
	Trap    *formatv0.TrapValue
}

SlotVerdict is the verdict of an answer slot: with its reason when it is Unreadable, and with the trap value that the value matches, a copy of it, when it is NotYet and matches one — the trap it shows, and the text that the learner reads after it, if the author wrote one (format/README.md, sections 15 and 19).

func OfSlot

func OfSlot(ctx context.Context, slot AnswerSlot, value *string) (SlotVerdict, error)

OfSlot gives the verdict of an answer slot on the value read in it: the value as it is written, or nil when nothing was read (format/README.md, section 15). The value and the trap values are normalized as the check kind normalizes them, and the key is read as it is written, in the kind's notation.

An error gives no verdict: ctx is done; the value is not UTF-8; the check is one that the format does not take — its kind is none of the five, a number, a fraction or a choice has no key, the key of a number or a fraction is not in its notation, it or a trap value holds the placeholder of a template, ErrPlaceholder, or a choice has no options; the check is a rubric, ErrNoVerdict; or it is a predicate and the value is in its notation, which the sandbox decides. A check that breaks a rule of the format that the check sees itself — a key that is none of the options, two options alike, a key of a fraction in lowest terms that can be reduced, a trap value that is not wrong — still gives its verdict, so that the check of a module reads those rules by it.

type Verdict

type Verdict string

Verdict is the verdict of an answer slot or of an item, as the format writes it (format/README.md, section 15).

const (
	Correct    Verdict = "correct"    // the value is right
	NotYet     Verdict = "not_yet"    // the value is in the kind's notation and is not right
	Unreadable Verdict = "unreadable" // the learner is asked to write the answer again, which is no wrong answer
	Unchecked  Verdict = "unchecked"  // the check could not run
)

The verdicts.

Jump to

Keyboard shortcuts

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