<commit_before>var OpenSpending = OpenSpending || {};
OpenSpending.Widgets = OpenSpending.Widgets || {};

(function ($) {

var osw = OpenSpending.Widgets;

osw.QueryBuilder = function(elem, callback, finish, context, spec) {
    var self = this;

    var resources = ["//ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js",
                     OpenSpending.scriptRoot + "/app/bob/css/query-builder/jquery-ui-1.8.18.custom.css",
                     OpenSpending.scriptRoot + "/lib/vendor/handlebars.js"
                 ];

    self.nodes = {};
    self.hasFinish = finish instanceof Function;
    self.noFinish = !self.hasFinish;

    self.context = _.extend({
        }, context);

    self.serialize = function() {
        state = {};
        _.each(spec, function(obj) {
            var node = self.nodes[obj.variable];
            if (node) state[obj.variable] = node.serialize();
            state[obj.variable] = state[obj.variable] || obj['default'];
        });<commit_msg>Add UnderscoreJS as a Bob dependency<commit_after>var OpenSpending = OpenSpending || {};
OpenSpending.Widgets = OpenSpending.Widgets || {};

(function ($) {

var osw = OpenSpending.Widgets;

osw.QueryBuilder = function(elem, callback, finish, context, spec) {
    var self = this;

    var resources = ["//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js",
                     "//ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js",
                     OpenSpending.scriptRoot + "/app/bob/css/query-builder/jquery-ui-1.8.18.custom.css",
                     OpenSpending.scriptRoot + "/lib/vendor/handlebars.js"
                 ];

    self.nodes = {};
    self.hasFinish = finish instanceof Function;
    self.noFinish = !self.hasFinish;

    self.context = $.extend({}, context);

    self.serialize = function() {
        state = {};
        _.each(spec, function(obj) {
            var node = self.nodes[obj.variable];
            if (node) state[obj.variable] = node.serialize();
            state[obj.variable] = state[obj.variable] || obj['default'];
        });
{'fraction_non_alphanumeric': 0.15340638399237733, 'fraction_numerical': 0.009051929490233444, 'mean_word_length': 2.392568659127625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3570988', 'n_tokens_mistral': 667, 'n_tokens_neox': 632, 'n_words': 106}