<commit_before>/* jspsych plugin for categorization trials with feedback
 * <NAME>
 * 
 * display an image and then give corrective feedback based on the subject's response
 *
 * updated March 2013
 */ 
 
 (function($) {
    jsPsych.categorize_feedback = (function() {

        var plugin = {};

        plugin.create = function(params) {
            var trials = [];
            for (var i = 0; i < params.stimuli.length; i++) {
                trials.push({});
                trials[i].type = "categorize_feedback";
                trials[i].a_path = params.stimuli[i];
                trials[i].key_answer = params.key_answer[i];
                trials[i].text_answer = params.text_answer[i];
                trials[i].choices = params.choices;
                trials[i].correct_text = params.correct_text;
                trials[i].incorrect_text = params.incorrect_text;
                // timing params
                trials[i].timing_image = params.timing_image || -1; // default is to show image until response
                trials[i].timing_feedback_duration = params.timing_feedback_duration || 2000;
                trials[i].timing_post_trial = params.timing_post_trial || 1000;
                // optional params
                trials[i].show_stim_with_feedback =  (typeof params.show_stim_with_feedback === undefined) ? true : params.show_stim_with_feedback;
                trials[i].is_html = (typeof params.is_html === undefined) ? false : params.is_html;
                trials[i].force_correct_button_press = (typeof params.force_correct_button_press === undefined) ? false : params.force_correct_button_press;
                trials[i].prompt = (typeof params.prompt === undefined) ? undefined : params.prompt;
                trials[i].data = (typeof params.data === undefined) ? undefined : params.data[i];
            }
            return trials;
        }

        var cf_trial_complete = false;

        plugin.trial = function(display_element, block, trial, part) {
            switch (part) {
            case 1:
                // set finish flag
                cf_trial_complete = false;

                if(!trial.is_html){
                    // add image to display
                    display_element.append($('<img>', {
                        "src": trial.a_path,
                        "class": 'cf',
                        "id": 'jspsych_cf_image'
                    }));
                } else {
                    display_element.append($('<div>', {<commit_msg>bug fix categorize-feedback<commit_after>/* jspsych plugin for categorization trials with feedback
 * <NAME>
 * 
 * display an image and then give corrective feedback based on the subject's response
 *
 * updated March 2013
 */ 
 
 (function($) {
    jsPsych.categorize_feedback = (function() {

        var plugin = {};

        plugin.create = function(params) {
            var trials = [];
            for (var i = 0; i < params.stimuli.length; i++) {
                trials.push({});
                trials[i].type = "categorize_feedback";
                trials[i].a_path = params.stimuli[i];
                trials[i].key_answer = params.key_answer[i];
                trials[i].text_answer = params.text_answer[i];
                trials[i].choices = params.choices;
                trials[i].correct_text = params.correct_text;
                trials[i].incorrect_text = params.incorrect_text;
                // timing params
                trials[i].timing_image = params.timing_image || -1; // default is to show image until response
                trials[i].timing_feedback_duration = params.timing_feedback_duration || 2000;
                trials[i].timing_post_trial = params.timing_post_trial || 1000;
                // optional params
                trials[i].show_stim_with_feedback =  (typeof params.show_stim_with_feedback === 'undefined') ? true : params.show_stim_with_feedback;
                trials[i].is_html = (typeof params.is_html === 'undefined') ? false : params.is_html;
                trials[i].force_correct_button_press = (typeof params.force_correct_button_press === 'undefined') ? false : params.force_correct_button_press;
                trials[i].prompt = (typeof params.prompt === 'undefined') ? 'undefined' : params.prompt;
                trials[i].data = (typeof params.data === 'undefined') ? {} : params.data[i];
            }
            return trials;
        };

        var cf_trial_complete = false;

        plugin.trial = function(display_element, block, trial, part) {
            switch (part) {
            case 1:
                // set finish flag
                cf_trial_complete = false;

                if(!trial.is_html){
                    // add image to display
                    display_element.append($('<img>', {
                        "src": trial.a_path,
                        "class": 'cf',
                        "id": 'jspsych_cf_image'
                    }));
                } else {
                    display_element.append($('<div>', {
{'fraction_non_alphanumeric': 0.11349206349206349, 'fraction_numerical': 0.005952380952380952, 'mean_word_length': 1.7943458980044347, 'pattern_counts': {'":': 6, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3090520', 'n_tokens_mistral': 1446, 'n_tokens_neox': 1332, 'n_words': 279}