@intellectif/lk-core 0.20.0 → 0.22.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/CHANGELOG.md +32 -0
- package/README.md +30 -1
- package/dist/{activity-f0bgZSTP.d.cts → activity-CYc7SD3d.d.cts} +157 -11
- package/dist/{activity-f0bgZSTP.d.ts → activity-CYc7SD3d.d.ts} +157 -11
- package/dist/ai-check.cjs +103 -15
- package/dist/ai-check.cjs.map +1 -1
- package/dist/ai-check.d.cts +9 -5
- package/dist/ai-check.d.ts +9 -5
- package/dist/ai-check.js +102 -14
- package/dist/ai-check.js.map +1 -1
- package/dist/{chunk-BIJCO2HM.js → chunk-5UCR4UNR.js} +301 -20
- package/dist/chunk-5UCR4UNR.js.map +1 -0
- package/dist/{chunk-FVZJ4X3Y.cjs → chunk-OPMY2MNS.cjs} +302 -21
- package/dist/chunk-OPMY2MNS.cjs.map +1 -0
- package/dist/{chunk-MMEQKFFQ.js → chunk-Q7MV3IXJ.js} +196 -8
- package/dist/chunk-Q7MV3IXJ.js.map +1 -0
- package/dist/{chunk-COBK2RUX.cjs → chunk-WQVZPIN7.cjs} +197 -9
- package/dist/chunk-WQVZPIN7.cjs.map +1 -0
- package/dist/{index-BA9f2ydg.d.ts → index-0Z3-nnAP.d.ts} +1 -1
- package/dist/{index-7S3-TLjT.d.cts → index-CxxiNSSH.d.cts} +1 -1
- package/dist/index.cjs +56 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +93 -10
- package/dist/index.d.ts +93 -10
- package/dist/index.js +52 -5
- package/dist/index.js.map +1 -1
- package/dist/schemas.d.cts +2 -2
- package/dist/schemas.d.ts +2 -2
- package/dist/scoring.cjs +14 -2
- package/dist/scoring.cjs.map +1 -1
- package/dist/scoring.d.cts +240 -4
- package/dist/scoring.d.ts +240 -4
- package/dist/scoring.js +13 -1
- package/dist/xapi.d.cts +1 -1
- package/dist/xapi.d.ts +1 -1
- package/package.json +1 -1
- package/vectors/README.md +10 -0
- package/vectors/scoring.json +2127 -1
- package/dist/chunk-BIJCO2HM.js.map +0 -1
- package/dist/chunk-COBK2RUX.cjs.map +0 -1
- package/dist/chunk-FVZJ4X3Y.cjs.map +0 -1
- package/dist/chunk-MMEQKFFQ.js.map +0 -1
package/dist/schemas.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import './activity-
|
|
2
|
-
export { A as AiPermissionsSchema, B as BlankConfigSchema, D as DictationDataSchema, a as DictationEquivalenceSchema, b as DictationSlowMediaSchema, c as DictationToleranceSchema, F as FeedbackSchema, d as FillInTheBlanksDataSchema, G as GapSelectBankSchema, e as GapSelectChoiceSchema, f as GapSelectDataSchema, g as GapSelectGapSchema, h as ItemGroupSchema, M as MediaPlaybackSchema, j as MediaSchema, l as MediaTimelineSchema, m as MediaTrackSchema, n as MediaUrlSchema, o as MultipleChoiceDataSchema, p as MultipleChoiceOptionMediaSchema, q as MultipleChoiceOptionSchema, N as NativeControlHintSchema, R as ReadAloudDataSchema, r as ReadAloudSlowMediaSchema, s as RedactedActivity, t as RedactedBlankConfig, u as RedactedBlankConfigSchema, v as RedactedDictationData, w as RedactedDictationDataSchema, x as RedactedDictationSlowMedia, y as RedactedDictationSlowMediaSchema, z as RedactedFillInTheBlanksData, C as RedactedFillInTheBlanksDataSchema, E as RedactedGapSelectBank, H as RedactedGapSelectBankSchema, J as RedactedGapSelectChoice, K as RedactedGapSelectChoiceSchema, L as RedactedGapSelectData, O as RedactedGapSelectDataSchema, P as RedactedGapSelectGap, Q as RedactedGapSelectGapSchema, S as RedactedItemGroupSchema, T as RedactedMediaSchema, U as RedactedMultipleChoiceData, V as RedactedMultipleChoiceDataSchema, W as RedactedMultipleChoiceOption, X as RedactedMultipleChoiceOptionMedia, Y as RedactedMultipleChoiceOptionMediaSchema, Z as RedactedMultipleChoiceOptionSchema, _ as RedactedReadAloudData, $ as RedactedReadAloudDataSchema, a0 as RedactedStimulus, a1 as RedactedStimulusSchema, a2 as RedactedWrittenResponseData, a3 as RedactedWrittenResponseDataSchema, a9 as StimulusSchema, aa as TextMatchPolicySchema, ac as TimelineChapterSchema, ae as TimelineCueSchema, af as WrittenResponseDataSchema, ag as WrittenResponseRubricCriterionSchema, ah as WrittenResponseRubricSchema, ai as dictationJsonSchema, aj as fillInTheBlanksJsonSchema, ak as gapSelectJsonSchema, al as itemGroupJsonSchema, am as jsonSchemaFor, an as multipleChoiceJsonSchema, ao as readAloudJsonSchema, ap as stimulusJsonSchema, aq as validateActivity, ar as validateItemGroup, as as writtenResponseJsonSchema } from './index-
|
|
1
|
+
import './activity-CYc7SD3d.cjs';
|
|
2
|
+
export { A as AiPermissionsSchema, B as BlankConfigSchema, D as DictationDataSchema, a as DictationEquivalenceSchema, b as DictationSlowMediaSchema, c as DictationToleranceSchema, F as FeedbackSchema, d as FillInTheBlanksDataSchema, G as GapSelectBankSchema, e as GapSelectChoiceSchema, f as GapSelectDataSchema, g as GapSelectGapSchema, h as ItemGroupSchema, M as MediaPlaybackSchema, j as MediaSchema, l as MediaTimelineSchema, m as MediaTrackSchema, n as MediaUrlSchema, o as MultipleChoiceDataSchema, p as MultipleChoiceOptionMediaSchema, q as MultipleChoiceOptionSchema, N as NativeControlHintSchema, R as ReadAloudDataSchema, r as ReadAloudSlowMediaSchema, s as RedactedActivity, t as RedactedBlankConfig, u as RedactedBlankConfigSchema, v as RedactedDictationData, w as RedactedDictationDataSchema, x as RedactedDictationSlowMedia, y as RedactedDictationSlowMediaSchema, z as RedactedFillInTheBlanksData, C as RedactedFillInTheBlanksDataSchema, E as RedactedGapSelectBank, H as RedactedGapSelectBankSchema, J as RedactedGapSelectChoice, K as RedactedGapSelectChoiceSchema, L as RedactedGapSelectData, O as RedactedGapSelectDataSchema, P as RedactedGapSelectGap, Q as RedactedGapSelectGapSchema, S as RedactedItemGroupSchema, T as RedactedMediaSchema, U as RedactedMultipleChoiceData, V as RedactedMultipleChoiceDataSchema, W as RedactedMultipleChoiceOption, X as RedactedMultipleChoiceOptionMedia, Y as RedactedMultipleChoiceOptionMediaSchema, Z as RedactedMultipleChoiceOptionSchema, _ as RedactedReadAloudData, $ as RedactedReadAloudDataSchema, a0 as RedactedStimulus, a1 as RedactedStimulusSchema, a2 as RedactedWrittenResponseData, a3 as RedactedWrittenResponseDataSchema, a9 as StimulusSchema, aa as TextMatchPolicySchema, ac as TimelineChapterSchema, ae as TimelineCueSchema, af as WrittenResponseDataSchema, ag as WrittenResponseRubricCriterionSchema, ah as WrittenResponseRubricSchema, ai as dictationJsonSchema, aj as fillInTheBlanksJsonSchema, ak as gapSelectJsonSchema, al as itemGroupJsonSchema, am as jsonSchemaFor, an as multipleChoiceJsonSchema, ao as readAloudJsonSchema, ap as stimulusJsonSchema, aq as validateActivity, ar as validateItemGroup, as as writtenResponseJsonSchema } from './index-CxxiNSSH.cjs';
|
|
3
3
|
import 'zod/v4';
|
package/dist/schemas.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import './activity-
|
|
2
|
-
export { A as AiPermissionsSchema, B as BlankConfigSchema, D as DictationDataSchema, a as DictationEquivalenceSchema, b as DictationSlowMediaSchema, c as DictationToleranceSchema, F as FeedbackSchema, d as FillInTheBlanksDataSchema, G as GapSelectBankSchema, e as GapSelectChoiceSchema, f as GapSelectDataSchema, g as GapSelectGapSchema, h as ItemGroupSchema, M as MediaPlaybackSchema, j as MediaSchema, l as MediaTimelineSchema, m as MediaTrackSchema, n as MediaUrlSchema, o as MultipleChoiceDataSchema, p as MultipleChoiceOptionMediaSchema, q as MultipleChoiceOptionSchema, N as NativeControlHintSchema, R as ReadAloudDataSchema, r as ReadAloudSlowMediaSchema, s as RedactedActivity, t as RedactedBlankConfig, u as RedactedBlankConfigSchema, v as RedactedDictationData, w as RedactedDictationDataSchema, x as RedactedDictationSlowMedia, y as RedactedDictationSlowMediaSchema, z as RedactedFillInTheBlanksData, C as RedactedFillInTheBlanksDataSchema, E as RedactedGapSelectBank, H as RedactedGapSelectBankSchema, J as RedactedGapSelectChoice, K as RedactedGapSelectChoiceSchema, L as RedactedGapSelectData, O as RedactedGapSelectDataSchema, P as RedactedGapSelectGap, Q as RedactedGapSelectGapSchema, S as RedactedItemGroupSchema, T as RedactedMediaSchema, U as RedactedMultipleChoiceData, V as RedactedMultipleChoiceDataSchema, W as RedactedMultipleChoiceOption, X as RedactedMultipleChoiceOptionMedia, Y as RedactedMultipleChoiceOptionMediaSchema, Z as RedactedMultipleChoiceOptionSchema, _ as RedactedReadAloudData, $ as RedactedReadAloudDataSchema, a0 as RedactedStimulus, a1 as RedactedStimulusSchema, a2 as RedactedWrittenResponseData, a3 as RedactedWrittenResponseDataSchema, a9 as StimulusSchema, aa as TextMatchPolicySchema, ac as TimelineChapterSchema, ae as TimelineCueSchema, af as WrittenResponseDataSchema, ag as WrittenResponseRubricCriterionSchema, ah as WrittenResponseRubricSchema, ai as dictationJsonSchema, aj as fillInTheBlanksJsonSchema, ak as gapSelectJsonSchema, al as itemGroupJsonSchema, am as jsonSchemaFor, an as multipleChoiceJsonSchema, ao as readAloudJsonSchema, ap as stimulusJsonSchema, aq as validateActivity, ar as validateItemGroup, as as writtenResponseJsonSchema } from './index-
|
|
1
|
+
import './activity-CYc7SD3d.js';
|
|
2
|
+
export { A as AiPermissionsSchema, B as BlankConfigSchema, D as DictationDataSchema, a as DictationEquivalenceSchema, b as DictationSlowMediaSchema, c as DictationToleranceSchema, F as FeedbackSchema, d as FillInTheBlanksDataSchema, G as GapSelectBankSchema, e as GapSelectChoiceSchema, f as GapSelectDataSchema, g as GapSelectGapSchema, h as ItemGroupSchema, M as MediaPlaybackSchema, j as MediaSchema, l as MediaTimelineSchema, m as MediaTrackSchema, n as MediaUrlSchema, o as MultipleChoiceDataSchema, p as MultipleChoiceOptionMediaSchema, q as MultipleChoiceOptionSchema, N as NativeControlHintSchema, R as ReadAloudDataSchema, r as ReadAloudSlowMediaSchema, s as RedactedActivity, t as RedactedBlankConfig, u as RedactedBlankConfigSchema, v as RedactedDictationData, w as RedactedDictationDataSchema, x as RedactedDictationSlowMedia, y as RedactedDictationSlowMediaSchema, z as RedactedFillInTheBlanksData, C as RedactedFillInTheBlanksDataSchema, E as RedactedGapSelectBank, H as RedactedGapSelectBankSchema, J as RedactedGapSelectChoice, K as RedactedGapSelectChoiceSchema, L as RedactedGapSelectData, O as RedactedGapSelectDataSchema, P as RedactedGapSelectGap, Q as RedactedGapSelectGapSchema, S as RedactedItemGroupSchema, T as RedactedMediaSchema, U as RedactedMultipleChoiceData, V as RedactedMultipleChoiceDataSchema, W as RedactedMultipleChoiceOption, X as RedactedMultipleChoiceOptionMedia, Y as RedactedMultipleChoiceOptionMediaSchema, Z as RedactedMultipleChoiceOptionSchema, _ as RedactedReadAloudData, $ as RedactedReadAloudDataSchema, a0 as RedactedStimulus, a1 as RedactedStimulusSchema, a2 as RedactedWrittenResponseData, a3 as RedactedWrittenResponseDataSchema, a9 as StimulusSchema, aa as TextMatchPolicySchema, ac as TimelineChapterSchema, ae as TimelineCueSchema, af as WrittenResponseDataSchema, ag as WrittenResponseRubricCriterionSchema, ah as WrittenResponseRubricSchema, ai as dictationJsonSchema, aj as fillInTheBlanksJsonSchema, ak as gapSelectJsonSchema, al as itemGroupJsonSchema, am as jsonSchemaFor, an as multipleChoiceJsonSchema, ao as readAloudJsonSchema, ap as stimulusJsonSchema, aq as validateActivity, ar as validateItemGroup, as as writtenResponseJsonSchema } from './index-0Z3-nnAP.js';
|
|
3
3
|
import 'zod/v4';
|
package/dist/scoring.cjs
CHANGED
|
@@ -13,7 +13,13 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _chunkWQVZPIN7cjs = require('./chunk-WQVZPIN7.cjs');
|
|
17
23
|
|
|
18
24
|
|
|
19
25
|
|
|
@@ -59,5 +65,11 @@ var _chunkD4TOPSHVcjs = require('./chunk-D4TOPSHV.cjs');
|
|
|
59
65
|
|
|
60
66
|
|
|
61
67
|
|
|
62
|
-
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
exports.DEFAULT_ITEM_SCORING_POLICY = _chunkWQVZPIN7cjs.DEFAULT_ITEM_SCORING_POLICY; exports.DEFAULT_PASS_THRESHOLD = _chunkWQVZPIN7cjs.DEFAULT_PASS_THRESHOLD; exports.DICTATION_MAX_ACCEPTED_TRANSCRIPTS = _chunkD4TOPSHVcjs.DICTATION_MAX_ACCEPTED_TRANSCRIPTS; exports.DICTATION_MAX_EQUIVALENCES = _chunkD4TOPSHVcjs.DICTATION_MAX_EQUIVALENCES; exports.DICTATION_MAX_EQUIVALENCE_LENGTH = _chunkD4TOPSHVcjs.DICTATION_MAX_EQUIVALENCE_LENGTH; exports.DICTATION_MAX_TEXT_LENGTH = _chunkD4TOPSHVcjs.DICTATION_MAX_TEXT_LENGTH; exports.DICTATION_MAX_TRANSCRIPT_LENGTH = _chunkD4TOPSHVcjs.DICTATION_MAX_TRANSCRIPT_LENGTH; exports.ITEM_SCORING_MAX_RETRIES = _chunkWQVZPIN7cjs.ITEM_SCORING_MAX_RETRIES; exports.READ_ALOUD_MAX_DIMENSION_WEIGHT = _chunkD4TOPSHVcjs.READ_ALOUD_MAX_DIMENSION_WEIGHT; exports.READ_ALOUD_MAX_REFERENCE_LENGTH = _chunkD4TOPSHVcjs.READ_ALOUD_MAX_REFERENCE_LENGTH; exports.READ_ALOUD_MAX_SECONDS = _chunkD4TOPSHVcjs.READ_ALOUD_MAX_SECONDS; exports.READ_ALOUD_MAX_TAKES = _chunkD4TOPSHVcjs.READ_ALOUD_MAX_TAKES; exports.SPEECH_ASSESSMENT_MAX_WORDS = _chunkD4TOPSHVcjs.SPEECH_ASSESSMENT_MAX_WORDS; exports.alignDictation = _chunkD4TOPSHVcjs.alignDictation; exports.alignReadAloud = _chunkWQVZPIN7cjs.alignReadAloud; exports.classifyBand = _chunkWQVZPIN7cjs.classifyBand; exports.composeAssessmentScore = _chunkWQVZPIN7cjs.composeAssessmentScore; exports.computePassThreshold = _chunkWQVZPIN7cjs.computePassThreshold; exports.dictationReferenceWords = _chunkD4TOPSHVcjs.dictationReferenceWords; exports.diffDictationChars = _chunkWQVZPIN7cjs.diffDictationChars; exports.evaluate = _chunkWQVZPIN7cjs.evaluate; exports.evaluateTries = _chunkWQVZPIN7cjs.evaluateTries; exports.gradeReadAloud = _chunkWQVZPIN7cjs.gradeReadAloud; exports.gte = _chunkWQVZPIN7cjs.gte; exports.inspectWav = _chunkWQVZPIN7cjs.inspectWav; exports.levenshteinDistance = _chunkD4TOPSHVcjs.levenshteinDistance; exports.matchText = _chunkD4TOPSHVcjs.matchText; exports.outcomeFromUnscorable = _chunkWQVZPIN7cjs.outcomeFromUnscorable; exports.resolveItemScoringPolicy = _chunkWQVZPIN7cjs.resolveItemScoringPolicy; exports.roundGrade = _chunkWQVZPIN7cjs.roundGrade; exports.score = _chunkWQVZPIN7cjs.score; exports.scoreTries = _chunkWQVZPIN7cjs.scoreTries; exports.validateItemScoringPolicy = _chunkWQVZPIN7cjs.validateItemScoringPolicy; exports.validateSpeechAssessment = _chunkWQVZPIN7cjs.validateSpeechAssessment;
|
|
63
75
|
//# sourceMappingURL=scoring.cjs.map
|
package/dist/scoring.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/learning-kit/learning-kit/packages/lk-core/dist/scoring.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/learning-kit/learning-kit/packages/lk-core/dist/scoring.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,y1EAAC","file":"/home/runner/work/learning-kit/learning-kit/packages/lk-core/dist/scoring.cjs"}
|
package/dist/scoring.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a3 as ItemOutcome, Y as Grader, L as DictationData, a as ActivityData, ad as ReadAloudData, aq as ValidationResult, ag as ReadAloudLearnerResponse, X as GradeRecord, a4 as LearnerResponse, f as ActivityType, am as ScoringResult } from './activity-CYc7SD3d.cjs';
|
|
2
|
+
export { aj as RecordingRef, an as TextMatchPolicy, ao as TextMatchResult, aF as levenshteinDistance, aG as matchText } from './activity-CYc7SD3d.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Rounding for assessment scores.
|
|
@@ -216,6 +216,122 @@ interface AssessmentScore {
|
|
|
216
216
|
*/
|
|
217
217
|
declare function composeAssessmentScore(sections: readonly AssessmentSectionInput[], policy: CompositionPolicy): AssessmentScore;
|
|
218
218
|
|
|
219
|
+
/**
|
|
220
|
+
* How the questions on a paper are scored when a learner can try again or ask
|
|
221
|
+
* for hints: how many tries there are, which one counts, and what each try and
|
|
222
|
+
* each hint costs.
|
|
223
|
+
*
|
|
224
|
+
* It sits beside the {@link DeliveryPolicy} and is set per paper in the same
|
|
225
|
+
* way, but it is a separate object for a reason: every delivery setting takes
|
|
226
|
+
* something away from what a learner is shown and cannot move a grade, while
|
|
227
|
+
* every setting here moves one. A delivery policy can be read charitably; this
|
|
228
|
+
* one cannot, because a grade-moving setting has no safe direction to read a
|
|
229
|
+
* mistake in. {@link resolveItemScoringPolicy} throws on one.
|
|
230
|
+
*
|
|
231
|
+
* Every setting is optional, and absent or `null` is its default. The defaults
|
|
232
|
+
* are exactly how questions were scored before this policy existed: one try,
|
|
233
|
+
* nothing costs anything, and the first (only) try counts.
|
|
234
|
+
*
|
|
235
|
+
* **The SDK's components apply it in `practice`**, where they grade. An exam's
|
|
236
|
+
* hints stay free and uncounted, as they always were. See
|
|
237
|
+
* https://github.com/intellectif/learning-kit/blob/main/docs/scoring.md
|
|
238
|
+
*
|
|
239
|
+
* @see {@link scoreTries} for the arithmetic.
|
|
240
|
+
*/
|
|
241
|
+
interface ItemScoringPolicy {
|
|
242
|
+
/**
|
|
243
|
+
* What each hint costs, as a fraction of the question's marks: `0.1` takes
|
|
244
|
+
* a tenth of them per hint. A hint is any a learner is shown before
|
|
245
|
+
* answering — an author's hint on a blank, a dictation's hint word, an AI
|
|
246
|
+
* hint — and is counted in the response's `hintsRevealed`.
|
|
247
|
+
*
|
|
248
|
+
* A number from 0 to 1. Default 0.
|
|
249
|
+
*/
|
|
250
|
+
hintPenalty?: number | null;
|
|
251
|
+
/**
|
|
252
|
+
* How many more tries a learner gets after an answer that did not earn full
|
|
253
|
+
* marks: "Try again". A whole number from 0 to 10. Default 0 — one try, as
|
|
254
|
+
* before.
|
|
255
|
+
*/
|
|
256
|
+
retries?: number | null;
|
|
257
|
+
/**
|
|
258
|
+
* What each try after the first costs, as a fraction of the question's
|
|
259
|
+
* marks: with `0.25`, a right answer on the second try earns 75%. A number
|
|
260
|
+
* from 0 to 1. Default 0.
|
|
261
|
+
*
|
|
262
|
+
* It applies only where a later try can count — `counts: 'best'` or
|
|
263
|
+
* `'last'` — and {@link validateItemScoringPolicy} refuses it otherwise.
|
|
264
|
+
*/
|
|
265
|
+
retryPenalty?: number | null;
|
|
266
|
+
/**
|
|
267
|
+
* Which try's score is the question's score.
|
|
268
|
+
*
|
|
269
|
+
* - `first` (default): the first. Tries after it are for learning, and
|
|
270
|
+
* change no grade — which is why it is the default: switching tries on
|
|
271
|
+
* moves no grade until a school also chooses one of the others.
|
|
272
|
+
* - `best`: the highest, after what each try cost. Never goes down.
|
|
273
|
+
* - `last`: the latest the policy allows.
|
|
274
|
+
*/
|
|
275
|
+
counts?: ItemScoringCount | null;
|
|
276
|
+
}
|
|
277
|
+
/** Which try counts: see {@link ItemScoringPolicy.counts}. */
|
|
278
|
+
type ItemScoringCount = 'first' | 'best' | 'last';
|
|
279
|
+
/**
|
|
280
|
+
* A policy with every setting spelled out: what
|
|
281
|
+
* {@link resolveItemScoringPolicy} returns and what an attempt plan records,
|
|
282
|
+
* so the record never depends on a default that may one day change.
|
|
283
|
+
*/
|
|
284
|
+
interface ResolvedItemScoringPolicy {
|
|
285
|
+
hintPenalty: number;
|
|
286
|
+
retries: number;
|
|
287
|
+
retryPenalty: number;
|
|
288
|
+
counts: ItemScoringCount;
|
|
289
|
+
}
|
|
290
|
+
/** One thing {@link validateItemScoringPolicy} found wrong with a policy. */
|
|
291
|
+
interface ItemScoringPolicyIssue {
|
|
292
|
+
/** The setting, e.g. `hintPenalty`, or `''` for the policy itself. */
|
|
293
|
+
path: string;
|
|
294
|
+
message: string;
|
|
295
|
+
}
|
|
296
|
+
/** One graded try at a question, as {@link scoreTries} reads it. */
|
|
297
|
+
interface ItemTry {
|
|
298
|
+
/** What the try's answer scored, before anything it cost: from `score()`. */
|
|
299
|
+
score: number;
|
|
300
|
+
maxScore: number;
|
|
301
|
+
/**
|
|
302
|
+
* Hints shown before this try was submitted, counted from the start of the
|
|
303
|
+
* question — so a later try's count includes an earlier one's. The response's
|
|
304
|
+
* `hintsRevealed`. Anything but a whole number of 0 or more reads as 0.
|
|
305
|
+
*/
|
|
306
|
+
hintsRevealed?: number | undefined;
|
|
307
|
+
}
|
|
308
|
+
/** One try, as {@link scoreTries} scored it. */
|
|
309
|
+
interface ItemTryScore {
|
|
310
|
+
/** What the answer scored, before anything it cost. */
|
|
311
|
+
score: number;
|
|
312
|
+
/** What it scored after what it cost, never below 0. */
|
|
313
|
+
scored: number;
|
|
314
|
+
maxScore: number;
|
|
315
|
+
/** The hints it was charged for. */
|
|
316
|
+
hintsRevealed: number;
|
|
317
|
+
/** What it cost, as a fraction of `maxScore`: hints, and the tries before it. */
|
|
318
|
+
penalty: number;
|
|
319
|
+
}
|
|
320
|
+
/** A question's score under a policy, from its tries. */
|
|
321
|
+
interface ItemTriesScore {
|
|
322
|
+
/** The counted try's score after what it cost, never below 0. */
|
|
323
|
+
score: number;
|
|
324
|
+
maxScore: number;
|
|
325
|
+
/** 0-based: the try whose score counts. */
|
|
326
|
+
counted: number;
|
|
327
|
+
/**
|
|
328
|
+
* Every try the policy allows, in order, as scored. A try past the
|
|
329
|
+
* allowance (`1 + retries`) is left out: a learner cannot be given one, so a
|
|
330
|
+
* record that holds one is not believed.
|
|
331
|
+
*/
|
|
332
|
+
tries: ItemTryScore[];
|
|
333
|
+
}
|
|
334
|
+
|
|
219
335
|
/**
|
|
220
336
|
* Speech assessment: the neutral shape a pronunciation assessor's result is
|
|
221
337
|
* mapped into, and the types a read-aloud grade reads and writes.
|
|
@@ -582,6 +698,65 @@ declare const DICTATION_MAX_EQUIVALENCES = 100;
|
|
|
582
698
|
*/
|
|
583
699
|
declare const DICTATION_MAX_ACCEPTED_TRANSCRIPTS = 10;
|
|
584
700
|
|
|
701
|
+
/**
|
|
702
|
+
* The policy that changes nothing: one try, nothing costs anything, the first
|
|
703
|
+
* try counts. What an absent policy resolves to, and exactly how questions were
|
|
704
|
+
* scored before policies existed.
|
|
705
|
+
*/
|
|
706
|
+
declare const DEFAULT_ITEM_SCORING_POLICY: ResolvedItemScoringPolicy;
|
|
707
|
+
/** The most tries after the first a policy can give. */
|
|
708
|
+
declare const ITEM_SCORING_MAX_RETRIES = 10;
|
|
709
|
+
/**
|
|
710
|
+
* Checks a policy before it is stored or used: every setting absent, `null`,
|
|
711
|
+
* or a value it can take — costs from 0 to 1, `retries` a whole number from 0
|
|
712
|
+
* to {@link ITEM_SCORING_MAX_RETRIES}, `counts` one of `first`, `best` or
|
|
713
|
+
* `last` — and no setting it does not know.
|
|
714
|
+
*
|
|
715
|
+
* It also refuses a `retryPenalty` above 0 while the first try counts: that
|
|
716
|
+
* cost can never be charged, and a school that set it believes retries cost
|
|
717
|
+
* something. Choose `counts: 'best'` or `'last'`.
|
|
718
|
+
*/
|
|
719
|
+
declare function validateItemScoringPolicy(policy: unknown): {
|
|
720
|
+
success: true;
|
|
721
|
+
data: ItemScoringPolicy;
|
|
722
|
+
} | {
|
|
723
|
+
success: false;
|
|
724
|
+
issues: ItemScoringPolicyIssue[];
|
|
725
|
+
};
|
|
726
|
+
/**
|
|
727
|
+
* A policy with every setting spelled out.
|
|
728
|
+
*
|
|
729
|
+
* **It throws rather than guess.** A delivery policy reads a setting it cannot
|
|
730
|
+
* read as a restriction, because that is the safe way round; a setting here
|
|
731
|
+
* moves a grade, and there is no safe way round — a cost misread as 0 raises
|
|
732
|
+
* grades, misread as 1 lowers them. So a policy {@link validateItemScoringPolicy}
|
|
733
|
+
* refuses is refused here too, with a `RangeError` naming what is wrong, as an
|
|
734
|
+
* unreadable `rounding` is.
|
|
735
|
+
*/
|
|
736
|
+
declare function resolveItemScoringPolicy(policy: unknown): ResolvedItemScoringPolicy;
|
|
737
|
+
/**
|
|
738
|
+
* A question's score under a policy, from its tries in the order they were
|
|
739
|
+
* made.
|
|
740
|
+
*
|
|
741
|
+
* - **What a try costs** is a fraction of the question's marks, subtracted
|
|
742
|
+
* from what its answer scored: `hintPenalty` for every hint shown before it
|
|
743
|
+
* (its `hintsRevealed`, which counts from the start of the question), and
|
|
744
|
+
* `retryPenalty` for every try before it. A try never scores below 0.
|
|
745
|
+
* - **Which try counts** is the policy's `counts`: the first, the best after
|
|
746
|
+
* costs (the earliest, where two are equal), or the last.
|
|
747
|
+
* - **Only the tries the policy allows are read**: the first `1 + retries`. A
|
|
748
|
+
* record with more cannot have come from a learner under this policy.
|
|
749
|
+
*
|
|
750
|
+
* Nothing that cost nothing is changed: with no cost to charge, a try's score
|
|
751
|
+
* is exactly what its answer scored.
|
|
752
|
+
*
|
|
753
|
+
* @throws RangeError for a policy {@link resolveItemScoringPolicy} refuses, for
|
|
754
|
+
* an empty list of tries, and for a try whose `score` and `maxScore`
|
|
755
|
+
* cannot be a grade — the rule `outcomeFromGrade` applies: `maxScore`
|
|
756
|
+
* positive and finite, `score` finite from 0 to it.
|
|
757
|
+
*/
|
|
758
|
+
declare function scoreTries(tries: readonly ItemTry[], policy?: ItemScoringPolicy | ResolvedItemScoringPolicy | null): ItemTriesScore;
|
|
759
|
+
|
|
585
760
|
/**
|
|
586
761
|
* The pass line, and the authored feedback it selects.
|
|
587
762
|
*
|
|
@@ -831,6 +1006,28 @@ interface ScoringOptions {
|
|
|
831
1006
|
*/
|
|
832
1007
|
rounding?: RoundingPolicy;
|
|
833
1008
|
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Options for {@link evaluate} and {@link evaluateTries}: {@link ScoringOptions},
|
|
1011
|
+
* and the paper's scoring policy.
|
|
1012
|
+
*/
|
|
1013
|
+
interface EvaluateOptions extends ScoringOptions {
|
|
1014
|
+
/**
|
|
1015
|
+
* What hints and tries cost, and which try counts — see
|
|
1016
|
+
* {@link ItemScoringPolicy}. Absent or `null`, nothing costs anything and the
|
|
1017
|
+
* outcome is exactly what it was before policies existed.
|
|
1018
|
+
*
|
|
1019
|
+
* `evaluate` reads the hints from the response's `hintsRevealed`. The count
|
|
1020
|
+
* is the client's: when your server knows better — it served the AI hints,
|
|
1021
|
+
* say — write its own count there before you evaluate.
|
|
1022
|
+
*
|
|
1023
|
+
* Checked at the call: a policy `validateItemScoringPolicy` refuses throws a
|
|
1024
|
+
* `RangeError`. A grade-moving setting has no safe way to be misread. Under a
|
|
1025
|
+
* policy, a scored outcome whose numbers cannot be a grade — a registered
|
|
1026
|
+
* scorer out of contract — has nothing to charge a cost to, and comes back
|
|
1027
|
+
* `unscorable`.
|
|
1028
|
+
*/
|
|
1029
|
+
scoring?: ItemScoringPolicy | null;
|
|
1030
|
+
}
|
|
834
1031
|
/**
|
|
835
1032
|
* Scores a learner response against activity data and returns a full
|
|
836
1033
|
* {@link ScoringResult}.
|
|
@@ -858,10 +1055,49 @@ declare function score(activityType: ActivityType, activityData: ActivityData, l
|
|
|
858
1055
|
* "wrong".
|
|
859
1056
|
* - An unregistered `data.type` returns `{ status: 'unscorable' }` rather
|
|
860
1057
|
* than throwing, so a mixed-version content bank cannot crash an exam run.
|
|
1058
|
+
* - With a scoring policy (`options.scoring`), a scored outcome is charged what
|
|
1059
|
+
* the response's hints cost, and `passed` is read from what is left. The
|
|
1060
|
+
* `details` and authored `feedback` stay the answer's. For several tries at
|
|
1061
|
+
* one question, use {@link evaluateTries}.
|
|
861
1062
|
*
|
|
862
1063
|
* The activity type is read from `data.type` — there is no separate type
|
|
863
1064
|
* parameter to disagree with the payload.
|
|
864
1065
|
*/
|
|
865
|
-
declare function evaluate(data: ActivityData, response: LearnerResponse, options?:
|
|
1066
|
+
declare function evaluate(data: ActivityData, response: LearnerResponse, options?: EvaluateOptions): ItemOutcome;
|
|
1067
|
+
/** A question's outcome over its tries: see {@link evaluateTries}. */
|
|
1068
|
+
interface ItemTriesOutcome {
|
|
1069
|
+
/**
|
|
1070
|
+
* The question's outcome under the policy. Scored: the counted try's
|
|
1071
|
+
* `details` and authored `feedback` — they describe that answer — with its
|
|
1072
|
+
* `score` after what it cost and `passed` read from that score. Anything
|
|
1073
|
+
* else — deferred, unscorable — is the first try's outcome as `evaluate`
|
|
1074
|
+
* gives it.
|
|
1075
|
+
*/
|
|
1076
|
+
outcome: ItemOutcome;
|
|
1077
|
+
/** 0-based: the try whose score counts. `null` when the outcome is not scored. */
|
|
1078
|
+
counted: number | null;
|
|
1079
|
+
/**
|
|
1080
|
+
* Every try the policy allows, as scored: before and after what it cost.
|
|
1081
|
+
* Empty when the outcome is not scored, or when, with no policy, it is an
|
|
1082
|
+
* outcome `evaluate` passes through that cannot be a grade.
|
|
1083
|
+
*/
|
|
1084
|
+
tries: ItemTryScore[];
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* A question's outcome from every try a learner made at it, in order, under a
|
|
1088
|
+
* paper's scoring policy: what a server that scores practice itself calls,
|
|
1089
|
+
* with the tries it stored, to reach the grade the SDK's components reached.
|
|
1090
|
+
*
|
|
1091
|
+
* Each response is scored as {@link evaluate} scores it, and costed and chosen
|
|
1092
|
+
* as {@link scoreTries} does: hints from each response's `hintsRevealed`,
|
|
1093
|
+
* which counts from the start of the question; the tries before each one;
|
|
1094
|
+
* and the try `counts` names. Only the first `1 + retries` responses are read.
|
|
1095
|
+
*
|
|
1096
|
+
* With no policy it is `evaluate` of the first response: one try, as before.
|
|
1097
|
+
* With no response at all, the question was never answered —
|
|
1098
|
+
* `{ status: 'deferred', reason: 'no_response_recorded' }`, as a missing slot
|
|
1099
|
+
* is everywhere else.
|
|
1100
|
+
*/
|
|
1101
|
+
declare function evaluateTries(data: ActivityData, responses: readonly LearnerResponse[], options?: EvaluateOptions): ItemTriesOutcome;
|
|
866
1102
|
|
|
867
|
-
export { type AssessmentScore, type AssessmentSectionInput, type Band, type CompositionPolicy, DEFAULT_PASS_THRESHOLD, DICTATION_MAX_ACCEPTED_TRANSCRIPTS, DICTATION_MAX_EQUIVALENCES, DICTATION_MAX_EQUIVALENCE_LENGTH, DICTATION_MAX_TEXT_LENGTH, DICTATION_MAX_TRANSCRIPT_LENGTH, type DictationAlignment, type DictationCharOp, type DictationReference, type DictationWordAlignment, type GradeReadAloudOptions, GradeRecord, ItemOutcome, type PassFailureReason, READ_ALOUD_MAX_DIMENSION_WEIGHT, READ_ALOUD_MAX_REFERENCE_LENGTH, READ_ALOUD_MAX_SECONDS, READ_ALOUD_MAX_TAKES, ReadAloudData, ReadAloudLearnerResponse, type ReadAloudWordAlignment, type ReadAloudWordState, type RoundingMode, type RoundingPolicy, SPEECH_ASSESSMENT_MAX_WORDS, type ScoredItem, type ScoringOptions, type SectionScore, type SpeechAssessment, type SpeechMeasurement, type SpeechPhoneme, type SpeechPhonemeCandidate, type SpeechPlausibilityPolicy, type SpeechSyllable, type SpeechUnscorable, type SpeechUnscorableCode, type SpeechWord, type SpeechWordError, type WavInspection, type WavInspectionPolicy, alignDictation, alignReadAloud, classifyBand, composeAssessmentScore, computePassThreshold, dictationReferenceWords, diffDictationChars, evaluate, gradeReadAloud, gte, inspectWav, outcomeFromUnscorable, roundGrade, score, validateSpeechAssessment };
|
|
1103
|
+
export { type AssessmentScore, type AssessmentSectionInput, type Band, type CompositionPolicy, DEFAULT_ITEM_SCORING_POLICY, DEFAULT_PASS_THRESHOLD, DICTATION_MAX_ACCEPTED_TRANSCRIPTS, DICTATION_MAX_EQUIVALENCES, DICTATION_MAX_EQUIVALENCE_LENGTH, DICTATION_MAX_TEXT_LENGTH, DICTATION_MAX_TRANSCRIPT_LENGTH, type DictationAlignment, type DictationCharOp, type DictationReference, type DictationWordAlignment, type EvaluateOptions, type GradeReadAloudOptions, GradeRecord, ITEM_SCORING_MAX_RETRIES, ItemOutcome, type ItemScoringCount, type ItemScoringPolicy, type ItemScoringPolicyIssue, type ItemTriesOutcome, type ItemTriesScore, type ItemTry, type ItemTryScore, type PassFailureReason, READ_ALOUD_MAX_DIMENSION_WEIGHT, READ_ALOUD_MAX_REFERENCE_LENGTH, READ_ALOUD_MAX_SECONDS, READ_ALOUD_MAX_TAKES, ReadAloudData, ReadAloudLearnerResponse, type ReadAloudWordAlignment, type ReadAloudWordState, type ResolvedItemScoringPolicy, type RoundingMode, type RoundingPolicy, SPEECH_ASSESSMENT_MAX_WORDS, type ScoredItem, type ScoringOptions, type SectionScore, type SpeechAssessment, type SpeechMeasurement, type SpeechPhoneme, type SpeechPhonemeCandidate, type SpeechPlausibilityPolicy, type SpeechSyllable, type SpeechUnscorable, type SpeechUnscorableCode, type SpeechWord, type SpeechWordError, type WavInspection, type WavInspectionPolicy, alignDictation, alignReadAloud, classifyBand, composeAssessmentScore, computePassThreshold, dictationReferenceWords, diffDictationChars, evaluate, evaluateTries, gradeReadAloud, gte, inspectWav, outcomeFromUnscorable, resolveItemScoringPolicy, roundGrade, score, scoreTries, validateItemScoringPolicy, validateSpeechAssessment };
|
package/dist/scoring.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a3 as ItemOutcome, Y as Grader, L as DictationData, a as ActivityData, ad as ReadAloudData, aq as ValidationResult, ag as ReadAloudLearnerResponse, X as GradeRecord, a4 as LearnerResponse, f as ActivityType, am as ScoringResult } from './activity-CYc7SD3d.js';
|
|
2
|
+
export { aj as RecordingRef, an as TextMatchPolicy, ao as TextMatchResult, aF as levenshteinDistance, aG as matchText } from './activity-CYc7SD3d.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Rounding for assessment scores.
|
|
@@ -216,6 +216,122 @@ interface AssessmentScore {
|
|
|
216
216
|
*/
|
|
217
217
|
declare function composeAssessmentScore(sections: readonly AssessmentSectionInput[], policy: CompositionPolicy): AssessmentScore;
|
|
218
218
|
|
|
219
|
+
/**
|
|
220
|
+
* How the questions on a paper are scored when a learner can try again or ask
|
|
221
|
+
* for hints: how many tries there are, which one counts, and what each try and
|
|
222
|
+
* each hint costs.
|
|
223
|
+
*
|
|
224
|
+
* It sits beside the {@link DeliveryPolicy} and is set per paper in the same
|
|
225
|
+
* way, but it is a separate object for a reason: every delivery setting takes
|
|
226
|
+
* something away from what a learner is shown and cannot move a grade, while
|
|
227
|
+
* every setting here moves one. A delivery policy can be read charitably; this
|
|
228
|
+
* one cannot, because a grade-moving setting has no safe direction to read a
|
|
229
|
+
* mistake in. {@link resolveItemScoringPolicy} throws on one.
|
|
230
|
+
*
|
|
231
|
+
* Every setting is optional, and absent or `null` is its default. The defaults
|
|
232
|
+
* are exactly how questions were scored before this policy existed: one try,
|
|
233
|
+
* nothing costs anything, and the first (only) try counts.
|
|
234
|
+
*
|
|
235
|
+
* **The SDK's components apply it in `practice`**, where they grade. An exam's
|
|
236
|
+
* hints stay free and uncounted, as they always were. See
|
|
237
|
+
* https://github.com/intellectif/learning-kit/blob/main/docs/scoring.md
|
|
238
|
+
*
|
|
239
|
+
* @see {@link scoreTries} for the arithmetic.
|
|
240
|
+
*/
|
|
241
|
+
interface ItemScoringPolicy {
|
|
242
|
+
/**
|
|
243
|
+
* What each hint costs, as a fraction of the question's marks: `0.1` takes
|
|
244
|
+
* a tenth of them per hint. A hint is any a learner is shown before
|
|
245
|
+
* answering — an author's hint on a blank, a dictation's hint word, an AI
|
|
246
|
+
* hint — and is counted in the response's `hintsRevealed`.
|
|
247
|
+
*
|
|
248
|
+
* A number from 0 to 1. Default 0.
|
|
249
|
+
*/
|
|
250
|
+
hintPenalty?: number | null;
|
|
251
|
+
/**
|
|
252
|
+
* How many more tries a learner gets after an answer that did not earn full
|
|
253
|
+
* marks: "Try again". A whole number from 0 to 10. Default 0 — one try, as
|
|
254
|
+
* before.
|
|
255
|
+
*/
|
|
256
|
+
retries?: number | null;
|
|
257
|
+
/**
|
|
258
|
+
* What each try after the first costs, as a fraction of the question's
|
|
259
|
+
* marks: with `0.25`, a right answer on the second try earns 75%. A number
|
|
260
|
+
* from 0 to 1. Default 0.
|
|
261
|
+
*
|
|
262
|
+
* It applies only where a later try can count — `counts: 'best'` or
|
|
263
|
+
* `'last'` — and {@link validateItemScoringPolicy} refuses it otherwise.
|
|
264
|
+
*/
|
|
265
|
+
retryPenalty?: number | null;
|
|
266
|
+
/**
|
|
267
|
+
* Which try's score is the question's score.
|
|
268
|
+
*
|
|
269
|
+
* - `first` (default): the first. Tries after it are for learning, and
|
|
270
|
+
* change no grade — which is why it is the default: switching tries on
|
|
271
|
+
* moves no grade until a school also chooses one of the others.
|
|
272
|
+
* - `best`: the highest, after what each try cost. Never goes down.
|
|
273
|
+
* - `last`: the latest the policy allows.
|
|
274
|
+
*/
|
|
275
|
+
counts?: ItemScoringCount | null;
|
|
276
|
+
}
|
|
277
|
+
/** Which try counts: see {@link ItemScoringPolicy.counts}. */
|
|
278
|
+
type ItemScoringCount = 'first' | 'best' | 'last';
|
|
279
|
+
/**
|
|
280
|
+
* A policy with every setting spelled out: what
|
|
281
|
+
* {@link resolveItemScoringPolicy} returns and what an attempt plan records,
|
|
282
|
+
* so the record never depends on a default that may one day change.
|
|
283
|
+
*/
|
|
284
|
+
interface ResolvedItemScoringPolicy {
|
|
285
|
+
hintPenalty: number;
|
|
286
|
+
retries: number;
|
|
287
|
+
retryPenalty: number;
|
|
288
|
+
counts: ItemScoringCount;
|
|
289
|
+
}
|
|
290
|
+
/** One thing {@link validateItemScoringPolicy} found wrong with a policy. */
|
|
291
|
+
interface ItemScoringPolicyIssue {
|
|
292
|
+
/** The setting, e.g. `hintPenalty`, or `''` for the policy itself. */
|
|
293
|
+
path: string;
|
|
294
|
+
message: string;
|
|
295
|
+
}
|
|
296
|
+
/** One graded try at a question, as {@link scoreTries} reads it. */
|
|
297
|
+
interface ItemTry {
|
|
298
|
+
/** What the try's answer scored, before anything it cost: from `score()`. */
|
|
299
|
+
score: number;
|
|
300
|
+
maxScore: number;
|
|
301
|
+
/**
|
|
302
|
+
* Hints shown before this try was submitted, counted from the start of the
|
|
303
|
+
* question — so a later try's count includes an earlier one's. The response's
|
|
304
|
+
* `hintsRevealed`. Anything but a whole number of 0 or more reads as 0.
|
|
305
|
+
*/
|
|
306
|
+
hintsRevealed?: number | undefined;
|
|
307
|
+
}
|
|
308
|
+
/** One try, as {@link scoreTries} scored it. */
|
|
309
|
+
interface ItemTryScore {
|
|
310
|
+
/** What the answer scored, before anything it cost. */
|
|
311
|
+
score: number;
|
|
312
|
+
/** What it scored after what it cost, never below 0. */
|
|
313
|
+
scored: number;
|
|
314
|
+
maxScore: number;
|
|
315
|
+
/** The hints it was charged for. */
|
|
316
|
+
hintsRevealed: number;
|
|
317
|
+
/** What it cost, as a fraction of `maxScore`: hints, and the tries before it. */
|
|
318
|
+
penalty: number;
|
|
319
|
+
}
|
|
320
|
+
/** A question's score under a policy, from its tries. */
|
|
321
|
+
interface ItemTriesScore {
|
|
322
|
+
/** The counted try's score after what it cost, never below 0. */
|
|
323
|
+
score: number;
|
|
324
|
+
maxScore: number;
|
|
325
|
+
/** 0-based: the try whose score counts. */
|
|
326
|
+
counted: number;
|
|
327
|
+
/**
|
|
328
|
+
* Every try the policy allows, in order, as scored. A try past the
|
|
329
|
+
* allowance (`1 + retries`) is left out: a learner cannot be given one, so a
|
|
330
|
+
* record that holds one is not believed.
|
|
331
|
+
*/
|
|
332
|
+
tries: ItemTryScore[];
|
|
333
|
+
}
|
|
334
|
+
|
|
219
335
|
/**
|
|
220
336
|
* Speech assessment: the neutral shape a pronunciation assessor's result is
|
|
221
337
|
* mapped into, and the types a read-aloud grade reads and writes.
|
|
@@ -582,6 +698,65 @@ declare const DICTATION_MAX_EQUIVALENCES = 100;
|
|
|
582
698
|
*/
|
|
583
699
|
declare const DICTATION_MAX_ACCEPTED_TRANSCRIPTS = 10;
|
|
584
700
|
|
|
701
|
+
/**
|
|
702
|
+
* The policy that changes nothing: one try, nothing costs anything, the first
|
|
703
|
+
* try counts. What an absent policy resolves to, and exactly how questions were
|
|
704
|
+
* scored before policies existed.
|
|
705
|
+
*/
|
|
706
|
+
declare const DEFAULT_ITEM_SCORING_POLICY: ResolvedItemScoringPolicy;
|
|
707
|
+
/** The most tries after the first a policy can give. */
|
|
708
|
+
declare const ITEM_SCORING_MAX_RETRIES = 10;
|
|
709
|
+
/**
|
|
710
|
+
* Checks a policy before it is stored or used: every setting absent, `null`,
|
|
711
|
+
* or a value it can take — costs from 0 to 1, `retries` a whole number from 0
|
|
712
|
+
* to {@link ITEM_SCORING_MAX_RETRIES}, `counts` one of `first`, `best` or
|
|
713
|
+
* `last` — and no setting it does not know.
|
|
714
|
+
*
|
|
715
|
+
* It also refuses a `retryPenalty` above 0 while the first try counts: that
|
|
716
|
+
* cost can never be charged, and a school that set it believes retries cost
|
|
717
|
+
* something. Choose `counts: 'best'` or `'last'`.
|
|
718
|
+
*/
|
|
719
|
+
declare function validateItemScoringPolicy(policy: unknown): {
|
|
720
|
+
success: true;
|
|
721
|
+
data: ItemScoringPolicy;
|
|
722
|
+
} | {
|
|
723
|
+
success: false;
|
|
724
|
+
issues: ItemScoringPolicyIssue[];
|
|
725
|
+
};
|
|
726
|
+
/**
|
|
727
|
+
* A policy with every setting spelled out.
|
|
728
|
+
*
|
|
729
|
+
* **It throws rather than guess.** A delivery policy reads a setting it cannot
|
|
730
|
+
* read as a restriction, because that is the safe way round; a setting here
|
|
731
|
+
* moves a grade, and there is no safe way round — a cost misread as 0 raises
|
|
732
|
+
* grades, misread as 1 lowers them. So a policy {@link validateItemScoringPolicy}
|
|
733
|
+
* refuses is refused here too, with a `RangeError` naming what is wrong, as an
|
|
734
|
+
* unreadable `rounding` is.
|
|
735
|
+
*/
|
|
736
|
+
declare function resolveItemScoringPolicy(policy: unknown): ResolvedItemScoringPolicy;
|
|
737
|
+
/**
|
|
738
|
+
* A question's score under a policy, from its tries in the order they were
|
|
739
|
+
* made.
|
|
740
|
+
*
|
|
741
|
+
* - **What a try costs** is a fraction of the question's marks, subtracted
|
|
742
|
+
* from what its answer scored: `hintPenalty` for every hint shown before it
|
|
743
|
+
* (its `hintsRevealed`, which counts from the start of the question), and
|
|
744
|
+
* `retryPenalty` for every try before it. A try never scores below 0.
|
|
745
|
+
* - **Which try counts** is the policy's `counts`: the first, the best after
|
|
746
|
+
* costs (the earliest, where two are equal), or the last.
|
|
747
|
+
* - **Only the tries the policy allows are read**: the first `1 + retries`. A
|
|
748
|
+
* record with more cannot have come from a learner under this policy.
|
|
749
|
+
*
|
|
750
|
+
* Nothing that cost nothing is changed: with no cost to charge, a try's score
|
|
751
|
+
* is exactly what its answer scored.
|
|
752
|
+
*
|
|
753
|
+
* @throws RangeError for a policy {@link resolveItemScoringPolicy} refuses, for
|
|
754
|
+
* an empty list of tries, and for a try whose `score` and `maxScore`
|
|
755
|
+
* cannot be a grade — the rule `outcomeFromGrade` applies: `maxScore`
|
|
756
|
+
* positive and finite, `score` finite from 0 to it.
|
|
757
|
+
*/
|
|
758
|
+
declare function scoreTries(tries: readonly ItemTry[], policy?: ItemScoringPolicy | ResolvedItemScoringPolicy | null): ItemTriesScore;
|
|
759
|
+
|
|
585
760
|
/**
|
|
586
761
|
* The pass line, and the authored feedback it selects.
|
|
587
762
|
*
|
|
@@ -831,6 +1006,28 @@ interface ScoringOptions {
|
|
|
831
1006
|
*/
|
|
832
1007
|
rounding?: RoundingPolicy;
|
|
833
1008
|
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Options for {@link evaluate} and {@link evaluateTries}: {@link ScoringOptions},
|
|
1011
|
+
* and the paper's scoring policy.
|
|
1012
|
+
*/
|
|
1013
|
+
interface EvaluateOptions extends ScoringOptions {
|
|
1014
|
+
/**
|
|
1015
|
+
* What hints and tries cost, and which try counts — see
|
|
1016
|
+
* {@link ItemScoringPolicy}. Absent or `null`, nothing costs anything and the
|
|
1017
|
+
* outcome is exactly what it was before policies existed.
|
|
1018
|
+
*
|
|
1019
|
+
* `evaluate` reads the hints from the response's `hintsRevealed`. The count
|
|
1020
|
+
* is the client's: when your server knows better — it served the AI hints,
|
|
1021
|
+
* say — write its own count there before you evaluate.
|
|
1022
|
+
*
|
|
1023
|
+
* Checked at the call: a policy `validateItemScoringPolicy` refuses throws a
|
|
1024
|
+
* `RangeError`. A grade-moving setting has no safe way to be misread. Under a
|
|
1025
|
+
* policy, a scored outcome whose numbers cannot be a grade — a registered
|
|
1026
|
+
* scorer out of contract — has nothing to charge a cost to, and comes back
|
|
1027
|
+
* `unscorable`.
|
|
1028
|
+
*/
|
|
1029
|
+
scoring?: ItemScoringPolicy | null;
|
|
1030
|
+
}
|
|
834
1031
|
/**
|
|
835
1032
|
* Scores a learner response against activity data and returns a full
|
|
836
1033
|
* {@link ScoringResult}.
|
|
@@ -858,10 +1055,49 @@ declare function score(activityType: ActivityType, activityData: ActivityData, l
|
|
|
858
1055
|
* "wrong".
|
|
859
1056
|
* - An unregistered `data.type` returns `{ status: 'unscorable' }` rather
|
|
860
1057
|
* than throwing, so a mixed-version content bank cannot crash an exam run.
|
|
1058
|
+
* - With a scoring policy (`options.scoring`), a scored outcome is charged what
|
|
1059
|
+
* the response's hints cost, and `passed` is read from what is left. The
|
|
1060
|
+
* `details` and authored `feedback` stay the answer's. For several tries at
|
|
1061
|
+
* one question, use {@link evaluateTries}.
|
|
861
1062
|
*
|
|
862
1063
|
* The activity type is read from `data.type` — there is no separate type
|
|
863
1064
|
* parameter to disagree with the payload.
|
|
864
1065
|
*/
|
|
865
|
-
declare function evaluate(data: ActivityData, response: LearnerResponse, options?:
|
|
1066
|
+
declare function evaluate(data: ActivityData, response: LearnerResponse, options?: EvaluateOptions): ItemOutcome;
|
|
1067
|
+
/** A question's outcome over its tries: see {@link evaluateTries}. */
|
|
1068
|
+
interface ItemTriesOutcome {
|
|
1069
|
+
/**
|
|
1070
|
+
* The question's outcome under the policy. Scored: the counted try's
|
|
1071
|
+
* `details` and authored `feedback` — they describe that answer — with its
|
|
1072
|
+
* `score` after what it cost and `passed` read from that score. Anything
|
|
1073
|
+
* else — deferred, unscorable — is the first try's outcome as `evaluate`
|
|
1074
|
+
* gives it.
|
|
1075
|
+
*/
|
|
1076
|
+
outcome: ItemOutcome;
|
|
1077
|
+
/** 0-based: the try whose score counts. `null` when the outcome is not scored. */
|
|
1078
|
+
counted: number | null;
|
|
1079
|
+
/**
|
|
1080
|
+
* Every try the policy allows, as scored: before and after what it cost.
|
|
1081
|
+
* Empty when the outcome is not scored, or when, with no policy, it is an
|
|
1082
|
+
* outcome `evaluate` passes through that cannot be a grade.
|
|
1083
|
+
*/
|
|
1084
|
+
tries: ItemTryScore[];
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* A question's outcome from every try a learner made at it, in order, under a
|
|
1088
|
+
* paper's scoring policy: what a server that scores practice itself calls,
|
|
1089
|
+
* with the tries it stored, to reach the grade the SDK's components reached.
|
|
1090
|
+
*
|
|
1091
|
+
* Each response is scored as {@link evaluate} scores it, and costed and chosen
|
|
1092
|
+
* as {@link scoreTries} does: hints from each response's `hintsRevealed`,
|
|
1093
|
+
* which counts from the start of the question; the tries before each one;
|
|
1094
|
+
* and the try `counts` names. Only the first `1 + retries` responses are read.
|
|
1095
|
+
*
|
|
1096
|
+
* With no policy it is `evaluate` of the first response: one try, as before.
|
|
1097
|
+
* With no response at all, the question was never answered —
|
|
1098
|
+
* `{ status: 'deferred', reason: 'no_response_recorded' }`, as a missing slot
|
|
1099
|
+
* is everywhere else.
|
|
1100
|
+
*/
|
|
1101
|
+
declare function evaluateTries(data: ActivityData, responses: readonly LearnerResponse[], options?: EvaluateOptions): ItemTriesOutcome;
|
|
866
1102
|
|
|
867
|
-
export { type AssessmentScore, type AssessmentSectionInput, type Band, type CompositionPolicy, DEFAULT_PASS_THRESHOLD, DICTATION_MAX_ACCEPTED_TRANSCRIPTS, DICTATION_MAX_EQUIVALENCES, DICTATION_MAX_EQUIVALENCE_LENGTH, DICTATION_MAX_TEXT_LENGTH, DICTATION_MAX_TRANSCRIPT_LENGTH, type DictationAlignment, type DictationCharOp, type DictationReference, type DictationWordAlignment, type GradeReadAloudOptions, GradeRecord, ItemOutcome, type PassFailureReason, READ_ALOUD_MAX_DIMENSION_WEIGHT, READ_ALOUD_MAX_REFERENCE_LENGTH, READ_ALOUD_MAX_SECONDS, READ_ALOUD_MAX_TAKES, ReadAloudData, ReadAloudLearnerResponse, type ReadAloudWordAlignment, type ReadAloudWordState, type RoundingMode, type RoundingPolicy, SPEECH_ASSESSMENT_MAX_WORDS, type ScoredItem, type ScoringOptions, type SectionScore, type SpeechAssessment, type SpeechMeasurement, type SpeechPhoneme, type SpeechPhonemeCandidate, type SpeechPlausibilityPolicy, type SpeechSyllable, type SpeechUnscorable, type SpeechUnscorableCode, type SpeechWord, type SpeechWordError, type WavInspection, type WavInspectionPolicy, alignDictation, alignReadAloud, classifyBand, composeAssessmentScore, computePassThreshold, dictationReferenceWords, diffDictationChars, evaluate, gradeReadAloud, gte, inspectWav, outcomeFromUnscorable, roundGrade, score, validateSpeechAssessment };
|
|
1103
|
+
export { type AssessmentScore, type AssessmentSectionInput, type Band, type CompositionPolicy, DEFAULT_ITEM_SCORING_POLICY, DEFAULT_PASS_THRESHOLD, DICTATION_MAX_ACCEPTED_TRANSCRIPTS, DICTATION_MAX_EQUIVALENCES, DICTATION_MAX_EQUIVALENCE_LENGTH, DICTATION_MAX_TEXT_LENGTH, DICTATION_MAX_TRANSCRIPT_LENGTH, type DictationAlignment, type DictationCharOp, type DictationReference, type DictationWordAlignment, type EvaluateOptions, type GradeReadAloudOptions, GradeRecord, ITEM_SCORING_MAX_RETRIES, ItemOutcome, type ItemScoringCount, type ItemScoringPolicy, type ItemScoringPolicyIssue, type ItemTriesOutcome, type ItemTriesScore, type ItemTry, type ItemTryScore, type PassFailureReason, READ_ALOUD_MAX_DIMENSION_WEIGHT, READ_ALOUD_MAX_REFERENCE_LENGTH, READ_ALOUD_MAX_SECONDS, READ_ALOUD_MAX_TAKES, ReadAloudData, ReadAloudLearnerResponse, type ReadAloudWordAlignment, type ReadAloudWordState, type ResolvedItemScoringPolicy, type RoundingMode, type RoundingPolicy, SPEECH_ASSESSMENT_MAX_WORDS, type ScoredItem, type ScoringOptions, type SectionScore, type SpeechAssessment, type SpeechMeasurement, type SpeechPhoneme, type SpeechPhonemeCandidate, type SpeechPlausibilityPolicy, type SpeechSyllable, type SpeechUnscorable, type SpeechUnscorableCode, type SpeechWord, type SpeechWordError, type WavInspection, type WavInspectionPolicy, alignDictation, alignReadAloud, classifyBand, composeAssessmentScore, computePassThreshold, dictationReferenceWords, diffDictationChars, evaluate, evaluateTries, gradeReadAloud, gte, inspectWav, outcomeFromUnscorable, resolveItemScoringPolicy, roundGrade, score, scoreTries, validateItemScoringPolicy, validateSpeechAssessment };
|