Skip to content

Commit 79d46f7

Browse files
author
Brian Genisio
committed
First pass at the Matching activity
1 parent 10ddc14 commit 79d46f7

File tree

9 files changed

+877
-122
lines changed

9 files changed

+877
-122
lines changed

data/answer.md

Lines changed: 28 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,63 @@
11
__Type__
22

3-
Multiple Choice
3+
Matching
44

55
__Summary__
66

7-
0/4 correct
7+
0/5 correct
88

99
__Responses__
1010

11-
1. **Question 1**
11+
1. **Item 1**
1212
- Selected Answer: No answer selected
13-
- Correct Answer: B, C
13+
- Correct Answer: Discomfort
1414
- Result: ✗ Incorrect
1515

16-
2. **Question 2**
17-
- Selected Answer: B
18-
- Correct Answer: A
16+
2. **Item 2**
17+
- Selected Answer: No answer selected
18+
- Correct Answer: Engagement
1919
- Result: ✗ Incorrect
2020

21-
3. **Question 3**
22-
- Selected Answer: D
23-
- Correct Answer: B
21+
3. **Item 3**
22+
- Selected Answer: No answer selected
23+
- Correct Answer: Tension
2424
- Result: ✗ Incorrect
2525

26-
4. **Question 4**
26+
4. **Item 4**
2727
- Selected Answer: No answer selected
28-
- Correct Answer: B, C
28+
- Correct Answer: Frustration
2929
- Result: ✗ Incorrect
3030

31-
__Practice Question__
32-
33-
Why is it important to include both Wikipedia and web text in a language model's training data?
34-
35-
D. It prevents the model from learning code snippets.
36-
A. It ensures the model only learns formal writing styles.
37-
B. It limits the model to factual information only.
38-
C. It exposes the model to both structured and informal language.
39-
40-
__Suggested Answers__
31+
5. **Item 5**
32+
- Selected Answer: No answer selected
33+
- Correct Answer: Relief
34+
- Result: ✗ Incorrect
4135

42-
- D
43-
- A
44-
- B - Correct
45-
- C - Correct
36+
__Markdown With Blanks__
4637

47-
__Practice Question__
38+
Match each subtle cue a leader might notice with what it could signal about the team's emotions.
4839

49-
Which of the following are common preprocessing steps for text data before training a language model? Select all that apply.
5040

51-
A. Cleaning (removing HTML tags and ads)
52-
B. Adding random spelling errors
53-
C. Splitting text at random points
54-
E. Normalization (standardizing text format)
55-
D. Deduplication (removing repeated content)
5641

57-
__Suggested Answers__
42+
> **Subtle Cue 1**: Team members are avoiding eye contact and have closed body language. [[blank:Discomfort]]
5843
59-
- A - Correct
60-
- B
61-
- C
62-
- E
63-
- D
6444

65-
__Practice Question__
45+
> **Subtle Cue 2**: Several people are nodding, smiling, and leaning forward during a discussion. [[blank:Engagement]]
6646
67-
What is the main reason for removing duplicate content from a training dataset?
6847

69-
D. To ensure all documents are the same length
70-
C. To increase the number of unique special characters
71-
A. To make the dataset smaller for faster downloads
72-
B. To prevent the model from overfitting to repeated phrases
73-
74-
__Suggested Answers__
48+
> **Subtle Cue 3**: Voices are raised and people are talking over each other. [[blank:Tension]]
7549
76-
- D
77-
- C
78-
- A
79-
- B - Correct
8050

81-
__Practice Question__
51+
> **Subtle Cue 4**: Someone sighs and looks away when a topic comes up. [[blank:Frustration]]
8252
83-
Which of the following is an example of normalization in text preprocessing?
8453

85-
D. Adding HTML tags to mark sections
86-
B. Converting all text to lowercase
87-
A. Removing all numbers from the text
88-
C. Splitting a book into chapters
54+
> **Subtle Cue 5**: Laughter and relaxed posture spread through the group after a team win. [[blank:Relief]]
8955
9056
__Suggested Answers__
9157

