### Set up development environment Source: https://github.com/akoumjian/datefinder/blob/master/CONTRIBUTING.md Commands to initialize a virtual environment and install necessary build and test dependencies. ```bash python3 -m venv .venv . .venv/bin/activate python -m pip install --upgrade pip python -m pip install maturin pytest tox python -m pip install -e . ``` -------------------------------- ### Validate Installability Source: https://github.com/akoumjian/datefinder/blob/master/RELEASE.md Perform local smoke tests for wheel and source-build installations. ```bash python -m venv /tmp/datefinder-ga-smoke . /tmp/datefinder-ga-smoke/bin/activate python -m pip install --upgrade pip python -m pip install dist/datefinder-1.0.0*.whl python - <<'PY' import datefinder print(list(datefinder.find_dates("tomorrow and 2024-12-10"))) PY deactivate ``` ```bash . /tmp/datefinder-ga-smoke/bin/activate python -m pip uninstall -y datefinder python -m pip install dist/datefinder-1.0.0.tar.gz python - <<'PY' import datefinder print(list(datefinder.find_dates("created 01/15/2005 by ACME"))) PY deactivate ``` -------------------------------- ### CLI usage examples Source: https://github.com/akoumjian/datefinder/blob/master/README.rst Various ways to invoke datefinder from the command line. ```sh datefinder --json "tomorrow and 2024-12-10" ``` ```sh python -m datefinder --engine extract --json --reference "2026-03-18T00:00:00+00:00" "in 3 days" ``` ```sh # default engine (v2 compatibility), anchored relative parsing datefinder --reference "2026-03-19T12:00:00+00:00" --json "tomorrow and 2024-12-10" ``` -------------------------------- ### CLI usage examples with various engines Source: https://github.com/akoumjian/datefinder/blob/master/docs/index.rst Demonstrates specific engine configurations, reference dates, and input methods for the CLI. ```sh # default engine (v2 compatibility), anchored relative parsing datefinder --reference "2026-03-19T12:00:00+00:00" --json "tomorrow and 2024-12-10" # explicit legacy behavior, include source text and indices datefinder --engine legacy --source --index --json "created 01/15/2005 by ACME" # typed extract output with locale hints datefinder --engine extract --locale en --locale fr --pretty --json "in 3 days and demain" # read long input from stdin cat document.txt | datefinder --engine extract --json ``` -------------------------------- ### Install Rust toolchain Source: https://github.com/akoumjian/datefinder/blob/master/CONTRIBUTING.md Required steps to install the Rust compiler and environment variables for the datefinder runtime. ```bash curl https://sh.rustup.rs -sSf | sh -s -- -y source "$HOME/.cargo/env" ``` -------------------------------- ### Install datefinder via pip Source: https://github.com/akoumjian/datefinder/blob/master/docs/_build/html/index.html Use this command to install the package in your Python environment. ```bash pip install datefinder ``` -------------------------------- ### Validate TestPyPI Installation Source: https://github.com/akoumjian/datefinder/blob/master/RELEASE.md Verify the package installation from TestPyPI on a clean environment. ```bash python -m pip install -U pip python -m pip install \ --index-url https://test.pypi.org/simple/ \ --extra-index-url https://pypi.org/simple \ --only-binary=datefinder \ datefinder==1.0.0 ``` -------------------------------- ### Build locally with maturin Source: https://github.com/akoumjian/datefinder/blob/master/CONTRIBUTING.md Alternative command to build and install the project locally using the specified Cargo manifest. ```bash maturin develop --release --manifest-path rust/datefinder-kernel/Cargo.toml ``` -------------------------------- ### Run test and benchmark commands Source: https://github.com/akoumjian/datefinder/blob/master/CONTRIBUTING.md Standard commands for executing the test suite, generating conformance data, and running performance benchmarks. ```bash pytest -q tox -q python scripts/build_conformance_corpus.py python scripts/diff_legacy_v2.py python bench/bench_core.py --dataset bench/corpus_core.txt --iterations 10 ``` -------------------------------- ### Initialize Facebook SDK Source: https://github.com/akoumjian/datefinder/blob/master/tests/seattle_weekly.html Asynchronously loads the Facebook JavaScript SDK for XFBML support. ```javascript (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=500578586675733"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); ``` -------------------------------- ### Generate README comparison snapshot Source: https://github.com/akoumjian/datefinder/blob/master/bench/README.md Produces benchmark result files in JSON and Markdown formats for documentation updates. ```bash python bench/bench_readme_compare.py \ --iterations-small 12 \ --iterations-large 2 ``` -------------------------------- ### Migrate to v2 using compatibility helpers Source: https://github.com/akoumjian/datefinder/blob/master/docs/index.rst Provides methods to maintain compatibility with existing codebases or to force legacy parser behavior. ```python for dt in datefinder.find_dates_compat("tomorrow and 2024-12-10"): print(dt) ``` ```python for dt in datefinder.find_dates_legacy("April 9, 2013 at 6:11 a.m."): print(dt) ``` -------------------------------- ### Initialize Fancybox and Quantcast Tracking Source: https://github.com/akoumjian/datefinder/blob/master/tests/seattle_weekly.html Initializes the Fancybox plugin for elements with the photoGroup rel attribute and injects the Quantcast tracking script. ```javascript $(document).ready(function() { $("a[rel=photoGroup]").fancybox({ 'autoScale' : true, 'titlePosition' : 'inside' }); }); var _qevents = _qevents || []; (function() { var elem = document.createElement('script'); elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js"; elem.async = true; elem.type = "text/javascript"; var scpt = document.getElementsByTagName('script')[0]; scpt.parentNode.insertBefore(elem, scpt); })(); _qevents.push({ qacct:"p-9eMdqgZDb7EWs" }); ``` -------------------------------- ### Initialize Searchbox Source: https://github.com/akoumjian/datefinder/blob/master/docs/_build/html/_modules/datefinder.html JavaScript snippet to display the search box element. ```javascript $('#searchbox').show(0); ``` -------------------------------- ### Run core benchmarks Source: https://github.com/akoumjian/datefinder/blob/master/bench/README.md Executes the core benchmark suite against a specified dataset for a set number of iterations. ```bash python bench/bench_core.py --dataset bench/corpus_core.txt --iterations 20 ``` ```bash python bench/bench_core.py --dataset bench/corpus_core.txt --iterations 20 --duckling-url http://localhost:8000/parse ``` ```bash python bench/bench_core.py --dataset bench/corpus_core.txt --iterations 20 --duckling-python ``` -------------------------------- ### Initialize Google Ad Manager Source: https://github.com/akoumjian/datefinder/blob/master/tests/seattle_weekly.html Displays a specific ad unit using the Google Publisher Tag library. ```javascript googletag.cmd.push(function() { googletag.display('div-gpt-ad-1362001150465-1'); }); ``` -------------------------------- ### Initialize Google Plus Script Source: https://github.com/akoumjian/datefinder/blob/master/tests/seattle_weekly.html Asynchronously loads the Google Plus API script. ```javascript // ``` -------------------------------- ### Extract dates using Python Source: https://github.com/akoumjian/datefinder/blob/master/docs/index.rst Demonstrates extracting dates using both the compatibility find_dates method and the modern typed extract method with a reference date. ```python import datefinder from datetime import datetime, timezone text = "Meeting tomorrow; launch on 2024-11-03 18:00 UTC." ref = datetime(2026, 3, 19, 12, 0, tzinfo=timezone.utc) # Compatibility datetimes print(list(datefinder.find_dates(text, base_date=ref))) # Typed extraction for match in datefinder.extract(text, reference_dt=ref): print(match.kind, match.text, match.value) ``` -------------------------------- ### Initialize Twitter Widgets Source: https://github.com/akoumjian/datefinder/blob/master/tests/seattle_weekly.html Asynchronously loads the Twitter widgets script to enable social sharing buttons. ```javascript !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs'); ``` -------------------------------- ### Run Benchmark Comparison Source: https://github.com/akoumjian/datefinder/blob/master/docs/index.rst Executes the benchmark script with specified iteration counts. Requires a running Duckling instance if testing the duckling_http integration. ```sh # optional: run duckling locally docker run --rm -p 8000:8000 rasa/duckling:latest python bench/bench_readme_compare.py \ --iterations-small 12 \ --iterations-large 2 ``` -------------------------------- ### Validate Performance Source: https://github.com/akoumjian/datefinder/blob/master/RELEASE.md Benchmark core performance and optionally gate against Duckling results. ```bash python bench/bench_core.py --dataset bench/corpus_core.txt --iterations 20 ``` ```bash python bench/bench_gate.py \ --dataset bench/corpus_core.txt \ --duckling-url http://localhost:8000/parse \ --iterations 20 \ --required-ratio 0.95 ``` -------------------------------- ### Build Distribution Artifacts Source: https://github.com/akoumjian/datefinder/blob/master/RELEASE.md Build wheel and sdist artifacts using maturin for the Rust kernel. ```bash python -m pip install --upgrade maturin maturin build --release --manifest-path rust/datefinder-kernel/Cargo.toml --out dist maturin sdist --manifest-path rust/datefinder-kernel/Cargo.toml --out dist ``` -------------------------------- ### Run datefinder via CLI Source: https://github.com/akoumjian/datefinder/blob/master/docs/index.rst Execute date extraction directly from the command line using the datefinder entrypoint or as a module. ```sh datefinder --json "tomorrow and 2024-12-10" ``` ```sh python -m datefinder --engine extract --json --reference "2026-03-18T00:00:00+00:00" "in 3 days" ``` -------------------------------- ### Initialize Disqus Comments Source: https://github.com/akoumjian/datefinder/blob/master/tests/seattle_weekly.html Configures and loads the Disqus comment system using specific page identifiers and URLs. ```javascript var disqus_shortname = 'sea-weekly'; // required: replace example with your forum shortname var disqus_identifier = '160106-Music-ElectricEye-SEA-962554'; // please use the combo of "SLUG-CMSID" var disqus_title = 'Electric Eye: The Top 5 Parties of 2015'; // please use the DTI web head var disqus_url = 'http://www.seattleweekly.com/home/962554-129/electric-eye-the-top-5-parties'; // please use the story's canonical URL /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); ``` -------------------------------- ### Generate conformance and differential reports Source: https://github.com/akoumjian/datefinder/blob/master/docs/index.rst Executes scripts to build a corpus from legacy tests and generate reports comparing legacy and v2 behavior. ```sh python scripts/build_conformance_corpus.py python scripts/diff_legacy_v2.py ``` -------------------------------- ### Extract Datetime Strings with find_dates Source: https://github.com/akoumjian/datefinder/blob/master/docs/_build/html/_modules/datefinder.html Main entry point for extracting datetime objects from text, supporting optional source text and index returns. ```python [docs]def find_dates(text, source=False, index=False, strict=False): """ Extract datetime strings from text :param text: A string that contains one or more natural language or literal datetime strings :type text: str|unicode :param source: Return the original string segment :type source: boolean :param index: Return the indices where the datetime string was located in text :type index: boolean :param strict: Only return datetimes with complete date information. For example: `July 2016` of `Monday` will not return datetimes. `May 16, 2015` will return datetimes. :type strict: boolean :return: Returns a generator that produces :mod:`datetime.datetime` objects, or a tuple with the source text and index, if requested """ date_finder = DateFinder() return date_finder.find_dates(text, source=source, index=index, strict=strict) ``` -------------------------------- ### Validate Code and Parser Behavior Source: https://github.com/akoumjian/datefinder/blob/master/RELEASE.md Run tests and generate conformance reports to ensure parser consistency. ```bash pytest -q python scripts/build_conformance_corpus.py python scripts/diff_legacy_v2.py --min-v2-legacy-ratio 1.0 ``` -------------------------------- ### Date Extraction and Parsing Methods Source: https://github.com/akoumjian/datefinder/blob/master/docs/_build/html/_modules/datefinder.html Core methods for finding, cleaning, and converting date strings into datetime objects. ```python def find_dates(self, text, source=False, index=False, strict=False): for date_string, indices, captures in self.extract_date_strings(text, strict=strict): as_dt = self.parse_date_string(date_string,captures) if as_dt is None: ## Dateparser couldn't make heads or tails of it ## move on to next continue returnables = (as_dt,) if source: returnables = returnables + (date_string,) if index: returnables = returnables + (indices,) if len(returnables) == 1: returnables = returnables[0] yield returnables ``` ```python def _find_and_replace(self, date_string, captures): """ replace strings which helped us do matching but dateparser can't read. also replace captured timezones and return tz_string separately so that dateparser.parse doesn't do weirdo auto tzoffset conversions https://github.com/scrapinghub/dateparser/blob/master/dateparser/timezone_parser.py#L19 :warning: when multiple tz matches exist the last sorted capture will trump :param date_string: :return: date_string, tz_string """ # add timezones to replace cloned_replacements = copy.copy(self.REPLACEMENTS) # don't mutate for tz_string in captures.get('timezones',[]): cloned_replacements.update({tz_string:''}) date_string = date_string.lower() for key, replacement in cloned_replacements.items(): date_string = re.sub(key,replacement,date_string,flags=re.IGNORECASE) return date_string, self._pop_tz_string(sorted(captures.get('timezones',[]))) ``` ```python def _pop_tz_string(self, list_of_timezones): try: tz_string = list_of_timezones.pop() # make sure it's not a timezone we # want replaced with better abbreviation return self.TIMEZONE_REPLACEMENTS.get(tz_string, tz_string) except IndexError: return '' ``` ```python def _add_tzinfo(self, datetime_obj, tz_string): """ take a naive datetime and add dateutil.tz.tzinfo object :param datetime_obj: naive datetime object :return: datetime object with tzinfo """ if datetime_obj is None: return None tzinfo_match = tz.gettz(tz_string) return datetime_obj.replace(tzinfo=tzinfo_match) ``` ```python def parse_date_string(self, date_string, captures): # replace tokens that are problematic for dateparser date_string, tz_string = self._find_and_replace(date_string, captures) ## One last sweep after removing date_string = date_string.strip(self.STRIP_CHARS) ## Match strings must be at least 3 characters long ## < 3 tends to be garbage if len(date_string) < 3: return None as_dt = dateparser.parse(date_string) if tz_string: as_dt = self._add_tzinfo(as_dt,tz_string) return as_dt ``` ```python def extract_date_strings(self, text, strict=False): """ Scans text for possible datetime strings and extracts them source: also return the original date string index: also return the indices of the date string in the text strict: Strict mode will only return dates sourced with day, month, and year """ for match in self.DATE_REGEX.finditer(text): match_str = match.group(0) indices = match.span(0) ## Get individual group matches captures = match.capturesdict() time = captures.get('time') digits = captures.get('digits') digits_modifiers = captures.get('digits_modifiers') days = captures.get('days') months = captures.get('months') timezones = captures.get('timezones') delimiters = captures.get('delimiters') time = captures.get('time)') time_periods = captures.get('time_periods') extra_tokens = captures.get('extra_tokens') ``` -------------------------------- ### Extract dates from text Source: https://github.com/akoumjian/datefinder/blob/master/docs/_build/html/index.html Demonstrates importing the module and using find_dates to iterate over extracted datetime objects. ```python In [1]: string_with_dates = """ ...: ... ...: entries are due by January 4th, 2017 at 8:00pm ...: ... ...: created 01/15/2005 by ACME Inc. and associates. ...: ... ...: """ In [2]: import datefinder In [3]: matches = datefinder.find_dates(string_with_dates) In [4]: for match in matches: ...: print match ...: 2017-01-04 20:00:00 2005-01-15 00:00:00 ``` -------------------------------- ### Extract dates via CLI Source: https://github.com/akoumjian/datefinder/blob/master/docs/index.rst Use the command line interface to process text and output results in JSON format. ```sh datefinder --reference "2026-03-19T12:00:00+00:00" --json \ "Meeting tomorrow; launch on 2024-11-03 18:00 UTC." ``` -------------------------------- ### Token Replacement Configuration Source: https://github.com/akoumjian/datefinder/blob/master/docs/_build/html/_modules/datefinder.html Dictionaries defining tokens to be stripped or replaced during the date parsing process. ```python REPLACEMENTS = { "standard": "", "daylight": "", "savings": "", "time": "", "date": "", "by": "", "due": "", "on": "", ",": "", } TIMEZONE_REPLACEMENTS = { "pacific": "PST", "eastern": "EST", "mountain": "MST", "central": "CST", } ``` -------------------------------- ### Validate API Contracts Source: https://github.com/akoumjian/datefinder/blob/master/RELEASE.md Verify versioning and date parsing functionality using both default and legacy engines. ```python python - <<'PY' import datefinder print("version:", datefinder.__version__) print("default:", list(datefinder.find_dates("tomorrow and 2024-12-10"))) print("legacy:", list(datefinder.find_dates("June 2018", engine="legacy"))) print("legacy-explicit:", list(datefinder.find_dates_legacy("June 2018"))) PY ``` -------------------------------- ### Enforce benchmark speed gate Source: https://github.com/akoumjian/datefinder/blob/master/bench/README.md Validates performance against a Duckling baseline using a required ratio threshold. ```bash python bench/bench_gate.py \ --dataset bench/corpus_core.txt \ --duckling-url http://localhost:8000/parse \ --iterations 10 \ --required-ratio 0.95 ``` -------------------------------- ### Regex Pattern Definitions Source: https://github.com/akoumjian/datefinder/blob/master/docs/_build/html/_modules/datefinder.html Compiled regular expressions used for identifying date and time patterns in input text. ```python DATE_REGEX = re.compile(DATES_PATTERN, re.IGNORECASE | re.MULTILINE | re.UNICODE | re.DOTALL | re.VERBOSE) TIME_REGEX = re.compile(TIME_PATTERN, re.IGNORECASE | re.MULTILINE | re.UNICODE | re.DOTALL | re.VERBOSE) ``` -------------------------------- ### Extract dates from a string using Python Source: https://github.com/akoumjian/datefinder/blob/master/docs/index.rst Use find_dates to identify and parse date strings within a larger text block. ```python In [1]: string_with_dates = """ ...: ... ...: entries are due by January 4th, 2017 at 8:00pm ...: ... ...: created 01/15/2005 by ACME Inc. and associates. ...: ... ...: """ In [2]: import datefinder In [3]: matches = datefinder.find_dates(string_with_dates) In [4]: for match in matches: ...: print(match) ...: 2017-01-04 20:00:00 2005-01-15 00:00:00 ``` -------------------------------- ### DateFinder Class Definition Source: https://github.com/akoumjian/datefinder/blob/master/docs/_build/html/_modules/datefinder.html The core class for locating dates, containing regex patterns for digits, timezones, and time formats. ```python import copy import dateparser import regex as re from dateutil import tz class DateFinder(): """ Locates dates in a text """ DIGITS_MODIFIER_PATTERN = '\d+st|\d+th|\d+rd|first|second|third|fourth|fifth|sixth|seventh|eighth|nineth|tenth|next|last' DIGITS_PATTERN = '\d+' DAYS_PATTERN = 'monday|tuesday|wednesday|thursday|friday|saturday|sunday|mon|tue|tues|wed|thur|thurs|fri|sat|sun' MONTHS_PATTERN = 'january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|may|jun|jul|aug|sep|sept|oct|nov|dec' TIMEZONES_PATTERN = 'ACDT|ACST|ACT|ACWDT|ACWST|ADDT|ADMT|ADT|AEDT|AEST|AFT|AHDT|AHST|AKDT|AKST|AKTST|AKTT|ALMST|ALMT|AMST|AMT|ANAST|ANAT|ANT|APT|AQTST|AQTT|ARST|ART|ASHST|ASHT|AST|AWDT|AWST|AWT|AZOMT|AZOST|AZOT|AZST|AZT|BAKST|BAKT|BDST|BDT|BEAT|BEAUT|BIOT|BMT|BNT|BORT|BOST|BOT|BRST|BRT|BST|BTT|BURT|CANT|CAPT|CAST|CAT|CAWT|CCT|CDDT|CDT|CEDT|CEMT|CEST|CET|CGST|CGT|CHADT|CHAST|CHDT|CHOST|CHOT|CIST|CKHST|CKT|CLST|CLT|CMT|COST|COT|CPT|CST|CUT|CVST|CVT|CWT|CXT|ChST|DACT|DAVT|DDUT|DFT|DMT|DUSST|DUST|EASST|EAST|EAT|ECT|EDDT|EDT|EEDT|EEST|EET|EGST|EGT|EHDT|EMT|EPT|EST|ET|EWT|FET|FFMT|FJST|FJT|FKST|FKT|FMT|FNST|FNT|FORT|FRUST|FRUT|GALT|GAMT|GBGT|GEST|GET|GFT|GHST|GILT|GIT|GMT|GST|GYT|HAA|HAC|HADT|HAE|HAP|HAR|HAST|HAT|HAY|HDT|HKST|HKT|HLV|HMT|HNA|HNC|HNE|HNP|HNR|HNT|HNY|HOVST|HOVT|HST|ICT|IDDT|IDT|IHST|IMT|IOT|IRDT|IRKST|IRKT|IRST|ISST|IST|JAVT|JCST|JDT|JMT|JST|JWST|KART|KDT|KGST|KGT|KIZST|KIZT|KMT|KOST|KRAST|KRAT|KST|KUYST|KUYT|KWAT|LHDT|LHST|LINT|LKT|LMT|LMT|LMT|LMT|LRT|LST|MADMT|MADST|MADT|MAGST|MAGT|MALST|MALT|MART|MAWT|MDDT|MDST|MDT|MEST|MET|MHT|MIST|MIT|MMT|MOST|MOT|MPT|MSD|MSK|MSM|MST|MUST|MUT|MVT|MWT|MYT|NCST|NCT|NDDT|NDT|NEGT|NEST|NET|NFT|NMT|NOVST|NOVT|NPT|NRT|NST|NT|NUT|NWT|NZDT|NZMT|NZST|OMSST|OMST|ORAST|ORAT|PDDT|PDT|PEST|PET|PETST|PETT|PGT|PHOT|PHST|PHT|PKST|PKT|PLMT|PMDT|PMMT|PMST|PMT|PNT|PONT|PPMT|PPT|PST|PT|PWT|PYST|PYT|QMT|QYZST|QYZT|RET|RMT|ROTT|SAKST|SAKT|SAMT|SAST|SBT|SCT|SDMT|SDT|SET|SGT|SHEST|SHET|SJMT|SLT|SMT|SRET|SRT|SST|STAT|SVEST|SVET|SWAT|SYOT|TAHT|TASST|TAST|TBIST|TBIT|TBMT|TFT|THA|TJT|TKT|TLT|TMT|TOST|TOT|TRST|TRT|TSAT|TVT|ULAST|ULAT|URAST|URAT|UTC|UYHST|UYST|UYT|UZST|UZT|VET|VLAST|VLAT|VOLST|VOLT|VOST|VUST|VUT|WARST|WART|WAST|WAT|WDT|WEDT|WEMT|WEST|WET|WFT|WGST|WGT|WIB|WIT|WITA|WMT|WSDT|WSST|WST|WT|XJT|YAKST|YAKT|YAPT|YDDT|YDT|YEKST|YEKST|YEKT|YEKT|YERST|YERT|YPT|YST|YWT|zzz' ## explicit north american timezones that get replaced NA_TIMEZONES_PATTERN = 'pacific|eastern|mountain|central' ALL_TIMEZONES_PATTERN = TIMEZONES_PATTERN + '|' + NA_TIMEZONES_PATTERN DELIMITERS_PATTERN = '[/\:\-\,\s\_\+\@]+' TIME_PERIOD_PATTERN = 'a\.m\.|am|p\.m\.|pm' ## can be in date strings but not recognized by dateparser EXTRA_TOKENS_PATTERN = 'due|by|on|standard|daylight|savings|time|date|year|of|to|until|z|at' ## Time pattern is used independently, so specified here. TIME_PATTERN = """ (?P