@shaxpir/duiduidui-models 1.17.2 → 1.17.3
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.
|
@@ -81,6 +81,34 @@ export declare class CognitiveLoadModel {
|
|
|
81
81
|
* @returns Capacity value (higher = can manage more cards)
|
|
82
82
|
*/
|
|
83
83
|
static calculateCapacity(skillLevel: number): number;
|
|
84
|
+
/**
|
|
85
|
+
* Calculate the skill-independent "raw" contribution of a single card.
|
|
86
|
+
*
|
|
87
|
+
* This is the numerator of the per-card load formula, factoring out the
|
|
88
|
+
* skill-dependent divisor so that a running sum can be maintained incrementally.
|
|
89
|
+
*
|
|
90
|
+
* Formula: raw = attention(α,β) × mastery(θ) × √difficulty
|
|
91
|
+
*
|
|
92
|
+
* The full card load is: raw / effectiveSkill^1.1
|
|
93
|
+
* (where 1.1 = 0.5 from relativeWeight's sqrt + 0.6 from capacity)
|
|
94
|
+
*
|
|
95
|
+
* @returns Non-negative raw contribution
|
|
96
|
+
*/
|
|
97
|
+
static calculateRawContribution(card: CognitiveLoadCard): number;
|
|
98
|
+
/**
|
|
99
|
+
* Convert a raw load sum to a total cognitive load using the current skill level.
|
|
100
|
+
*
|
|
101
|
+
* Formula: totalLoad = rawLoadSum / effectiveSkill^1.1
|
|
102
|
+
*
|
|
103
|
+
* @returns Total load (0.0 = no cards, 0.8 = near capacity, >1.0 = overloaded)
|
|
104
|
+
*/
|
|
105
|
+
static totalLoadFromRawSum(rawLoadSum: number, skillLevel: number): number;
|
|
106
|
+
/**
|
|
107
|
+
* Calculate the raw load sum for a full set of cards (used for initial seeding).
|
|
108
|
+
*
|
|
109
|
+
* @returns The sum of raw contributions across all cards
|
|
110
|
+
*/
|
|
111
|
+
static calculateRawLoadSum(cards: CognitiveLoadCard[]): number;
|
|
84
112
|
/**
|
|
85
113
|
* Calculate the cognitive load contribution of a single card.
|
|
86
114
|
*
|
|
@@ -87,6 +87,47 @@ class CognitiveLoadModel {
|
|
|
87
87
|
const effectiveSkill = Math.max(skillLevel, exports.MIN_SKILL);
|
|
88
88
|
return Math.pow(effectiveSkill, exports.CAPACITY_EXPONENT);
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Calculate the skill-independent "raw" contribution of a single card.
|
|
92
|
+
*
|
|
93
|
+
* This is the numerator of the per-card load formula, factoring out the
|
|
94
|
+
* skill-dependent divisor so that a running sum can be maintained incrementally.
|
|
95
|
+
*
|
|
96
|
+
* Formula: raw = attention(α,β) × mastery(θ) × √difficulty
|
|
97
|
+
*
|
|
98
|
+
* The full card load is: raw / effectiveSkill^1.1
|
|
99
|
+
* (where 1.1 = 0.5 from relativeWeight's sqrt + 0.6 from capacity)
|
|
100
|
+
*
|
|
101
|
+
* @returns Non-negative raw contribution
|
|
102
|
+
*/
|
|
103
|
+
static calculateRawContribution(card) {
|
|
104
|
+
const attention = CognitiveLoadModel.calculateAttention(card.alpha, card.beta);
|
|
105
|
+
const masteryFactor = CognitiveLoadModel.calculateMasteryFactor(card.theta);
|
|
106
|
+
return attention * masteryFactor * Math.sqrt(card.difficulty);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Convert a raw load sum to a total cognitive load using the current skill level.
|
|
110
|
+
*
|
|
111
|
+
* Formula: totalLoad = rawLoadSum / effectiveSkill^1.1
|
|
112
|
+
*
|
|
113
|
+
* @returns Total load (0.0 = no cards, 0.8 = near capacity, >1.0 = overloaded)
|
|
114
|
+
*/
|
|
115
|
+
static totalLoadFromRawSum(rawLoadSum, skillLevel) {
|
|
116
|
+
const effectiveSkill = Math.max(skillLevel, exports.MIN_SKILL);
|
|
117
|
+
return rawLoadSum / Math.pow(effectiveSkill, exports.CAPACITY_EXPONENT + 0.5);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Calculate the raw load sum for a full set of cards (used for initial seeding).
|
|
121
|
+
*
|
|
122
|
+
* @returns The sum of raw contributions across all cards
|
|
123
|
+
*/
|
|
124
|
+
static calculateRawLoadSum(cards) {
|
|
125
|
+
let total = 0;
|
|
126
|
+
for (const card of cards) {
|
|
127
|
+
total += CognitiveLoadModel.calculateRawContribution(card);
|
|
128
|
+
}
|
|
129
|
+
return total;
|
|
130
|
+
}
|
|
90
131
|
/**
|
|
91
132
|
* Calculate the cognitive load contribution of a single card.
|
|
92
133
|
*
|
|
@@ -24,6 +24,7 @@ export interface StreakData {
|
|
|
24
24
|
export interface ProgressPayload {
|
|
25
25
|
skill_level: SkillLevel;
|
|
26
26
|
cognitive_load: number;
|
|
27
|
+
raw_load_sum?: number;
|
|
27
28
|
streaks?: StreakData;
|
|
28
29
|
total_review_count: number;
|
|
29
30
|
}
|
|
@@ -47,6 +48,8 @@ export declare class Progress extends Content {
|
|
|
47
48
|
setSkillLevelMu(mu: number): void;
|
|
48
49
|
setSkillLevelSigma(sigma: number): void;
|
|
49
50
|
setCognitiveLoad(value: number): void;
|
|
51
|
+
getRawLoadSum(): number | undefined;
|
|
52
|
+
setRawLoadSum(value: number): void;
|
|
50
53
|
getStreaks(): StreakData | undefined;
|
|
51
54
|
setStreaks(streaks: StreakData): void;
|
|
52
55
|
getTotalReviewCount(): number;
|
package/dist/models/Progress.js
CHANGED
|
@@ -102,6 +102,18 @@ class Progress extends Content_1.Content {
|
|
|
102
102
|
batch.commit();
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
+
getRawLoadSum() {
|
|
106
|
+
this.checkDisposed("Progress.getRawLoadSum");
|
|
107
|
+
return this.payload.raw_load_sum;
|
|
108
|
+
}
|
|
109
|
+
setRawLoadSum(value) {
|
|
110
|
+
this.checkDisposed("Progress.setRawLoadSum");
|
|
111
|
+
if (this.payload.raw_load_sum !== value) {
|
|
112
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
113
|
+
batch.setPathValue(['payload', 'raw_load_sum'], value);
|
|
114
|
+
batch.commit();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
105
117
|
getStreaks() {
|
|
106
118
|
this.checkDisposed("Progress.getStreaks");
|
|
107
119
|
return this.payload.streaks ? shaxpir_common_1.Struct.clone(this.payload.streaks) : undefined;
|