<commit_before># -*- coding: utf-8 -*-
"""
Don't use this module. It's highly experimental, incomplete
and not supposed to work reliably. But, what works is cool:

>>> from recipi.utils.nldate import parse, convert_rrule_to_str

>>> convert_rrule_to_str(parse('every tuesday vegan').rule)
>>> 'dtstart:2015-01-18T00:00:00;freq:2;byhour:0;byweekday:1;bysecond:0;byminute:0;interval:1;'

>>> parse('every tuesday vegan')
>>> Rule(date=None, rule=<dateutil.rrule.rrule object at 0x7f0078062e48>, details='vegan')

"""
from collections import namedtuple
from datetime import datetime
from dateutil import parser, rrule
from dateutil.relativedelta import relativedelta

import nltk


ParseResult = namedtuple('Rule', 'date, rule, details')

RRULE_ATTRIBUTES = frozenset((
    'freq', 'dtstart', 'interval', 'count', 'until',
    'bysetpos', 'bymonth', 'bymonthday', 'byyearday',
    'byweekno', 'byweekday', 'byhour', 'byminute',
    'bysecond', 'byeaster'
))

days = "(mon|tue|wed|thu|fri|sat|sun|weekday|wday)"
months = "(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)"
dmy = "(year|day|week|month)"
rel_day = "(tod|yes|tom|ton)"<commit_msg>Add note about arrow.<commit_after># -*- coding: utf-8 -*-
"""
Don't use this module. It's highly experimental, incomplete
and not supposed to work reliably. But, what works is cool:

>>> from recipi.utils.nldate import parse, convert_rrule_to_str

>>> convert_rrule_to_str(parse('every tuesday vegan').rule)
>>> 'dtstart:2015-01-18T00:00:00;freq:2;byhour:0;byweekday:1;bysecond:0;byminute:0;interval:1;'

>>> parse('every tuesday vegan')
>>> Rule(date=None, rule=<dateutil.rrule.rrule object at 0x7f0078062e48>, details='vegan')

TODO: See if it makes sense to utilize `arrow` (http://crsmithdev.com/arrow/)

"""
from collections import namedtuple
from datetime import datetime
from dateutil import parser, rrule
from dateutil.relativedelta import relativedelta

import nltk


ParseResult = namedtuple('Rule', 'date, rule, details')

RRULE_ATTRIBUTES = frozenset((
    'freq', 'dtstart', 'interval', 'count', 'until',
    'bysetpos', 'bymonth', 'bymonthday', 'byyearday',
    'byweekno', 'byweekday', 'byhour', 'byminute',
    'bysecond', 'byeaster'
))

days = "(mon|tue|wed|thu|fri|sat|sun|weekday|wday)"
months = "(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)"
dmy = "(year|day|week|month)"
rel_day = "(tod|yes|tom|ton)"
{'fraction_non_alphanumeric': 0.1681453316434305, 'fraction_numerical': 0.02703844528939586, 'mean_word_length': 6.663430420711974, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '1432323', 'n_tokens_mistral': 924, 'n_tokens_neox': 878, 'n_words': 190}