<commit_before>const items = require("../json/items.json");
const item_embed = require("../embeds/item");

const too_short = ["of", "and", "in", "the", "de"];

module.exports = (message, client, helper) => {
    let options = message.content.toLowerCase().split(" ").slice(1);

    helper.log(message, `item: ${options.join(" ")}`);

    let result = false;
    let search;
    let conflicts = [];

    loop1: for (let i = 0; i <= options.length; i++) {
        loop2: for (let j = 0; j <= options.length; j++) {
            if (i < j) {
                let term = options.slice(i, j).join(" ");
                if (too_short.includes(term)) break loop2;
                
                search = items.filter(item => {
                    if (too_short.includes(item)) return false;
                    if (item.format_name.toLowerCase().match(term) && term.length > 2) return true;
                    if ((item.aliases || []).includes(term)) return true;
                    if (item.true_name.split("_").includes(term)) return true;
                    if (item.format_name.split(" ").map(item => item.charAt(0)).join("").toLowerCase() == term) return true;
                });

                if (search.length == 1) {
                    result = search[0];
                    break loop1;
                } else if (search.length > 1) {
                    let conf = search.map(item => item.format_name);
                    for (let item in conf) conflicts.push(conf[item]);
                }
            }
        }
    }

    if (result && search.length > 0) {
        message.channel.createMessage({
            "embed": item_embed(result)
        }).then(() => {
            helper.log(message, "sent item embed");
        }).catch(err => {
            helper.handle(message, err);
        });
    } else {
        let content = "Couldn't find that item. ";
        if (conflicts.length > 1) {
            conflicts = conflicts.filter((item, inc, newlist) => newlist.indexOf(item) === inc);
            content += `Possible conflicts: ${conflicts.join(", ")}`;
        }

        message.channel.createMessage(content).then(new_message => {
            helper.log(message, "sent not found");
            setTimeout(() => {
                new_message.delete();
            }, 10000);
        });
    }
};
<commit_msg>fix sange or yasha<commit_after>const items = require("../json/items.json");
const item_embed = require("../embeds/item");

const too_short = ["of", "and", "in", "the", "de"];

module.exports = (message, client, helper) => {
    let options = message.content.toLowerCase().split(" ").slice(1);

    helper.log(message, `item: ${options.join(" ")}`);

    let result = false;
    let search;
    let conflicts = [];

    loop1: for (let i = 0; i <= options.length; i++) {
        loop2: for (let j = 0; j <= options.length; j++) {
            if (i < j) {
                let term = options.slice(i, j).join(" ");
                if (too_short.includes(term)) break loop2;
                
                search = items.filter(item => {
                    if (item.true_name == "sange_and_yasha" & (term.toLowerCase() == "yasha" | term.toLowerCase() == "sange")) return false;
                    if (too_short.includes(item)) return false;
                    if (item.format_name.toLowerCase().match(term) && term.length > 2) return true;
                    if ((item.aliases || []).includes(term)) return true;
                    if (item.true_name.split("_").includes(term)) return true;
                    if (item.format_name.split(" ").map(item => item.charAt(0)).join("").toLowerCase() == term) return true;
                });

                if (search.length == 1) {
                    result = search[0];
                    break loop1;
                } else if (search.length > 1) {
                    let conf = search.map(item => item.format_name);
                    for (let item in conf) conflicts.push(conf[item]);
                }
            }
        }
    }

    if (result && search.length > 0) {
        message.channel.createMessage({
            "embed": item_embed(result)
        }).then(() => {
            helper.log(message, "sent item embed");
        }).catch(err => {
            helper.handle(message, err);
        });
    } else {
        let content = "Couldn't find that item. ";
        if (conflicts.length > 1) {
            conflicts = conflicts.filter((item, inc, newlist) => newlist.indexOf(item) === inc);
            content += `Possible conflicts: ${conflicts.join(", ")}`;
        }

        message.channel.createMessage(content).then(new_message => {
            helper.log(message, "sent not found");
            setTimeout(() => {
                new_message.delete();
            }, 10000);
        });
    }
};

{'fraction_non_alphanumeric': 0.16340956340956342, 'fraction_numerical': 0.0079002079002079, 'mean_word_length': 1.7288712422007941, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 29, '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': '3256263', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1348, 'n_words': 312}