Documentation
¶
Overview ¶
Package journal tells how a sheet was written, for the forms of the measurement that show the model the writing process: a journal of numbered steps in English, and up to two frames of the sheet just before erasures. It builds both from the strokes and the erasures alone, as a device would, without the markup.
A journal comes in two versions, each with its own words. A journal of lines (Of), version 1, is for sheets of lines: its lines are those lines.Group finds among all the strokes, the erased ones too, numbered from the top of the sheet down. A journal of parts (OfParts), version 2, is that of free writing: its parts are the stroke groups lines.Groups finds, numbered in the order they were first written, each named by where it stands on the sheet.
The journal tells in which order the lines or the parts were written, the long pauses, how many strokes each erasure took and from which, and the returns to those written before. It holds no time, no pressure, no coordinates and nothing of what was erased.
Index ¶
Constants ¶
const ( // Pause is the shortest pause the journal tells, in milliseconds. A wait before the first // stroke is the reading of the task, and the journal does not tell it. Pause = 6000 // MaxFrames is how many frames before erasures a sheet gives at most. MaxFrames = 2 // MaxSteps is how many steps the text of a journal tells at most, so that it stays near 300 // tokens; it counts the steps after them and leaves them out. MaxSteps = 30 )
Variables ¶
This section is empty.
Functions ¶
func PartsWords ¶
func PartsWords() []string
PartsWords are all the words a journal of parts' text is made of, the places among them. As Words for a journal of lines, a judge's prompt that shows it holds them in its fingerprint, so a phrase partStep tells must be among them: the tests check that each word of the texts is.
Types ¶
type Agreement ¶
Agreement is how the lines of a journal agree with the lines of a sample's markup: of the markup's lines, how many the journal found with just their strokes. It compares the strokes the markup's lines hold, which are all on the sheet: an erased stroke, an inscription or a stray mark the journal puts on a line does not count against it. The markup of a sheet starts from the lines the board proposes with lines.Group, so the agreement is higher than it would be with a markup made apart, the more so on a sheet whose markup is the proposal unedited. Of a journal of parts, it compares the parts with the parts of the markup, which the board proposes from lines.Groups.
type Event ¶
Event is one event of the writing: a stroke, or an erasure by its index in the sample.
func Writing ¶
Writing is the strokes with points and the erasures of a sample that passes its check, in the order of the writing, a piece of a cut at its cut. Strokes and erasures each go in the order of the clock; merged, they are the writing. An erasure goes before a stroke begun at its very moment, unless it takes that stroke away: the stroke is then the next one, as on the frames of internal/render.
type Frame ¶
type Frame struct {
Erasure int // the erasure's index in the sample: render.Before draws the frame
Step int // the index of the step of the journal the frame stands just before
Line int // the line the frame is for, or the place of its part in Parts
Strokes int // how many strokes the erasures took from the line or the part, in all
}
Frame is a frame of the sheet just before an erasure: the first erasure of a line or a part, of those most strokes were erased from.
type Journal ¶
type Journal struct {
// Lines are the lines of all the strokes, the erased ones too, from the top of the sheet down,
// in a journal of lines.
Lines []lines.Line
// Parts are the parts of a journal of parts, in the order they were first written.
Parts []Part
// Steps are all the steps of the writing; the text tells the first MaxSteps of them.
Steps []Step
// Frames are the frames before erasures, in the order of the writing.
Frames []Frame
// contains filtered or unexported fields
}
Journal is how a sheet was written.
func OfParts ¶
OfParts builds the journal of parts of a sample that passes its check (sample.Check), for free writing. Each stroke stands on one part:
- a stroke the sheet shows, on its group;
- an erased stroke, on the group it would be a neighbour of; of two, on the one written on last if it is one of them, or else on the earlier in the order of lines.Groups;
- an erased stroke of no group, on its erased writing.
The parts are numbered in the order they were first written, the strokes erased later counting as writing too.
func (*Journal) LineOf ¶
LineOf is the number of the line a stroke stands on, from 1, in a journal of lines, or the place of its part in Parts, from 1, in a journal of parts; 0 for a stroke of no line or part.
func (*Journal) Text ¶
Text is the journal in English: a sentence on how to read it, then one numbered step a line, the first MaxSteps steps, and how many it leaves out. With marks, a step that a frame stands just before says so, by the frame's number, and so does the end for a frame among the steps left out. Each version tells it in its own words.
type Kind ¶
type Kind int
Kind is what a step of the journal is.
const ( Wrote Kind = iota // writing on a line or a part not written on before Again // writing on the one written on last, after an erasure or a pause Back // writing on one written on before, coming from another Erased // an erasure, or erasures one after another from the same one Paused // a pause of Pause or longer )
type Part ¶
type Part struct {
// Group is the group: its strokes, the erased strokes that would be their neighbours and its
// rectangle. The strokes of erased writing are all erased.
Group lines.StrokeGroup
// Erased tells erased writing from a part the sheet shows.
Erased bool
// Number is its number in the text, from 1. Parts and erased writing are numbered apart, each
// in the order it was first written.
Number int
// Place is where it stands on the sheet, in the journal's words: "top right".
Place string
}
Part is one part of a journal of parts: a group of the strokes the sheet shows, as lines.Groups finds it, or erased writing. Erased writing is erased strokes that no group holds, grouped among themselves by the same rule. A line erased whole and written again after a pause is such: it has no neighbours on the sheet, so by the rule it is of no group. An erased stroke that would be a neighbour of a stroke on the sheet is of that group, though, so a line erased whole just after a stroke beside it starts on that part and goes on as erased writing.
type Step ¶
type Step struct {
Kind Kind
// Line is the number of the line written on, in a step of writing; in a journal of parts, the
// place of the part in Parts, from 1.
Line int
// Taken is how many strokes the erasures of the step took, by the number of their line, or by
// the place of their part in Parts.
Taken map[int]int
// Erasures are the indexes, in the sample, of the erasures the step tells.
Erasures []int
// Frame is the number of the frame of the sheet just before the step, from 1, or 0.
Frame int
}
Step is one step of the journal.