<commit_before>"use strict";

const IO = io(),
      ERROR_CODE_BLANK = -1,
      SPACE = ' ';

let Request = {
        get: (url, query) => {
                let defer = $.Deferred();
                $.ajax( {
                        url: url + query,
                        type: 'GET',
                        success: defer.resolve,
                        error: defer.reject
                });
                return defer.promise();
        }};

class Dom {
        constructor(id) {
                this._id = document.getElementById(id);
        }
        getIdDom() {
                return this._id;
        }
        isNotEquals(text) {
                return this.getIdDom().innerText !== text;
        }
}

class InputDom extends Dom {
        getInputValue() {
                let value = super.getIdDom().value;
                if (value === "") {
                        console.info(`not blank, errorCode [${ERROR_CODE_BLANK}]`);
                        return ERROR_CODE_BLANK;
                }
                return value;
        }
}

class RequestUrls {
        constructor() {
                this.__urls = new Map()
                        .set('YAHOO', 'http://search.yahoo.co.jp/search?p=')
                        .set('GITHUB', 'https://github.com/search?utf8=✓&q=')
                        .set('STACKOVERFLOW', 'http://stackoverflow.com/search?q=')
                        .set('NONE', '');
        }
        getUrl(serviceName, searchWord) {
                let url = this.__urls.get(serviceName);
                return url + searchWord;
        }
}

function ajaxRequest() {
        let wordResultDom = new InputDom("word_result"),
        result = wordResultDom.getIdDom(),
        wordDom = new InputDom("word"),
                word = wordDom.getInputValue(),
                request,
                        yahooUrl,
                        githubUrl,
                                stackoverflowUrl;
        if (ERROR_CODE_BLANK === word) {
                result.innerText = SPACE;
                return;
        } else if (wordDom.isNotEquals(word)) {
                result.innerText = word;
        }
        IO.emit('server', {word: word});
        request = new RequestUrls();
        yahooUrl = request.getUrl('YAHOO', word);
        githubUrl = request.getUrl('GITHUB', word);
        stackoverflowUrl = request.getUrl('STACKOVERFLOW', word);
        console.info(`request url : \r\n${yahooUrl}\r\n${githubUrl}\r\n${stackoverflowUrl}`);

        Request.get(yahooUrl, word).done(data => {
                console.log(data);
        });
        Request.get(githubUrl, word).done(data => {
                console.log(data);
        });
        Request.get(stackoverflowUrl, word).done(data => {
                console.log(data);
        });
}

class Timer {
        constructor() {
                this.__times = new Map()
                        .set(1, [17,45])
                        .set(2, [17,45])
                        .set(3, [17,45])
                        .set(4, [17,45])
                        .set(5, [17,45])
                        .set(6, [0])
                        .set(7, [0]);<commit_msg>Update client.js<commit_after>"use strict";

const IO = io(),
      ERROR_CODE_BLANK = -1,
      SPACE = ' ';

let Request = {
        get: (url, query) => {
                let defer = $.Deferred();
                $.ajax( {
                        url: url + query,
                        type: 'GET',
                        success: defer.resolve,
                        error: defer.reject
                });
                return defer.promise();
        }};

class Dom {
        constructor(id) {
                this._id = document.getElementById(id);
        }
        getIdDom() {
                return this._id;
        }
        isNotEquals(text) {
                return this.getIdDom().innerText !== text;
        }
}

class InputDom extends Dom {
        getInputValue() {
                let value = super.getIdDom().value;
                if (value === "") {
                        console.info(`not blank, errorCode [${ERROR_CODE_BLANK}]`);
                        return ERROR_CODE_BLANK;
                }
                return value;
        }
}

class RequestUrls {
        constructor() {
                this.__urls = new Map()
                        .set('YAHOO', 'http://search.yahoo.co.jp/search?p=')
                        .set('GITHUB', 'https://github.com/search?utf8=✓&q=')
                        .set('STACKOVERFLOW', 'http://stackoverflow.com/search?q=')
                        .set('NONE', '');
        }
        getUrl(serviceName, searchWord) {
                let url = this.__urls.get(serviceName);
                return url + searchWord;
        }
}

function ajaxRequest() {
        let wordResultDom = new InputDom("word_result"),
        result = wordResultDom.getIdDom(),
        wordDom = new InputDom("word"),
                word = wordDom.getInputValue(),
                request,
                        yahooUrl,
                        githubUrl,
                                stackoverflowUrl;
        if (ERROR_CODE_BLANK === word) {
                result.innerText = SPACE;
                return;
        } else if (wordDom.isNotEquals(word)) {
                result.innerText = word;
        }
        IO.emit('server', {word: word});
        request = new RequestUrls();
        yahooUrl = request.getUrl('YAHOO', word);
        githubUrl = request.getUrl('GITHUB', word);
        stackoverflowUrl = request.getUrl('STACKOVERFLOW', word);
        console.info(`request url : \r\n${yahooUrl}\r\n${githubUrl}\r\n${stackoverflowUrl}`);

        Request.get(yahooUrl, word)
                .done(data => { console.log(data) })
                .fail(e => { console.log(e) });
        Request.get(githubUrl, word)
                .done(data => { console.log(data) })
                .fail(e => { console.log(e) });
        Request.get(stackoverflowUrl, word)
                .done(data => { console.log(data) })
                .fail(e => { console.log(e) });
}

class Timer {
        constructor() {
                this.__times = new Map()
                        .set(1, [17,45])
                        .set(2, [17,45])
                        .set(3, [17,45])
                        .set(4, [17,45])
                        .set(5, [17,45])
                        .set(6, [0])
                        .set(7, [0]);
{'fraction_non_alphanumeric': 0.13449023861171366, 'fraction_numerical': 0.009606445615122404, 'mean_word_length': 1.211373758136348, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 2, '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': '3578137', 'n_tokens_mistral': 1859, 'n_tokens_neox': 1727, 'n_words': 317}