<commit_before># -*- coding: utf-8 -*-
from datetime import datetime

import elasticsearch_dsl as es
from babel.dates import format_date, format_timedelta
from pyjobs_crawlers.tools import condition_tags

from pyjobsweb.model.data import Tag2
from pyjobsweb.lib.elasticsearch_ import compute_index_name


class Tag(es.InnerObjectWrapper):
    def __init__(self, mapping, **kwargs):
        super(Tag, self).__init__(mapping, **kwargs)


class Job(es.DocType):
    class Meta:
        index = 'jobs'
        doc_type = 'job-offer'

    french_elision = es.token_filter(
        'french_elision',
        type='elision',
        articles_case=True,
        articles=[
            'l', 'm', 't', 'qu', 'n', 's',
            'j', 'd', 'c', 'jusqu', 'quoiqu',
            'lorsqu', 'puisqu'
        ]
    )

    french_stopwords = es.token_filter('french_stopwords',
                                       type='stop', stopwords='_french_')

    # Do not include this filter if keywords is empty
    french_keywords = es.token_filter('french_keywords',
                                      type='keyword_marker', keywords=[])

    french_stemmer = es.token_filter('french_stemmer',
                                     type='stemmer', language='light_french')

    french_analyzer = es.analyzer(
        'french_analyzer',
        tokenizer='standard',
        filter=[
            'lowercase',
            french_elision,
            french_stopwords,
            # french_keywords,
            french_stemmer
        ]
    )

    french_description_analyzer = es.analyzer(
        'french_description_analyzer',
        tokenizer='standard',
        filter=[
            'lowercase',
            french_elision,
            french_stopwords,
            # french_keywords,
            french_stemmer
        ],
        char_filter=['html_strip']
    )

    id = es.Integer()

    url = es.String(index='no')
    source = es.String(index='not_analyzed')

    title = es.String(analyzer=french_analyzer)
    description = es.String(analyzer=french_description_analyzer)
    company = es.String(index='analyzed')
    company_url = es.String(index='no')
<commit_msg>Better job offer index time analysis.<commit_after># -*- coding: utf-8 -*-
from datetime import datetime

import elasticsearch_dsl as es
from babel.dates import format_date, format_timedelta
from pyjobs_crawlers.tools import condition_tags

from pyjobsweb.model.data import Tag2
from pyjobsweb.lib.elasticsearch_ import compute_index_name


class Tag(es.InnerObjectWrapper):
    def __init__(self, mapping, **kwargs):
        super(Tag, self).__init__(mapping, **kwargs)


class Job(es.DocType):
    class Meta:
        index = 'jobs'
        doc_type = 'job-offer'

    french_elision = es.token_filter(
        'french_elision',
        type='elision',
        articles_case=True,
        articles=[
            'l', 'm', 't', 'qu', 'n', 's',
            'j', 'd', 'c', 'jusqu', 'quoiqu',
            'lorsqu', 'puisqu'
        ]
    )

    french_stopwords = es.token_filter('french_stopwords',
                                       type='stop', stopwords='_french_')

    # Do not include this filter if keywords is empty
    french_keywords = es.token_filter('french_keywords',
                                      type='keyword_marker', keywords=[])

    french_stemmer = es.token_filter('french_stemmer',
                                     type='stemmer', language='light_french')

    french_analyzer = es.analyzer(
        'french_analyzer',
        tokenizer='standard',
        filter=[
            'lowercase',
            'asciifolding',
            french_elision,
            french_stopwords,
            # french_keywords,
            french_stemmer
        ]
    )

    french_description_analyzer = es.analyzer(
        'french_description_analyzer',
        tokenizer='standard',
        filter=[
            'lowercase',
            'asciifolding',
            french_elision,
            french_stopwords,
            # french_keywords,
            french_stemmer
        ],
        char_filter=['html_strip']
    )

    id = es.Integer()

    url = es.String(index='no')
    source = es.String(index='not_analyzed')

    title = es.String(analyzer=french_analyzer)
    description = es.String(analyzer=french_description_analyzer)
    company = es.String(analyzer=french_analyzer)

    company_url = es.String(index='no')

{'fraction_non_alphanumeric': 0.10909503288727602, 'fraction_numerical': 0.0009072352007257881, 'mean_word_length': 2.2049418604651163, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3310126', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1309, 'n_words': 247}