<commit_before>
(function() {
    var setup = false;
    function ready() {
        if (setup) {
            return;
        }

        // TODO: Init
        setup = true;
    }

    if (document.readyState === 'complete') {
        setTimeout(ready, 0);
    }
    else if (document.addEventListener) {
        document.addEventListener('DOMContentLoaded', ready, false);
        window.addEventListener('load', ready, false);
    }
    else {
        document.attachEvent('onreadystatechange', readyStateChange);
        window.attachEvent('onload', ready);
    }
})();<commit_msg>Connect the web interface to Diffusion.<commit_after>
(function() {
    var diffusion = require('diffusion');

    function start() {
        console.log('Ready');

        session
            .stream('?adapter/rest/model/store/')
            .asType(diffusion.datatypes.json())
            .on('value', function(path, specification, newValue, oldValue) {
                console.log(path, newValue);
            });
    }

    var started = false;
    function tryStart() {
        if (!started && setup && connected) {
            start();

            started = true;
        }
    }

    var connected = false;
    var session;
    function connect() {
        diffusion.connect({
            host : 'localhost',
            port : 8080
        }).then(function (newSession) {
            connected = true;
            session = newSession;
            session.subscribe('?adapter/rest/model/store/');

            tryStart();
        }, function() {
            setTimeout(connect, 5000);
        });
    }

    var setup = false;
    function ready() {
        if (setup) {
            return;
        }

        tryStart();

        setup = true;
    }

    if (document.readyState === 'complete') {
        setTimeout(ready, 0);
    }
    else if (document.addEventListener) {
        document.addEventListener('DOMContentLoaded', ready, false);
        window.addEventListener('load', ready, false);
    }
    else {
        document.attachEvent('onreadystatechange', readyStateChange);
        window.attachEvent('onload', ready);
    }

    connect();
})();
{'fraction_non_alphanumeric': 0.1330232558139535, 'fraction_numerical': 0.004651162790697674, 'mean_word_length': 1.898921832884097, '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': '1885333', 'n_tokens_mistral': 586, 'n_tokens_neox': 563, 'n_words': 122}