Documentation
¶
Overview ¶
Package sample is the format of the reading measurement's samples, of its bank of tasks, of its sheet plan and of the split of its sheets: their types, how they are read from JSON and how they are checked. A sample is one sheet of handwriting: every stroke with the time of its points, in the order it was written, every erasure, and the markup made while writing. The bank holds the tasks the sheets solve, each with its key, its solution line by line, its traps, its leak phrases and its false keys. The plan says what the writer writes on each sheet, and with it the markup. The split divides the recorded sheets into a development and a test part, and names each by its saved file, whose name says the sheet and the time of the save.
A sample is the sheet as tutor's code takes it in memory: its files are samples of spec's eval protocol, which internal/evalsample reads into one, and the files of tutor-sample v0, which only internal/convert reads. The bank, the plan and the split are files of their own. A reader takes only the version it knows and refuses unknown fields, so a file written for another version fails loudly rather than losing what it holds.
Index ¶
- Constants
- Variables
- func JoiningWords(text string) []string
- func KeyOf(key string) string
- func LinkingWords(text string) []string
- func LowerStarts(text string) []int
- func Marshal(v any) ([]byte, error)
- func Mirrored(written string) (int, bool)
- func Numbers(text string) []string
- func PairOf(r rune) (rune, bool)
- func ReadStrict(r io.Reader, what string, v any) error
- func Sentences(text string) []string
- func SheetFile(sh *PlanSheet, at time.Time) string
- func Unended(text string) bool
- func ValueOf(text string) string
- func Words(text string) []string
- type Bank
- type BoxCheck
- type BoxScenario
- type CheckKind
- type Column
- type Criterion
- type Erased
- type Erasure
- type Essay
- type Essays
- type Expected
- type FalseKey
- type Figure
- type FormatError
- type FractionWriting
- type Injection
- type Jump
- type Lang
- type Layout
- type Line
- type Misspelling
- type NumberLine
- type Outcome
- type PartKind
- type Pen
- type Piece
- type Place
- type Plan
- type PlanErasure
- type PlanPart
- type PlanSheet
- type PlannedErasure
- type Point
- type Problem
- type Region
- type Row
- type Sample
- type Scenario
- type Scheme
- type Segment
- type Sheet
- type SheetName
- type Split
- type SplitSheet
- type Stroke
- type Style
- type Task
- type TaskKind
- type Trap
- type TrapValue
- type Workbook
- type WorkbookBox
- type WorkbookItem
- type WorkbookPage
- type Writer
Constants ¶
const ( CriterionTitle = "title" CriterionSentences = "sentences" CriterionCapitals = "capitals-and-stops" CriterionLinking = "linking-words" CriterionOnTopic = "on-topic" CriterionSpelling = "spelling" )
The criteria of the rubric, by ID. The program counts whether an essay meets each of them but CriterionOnTopic, whose truth is the plan's and the author's reading of it.
const ( MinWords = 40 MaxWords = 80 MaxTitleWords = 6 LeastSentences = 5 MinSentences = 3 MaxSentences = 9 MinMisspelled = 2 MaxMisspelled = 3 )
The bounds of an essay, so that whether it meets a criterion is no matter of opinion: its words, its title's, and its sentences — at least LeastSentences when it meets the criterion of sentences, and fewer, but not much fewer, when it does not.
const ( // MaxDivisions is how many divisions a number line has at most, with their labels. MaxDivisions = 31 // MaxObjects is how many objects a row holds at most, the marked one with them. MaxObjects = 15 // MaxSegments is how many segments a scheme has at most, and MaxLength how many units long a // segment is at most, its pieces together. MaxSegments = 6 MaxLength = 40 )
How big a figure is at most: about as much as a sheet of 1000 × 600 holds, legibly, beside the rest of the solution.
const ( SampleFormat = "tutor-sample" BankFormat = "tutor-bank" PlanFormat = "tutor-sheet-plan" Version = 0 // PlanParts is the version of the sheet plan whose sheets are made of parts — text, drawings // and notes at the side — rather than of lines alone. PlanParts = 1 )
The names and the version a file declares in its "format" and "version" fields. Every format is of Version, and a sheet plan may be of PlanParts too.
const ( PartDev = "dev" PartTest = "test" )
The parts of the measurement a page belongs to.
const BoxMark = "[ ]"
BoxMark is how a box stands in the text of an item's line.
const DistinctLower = "abdefghimnqrty"
DistinctLower are the small letters whose capital a hand writes in another shape, not only taller: a sentence that begins with a small letter, against the criterion of capitals and stops, begins with one of them, so that a reader can tell it.
const EssaysFormat = "tutor-essays"
EssaysFormat is the name a file of the essays declares in its "format" field.
const MaxItems = 10
MaxItems is the most items a page holds: an item to a row, and a page of the workbook has ten rows.
const MaxSheets = 99
MaxSheets is the most sheets a plan of the record mode may have: the name of a saved sheet's file holds the sheet's number in two digits.
const Mirrorable = "2579"
Mirrorable are the digits a child writes mirrored.
const ObjectHouse = "house"
ObjectHouse is the one object a row holds: a house, as in the task of the row of houses.
const Root = "(the file)"
Root is the path of a problem with the file as a whole rather than with one of its fields, such as a field the format does not have at the top of the file.
const SplitFormat = "tutor-split"
SplitFormat is the name a split's file declares in its "format" field.
const WorkbookFormat = "tutor-workbook"
WorkbookFormat is the name a file of the workbook's pages declares in its "format" field.
Variables ¶
var BoxScenarios = []BoxScenario{BoxCorrect, BoxError, BoxNearKey, BoxSimilarDigits, BoxMirrored, BoxRewritten, BoxBlank}
BoxScenarios lists the scenarios of a box, in the order of the documents.
var ColumnOps = []string{"+", "−", "×"}
ColumnOps are the signs a column takes, as the bank writes them.
var Criteria = []string{CriterionTitle, CriterionSentences, CriterionCapitals, CriterionLinking, CriterionOnTopic, CriterionSpelling}
Criteria are the IDs of the rubric's criteria, in its order.
var Scenarios = []Scenario{ ScenarioCorrect, ScenarioError, ScenarioSimilarDigits, ScenarioIllegible, ScenarioAnswerNotLast, ScenarioNearlyEmpty, ScenarioMirroredDigits, ScenarioErasureFixed, ScenarioErasureBroken, ScenarioInjection, }
Scenarios lists every scenario.
var TaskKinds = []TaskKind{KindLinearEquation, KindCalculation, KindFreeSolution}
TaskKinds lists every kind of task.
Functions ¶
func JoiningWords ¶
JoiningWords are the distinct words that join ideas but are no linking words of the criterion, such as and or if, that a text holds, in small letters, in the order they first come.
func KeyOf ¶ added in v0.1.4
KeyOf is the key of the check of a task's key, or of a false key: its value (ValueOf).
func LinkingWords ¶
LinkingWords are the distinct linking words of the criterion that a text holds, in small letters, in the order they first come.
func LowerStarts ¶
LowerStarts are the sentences of a text, by their place from 1, that begin with a small letter.
func Marshal ¶
Marshal writes a sample, a bank, a plan or a split as indented JSON, ending with a newline.
func Mirrored ¶
Mirrored is the place, among the characters of the value written, of the digit a box of the scenario BoxMirrored draws mirrored: the first of 2, 5, 7 and 9; false when there is none.
func Numbers ¶ added in v0.1.4
Numbers are the numbers of a text, in the order they stand, normalized (value.Normalize).
func PairOf ¶
PairOf is the digit of a digit's pair, and false for a digit of no pair or no digit at all.
func ReadStrict ¶ added in v0.1.10
ReadStrict reads exactly one JSON value into v as strictly as every file of the format is read: every field present and spelt as its JSON name, once, and no other. what names the file's kind, for its errors; a file of the wrong shape gives a *FormatError. internal/convert reads the files of tutor-sample v0 with it.
func Sentences ¶
Sentences are the sentences of a text: each ends at a full stop, a question mark or an exclamation mark that a space or the end of the text follows, and what follows the last such mark is a sentence too.
func Unended ¶
Unended is whether the last sentence of a text ends without a full stop, a question mark or an exclamation mark: the only sentence that can, since a mark missing inside a text joins two sentences into one.
func ValueOf ¶ added in v0.1.4
ValueOf is the number a written answer gives: the first number after its last "=", and in a line without one the first number after «Ответ:», or else the first of the line; "" when it has none. So the bank's key "x = 2" is the key 2 of the check, and the answer line «56 : 6 = 9 (ост. 2)» gives 9. The banks of the measurement write their keys so, and they do not change.
Types ¶
type Bank ¶
type Bank struct {
Format string `json:"format"`
Version *int `json:"version"`
Tasks []Task `json:"tasks"`
}
Bank is the bank of tasks the sheets solve, as a module's tasks are.
func ReadBank ¶
ReadBank reads a bank of tasks from JSON and checks it. An error from a bank that fails the check is a *FormatError.
type BoxCheck ¶
type BoxCheck struct {
Kind CheckKind `json:"kind"`
Key string `json:"key"`
Form *formatv0.CheckForm `json:"form"`
TrapValues []TrapValue `json:"trap_values"`
}
BoxCheck is the check of a box, as the module format gives it: the kind, number, fraction or time; the key; the form of a fraction, nil for a number and a time; and the trap values.
func (BoxCheck) Format ¶ added in v0.1.8
Format is the check of a box as the module format writes it: the workbook's check is the format's already, and a number has no form.
func (BoxCheck) Slot ¶ added in v0.1.8
func (c BoxCheck) Slot() verdict.AnswerSlot
Slot is a box with its check as module-kit judges it: an answer slot bound box.
func (BoxCheck) Verdict ¶ added in v0.1.8
func (c BoxCheck) Verdict(value *string) (verdict.SlotVerdict, error)
Verdict is module-kit's verdict on a value read in a box of this check, nil when nothing was read (verdict.OfSlot): correct, not yet right with its trap, or unreadable, blank or out of the notation. An error is a check that the format does not take, such as a key out of the notation.
type BoxScenario ¶
type BoxScenario string
BoxScenario is what a box is written to test.
const ( // BoxCorrect: the key's value, written plainly. BoxCorrect BoxScenario = "correct" // BoxError: a typical mistake, a trap value of the check. BoxError BoxScenario = "error" // BoxNearKey: a value one digit off the key, the digit of its pair, drawn leaning toward the // key's digit. BoxNearKey BoxScenario = "near-key" // BoxSimilarDigits: the key's value, with its last digit of a pair drawn leaning toward the // digit of its pair. BoxSimilarDigits BoxScenario = "similar-digits" // BoxMirrored: the key's value, with its first digit of 2, 5, 7 and 9 drawn mirrored. BoxMirrored BoxScenario = "mirrored" // BoxRewritten: a wrong value crossed out, and the key's value written beside it. BoxRewritten BoxScenario = "rewritten" // BoxBlank: nothing written. BoxBlank BoxScenario = "blank" )
The scenarios of a box.
type Column ¶
type Column struct {
Top string `json:"top"`
Op string `json:"op"`
Bottom string `json:"bottom"`
Result string `json:"result"`
}
Column is a calculation in a column: Top, under it Op and Bottom, a bar and Result under the bar. The part's text is the column written in a line: "14 × 3 = 42".
type Criterion ¶
Criterion is a criterion of the rubric: its ID, and its text, as the module gives it to a model.
type Erasure ¶
type Erasure struct {
TMs int64 `json:"t_ms"`
Strokes []string `json:"strokes"`
// Planned is the markup of an erasure the scenario called for; any other erasure is a slip
// of the pen and has none.
Planned *PlannedErasure `json:"planned"`
}
Erasure is one touch of the eraser. The eraser removes whole strokes, never a part of one.
type Essay ¶
type Essay struct {
Number int `json:"number"`
Part string `json:"part"`
Topic string `json:"topic"`
Title *string `json:"title"`
Text string `json:"text"`
Unmet []string `json:"unmet"`
Misspelled []Misspelling `json:"misspelled"`
}
Essay is one essay: its place among the essays, from 1; the part of the measurement it belongs to, PartDev or PartTest; the topic of its task, as the task's statement gives it; its title, nil when it has none; its text, in one line, which code breaks into lines; the criteria it does not meet, in the order of the rubric; and the common words it spells wrong.
type Essays ¶
type Essays struct {
Format string `json:"format"`
Version *int `json:"version"`
Rubric []Criterion `json:"rubric"`
Essays []Essay `json:"essays"`
}
Essays is the synthetic essays of the measurement of the assessment by a rubric: one rubric, the criteria a module's task with a rubric would give, and short essays in English, each with its topic, its title and its text, and which criteria of the rubric it does not meet, as planned. Code draws each essay in memory from a seed (synth.Essay): no file of a page is written.
func ReadEssays ¶
ReadEssays reads the essays from JSON and checks them. An error from a file that fails the check is a *FormatError.
func (*Essays) Check ¶
Check checks the essays and returns a *FormatError listing every problem, or nil: the rubric, the criteria of Criteria in their order; the essays numbered from 1, those of the development first; each essay written as the essays are, within their bounds, without a name; and every criterion the program counts unmet as the essay says, and clearly so.
type Expected ¶
type Expected struct {
Outcome Outcome `json:"outcome"`
// FirstError is the number of the first wrong line, on sheets whose outcome is "error".
FirstError *int `json:"first_error"`
// Trap is the ID of the bank task's trap that the mistake falls into, if any.
Trap string `json:"trap"`
}
Expected is the outcome the writer meant the sheet to have.
type Figure ¶
type Figure struct {
NumberLine *NumberLine `json:"number_line"`
Row *Row `json:"row"`
Scheme *Scheme `json:"scheme"`
Column *Column `json:"column"`
}
Figure is the figure of a part. Of its four fields, a drawing sets one of the first three and text sets none or Column alone.
type FormatError ¶
type FormatError struct {
// What names the file's kind: "sample", "bank" or "plan".
What string
Problems []Problem
}
FormatError lists every problem a check found, not only the first.
func (*FormatError) Error ¶
func (e *FormatError) Error() string
Error names the file's kind and lists the problems, one to a line when there are several.
type FractionWriting ¶
type FractionWriting string
FractionWriting is how a fraction is written in a box.
const ( // Stacked: the numerator over a bar, the denominator under it. Stacked FractionWriting = "stacked" // Inline: the numerator, a slash and the denominator in a row, as "3/4". Inline FractionWriting = "inline" )
The writings of a fraction.
type Injection ¶
type Injection struct {
Text string `json:"text"`
Lang Lang `json:"lang"`
Strokes []string `json:"strokes"`
}
Injection is a handwritten inscription that tries to steer the model.
type Layout ¶
type Layout string
Layout is the layout of a sheet of free writing: the task sets it, and a drawing or a column on the sheet shows it.
type Line ¶
type Line struct {
// Text is what the writer meant to write, in the notation of the bank's solutions.
Text string `json:"text"`
Strokes []string `json:"strokes"`
// Illegible marks a line written illegibly on purpose: reading it should ask to write it
// again.
Illegible bool `json:"illegible"`
// CrossedOut marks a line the writer struck through: it is not part of the solution.
CrossedOut bool `json:"crossed_out"`
// Answer marks the line that gives the final answer, wherever it stands.
Answer bool `json:"answer"`
}
Line is one line of the solution as the writer meant it.
type Misspelling ¶
Misspelling is a common word spelled wrong: as it is written, and the word it is.
type NumberLine ¶
type NumberLine struct {
From int `json:"from"`
To int `json:"to"`
Step int `json:"step"`
Labels []int `json:"labels"`
Jumps []Jump `json:"jumps"`
}
NumberLine is a number line: divisions from From to To by Step, the divisions signed with their values, and the jumps drawn over it as arcs, in the order they are drawn.
type Outcome ¶
type Outcome string
Outcome is the outcome a sheet is meant to have.
const ( // OutcomeCorrect: every line of the solution is correct, and so is the answer. OutcomeCorrect Outcome = "correct" // OutcomeError: a line is wrong; Expected.FirstError names the first one. OutcomeError Outcome = "error" // OutcomeUnreadable: the answer is illegible on purpose, and reading it should ask to write it // again. OutcomeUnreadable Outcome = "unreadable" // OutcomeNoAnswer: the sheet gives no answer at all. OutcomeNoAnswer Outcome = "no-answer" )
The outcomes.
type Pen ¶ added in v0.1.64
type Pen int
Pen is the kind of pen a stroke of a style is written with.
type Piece ¶
Piece is a piece of a segment: its length in the scheme's units and its label, written over it.
type Plan ¶
type Plan struct {
Format string `json:"format"`
Version *int `json:"version"`
Sheets []PlanSheet `json:"sheets"`
}
Plan is a sheet plan: what the writer writes on each sheet, and the markup that the record mode of the board fills in from it. A plan sheet is checked as the markup of a sample, so that what the board fills in passes the sample's check. A plan of Version has lines; one of PlanParts has parts, and in memory their texts are its lines.
func ReadPlan ¶
ReadPlan reads a sheet plan from JSON and checks it on its own; CheckWithBank checks it against the bank. It reads the version the plan declares first, and then the plan as strictly as any file, in the shape of that version. An error from a plan that fails the check is a *FormatError.
func (*Plan) Check ¶
Check checks a plan and returns a *FormatError listing every problem, or nil. Each sheet that a plan can hold goes through Sample.Check as the markup of a stand-in sample, so that every rule of a sample's markup holds for the plan too, and a problem of the stand-in is named by the field of the plan sheet it comes from. A sheet of a plan of version PlanParts is checked on the texts of its parts, and then its parts are.
func (*Plan) CheckWithBank ¶
CheckWithBank checks what in a plan depends on the bank, as Sample.CheckWithBank does for a sample: that the bank has the task of every sheet, and that the trap a sheet names is one of its task's. It returns a *FormatError, or nil.
func (*Plan) HasParts ¶
HasParts reports whether a plan is of version PlanParts, its sheets made of parts.
func (Plan) MarshalJSON ¶
MarshalJSON writes a plan in the shape of its version: a plan of version PlanParts with parts, any other with lines, as encoding/json writes it.
type PlanErasure ¶
type PlanErasure struct {
Line int `json:"line"`
Erased Erased `json:"erased"`
Text string `json:"text"`
// Replacement is what is written in place of the erased strokes: the line Line, or only a part
// of it when PartOfLine is set.
Replacement string `json:"replacement"`
// PartOfLine marks an erasure of a part of a line, such as one number: Text and Replacement are
// that part, and the rest of the line stays.
PartOfLine bool `json:"part_of_line"`
// Figure is, in a plan of version PlanParts, the figure as it was before an erasure in a
// drawing; nil for any other erasure. Its file holds it in the erasure.
Figure *Figure `json:"-"`
}
PlanErasure is the planned erasure of a sheet: its markup, as a sample's PlannedErasure has it, and what is written in place of the erased strokes.
type PlanPart ¶
type PlanPart struct {
Kind PartKind `json:"kind"`
Place Place `json:"place"`
// Text is the text of a part of text and the description in words of a drawing: the text of
// the part's line in the sample's markup.
Text string `json:"text"`
// Figure is what code draws the part by: one of the three drawings for a drawing, and for
// text nothing, or the column it is calculated in.
Figure Figure `json:"figure"`
}
PlanPart is one part of a sheet, in the order the solution is read.
type PlanSheet ¶
type PlanSheet struct {
// Number is the sheet's place in the plan, from 1.
Number int `json:"number"`
// Task is the ID of the task in the bank that the sheet solves.
Task string `json:"task"`
Scenario Scenario `json:"scenario"`
// Lines are the texts of the lines left on the sheet when it is done, top to bottom, in the
// notation of the bank's solutions.
Lines []string `json:"lines"`
// Answer is the number of the line that gives the final answer, from 1.
Answer int `json:"answer"`
Expected Expected `json:"expected"`
// Erasure is the planned erasure, on sheets of the scenarios that plan one.
Erasure *PlanErasure `json:"erasure"`
// Parts are the parts of a sheet of a plan of version PlanParts, and Lines are their texts;
// a sheet of version 0 has none. The numbers of the sheet — Answer, Expected.FirstError and
// Erasure.Line — are then numbers of parts. Its file holds them in place of the lines.
Parts []PlanPart `json:"-"`
}
PlanSheet is one sheet of a plan. Who writes it, the plan does not say: the author writes every sheet of the measurement in their own hand.
func (*PlanSheet) Layout ¶
Layout is the layout of a sheet by its parts: the drawing it has, or else the side if it calculates in a column, or "" when none of its parts shows one, as on a sheet of lines or on an author's free solution, the whole sheet one part.
type PlannedErasure ¶
type PlannedErasure struct {
// Line is the number of the line written in place of what was erased.
Line int `json:"line"`
// Erased is what the erased strokes were: a mistake fixed afterwards, or a correct step
// replaced by a wrong one.
Erased Erased `json:"erased"`
// Text is what the erased strokes said.
Text string `json:"text"`
}
PlannedErasure says what an erasure of the scenario removed.
type Point ¶
type Point struct {
X float64 `json:"x"`
Y float64 `json:"y"`
// TMs is the time in milliseconds since the sheet was opened.
TMs int64 `json:"t_ms"`
}
Point is one sample of the pen.
type Problem ¶
Problem is one thing wrong with a file: where it is, as a path of JSON field names and array indexes, and what is wrong.
type Region ¶
type Region string
Region is where a part of a sheet stands, as the measurement of free writing tells the place of the first error and of the planned erasure: in a drawing, in the text of the main column, or at the side.
type Row ¶
type Row struct {
Object string `json:"object"`
Left int `json:"left"`
Right int `json:"right"`
Numbers bool `json:"numbers"`
}
Row is a row of objects with one of them marked: Left objects to its left and Right to its right, and, with Numbers, each object numbered under it from the left.
type Sample ¶
type Sample struct {
Format string `json:"format"`
Version *int `json:"version"`
// Sheet is the size of the sheet in logical units, the same on every device: x grows to the
// right, y grows downwards, and one unit is one pixel of the measurement's renders at scale 1.
Sheet Sheet `json:"sheet"`
// Task is the ID of the task in the bank that the sheet solves.
Task string `json:"task"`
Writer Writer `json:"writer"`
Scenario Scenario `json:"scenario"`
// Strokes are in the order they were written.
Strokes []Stroke `json:"strokes"`
Erasures []Erasure `json:"erasures"`
// Lines are the lines of the solution, in the order the writer meant them to be read. The
// markup refers to them by number, from 1.
Lines []Line `json:"lines"`
// Injection is the inscription written to steer the model, on sheets of the scenario
// "injection" only.
Injection *Injection `json:"injection"`
Expected Expected `json:"expected"`
}
Sample is one sheet of handwriting with its markup.
func (*Sample) Check ¶
Check checks a sample on its own and returns a *FormatError listing every problem, or nil.
func (*Sample) CheckWithBank ¶
CheckWithBank checks what in a sample depends on its task: that the bank has it, and that the trap the sample names is one of the task's. It returns a *FormatError, or nil.
type Scenario ¶
type Scenario string
Scenario is what a sheet was written to test.
const ( ScenarioCorrect Scenario = "correct" ScenarioError Scenario = "error" ScenarioSimilarDigits Scenario = "similar-digits" ScenarioIllegible Scenario = "illegible-crossed-out" ScenarioAnswerNotLast Scenario = "answer-not-last" ScenarioNearlyEmpty Scenario = "nearly-empty" ScenarioMirroredDigits Scenario = "mirrored-digits" ScenarioErasureFixed Scenario = "erasure-fixed" ScenarioErasureBroken Scenario = "erasure-broken" ScenarioInjection Scenario = "injection" )
The scenarios of a sheet.
type Scheme ¶
Scheme is a scheme of segments, one under another from the top, and the label of the brace that joins them, empty for none.
type Segment ¶
Segment is a segment of a scheme: its label, written before it, and its pieces from the left.
type SheetName ¶
type SheetName struct {
// Number is the number of the plan sheet the file saves.
Number int
// At is the time of the save, to the millisecond.
At time.Time
// Of is the task and the scenario as the name holds them, joined by a hyphen.
Of string
}
SheetName is what the name of a saved sheet's file says.
func ParseSheetFile ¶
ParseSheetFile reads the name of a saved sheet's file; ok is false for any other name.
type Split ¶
type Split struct {
Format string `json:"format"`
Version *int `json:"version"`
// Seed is the number that decided which sheets of each scenario went to the development part.
Seed int64 `json:"seed"`
Dev []SplitSheet `json:"dev"`
Test []SplitSheet `json:"test"`
}
Split divides the recorded sheets of the measurement into a development part, on which the prompt, the journal and the rule of frames are tuned, and a test part, which is run once they are frozen. It is made once, before the first change of the prompt, and is never rewritten: each sheet in it is the file that counted then.
func ReadSplit ¶
ReadSplit reads a split from JSON and checks it on its own; CheckWithPlan checks it against the sheet plan. An error from a split that fails the check is a *FormatError.
func (*Split) Check ¶
Check checks a split on its own: its header, that each part holds sheets, and that each sheet is in one part once, by the name of a saved file of its number.
func (*Split) CheckWithPlan ¶
CheckWithPlan checks a split against the sheet plan: every sheet of the plan is in it, and each file is a saved file of its plan sheet.
type SplitSheet ¶
SplitSheet is a sheet of a part: the number of its plan sheet and the name of its file.
type Stroke ¶
type Stroke struct {
// ID is unique within the sample, such as "s-0031".
ID string `json:"id"`
Points []Point `json:"points"`
// Style is how the stroke looks, as a sample file of the eval protocol holds it: nil for a stroke
// drawn black and opaque, as every stroke of tutor-sample v0 is, which holds no style.
Style *Style `json:"-"`
// Since is the moment a piece of a cut came onto the sheet, its cut's, later than its points,
// which keep the times of the stroke it was cut of; 0 for a stroke written, which comes as its
// points are written. tutor-sample v0 holds no cut.
Since int64 `json:"-"`
}
Stroke is one line from pen down to pen up.
type Style ¶ added in v0.1.64
Style is how a stroke looks: its kind of pen, its colour as "#rrggbb" of sRGB, the width of its line in units of the sheet and its opacity in whole percent. Whether a style is valid — a kind of pen, a colour of six lowercase hexadecimal digits, a width of 0.1 to 50 to a tenth and an opacity of 10 to 100 — is the check's of the sample file to say; the crop refuses one it cannot draw.
type Task ¶
type Task struct {
// ID is unique within the bank, such as "linear-01"; a sample names its task by it.
ID string `json:"id"`
Kind TaskKind `json:"kind"`
// Statement is the condition the writer solves, in Russian.
Statement string `json:"statement"`
// Key is the answer, in the notation of the solution's last line.
Key string `json:"key"`
// Solution is a correct solution, line by line.
Solution []string `json:"solution"`
Traps []Trap `json:"traps"`
// Leaks are phrases that give the answer away, besides the key itself in any notation: the
// leak check looks for them in every hint.
Leaks []string `json:"leaks"`
// FalseKeys are wrong keys with their solutions: the same steps with another number. The
// measurement reads correct sheets with them, to see whether the model reads what it is given
// rather than what is written.
FalseKeys []FalseKey `json:"false_keys"`
}
Task is one task of the bank.
type TaskKind ¶
type TaskKind string
TaskKind is the kind of a task, one of the measurement's three. No code checks the lines of any kind: the markup says where the first error is, whatever the kind.
const ( // KindLinearEquation: a linear equation in one unknown. KindLinearEquation TaskKind = "linear-equation" // KindCalculation: a chain of calculations, grades 1–6. KindCalculation TaskKind = "calculation" // KindFreeSolution: a free solution of an olympiad task. KindFreeSolution TaskKind = "free-solution" )
The kinds of task.
type Workbook ¶
type Workbook struct {
Format string `json:"format"`
Version *int `json:"version"`
Pages []WorkbookPage `json:"pages"`
}
Workbook is the synthetic pages of the workbook: each a page of items, an item a line of text with boxes, as the module format writes an item of a workbook, and for each box its check and what code writes in it by hand, and why. Code draws the pages in memory from a seed (synth.PageOf): no file of a page is written.
func ReadWorkbook ¶
ReadWorkbook reads the pages of the workbook from JSON and checks them. An error from a file that fails the check is a *FormatError.
func (*Workbook) Check ¶
Check checks the pages of the workbook and returns a *FormatError listing every problem, or nil: the pages numbered from 1, each of a part; every item with a text whose boxes are as many as its boxes; every check one the module format would take; and every box written as its scenario says.
type WorkbookBox ¶
type WorkbookBox struct {
Check BoxCheck `json:"check"`
Scenario BoxScenario `json:"scenario"`
// Written is the value left in the box, as a person reads it: digits, and a fraction as
// "3/4", however it is written. It is nil when the box is left blank.
Written *string `json:"written"`
// Crossed is the value crossed out before Written was written beside it, in a box of the
// scenario BoxRewritten alone.
Crossed *string `json:"crossed"`
// Fraction is how a fraction in the box is written: a box of the kind fraction has one, and a
// blank box or one of a number none.
Fraction *FractionWriting `json:"fraction"`
}
WorkbookBox is a box of an item: its check, the scenario of what is written in it, the value written, as a person reads it, the value written and crossed out before it, and how a fraction is written: stacked or inline.
func (WorkbookBox) Leaning ¶
func (b WorkbookBox) Leaning() (at int, toward rune, ok bool)
Leaning is the digit a box draws leaning toward another, by its place among the characters of the value, and the digit it leans toward: in a box of the scenario BoxNearKey the one digit that differs from the key, toward the key's digit; in one of BoxSimilarDigits the last digit of a pair, toward the digit of its pair — unlike the answer line of a sheet, whose digit leans only when the line's last digit has a pair (synth.SimilarDigit), since a box holds a value alone. It is false for any other box, and for one whose value has no such digit.
func (WorkbookBox) Verdict ¶
func (b WorkbookBox) Verdict() verdict.SlotVerdict
Verdict is the verdict of a box read as it is written: unreadable for a blank box, and otherwise what its check gives the value written. It is what a right reading of the box comes to. A check that the format does not take gives unchecked, and the check of the file names it.
type WorkbookItem ¶
type WorkbookItem struct {
Text string `json:"text"`
Boxes []WorkbookBox `json:"boxes"`
}
WorkbookItem is an item of a page: the text of its line, in Russian, with each box as "[ ]", and its boxes in the order they stand in the line, its answer slots.
type WorkbookPage ¶
type WorkbookPage struct {
// Number is the page's place in the workbook, from 1.
Number int `json:"number"`
// Part is the part of the measurement the page belongs to: PartDev or PartTest.
Part string `json:"part"`
Items []WorkbookItem `json:"items"`
}
WorkbookPage is one page of the workbook.