92-
- D
93-
- B - Correct
94-
- A
95-
- C - Correct
58+
- Relief
59+
- Frustration
60+
- Engagement
61+
- Tension
62+
- Discomfort
9663

data/examples/matching.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
__Type__
2+
3+
Matching
4+
5+
__Markdown With Blanks__
6+
7+
Match each subtle cue a leader might notice with what it could signal about the team's emotions.
8+
9+
> **Subtle Cue 1**: Team members are avoiding eye contact and have closed body language. [[blank:Discomfort]]
10+
11+
> **Subtle Cue 2**: Several people are nodding, smiling, and leaning forward during a discussion. [[blank:Engagement]]
12+
13+
> **Subtle Cue 3**: Voices are raised and people are talking over each other. [[blank:Tension]]
14+
15+
> **Subtle Cue 4**: Someone sighs and looks away when a topic comes up. [[blank:Frustration]]
16+
17+
> **Subtle Cue 5**: Laughter and relaxed posture spread through the group after a team win. [[blank:Relief]]
18+
19+
__Suggested Answers__
20+
21+
- Discomfort
22+
- Engagement
23+
- Tension
24+
- Frustration
25+
- Relief

data/question.md

Lines changed: 13 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,25 @@
11
__Type__
22

3-
Multiple Choice
3+
Matching
44

5-
__Practice Question__
5+
__Markdown With Blanks__
66

7-
Why is it important to include both Wikipedia and web text in a language model's training data?
7+
Match each subtle cue a leader might notice with what it could signal about the team's emotions.
88

9-
A. It ensures the model only learns formal writing styles.
10-
B. It limits the model to factual information only.
11-
C. It exposes the model to both structured and informal language.
12-
D. It prevents the model from learning code snippets.
9+
> **Subtle Cue 1**: Team members are avoiding eye contact and have closed body language. [[blank:Discomfort]]
1310
14-
__Suggested Answers__
15-
16-
- A
17-
- B - Correct
18-
- C - Correct
19-
- D
20-
21-
__Practice Question__
22-
23-
Which of the following are common preprocessing steps for text data before training a language model? Select all that apply.
24-
25-
A. Cleaning (removing HTML tags and ads)
26-
B. Adding random spelling errors
27-
C. Splitting text at random points
28-
D. Deduplication (removing repeated content)
29-
E. Normalization (standardizing text format)
30-
31-
__Suggested Answers__
32-
33-
- A - Correct
34-
- B
35-
- C
36-
- D
37-
- E
38-
39-
__Practice Question__
40-
41-
What is the main reason for removing duplicate content from a training dataset?
42-
43-
A. To make the dataset smaller for faster downloads
44-
B. To prevent the model from overfitting to repeated phrases
45-
C. To increase the number of unique special characters
46-
D. To ensure all documents are the same length
47-
48-
__Suggested Answers__
49-
50-
- A
51-
- B - Correct
52-
- C
53-
- D
11+
> **Subtle Cue 2**: Several people are nodding, smiling, and leaning forward during a discussion. [[blank:Engagement]]
5412
55-
__Practice Question__
13+
> **Subtle Cue 3**: Voices are raised and people are talking over each other. [[blank:Tension]]
5614
57-
Which of the following is an example of normalization in text preprocessing?
15+
> **Subtle Cue 4**: Someone sighs and looks away when a topic comes up. [[blank:Frustration]]
5816
59-
A. Removing all numbers from the text
60-
B. Converting all text to lowercase
61-
C. Splitting a book into chapters
62-
D. Adding HTML tags to mark sections
17+
> **Subtle Cue 5**: Laughter and relaxed posture spread through the group after a team win. [[blank:Relief]]
6318
6419
__Suggested Answers__
6520

66-
- A
67-
- B - Correct
68-
- C - Correct
69-
- D
21+
- Discomfort
22+
- Engagement
23+
- Tension
24+
- Frustration
25+
- Relief

