@@ -218,6 +218,7 @@ function init() {
218
218
"positive" , "neg_positive" , "antonym" , "neg_antonym" , "neither_pos_nor_ant"
219
219
] ;
220
220
exp . n_stims = 6 ;
221
+ exp . n_trials = 30 ;
221
222
exp . stimsForParticipant = _ . shuffle ( stimuli ) . slice ( 0 , exp . n_stims ) ;
222
223
223
224
// exp.condition = _.sample(["all_four_sliders", "one_by_one"]);
@@ -226,36 +227,64 @@ function init() {
226
227
// exp.structure = [];
227
228
228
229
var shuffledNames = _ . shuffle ( characters ) ;
230
+ var expanded_stimuli = [ ] ;
229
231
230
- // create negation if necessary, add names
231
- for ( j = 0 ; j < exp . stimsForParticipant . length ; j ++ ) {
232
+ for ( j = 0 ; j < stimuli . length ; j ++ ) {
232
233
var trial = [ ] ;
233
234
for ( i = 0 ; i < exp . sentence_types . length ; i ++ ) {
234
235
var st = exp . sentence_types [ i ] ;
235
236
var adj = st . slice ( 0 , 3 ) == "neg" ?
236
- "not " + exp . stimsForParticipant [ j ] [ st . slice ( 4 ) ] :
237
+ "not " + stimuli [ j ] [ st . slice ( 4 ) ] :
237
238
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 ] ;
243
241
244
242
var stimulus = _ . extend (
245
243
{
246
244
sentence_type : st ,
247
245
adjective : adj
248
- } , exp . stimsForParticipant [ j ] , character )
246
+ } , stimuli [ j ] )
247
+
249
248
trial . push ( stimulus )
250
249
} ;
251
- exp . stimuli . push ( trial )
250
+ expanded_stimuli . push ( trial )
252
251
}
253
252
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
+
254
283
if ( exp . condition == "all_four_sliders" ) {
255
284
exp . structure . push ( "multi_slider" )
256
285
} else {
257
286
exp . structure . push ( "one_slider" )
258
- exp . stimuli = _ . flatten ( exp . stimuli ) ;
287
+ // exp.stimuli = _.flatten(exp.stimuli);
259
288
}
260
289
261
290
exp . structure . push ( "subj_info" , "thanks" ) ;
0 commit comments