Skip to content

Commit 052cbdf

Browse files
author
mhtess
committed
fully randomize stimuli
1 parent 17e09f8 commit 052cbdf

File tree

1 file changed

+40
-11
lines changed

1 file changed

+40
-11
lines changed

experiments/3_L1_expandstims/js/L1_3_expandstims.js

+40-11
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ function init() {
218218
"positive", "neg_positive", "antonym", "neg_antonym", "neither_pos_nor_ant"
219219
];
220220
exp.n_stims = 6;
221+
exp.n_trials = 30;
221222
exp.stimsForParticipant = _.shuffle(stimuli).slice(0, exp.n_stims);
222223

223224
// exp.condition = _.sample(["all_four_sliders", "one_by_one"]);
@@ -226,36 +227,64 @@ function init() {
226227
// exp.structure = [];
227228

228229
var shuffledNames = _.shuffle(characters);
230+
var expanded_stimuli = [];
229231

230-
// create negation if necessary, add names
231-
for (j=0; j<exp.stimsForParticipant.length; j++){
232+
for (j=0; j<stimuli.length; j++){
232233
var trial = [];
233234
for (i=0; i<exp.sentence_types.length; i++){
234235
var st = exp.sentence_types[i];
235236
var adj = st.slice(0,3) == "neg" ?
236-
"not " + exp.stimsForParticipant[j][st.slice(4)] :
237+
"not " + stimuli[j][st.slice(4)] :
237238
st.slice(0,3) == "nei" ?
238-
"neither " + exp.stimsForParticipant[j].positive + " nor " + exp.stimsForParticipant[j].antonym :
239-
exp.stimsForParticipant[j][st];
240-
241-
var character = exp.stimsForParticipant[j].referent == "person" ?
242-
shuffledNames.pop() : "NA"
239+
"neither " + stimuli[j].positive + " nor " + stimuli[j].antonym :
240+
stimuli[j][st];
243241

244242
var stimulus = _.extend(
245243
{
246244
sentence_type: st,
247245
adjective: adj
248-
}, exp.stimsForParticipant[j], character)
246+
}, stimuli[j])
247+
249248
trial.push(stimulus)
250249
};
251-
exp.stimuli.push(trial)
250+
expanded_stimuli.push(trial)
252251
}
253252

253+
exp.stimuli = _.map(_.zip(
254+
_.shuffle(_.flatten(expanded_stimuli)).slice(0, exp.n_trials), shuffledNames
255+
), function(item) {
256+
return _.defaults(item[0], item[1]);
257+
});
258+
259+
// create negation if necessary, add names
260+
// for (j=0; j<exp.stimsForParticipant.length; j++){
261+
// var trial = [];
262+
// for (i=0; i<exp.sentence_types.length; i++){
263+
// var st = exp.sentence_types[i];
264+
// var adj = st.slice(0,3) == "neg" ?
265+
// "not " + exp.stimsForParticipant[j][st.slice(4)] :
266+
// st.slice(0,3) == "nei" ?
267+
// "neither " + exp.stimsForParticipant[j].positive + " nor " + exp.stimsForParticipant[j].antonym :
268+
// exp.stimsForParticipant[j][st];
269+
//
270+
// var character = exp.stimsForParticipant[j].referent == "person" ?
271+
// shuffledNames.pop() : "NA"
272+
//
273+
// var stimulus = _.extend(
274+
// {
275+
// sentence_type: st,
276+
// adjective: adj
277+
// }, exp.stimsForParticipant[j], character)
278+
// trial.push(stimulus)
279+
// };
280+
// exp.stimuli.push(trial)
281+
// }
282+
254283
if (exp.condition == "all_four_sliders") {
255284
exp.structure.push("multi_slider")
256285
} else {
257286
exp.structure.push("one_slider")
258-
exp.stimuli = _.flatten(exp.stimuli);
287+
// exp.stimuli = _.flatten(exp.stimuli);
259288
}
260289

261290
exp.structure.push("subj_info", "thanks");

0 commit comments

Comments
 (0)