public/app.js

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { initSwipe } from './modules/swipe.js';
22
import { initSort } from './modules/sort.js';
33
import { initFib } from './modules/fib.js';
44
import { initMcq } from './modules/mcq.js';
5+
import { initMatching } from './modules/matching.js';
56

67
(() => {
78
'use strict';
@@ -84,15 +85,16 @@ import { initMcq } from './modules/mcq.js';
8485
const currentType = activity.type || '';
8586
const persistedType = persistedData.type || '';
8687

87-
if (!/^multiple choice$/i.test(currentType) && !/^fill in the blanks$/i.test(currentType)) {
88-
// Only validate MCQ and FIB for now
88+
if (!/^multiple choice$/i.test(currentType) && !/^fill in the blanks$/i.test(currentType) && !/^matching$/i.test(currentType)) {
89+
// Only validate MCQ, FIB, and Matching for now
8990
return null;
9091
}
9192

9293
// Type must match exactly
9394
const typeMatches =
9495
(/^multiple choice$/i.test(currentType) && /^multiple choice$/i.test(persistedType)) ||
95-
(/^fill in the blanks$/i.test(currentType) && /^fill in the blanks$/i.test(persistedType));
96+
(/^fill in the blanks$/i.test(currentType) && /^fill in the blanks$/i.test(persistedType)) ||
97+
(/^matching$/i.test(currentType) && /^matching$/i.test(persistedType));
9698

9799
if (!typeMatches) {
98100
return null;
@@ -143,6 +145,28 @@ import { initMcq } from './modules/mcq.js';
143145
}
144146
});
145147
return validatedAnswers;
148+
} else if (/^matching$/i.test(currentType)) {
149+
// For Matching: validate that item indices exist
150+
if (!activity.matching || !activity.matching.items) {
151+
return null;
152+
}
153+
const validItemIndices = new Set(activity.matching.items.map((item, idx) => idx));
154+
const persistedItemIndices = Object.keys(persistedData.answers).map(idx => parseInt(idx, 10));
155+
156+
// All persisted item indices must exist in current items
157+
const allIndicesValid = persistedItemIndices.every(idx => validItemIndices.has(idx));
158+
if (!allIndicesValid) {
159+
return null;
160+
}
161+
162+
// Return only answers for valid item indices
163+
const validatedAnswers = {};
164+
persistedItemIndices.forEach(idx => {
165+
if (validItemIndices.has(idx)) {
166+
validatedAnswers[idx] = persistedData.answers[idx];
167+
}
168+
});
169+
return validatedAnswers;
146170
}
147171

148172
return null;
@@ -170,6 +194,13 @@ import { initMcq } from './modules/mcq.js';
170194
if (currentActivity && typeof currentActivity.validate === 'function') {
171195
validationHandler = currentActivity.validate;
172196
}
197+
} else if (/^matching$/i.test(activity.type)) {
198+
currentActivity = initMatching({
199+
activity,
200+
state,
201+
postResults,
202+
persistedAnswers
203+
});
173204
} else {
174205
currentActivity = initSwipe({
175206
items: state.items,

public/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
<link rel="stylesheet" href="/design-system/spacing/spacing.css" />
1010
<link rel="stylesheet" href="/design-system/components/input/input.css" />
1111
<link rel="stylesheet" href="/design-system/components/button/button.css" />
12+
<link rel="stylesheet" href="/design-system/components/tags/tags.css" />
1213
<link rel="stylesheet" href="/styles.css" />
1314
<link rel="stylesheet" href="/modules/fib.css" />
1415
<link rel="stylesheet" href="/modules/mcq.css" />
16+
<link rel="stylesheet" href="/modules/matching.css" />
17+
<link rel="stylesheet" href="/design-system/components/horizontal-cards/horizontal-cards.css" />
1518
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='0.9em' font-size='90'%3E%E2%98%85%3C/text%3E%3C/svg%3E" />
1619
<link rel="preconnect" href="https://fonts.googleapis.com">
1720
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>

0 commit comments

Comments
 (0)