<commit_before>import _ from 'underscore';
import hasValue from './hasValue';

// Weird stuff are for accentated characters.
// See http://stackoverflow.com/questions/1073412/javascript-validation-issue-
// with-international-characters.
const regex = /(^|\s)#([\w\d\-_\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)(?=\s|$)/g; // eslint-disable-line max-len

export function containsTags(task, tags) {
    let result;
    if (tags.length === 0) {
        result = task.tags.length === 0;
    } else {
        const lowerCasedTags = task.tags.map(tag => tag.toLowerCase());
        result = _.every(tags, _.partial(_.contains, lowerCasedTags));
    }

    return result;
}


export function doesntContainsTags(task, tags) {
    let result;

    // No task to exclude, it cannot contain it.
    if (tags.length === 0) {
        result = true;
    } else {
        const lowerCasedTags = task.tags.map(tag => tag.toLowerCase());
        result = !_.some(tags, _.partial(_.contains, lowerCasedTags));
    }

    return result;
}

// Helper function to extract tag from description.
export function extractTags(desc) {<commit_msg>Add , ; and : as tag separator. Refs #41<commit_after>import _ from 'underscore';
import hasValue from './hasValue';

// Weird stuff are for accentated characters.
// See http://stackoverflow.com/questions/1073412/javascript-validation-issue-
// with-international-characters.
const regex = /(^|\s)#([\w\d\-_\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)(?=\s|;|:|,|$)/g; // eslint-disable-line max-len

export function containsTags(task, tags) {
    let result;
    if (tags.length === 0) {
        result = task.tags.length === 0;
    } else {
        const lowerCasedTags = task.tags.map(tag => tag.toLowerCase());
        result = _.every(tags, _.partial(_.contains, lowerCasedTags));
    }

    return result;
}


export function doesntContainsTags(task, tags) {
    let result;

    // No task to exclude, it cannot contain it.
    if (tags.length === 0) {
        result = true;
    } else {
        const lowerCasedTags = task.tags.map(tag => tag.toLowerCase());
        result = !_.some(tags, _.partial(_.contains, lowerCasedTags));
    }

    return result;
}

// Helper function to extract tag from description.
export function extractTags(desc) {
{'fraction_non_alphanumeric': 0.1534065934065934, 'fraction_numerical': 0.016703296703296705, 'mean_word_length': 2.9859894921190895, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4093832', 'n_tokens_mistral': 761, 'n_tokens_neox': 724, 'n_words': 176}