linked-rolls 0.43.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -2
- package/lib/Agent.d.ts +1 -1
- package/lib/Assumption.d.ts +2 -2
- package/lib/Collation.d.ts +84 -7
- package/lib/Collation.js +63 -16
- package/lib/ConditionState.d.ts +1 -1
- package/lib/Edit.d.ts +3 -3
- package/lib/Edition.d.ts +14 -8
- package/lib/EditionView.d.ts +8 -8
- package/lib/EditionView.js +6 -6
- package/lib/Emulation.d.ts +4 -4
- package/lib/Emulation.js +3 -3
- package/lib/Feature.d.ts +5 -5
- package/lib/FeatureSource.d.ts +4 -4
- package/lib/ReproducingSystem.d.ts +4 -4
- package/lib/RollCopy.d.ts +10 -10
- package/lib/RollCopy.js +4 -4
- package/lib/Symbol.d.ts +2 -2
- package/lib/Symbol.js +1 -1
- package/lib/TrackCalibration.d.ts +1 -1
- package/lib/TrackCalibration.js +1 -1
- package/lib/TrackerBar.d.ts +3 -3
- package/lib/TrackerBar.js +1 -1
- package/lib/Version.d.ts +13 -15
- package/lib/Version.js +2 -2
- package/lib/alignment.d.ts +4 -4
- package/lib/alignment.js +3 -3
- package/lib/asJsonLd.d.ts +1 -1
- package/lib/asJsonLd.js +3 -3
- package/lib/constraints.d.ts +1 -1
- package/lib/constraints.js +5 -5
- package/lib/context.js +4 -4
- package/lib/editionOps.d.ts +42 -10
- package/lib/editionOps.js +132 -19
- package/lib/importJsonLd.d.ts +1 -1
- package/lib/importJsonLd.js +3 -3
- package/lib/index.d.ts +42 -40
- package/lib/index.js +42 -40
- package/lib/migrate.js +18 -7
- package/lib/procedures.d.ts +1 -1
- package/lib/readers/phillipsEroll.d.ts +19 -4
- package/lib/readers/phillipsEroll.js +21 -6
- package/lib/readers/spencerBar.d.ts +2 -2
- package/lib/readers/spencerBar.js +3 -3
- package/lib/readers/stanfordAton.d.ts +3 -3
- package/lib/readers/stanfordAton.js +4 -4
- package/lib/reservations.d.ts +3 -3
- package/lib/reservations.js +4 -4
- package/lib/scatter.d.ts +225 -0
- package/lib/scatter.js +231 -0
- package/lib/schema.json +60 -12
- package/lib/sigla.d.ts +1 -1
- package/lib/sigla.js +4 -4
- package/lib/statistics.d.ts +71 -0
- package/lib/statistics.js +121 -0
- package/lib/substitution.d.ts +5 -5
- package/lib/substitution.js +2 -2
- package/lib/systems/index.d.ts +2 -2
- package/lib/systems/index.js +4 -4
- package/lib/systems/welteLicensee/bar.d.ts +1 -1
- package/lib/systems/welteLicensee/bar.js +2 -2
- package/lib/systems/welteLicensee/system.d.ts +2 -2
- package/lib/systems/welteLicensee/system.js +3 -3
- package/lib/systems/welteT100/bar.d.ts +1 -1
- package/lib/systems/welteT100/bar.js +2 -2
- package/lib/systems/welteT100/system.d.ts +4 -4
- package/lib/systems/welteT100/system.js +4 -4
- package/lib/systems/welteT98/bar.d.ts +1 -1
- package/lib/systems/welteT98/bar.js +2 -2
- package/lib/systems/welteT98/system.d.ts +4 -4
- package/lib/systems/welteT98/system.js +4 -4
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +10 -0
- package/lib/validate.d.ts +1 -1
- package/lib/validate.js +1 -1
- package/lib/vocabulary.d.ts +1 -1
- package/lib/vocabulary.js +3 -3
- package/lib/witnesses.d.ts +2 -2
- package/lib/witnesses.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,6 +75,98 @@ at. It then reads as the version it derives from, and
|
|
|
75
75
|
`reservationsAboutVersion` says so. A file that names a single
|
|
76
76
|
derivation loads as a list of one.
|
|
77
77
|
|
|
78
|
+
What a version is called is not stored with it. `siglaOf` reads the
|
|
79
|
+
sigla off the stemma as it stands, so a label never outlives the
|
|
80
|
+
arrangement it describes, and nothing should cite one without saying
|
|
81
|
+
which state of the edition it belongs to.
|
|
82
|
+
|
|
83
|
+
## The tolerance a derivation was collated at
|
|
84
|
+
|
|
85
|
+
`collationTolerance` on a derivation is the window two readings of one
|
|
86
|
+
symbol must fall in to be collated: how far apart they may lie at
|
|
87
|
+
either end, and, since two copies differ by a systematic offset as well
|
|
88
|
+
as by scatter, where that window is centred. A window naming no offset
|
|
89
|
+
is centred on nothing, which is what every window written before the
|
|
90
|
+
offset was held here means.
|
|
91
|
+
|
|
92
|
+
The number decides what counts as a reading at all, so it is worth
|
|
93
|
+
measuring rather than picking. `scatterOfCopy` measures how far one
|
|
94
|
+
copy puts each symbol from where the copies collated with it put it,
|
|
95
|
+
and `scatterOf` describes that sample: its median, its scatter as a
|
|
96
|
+
median absolute deviation scaled to a standard deviation, a histogram
|
|
97
|
+
with the normal curve to lay over it, and the readings the curve does
|
|
98
|
+
not account for. The scatter is taken from the median because the
|
|
99
|
+
displacements an editor is looking for are in the sample, and a
|
|
100
|
+
standard deviation would grow towards them until they no longer stood
|
|
101
|
+
out.
|
|
102
|
+
|
|
103
|
+
The copies named are one **side** of the comparison and the rest are
|
|
104
|
+
the other, so which copies to name is the first question and the
|
|
105
|
+
edition no longer answers it: a collation hands a child's carriers up
|
|
106
|
+
to the parent's symbols, so a descendant's copies come to bear an
|
|
107
|
+
ancestor's readings and look like its own. `sidesOf` reads the sides
|
|
108
|
+
off the edits instead, the copies bearing what a version inserts
|
|
109
|
+
standing for the reading it moves to and those bearing what it strikes
|
|
110
|
+
for the reading it moves from. Naming a set that is not a side measures
|
|
111
|
+
one copy's noise against a mixture of both sides, which is wider than
|
|
112
|
+
the truth.
|
|
113
|
+
|
|
114
|
+
The tolerance that follows is the scatter times a threshold fixed by
|
|
115
|
+
the size of the sample, the point beyond which fewer than one reading
|
|
116
|
+
is expected to fall by chance (`departureThreshold`). For the few
|
|
117
|
+
hundred readings an edge of a stemma yields this lands a little above
|
|
118
|
+
three. `toleranceAcross` covers several samples with one window, since
|
|
119
|
+
a derivation states one tolerance while notes and expressions scatter
|
|
120
|
+
differently. It asks which side was measured, because a window is
|
|
121
|
+
signed: the offset runs from the parent to the child, and one stored
|
|
122
|
+
the other way round has the right width and the wrong centre, so it
|
|
123
|
+
separates readings that belong together and merges readings that do
|
|
124
|
+
not while nothing in the number looks wrong. `inferredTolerance` builds
|
|
125
|
+
the belief the number rests on, to annotate `collationTolerance` with. It is held likely and not
|
|
126
|
+
true: the tolerance follows from the sample only as far as the sample
|
|
127
|
+
is normal, which is what the reported excess kurtosis and tail counts
|
|
128
|
+
are there to show.
|
|
129
|
+
|
|
130
|
+
Two limits are worth naming. Notes and expressions are estimated apart
|
|
131
|
+
by default, which is a stopgap standing in for a skew across the width
|
|
132
|
+
of the paper rather than a distinction in the model, so the grouping is
|
|
133
|
+
a parameter of the estimator and appears nowhere in the format. And the
|
|
134
|
+
method screens: it says which readings the curve does not account for,
|
|
135
|
+
and an editor says which of those are editorial acts.
|
|
136
|
+
|
|
137
|
+
A separation reports which end made it (`separatedBy`, and
|
|
138
|
+
`admittedAtEnds` for a collation). The two ends answer different
|
|
139
|
+
questions: the onset, with the kind, decides whether two copies read one
|
|
140
|
+
command, and the end decides whether that command was lengthened or
|
|
141
|
+
shortened. On welte225.org the end alone decides 24 collations of 2839
|
|
142
|
+
and the onset alone 39, so neither test is idle, but a difference at the
|
|
143
|
+
end is as often a punch measured badly as a punch genuinely prolonged,
|
|
144
|
+
and the two are not worth confusing.
|
|
145
|
+
|
|
146
|
+
## Collating a derivation a second time
|
|
147
|
+
|
|
148
|
+
A collated symbol is one symbol carrying every copy that reads it, so a
|
|
149
|
+
collation cannot simply be run again: there is no second symbol left to
|
|
150
|
+
match. `separateReadings` is the inverse. It takes one copy's carriers
|
|
151
|
+
back off the symbols it shares, gives them to new symbols of the
|
|
152
|
+
version's own, and states the exchange, leaving the edition in the state
|
|
153
|
+
a collation would have produced had nothing joined. `connectVersions` at
|
|
154
|
+
a new tolerance then re-collates, joining again whatever the new window
|
|
155
|
+
admits.
|
|
156
|
+
|
|
157
|
+
Nothing an editor established is lost by that. `connectVersions`
|
|
158
|
+
rewrites only what a collation wrote (`isCollationsOwn`): a bare
|
|
159
|
+
insertion or deletion, or an equivalence between two systems' spellings.
|
|
160
|
+
An edit naming what the change is, why it was made, or what it rests on
|
|
161
|
+
stays, and the symbols it speaks for are left out of the collation. An
|
|
162
|
+
equivalence counts as the collation's own, since it is derived from the
|
|
163
|
+
two systems' vocabularies rather than read off the paper and freezing it
|
|
164
|
+
would leave the transfers uncollatable, but one drawn a second time over
|
|
165
|
+
the very same symbols is kept as it stands, identifier and motivation
|
|
166
|
+
and all. Readings already separated by hand are carried by one copy
|
|
167
|
+
alone, so `separateReadings` passes over them and they keep their
|
|
168
|
+
identifiers.
|
|
169
|
+
|
|
78
170
|
## What brought a feature about
|
|
79
171
|
|
|
80
172
|
A copy states no list of features. Each feature stands in the act that
|
|
@@ -140,8 +232,8 @@ they carry it, a statement with the belief it rests on;
|
|
|
140
232
|
`versionsWitnessedBy` gathers the same from the side of a copy.
|
|
141
233
|
`carriageProblems` reports a statement made beside features that carry
|
|
142
234
|
symbols already, or one naming a version the edition lacks. A copy may
|
|
143
|
-
carry a `siglum`,
|
|
144
|
-
keeper.
|
|
235
|
+
carry a `siglum`, which is given by hand and not read off anything;
|
|
236
|
+
one without is named by its keeper.
|
|
145
237
|
|
|
146
238
|
```ts
|
|
147
239
|
import { reservationsAbout, stateSource } from 'linked-rolls'
|
package/lib/Agent.d.ts
CHANGED
package/lib/Assumption.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WithNote, WithId } from "./utils";
|
|
2
|
-
import { Person, WithActor } from "./Agent";
|
|
1
|
+
import { WithNote, WithId } from "./utils.js";
|
|
2
|
+
import { Person, WithActor } from "./Agent.js";
|
|
3
3
|
export declare const certainties: readonly ['true', 'likely', 'possible', 'unlikely', 'false'];
|
|
4
4
|
/**
|
|
5
5
|
* Certainty levels for beliefs, ranging from 'true' to 'false'
|
package/lib/Collation.d.ts
CHANGED
|
@@ -1,17 +1,76 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Edit } from "./Edit.js";
|
|
2
|
+
import { HorizontalSpan } from "./Feature.js";
|
|
3
|
+
import { AnySymbol } from "./Symbol.js";
|
|
4
|
+
import { Millimeters } from "./Quantity.js";
|
|
5
|
+
/** A value taken at each end of a feature: where it begins and where it stops. */
|
|
6
|
+
export interface BothEnds<T> {
|
|
7
|
+
from: T;
|
|
8
|
+
to: T;
|
|
9
|
+
}
|
|
10
|
+
/** How far one text puts a feature from where another puts it, at either end. */
|
|
11
|
+
export type Displacement = BothEnds<Millimeters>;
|
|
4
12
|
/**
|
|
5
|
-
*
|
|
6
|
-
* at either end
|
|
13
|
+
* The window two readings of one feature must fall in to be collated:
|
|
14
|
+
* how far apart they may lie at either end, and where that window is
|
|
15
|
+
* centred.
|
|
16
|
+
*
|
|
17
|
+
* The centre is worth stating. Two copies of one roll differ by a
|
|
18
|
+
* systematic offset as well as by scatter, and a window centred on
|
|
19
|
+
* nothing has to be widened by the whole of that offset before it
|
|
20
|
+
* admits what the offset alone displaces. Naming the offset lets the
|
|
21
|
+
* tolerance stand for the scatter only. A window that names none is
|
|
22
|
+
* centred on nothing, which is what every window written before the
|
|
23
|
+
* offset was held here means.
|
|
7
24
|
*/
|
|
8
25
|
export interface CollationTolerance {
|
|
9
|
-
/**
|
|
26
|
+
/** How far the two readings may lie apart at the start of a feature, measured from `offsetStart`. */
|
|
10
27
|
toleranceStart: Millimeters;
|
|
11
|
-
/**
|
|
28
|
+
/** How far they may lie apart at the end, measured from `offsetEnd`. */
|
|
12
29
|
toleranceEnd: Millimeters;
|
|
30
|
+
/**
|
|
31
|
+
* How much later the derived version puts the start of a feature
|
|
32
|
+
* than the version it is read against, where the two differ
|
|
33
|
+
* systematically. Nothing where they do not.
|
|
34
|
+
*
|
|
35
|
+
* The direction is the one a collation measures in, the child less
|
|
36
|
+
* the parent, and it is not symmetric: stored the other way round
|
|
37
|
+
* the window sits on the wrong side of the readings and merges what
|
|
38
|
+
* it should separate. A measurement taken over the parent's copies
|
|
39
|
+
* gives the negative of this, which is what `toleranceAcross` asks
|
|
40
|
+
* the side for.
|
|
41
|
+
*/
|
|
42
|
+
offsetStart?: Millimeters;
|
|
43
|
+
/** The same at the end of a feature, in the same direction. */
|
|
44
|
+
offsetEnd?: Millimeters;
|
|
13
45
|
}
|
|
14
46
|
export declare const defaultCollationTolerance: CollationTolerance;
|
|
47
|
+
/** Where the window is centred at the start of a feature, on nothing where it names no offset. */
|
|
48
|
+
export declare const offsetStartOf: (tolerance: CollationTolerance) => Millimeters;
|
|
49
|
+
/** Where the window is centred at the end of a feature. */
|
|
50
|
+
export declare const offsetEndOf: (tolerance: CollationTolerance) => Millimeters;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the window admits the displacement at each end, taken apart.
|
|
53
|
+
*
|
|
54
|
+
* The two ends answer different questions. The onset, with the kind,
|
|
55
|
+
* decides identity: whether the two copies read one command. The end
|
|
56
|
+
* decides duration: whether the same command was lengthened or
|
|
57
|
+
* shortened. A collation joins two readings only where both admit, so a
|
|
58
|
+
* separation may be the work of either, and an editor looking at one
|
|
59
|
+
* wants to know which.
|
|
60
|
+
*
|
|
61
|
+
* A difference at the end alone has at least three causes and only the
|
|
62
|
+
* first is an editorial act. A punch may genuinely have been lengthened
|
|
63
|
+
* or shortened. A chain of punches, bridged to keep the paper strong,
|
|
64
|
+
* may have been read as one perforation on one copy and as repeated
|
|
65
|
+
* notes on the other, which Phillips names as a common error of roll
|
|
66
|
+
* scanning and which runs in both directions (p. 173). Or a reading may
|
|
67
|
+
* report something other than the punched slot, as a pneumatic reader
|
|
68
|
+
* reports how long a valve stayed open. Long held notes are where the
|
|
69
|
+
* second is likeliest, since that is where the chains are.
|
|
70
|
+
*/
|
|
71
|
+
export declare const admittedAtEnds: (tolerance: CollationTolerance, displacement: Displacement) => BothEnds<boolean>;
|
|
72
|
+
/** Whether the window admits the displacement: within the tolerance of the offset, at both ends. */
|
|
73
|
+
export declare const admits: (tolerance: CollationTolerance, displacement: Displacement) => boolean;
|
|
15
74
|
/** Where a symbol lies along the roll, as its carriers put it, or nothing for a symbol without a place. */
|
|
16
75
|
export type Locate = (symbol: AnySymbol) => Readonly<HorizontalSpan> | undefined;
|
|
17
76
|
/**
|
|
@@ -26,3 +85,21 @@ export type Collation = {
|
|
|
26
85
|
};
|
|
27
86
|
/** Each of the own symbols with every inherited symbol it collates with, both in the order given. */
|
|
28
87
|
export declare const collationsOf: (own: readonly Readonly<AnySymbol>[], inherited: readonly Readonly<AnySymbol>[], locate: Locate, tolerance?: CollationTolerance) => Collation[];
|
|
88
|
+
/**
|
|
89
|
+
* Whether the edit is one a collation writes by itself: a bare
|
|
90
|
+
* insertion or a bare deletion saying nothing further, or an
|
|
91
|
+
* equivalence between two systems' spellings for one command.
|
|
92
|
+
*
|
|
93
|
+
* Collating again rewrites these and keeps the rest. An edit that says
|
|
94
|
+
* what the change is, or why it was made, or what it rests on, is an
|
|
95
|
+
* editor's reading of the difference between two texts, and collating
|
|
96
|
+
* the two again is no reason to discard it.
|
|
97
|
+
*
|
|
98
|
+
* An equivalence counts as the collation's own even where an editor
|
|
99
|
+
* added a motivation to it, because it is derived rather than read:
|
|
100
|
+
* freezing it would leave the transfers, where nearly every edit is
|
|
101
|
+
* one, unable to be collated again at all. What an editor wrote on it
|
|
102
|
+
* is not lost by that, since `connectVersions` keeps an equivalence it
|
|
103
|
+
* draws a second time over the very same symbols.
|
|
104
|
+
*/
|
|
105
|
+
export declare const isCollationsOwn: (edit: Readonly<Edit>) => boolean;
|
package/lib/Collation.js
CHANGED
|
@@ -1,7 +1,41 @@
|
|
|
1
|
-
import { keyOf } from "./TrackerBar";
|
|
2
|
-
import { distance, mm } from "./Quantity";
|
|
3
|
-
import { partitionPoint } from "./sorted";
|
|
1
|
+
import { keyOf } from "./TrackerBar.js";
|
|
2
|
+
import { distance, mm } from "./Quantity.js";
|
|
3
|
+
import { partitionPoint } from "./sorted.js";
|
|
4
|
+
import { groupBy } from "./utils.js";
|
|
4
5
|
export const defaultCollationTolerance = { toleranceStart: mm(5), toleranceEnd: mm(5) };
|
|
6
|
+
/** Where the window is centred at the start of a feature, on nothing where it names no offset. */
|
|
7
|
+
export const offsetStartOf = (tolerance) => tolerance.offsetStart ?? mm(0);
|
|
8
|
+
/** Where the window is centred at the end of a feature. */
|
|
9
|
+
export const offsetEndOf = (tolerance) => tolerance.offsetEnd ?? mm(0);
|
|
10
|
+
/**
|
|
11
|
+
* Whether the window admits the displacement at each end, taken apart.
|
|
12
|
+
*
|
|
13
|
+
* The two ends answer different questions. The onset, with the kind,
|
|
14
|
+
* decides identity: whether the two copies read one command. The end
|
|
15
|
+
* decides duration: whether the same command was lengthened or
|
|
16
|
+
* shortened. A collation joins two readings only where both admit, so a
|
|
17
|
+
* separation may be the work of either, and an editor looking at one
|
|
18
|
+
* wants to know which.
|
|
19
|
+
*
|
|
20
|
+
* A difference at the end alone has at least three causes and only the
|
|
21
|
+
* first is an editorial act. A punch may genuinely have been lengthened
|
|
22
|
+
* or shortened. A chain of punches, bridged to keep the paper strong,
|
|
23
|
+
* may have been read as one perforation on one copy and as repeated
|
|
24
|
+
* notes on the other, which Phillips names as a common error of roll
|
|
25
|
+
* scanning and which runs in both directions (p. 173). Or a reading may
|
|
26
|
+
* report something other than the punched slot, as a pneumatic reader
|
|
27
|
+
* reports how long a valve stayed open. Long held notes are where the
|
|
28
|
+
* second is likeliest, since that is where the chains are.
|
|
29
|
+
*/
|
|
30
|
+
export const admittedAtEnds = (tolerance, displacement) => ({
|
|
31
|
+
from: distance(displacement.from, offsetStartOf(tolerance)) <= tolerance.toleranceStart,
|
|
32
|
+
to: distance(displacement.to, offsetEndOf(tolerance)) <= tolerance.toleranceEnd
|
|
33
|
+
});
|
|
34
|
+
/** Whether the window admits the displacement: within the tolerance of the offset, at both ends. */
|
|
35
|
+
export const admits = (tolerance, displacement) => {
|
|
36
|
+
const ends = admittedAtEnds(tolerance, displacement);
|
|
37
|
+
return ends.from && ends.to;
|
|
38
|
+
};
|
|
5
39
|
/**
|
|
6
40
|
* What a symbol says, as a key: the pitch of a note, the type and scope
|
|
7
41
|
* of an expression. Symbols collate within one key only. This is the
|
|
@@ -10,8 +44,8 @@ export const defaultCollationTolerance = { toleranceStart: mm(5), toleranceEnd:
|
|
|
10
44
|
* what carries a note across a transfer between systems.
|
|
11
45
|
*/
|
|
12
46
|
const kindOf = (symbol) => symbol.type === 'text' ? 'text' : keyOf(symbol);
|
|
13
|
-
const
|
|
14
|
-
|
|
47
|
+
const displacementBetween = (here, there) => ({ from: mm(here.from - there.from), to: mm(here.to - there.to) });
|
|
48
|
+
const nearby = (here, there, tolerance) => admits(tolerance, displacementBetween(here, there));
|
|
15
49
|
/**
|
|
16
50
|
* Two symbols collate when they are of one kind, say the same thing
|
|
17
51
|
* (pitch, or expression type and scope), and lie at about the same
|
|
@@ -28,15 +62,6 @@ const placed = (symbols, locate) => symbols.flatMap((symbol, index) => {
|
|
|
28
62
|
const horizontal = locate(symbol);
|
|
29
63
|
return horizontal ? [{ symbol, index, horizontal }] : [];
|
|
30
64
|
});
|
|
31
|
-
const groupBy = (items, keyOf) => items.reduce((groups, item) => {
|
|
32
|
-
const key = keyOf(item);
|
|
33
|
-
const group = groups.get(key);
|
|
34
|
-
if (group)
|
|
35
|
-
group.push(item);
|
|
36
|
-
else
|
|
37
|
-
groups.set(key, [item]);
|
|
38
|
-
return groups;
|
|
39
|
-
}, new Map());
|
|
40
65
|
/** The placed symbols by kind, each kind in order of onset. */
|
|
41
66
|
const byKindInOrderOfOnset = (symbols) => {
|
|
42
67
|
const groups = groupBy(symbols, ({ symbol }) => kindOf(symbol));
|
|
@@ -47,8 +72,9 @@ const byKindInOrderOfOnset = (symbols) => {
|
|
|
47
72
|
const WINDOW_SLACK = 1e-9;
|
|
48
73
|
/** The symbols of a kind whose onset lies within the start tolerance of the span. */
|
|
49
74
|
const nearOnsetOf = (kind, span, tolerance) => {
|
|
50
|
-
const
|
|
51
|
-
const
|
|
75
|
+
const centre = span.from - offsetStartOf(tolerance);
|
|
76
|
+
const lowest = centre - tolerance.toleranceStart - WINDOW_SLACK;
|
|
77
|
+
const highest = centre + tolerance.toleranceStart + WINDOW_SLACK;
|
|
52
78
|
const first = partitionPoint(kind, candidate => candidate.horizontal.from < lowest);
|
|
53
79
|
const end = partitionPoint(kind, candidate => candidate.horizontal.from <= highest);
|
|
54
80
|
return kind.slice(first, end);
|
|
@@ -61,3 +87,24 @@ export const collationsOf = (own, inherited, locate, tolerance = defaultCollatio
|
|
|
61
87
|
.sort((a, b) => a.index - b.index)
|
|
62
88
|
.map(({ symbol: counterpart }) => ({ symbol, counterpart })));
|
|
63
89
|
};
|
|
90
|
+
/** The edit type a collation draws by itself, from the two systems' vocabularies rather than off the paper. */
|
|
91
|
+
const drawnByCollation = 'replace-with-equivalent';
|
|
92
|
+
/**
|
|
93
|
+
* Whether the edit is one a collation writes by itself: a bare
|
|
94
|
+
* insertion or a bare deletion saying nothing further, or an
|
|
95
|
+
* equivalence between two systems' spellings for one command.
|
|
96
|
+
*
|
|
97
|
+
* Collating again rewrites these and keeps the rest. An edit that says
|
|
98
|
+
* what the change is, or why it was made, or what it rests on, is an
|
|
99
|
+
* editor's reading of the difference between two texts, and collating
|
|
100
|
+
* the two again is no reason to discard it.
|
|
101
|
+
*
|
|
102
|
+
* An equivalence counts as the collation's own even where an editor
|
|
103
|
+
* added a motivation to it, because it is derived rather than read:
|
|
104
|
+
* freezing it would leave the transfers, where nearly every edit is
|
|
105
|
+
* one, unable to be collated again at all. What an editor wrote on it
|
|
106
|
+
* is not lost by that, since `connectVersions` keeps an equivalence it
|
|
107
|
+
* draws a second time over the very same symbols.
|
|
108
|
+
*/
|
|
109
|
+
export const isCollationsOwn = (edit) => edit.editType === drawnByCollation
|
|
110
|
+
|| (edit.editType === undefined && edit.motivation === undefined && edit['@annotation'] === undefined);
|
package/lib/ConditionState.d.ts
CHANGED
package/lib/Edit.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Assumption } from "./Assumption";
|
|
2
|
-
import { AnySymbol } from "./Symbol";
|
|
3
|
-
import { WithId } from "./utils";
|
|
1
|
+
import { Assumption } from "./Assumption.js";
|
|
2
|
+
import { AnySymbol } from "./Symbol.js";
|
|
3
|
+
import { WithId } from "./utils.js";
|
|
4
4
|
export declare const editTypes: readonly [
|
|
5
5
|
/**
|
|
6
6
|
* An additional accent that can only be encoded with
|
package/lib/Edition.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { RollCopy } from "./RollCopy";
|
|
2
|
-
import { Version } from "./Version";
|
|
3
|
-
import { CollationTolerance } from "./Collation";
|
|
4
|
-
import { DateAssignment, ObjectAssumption } from "./Assumption";
|
|
5
|
-
import { Editor, Person, Place } from "./Agent";
|
|
6
|
-
import { RollTempo } from "./ReproducingSystem";
|
|
1
|
+
import { RollCopy } from "./RollCopy.js";
|
|
2
|
+
import { Version } from "./Version.js";
|
|
3
|
+
import { CollationTolerance } from "./Collation.js";
|
|
4
|
+
import { DateAssignment, ObjectAssumption } from "./Assumption.js";
|
|
5
|
+
import { Editor, Person, Place } from "./Agent.js";
|
|
6
|
+
import { RollTempo } from "./ReproducingSystem.js";
|
|
7
7
|
/**
|
|
8
8
|
* This type describes the creation of an edition,
|
|
9
9
|
* i.e. the editor, publisher, and publication date.
|
|
@@ -29,9 +29,15 @@ export interface EditionCreation {
|
|
|
29
29
|
*/
|
|
30
30
|
publicationDate: Date;
|
|
31
31
|
/**
|
|
32
|
-
* The tolerance
|
|
33
|
-
*
|
|
32
|
+
* The tolerance every version of the edition was collated at,
|
|
33
|
+
* before each derivation stated its own. How precisely two copies
|
|
34
|
+
* place a symbol depends on which two they are, so the tolerance
|
|
35
|
+
* belongs to the derivation, `Derivation.collationTolerance`, and
|
|
36
|
+
* migration writes this one onto every derivation that gives none.
|
|
37
|
+
* Nothing else reads it. A window's offset is the displacement
|
|
38
|
+
* between two particular copies and so can never be stated here.
|
|
34
39
|
* Not exported to RDF.
|
|
40
|
+
* @deprecated
|
|
35
41
|
*/
|
|
36
42
|
collationTolerance?: CollationTolerance;
|
|
37
43
|
}
|
package/lib/EditionView.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Edition } from "./Edition";
|
|
2
|
-
import { HorizontalSpan, FeatureOrPatch } from "./Feature";
|
|
3
|
-
import { AnySymbol, Expression, Note } from "./Symbol";
|
|
4
|
-
import { Version } from "./Version";
|
|
5
|
-
import { NegotiatedEvent } from "./ReproducingSystem";
|
|
6
|
-
import { TrackerBar } from "./TrackerBar";
|
|
7
|
-
import { Modification, ProductionEvent, RollCopy } from "./RollCopy";
|
|
8
|
-
import { Millimeters } from "./Quantity";
|
|
1
|
+
import { Edition } from "./Edition.js";
|
|
2
|
+
import { HorizontalSpan, FeatureOrPatch } from "./Feature.js";
|
|
3
|
+
import { AnySymbol, Expression, Note } from "./Symbol.js";
|
|
4
|
+
import { Version } from "./Version.js";
|
|
5
|
+
import { NegotiatedEvent } from "./ReproducingSystem.js";
|
|
6
|
+
import { TrackerBar } from "./TrackerBar.js";
|
|
7
|
+
import { Modification, ProductionEvent, RollCopy } from "./RollCopy.js";
|
|
8
|
+
import { Millimeters } from "./Quantity.js";
|
|
9
9
|
export type Path = (string | number)[];
|
|
10
10
|
export declare const getAt: <T>(path: Path, obj: unknown) => T | undefined;
|
|
11
11
|
export declare class EditionView {
|
package/lib/EditionView.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { withBorneFeatures } from "./Feature";
|
|
2
|
-
import { deletedBy, insertedBy, principalDerivationOf } from "./Version";
|
|
3
|
-
import { systemIdOf } from "./TrackerBar";
|
|
4
|
-
import { featuresMadeBy, featuresOf, isPaperStretch } from "./RollCopy";
|
|
5
|
-
import { idOf, idsOf } from "./Assumption";
|
|
6
|
-
import { mean } from "./Quantity";
|
|
1
|
+
import { withBorneFeatures } from "./Feature.js";
|
|
2
|
+
import { deletedBy, insertedBy, principalDerivationOf } from "./Version.js";
|
|
3
|
+
import { systemIdOf } from "./TrackerBar.js";
|
|
4
|
+
import { featuresMadeBy, featuresOf, isPaperStretch } from "./RollCopy.js";
|
|
5
|
+
import { idOf, idsOf } from "./Assumption.js";
|
|
6
|
+
import { mean } from "./Quantity.js";
|
|
7
7
|
export const getAt = (path, obj) => {
|
|
8
8
|
let node = obj;
|
|
9
9
|
for (const key of path) {
|
package/lib/Emulation.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MidiFile } from "midifile-ts";
|
|
2
|
-
import { EditionView } from "./EditionView";
|
|
3
|
-
import { Version } from "./Version";
|
|
4
|
-
import { AnyPerformedRollFeature, EmulatedCurve, NegotiatedEvent, ReproducingSystem } from "./ReproducingSystem";
|
|
5
|
-
import { Millimeters } from "./Quantity";
|
|
2
|
+
import { EditionView } from "./EditionView.js";
|
|
3
|
+
import { Version } from "./Version.js";
|
|
4
|
+
import { AnyPerformedRollFeature, EmulatedCurve, NegotiatedEvent, ReproducingSystem } from "./ReproducingSystem.js";
|
|
5
|
+
import { Millimeters } from "./Quantity.js";
|
|
6
6
|
export type EmulationScope = {
|
|
7
7
|
/** Only notes whose onset lies within this span of the roll are played. */
|
|
8
8
|
range?: [Millimeters, Millimeters];
|
package/lib/Emulation.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MIDIControlEvents } from "midifile-ts";
|
|
2
|
-
import { idOf } from "./Assumption";
|
|
3
|
-
import { isCommand, pairsAmong, placementsOf } from "./Symbol";
|
|
4
|
-
import { add, mean, mm, seconds, subtract } from "./Quantity";
|
|
2
|
+
import { idOf } from "./Assumption.js";
|
|
3
|
+
import { isCommand, pairsAmong, placementsOf } from "./Symbol.js";
|
|
4
|
+
import { add, mean, mm, seconds, subtract } from "./Quantity.js";
|
|
5
5
|
/** The punch diameter the edition's copies report, where any of them does. */
|
|
6
6
|
const punchDiameterOf = (view) => {
|
|
7
7
|
const measured = view.edition.copies
|
package/lib/Feature.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ObjectAssumption } from "./Assumption";
|
|
2
|
-
import { ConditionState } from "./ConditionState";
|
|
3
|
-
import { Text } from "./Symbol";
|
|
4
|
-
import { PartialBy, WithId, WithType } from "./utils";
|
|
5
|
-
import { Measure, Millimeters, Track } from "./Quantity";
|
|
1
|
+
import { ObjectAssumption } from "./Assumption.js";
|
|
2
|
+
import { ConditionState } from "./ConditionState.js";
|
|
3
|
+
import { Text } from "./Symbol.js";
|
|
4
|
+
import { PartialBy, WithId, WithType } from "./utils.js";
|
|
5
|
+
import { Measure, Millimeters, Track } from "./Quantity.js";
|
|
6
6
|
/**
|
|
7
7
|
* Describes the horizontal extent of a feature on the roll,
|
|
8
8
|
* measured in millimeters from the beginning of the roll.
|
package/lib/FeatureSource.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ActorAssignment, DateAssignment, ObjectAssumption } from "./Assumption";
|
|
2
|
-
import { Concept, Named } from "./Agent";
|
|
3
|
-
import { ConditionState } from "./ConditionState";
|
|
4
|
-
import { WithNote } from "./utils";
|
|
1
|
+
import { ActorAssignment, DateAssignment, ObjectAssumption } from "./Assumption.js";
|
|
2
|
+
import { Concept, Named } from "./Agent.js";
|
|
3
|
+
import { ConditionState } from "./ConditionState.js";
|
|
4
|
+
import { WithNote } from "./utils.js";
|
|
5
5
|
/**
|
|
6
6
|
* What a copy's features were read from. The kinds run from the paper
|
|
7
7
|
* itself, through files in which the roll has already been read into
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Hole } from "./Feature";
|
|
2
|
-
import { Expression, Note } from "./Symbol";
|
|
3
|
-
import { TrackerBar } from "./TrackerBar";
|
|
4
|
-
import { Millimeters, Quantity, Seconds } from "./Quantity";
|
|
1
|
+
import { Hole } from "./Feature.js";
|
|
2
|
+
import { Expression, Note } from "./Symbol.js";
|
|
3
|
+
import { TrackerBar } from "./TrackerBar.js";
|
|
4
|
+
import { Millimeters, Quantity, Seconds } from "./Quantity.js";
|
|
5
5
|
export type SpeedUnit = 'ft/min' | 'm/min';
|
|
6
6
|
/**
|
|
7
7
|
* The playback tempo of the roll as a paper speed, stated at the
|
package/lib/RollCopy.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ConditionState } from "./ConditionState";
|
|
2
|
-
import { AnySymbol } from "./Symbol";
|
|
3
|
-
import { TrackerBar } from "./TrackerBar";
|
|
4
|
-
import { TrackCalibration } from "./TrackCalibration";
|
|
5
|
-
import { AnyFeature, FeatureOrPatch, GluedOn } from "./Feature";
|
|
6
|
-
import { ActorAssignment, DateAssignment, ObjectAssumption, ReferenceAssumption } from "./Assumption";
|
|
7
|
-
import { WithId, WithType } from "./utils";
|
|
8
|
-
import { Agent, Concept } from "./Agent";
|
|
9
|
-
import { FeatureSource } from "./FeatureSource";
|
|
10
|
-
import { Measure, Millimeters, Quantity, Track } from "./Quantity";
|
|
1
|
+
import { ConditionState } from "./ConditionState.js";
|
|
2
|
+
import { AnySymbol } from "./Symbol.js";
|
|
3
|
+
import { TrackerBar } from "./TrackerBar.js";
|
|
4
|
+
import { TrackCalibration } from "./TrackCalibration.js";
|
|
5
|
+
import { AnyFeature, FeatureOrPatch, GluedOn } from "./Feature.js";
|
|
6
|
+
import { ActorAssignment, DateAssignment, ObjectAssumption, ReferenceAssumption } from "./Assumption.js";
|
|
7
|
+
import { WithId, WithType } from "./utils.js";
|
|
8
|
+
import { Agent, Concept } from "./Agent.js";
|
|
9
|
+
import { FeatureSource } from "./FeatureSource.js";
|
|
10
|
+
import { Measure, Millimeters, Quantity, Track } from "./Quantity.js";
|
|
11
11
|
/**
|
|
12
12
|
* This condition state is used to describe the roll's
|
|
13
13
|
* paper shrinkage or stretching. It might be calculated
|
package/lib/RollCopy.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { v4 } from "uuid";
|
|
2
|
-
import { welteT100 } from "./systems/welteT100/bar";
|
|
3
|
-
import { trackerBarOf } from "./systems";
|
|
4
|
-
import { assignReference } from "./Assumption";
|
|
5
|
-
import { px, track } from "./Quantity";
|
|
2
|
+
import { welteT100 } from "./systems/welteT100/bar.js";
|
|
3
|
+
import { trackerBarOf } from "./systems/index.js";
|
|
4
|
+
import { assignReference } from "./Assumption.js";
|
|
5
|
+
import { px, track } from "./Quantity.js";
|
|
6
6
|
export const rollConditions = [
|
|
7
7
|
'general',
|
|
8
8
|
'paper-stretch'
|
package/lib/Symbol.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReferenceAssumption } from "./Assumption";
|
|
2
|
-
import { WithId } from "./utils";
|
|
1
|
+
import { ReferenceAssumption } from "./Assumption.js";
|
|
2
|
+
import { WithId } from "./utils.js";
|
|
3
3
|
/**
|
|
4
4
|
* A symbol is an abstract musical or textual entity carried by one or more
|
|
5
5
|
* physical features on the roll. Symbols are the result of interpreting
|
package/lib/Symbol.js
CHANGED
package/lib/TrackCalibration.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { px, subtract, track } from "./Quantity";
|
|
1
|
+
import { px, subtract, track } from "./Quantity.js";
|
|
2
2
|
/** Image column at the centre of a tracker bar track. */
|
|
3
3
|
export const columnOf = (position, calibration) => px(calibration.offset + (position - calibration.shift) * calibration.separation);
|
|
4
4
|
/** Tracker bar track covering an image column, unrounded. */
|
package/lib/TrackerBar.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Concept } from "./Agent";
|
|
2
|
-
import { Expression, Note } from "./Symbol";
|
|
3
|
-
import { Millimeters, SpeedMeasure, Track } from "./Quantity";
|
|
1
|
+
import type { Concept } from "./Agent.js";
|
|
2
|
+
import { Expression, Note } from "./Symbol.js";
|
|
3
|
+
import { Millimeters, SpeedMeasure, Track } from "./Quantity.js";
|
|
4
4
|
/**
|
|
5
5
|
* What a tracker bar position does: sound a note, or operate one of
|
|
6
6
|
* the expression valves on the bass or the treble side.
|
package/lib/TrackerBar.js
CHANGED
package/lib/Version.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Edit } from "./Edit";
|
|
2
|
-
import { Concept } from "./Agent";
|
|
3
|
-
import { ActorAssignment, Belief, Certainty, DateAssignment, ReferenceAssumption } from "./Assumption";
|
|
4
|
-
import { CollationTolerance } from "./Collation";
|
|
5
|
-
import { AnySymbol } from "./Symbol";
|
|
6
|
-
import { WithId, WithNote, WithType } from "./utils";
|
|
1
|
+
import { Edit } from "./Edit.js";
|
|
2
|
+
import { Concept } from "./Agent.js";
|
|
3
|
+
import { ActorAssignment, Belief, Certainty, DateAssignment, ObjectAssumption, ReferenceAssumption } from "./Assumption.js";
|
|
4
|
+
import { CollationTolerance } from "./Collation.js";
|
|
5
|
+
import { AnySymbol } from "./Symbol.js";
|
|
6
|
+
import { WithId, WithNote, WithType } from "./utils.js";
|
|
7
7
|
/**
|
|
8
8
|
* A motivation provides a reason or rationale for an editorial change.
|
|
9
9
|
* Motivations are defined at the version level and referenced by edits.
|
|
@@ -22,8 +22,14 @@ export type Derivation = ReferenceAssumption & {
|
|
|
22
22
|
* The tolerance at which the derived version was collated against
|
|
23
23
|
* the one it is based on. A derivation written before the tolerance
|
|
24
24
|
* was held here states none. Not exported to RDF.
|
|
25
|
+
*
|
|
26
|
+
* It is an object assumption, so that a tolerance calculated from
|
|
27
|
+
* the scatter of the readings can carry the inference it was drawn
|
|
28
|
+
* by. It is the one quantity in the edition that decides what
|
|
29
|
+
* counts as a reading at all, and a number arrived at by a method
|
|
30
|
+
* should say so.
|
|
25
31
|
*/
|
|
26
|
-
collationTolerance?: CollationTolerance
|
|
32
|
+
collationTolerance?: ObjectAssumption<CollationTolerance>;
|
|
27
33
|
};
|
|
28
34
|
/** The tolerance the derivation was collated at, or the default where it states none. */
|
|
29
35
|
export declare const collationToleranceOf: (derivation: Readonly<Derivation>) => CollationTolerance;
|
|
@@ -66,14 +72,6 @@ export interface VersionCreation {
|
|
|
66
72
|
* @see lrmoo:F2 Expression
|
|
67
73
|
*/
|
|
68
74
|
export interface Version extends WithId, WithType<'Version'> {
|
|
69
|
-
/**
|
|
70
|
-
* A label a document carries from before the sigla were computed.
|
|
71
|
-
* Nothing should write one here and nothing should show one: what a
|
|
72
|
-
* version is called comes from `siglaOf`.
|
|
73
|
-
* @deprecated
|
|
74
|
-
* @see reo:siglum
|
|
75
|
-
*/
|
|
76
|
-
siglum?: string;
|
|
77
75
|
/**
|
|
78
76
|
* The reproducing system this version is coded for. One roll was
|
|
79
77
|
* often issued for several of them, and a version is a reading in
|