eat-js-sdk 0.0.26 → 0.0.27
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/dist/eat-prompt-builder.mjs +15 -3
- package/package.json +1 -1
|
@@ -1004,6 +1004,10 @@
|
|
|
1004
1004
|
return await response.json();
|
|
1005
1005
|
};
|
|
1006
1006
|
|
|
1007
|
+
// src/lib/composables/useTypein.ts
|
|
1008
|
+
var useRemoveDiacritics = (data) => data.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, " ");
|
|
1009
|
+
var useRemovePunctuation = (data) => data.replace(/[^\p{L}\p{M}\s\d]/gu, "").replace(/\s+/g, " ");
|
|
1010
|
+
|
|
1007
1011
|
// src/lib/components/prompt/template/PromptBody.svelte
|
|
1008
1012
|
function create_if_block_1(ctx) {
|
|
1009
1013
|
let html_tag;
|
|
@@ -3764,7 +3768,7 @@
|
|
|
3764
3768
|
}
|
|
3765
3769
|
};
|
|
3766
3770
|
const updatePreviewData = (data) => {
|
|
3767
|
-
const { scoringMetadata: metadata } = sessionData;
|
|
3771
|
+
const { scoringMetadata: metadata, interaction } = sessionData;
|
|
3768
3772
|
let scoringMetadata;
|
|
3769
3773
|
$$invalidate(4, isFinished = true);
|
|
3770
3774
|
switch (interactionType) {
|
|
@@ -3776,10 +3780,18 @@
|
|
|
3776
3780
|
return;
|
|
3777
3781
|
case INTERACTION_TYPE_TYPEIN:
|
|
3778
3782
|
default:
|
|
3783
|
+
const { allow_non_macrons_as_correct_answer: allowNonMacrons, ignore_punctuation: ignorePunctuation } = interaction;
|
|
3779
3784
|
const { answer } = data;
|
|
3780
|
-
|
|
3785
|
+
let typeinAnswer = answer[0];
|
|
3786
|
+
scoringMetadata = { ...metadata, answer: typeinAnswer };
|
|
3781
3787
|
$$invalidate(0, sessionData = { ...sessionData, scoringMetadata });
|
|
3782
|
-
|
|
3788
|
+
if (allowNonMacrons) {
|
|
3789
|
+
typeinAnswer = useRemoveDiacritics(typeinAnswer);
|
|
3790
|
+
}
|
|
3791
|
+
if (ignorePunctuation) {
|
|
3792
|
+
typeinAnswer = useRemovePunctuation(typeinAnswer);
|
|
3793
|
+
}
|
|
3794
|
+
$$invalidate(5, isResultCorrect = previewTypeinCorrectAnswers.includes(typeinAnswer.toLowerCase().trim().replace(/\s+/g, " ")));
|
|
3783
3795
|
return;
|
|
3784
3796
|
}
|
|
3785
3797
|
};
|