<commit_before>'use strict';

const api = require('api');

const router = require('koa-router')();

router.get('/search/em', function*() {
    const value = +this.query.value;
    if (!value) {
        return error(this, 'missing value');
    }
    const options = {};
    if (this.query.limit) options.limit = +this.query.limit;
    if (this.query.precision) options.precision = +this.query.precision;
    this.body = {
        result: yield api.search.em(value, options)
    };
});

router.get('/molecules/em', function*() {
    const value = +this.query.value;
    if (!value) {
        return error(this, 'missing value');
    }
    this.body = {
        result: yield api.molecules.em(value)
    };
});

function error(ctx, message) {
    ctx.status = 400;
    ctx.body = {
        error: message
    };
}

module.exports = router;<commit_msg>Add route for molecule mf<commit_after>'use strict';

const api = require('api');

const router = require('koa-router')();

router.get('/search/em', function*() {
    const value = +this.query.value;
    if (!value) {
        return error(this, 'missing value');
    }
    const options = {};
    if (this.query.limit) options.limit = +this.query.limit;
    if (this.query.precision) options.precision = +this.query.precision;
    this.body = {
        result: yield api.search.em(value, options)
    };
});

router.get('/molecules/em', function*() {
    const value = +this.query.value;
    if (!value) {
        return error(this, 'missing value');
    }
    this.body = {
        result: yield api.molecules.em(value)
    };
});

router.get('/molecules/mf', function*() {
    const value = +this.query.value;
    if (!value) {
        return error(this, 'missing value');
    }
    this.body = {
        result: yield api.molecules.mf(value)
    };
});

function error(ctx, message) {
    ctx.status = 400;
    ctx.body = {
        error: message
    };
}

module.exports = router;
{'fraction_non_alphanumeric': 0.16873706004140787, 'fraction_numerical': 0.003105590062111801, 'mean_word_length': 2.667931688804554, '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': '1508896', 'n_tokens_mistral': 643, 'n_tokens_neox': 616, 'n_words': 136}