<commit_before>/*jshint browser: true, jquery: true */
/*global clique, _, tangelo */

function randomGraph(n, pct) {
    "use strict";

    var alphabet = "abcdefghijklmnopqrstuvwxyz",
        nodes = [],
        links = [];

    _.each(_.range(n), function (i) {
        nodes.push({
            name: alphabet[i]
        });
    });

    _.each(_.range(n), function (source, i) {
        _.each(_.range(i + 1, n), function (target) {
            if (Math.random() < pct) {
                links.push({
                    source: source,
                    target: target
                });
            }
        });
    });

    return {
        nodes: nodes,
        links: links
    };
}

$(function () {
    "use strict";

    var graphData,
        graph,
        view,
        info,
        mode;

    mode = tangelo.queryArguments().mode || "mongo";

    $.getJSON("clique.yaml", function (cfg) {
        switch (mode) {
        case "mongo": {
            window.graph = graph = new clique.Graph({
                adapter: clique.adapter.Mongo,
                options: {
                    host: cfg.host || "localhost",
                    database: cfg.database || "year3_graphs",
                    collection: cfg.collection || "mentions_monica_nino_2hop_mar12"
                }
            });
            break;
        }

        default: {
            graphData = randomGraph(26, 0.20);

            window.graph = graph = new clique.Graph({
                adapter: clique.adapter.NodeLinkList,
                options: graphData
            });
            break;
        }
        }

        $("#seed").on("click", function () {
            var name = $("#name").val().trim(),
                radiusText = $("#radius").val().trim(),
                radius = Number(radiusText),
                delsearch = $("#delsearch").prop("checked");

            if (name === "" || radiusText === "" || isNaN(radius)) {
                return;
            }

            graph.adapter.findNode({name: name})
                .then(function (center) {
                    if (center) {
                        graph.addNeighborhood({
                            center: center,
                            radius: radius,
                            deleted: delsearch
                        });
                    }
                });
        });

        $("#save").on("click", function () {
            graph.adapter.sync();
        });

        window.view = view = new clique.view.Cola({
            model: graph,
            el: "#content"
        });

        window.info = info = new clique.view.SelectionInfo({
            model: view.selection,
            el: "#info",
            graph: graph
        });
        info.render();
    });
});<commit_msg>Skirting issue with plugin paths for tangelo config plugin<commit_after>/*jshint browser: true, jquery: true */
/*global clique, _, tangelo */

function randomGraph(n, pct) {
    "use strict";

    var alphabet = "abcdefghijklmnopqrstuvwxyz",
        nodes = [],
        links = [];

    _.each(_.range(n), function (i) {
        nodes.push({
            name: alphabet[i]
        });
    });

    _.each(_.range(n), function (source, i) {
        _.each(_.range(i + 1, n), function (target) {
            if (Math.random() < pct) {
                links.push({
                    source: source,
                    target: target
                });
            }
        });
    });

    return {
        nodes: nodes,
        links: links
    };
}

$(function () {
    "use strict";

    var launch = function (cfg) {
        var graphData,
            graph,
            view,
            mode,
            info;

        mode = tangelo.queryArguments().mode || "mongo";

        switch (mode) {
        case "mongo": {
            window.graph = graph = new clique.Graph({
                adapter: clique.adapter.Mongo,
                options: {
                    host: cfg.host || "localhost",
                    database: cfg.database || "year3_graphs",
                    collection: cfg.collection || "mentions_monica_nino_2hop_mar12"
                }
            });
            break;
        }

        default: {
            graphData = randomGraph(26, 0.20);

            window.graph = graph = new clique.Graph({
                adapter: clique.adapter.NodeLinkList,
                options: graphData
            });
            break;
        }
        }

        $("#seed").on("click", function () {
            var name = $("#name").val().trim(),
                radiusText = $("#radius").val().trim(),
                radius = Number(radiusText),
                delsearch = $("#delsearch").prop("checked");

            if (name === "" || radiusText === "" || isNaN(radius)) {
                return;
            }

            graph.adapter.findNode({name: name})
                .then(function (center) {
                    if (center) {
                        graph.addNeighborhood({
                            center: center,
                            radius: radius,
                            deleted: delsearch
                        });
                    }
                });
        });

        $("#save").on("click", function () {
            graph.adapter.sync();
        });

        window.view = view = new clique.view.Cola({
            model: graph,
            el: "#content"
        });

        window.info = info = new clique.view.SelectionInfo({
            model: view.selection,
            el: "#info",
            graph: graph
        });
        info.render();
    };

    $.getJSON("clique.yaml").then(launch, _.bind(launch, {}));
});
{'fraction_non_alphanumeric': 0.13921154523055262, 'fraction_numerical': 0.0035198873636043647, 'mean_word_length': 1.1849288735101884, 'pattern_counts': {'":': 2, '<': 5, '<?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': '2433830', 'n_tokens_mistral': 1558, 'n_tokens_neox': 1460, 'n_words': 303}