{"id":24085109,"url":"https://github.com/mapado/datection","last_synced_at":"2025-09-03T01:38:44.928Z","repository":{"id":63574337,"uuid":"296622796","full_name":"mapado/datection","owner":"mapado","description":"Detect and normalize temporal expressions","archived":false,"fork":false,"pushed_at":"2023-09-11T04:31:07.000Z","size":864,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-21T11:03:36.025Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapado.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-09-18T13:02:56.000Z","updated_at":"2022-11-18T08:09:49.000Z","dependencies_parsed_at":"2025-07-08T04:25:30.337Z","dependency_job_id":"d829cbd6-afc5-4c9c-a878-12c507648956","html_url":"https://github.com/mapado/datection","commit_stats":null,"previous_names":[],"tags_count":194,"template":false,"template_full_name":null,"purl":"pkg:github/mapado/datection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapado%2Fdatection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapado%2Fdatection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapado%2Fdatection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapado%2Fdatection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapado","download_url":"https://codeload.github.com/mapado/datection/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapado%2Fdatection/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273377150,"owners_count":25094526,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-10T01:01:36.552Z","updated_at":"2025-09-03T01:38:44.901Z","avatar_url":"https://github.com/mapado.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# datection\nMultilingual library for normalisation and rendering of temporal expressions.\n\n## How to use it?\n\n### Normalisation\nThe normalisation step extracts temporal expressions from a text, using a language specific grammar, and exports them into a short, storable format.\n\n#### Example\n\n```python\n\u003e\u003e\u003e import datection\n\n\u003e\u003e\u003e from datetime import datetime\n\n# simple datetime\n\u003e\u003e\u003e datection.export(u\"Le 4 mars 2015 à 18h30\", \"fr\")\n[{'duration': 0,\n  'rrule': 'DTSTART:20150304\\nRRULE:FREQ=DAILY;COUNT=1;BYMINUTE=30;BYHOUR=18',\n  'span': (0, 23)}]\n\n# date interval with a recurrent exclusion\n\u003e\u003e\u003e datection.export(u\"Du 5 au 29 mars 2015, sauf le lundi\", \"fr\")\n[{'duration': 1439,\n  'excluded': ['DTSTART:20150305\\nRRULE:FREQ=DAILY;BYDAY=MO;BYHOUR=0;BYMINUTE=0;UNTIL=20150329T000000'],\n  'rrule': 'DTSTART:20150305\\nRRULE:FREQ=DAILY;BYHOUR=0;BYMINUTE=0;INTERVAL=1;UNTIL=20150329',\n  'span': (0, 36)}]\n\n# yearless date, with argument date reference\n\u003e\u003e\u003e datection.export(u\"Le 4 mars à 18h30\", \"fr\", reference=datetime(2015, 1, 1))\n[{'duration': 0,\n  'rrule': 'DTSTART:20150304\\nRRULE:FREQ=DAILY;COUNT=1;BYMINUTE=30;BYHOUR=18',\n  'span': (0, 18)}]\n\n# past datetime\n\u003e\u003e\u003e datection.export(u\"Le 4 mars 1990 à 18h30\", \"fr\")\n[]\n\n# past datetime and authorized past exports\n\u003e\u003e\u003e datection.export(u\"Le 4 mars 1990 à 18h30\", \"fr\", only_future=False)\n[{'duration': 0,\n  'rrule': 'DTSTART:19900304\\nRRULE:FREQ=DAILY;COUNT=1;BYMINUTE=30;BYHOUR=18',\n  'span': (0, 18)}]\n\n# continuous datetime interval\n\u003e\u003e\u003e datection.export(u\"Du 5 avril à 22h au 6 avril 2015 à 8h\", \"fr\")\n[{'continuous': True,\n  'duration': 600,\n  'rrule': 'DTSTART:20150405\\nRRULE:FREQ=DAILY;BYHOUR=22;BYMINUTE=0;INTERVAL=1;UNTIL=20150406T235959',\n  'span': (0, 38)}]\n\n```\n\n#### Export format\n\nThe export format contains 6 different items:\n\n* ``rrule``: a parseable expression, generating all the datetimes described by the expression. See the [python-dateutil](http://labix.org/python-dateutil) documentation and [RFC 2445](http://www.ietf.org/rfc/rfc2445.txt) for more details\n* ``duration``: the duration (in minutes) between each start datetime, egenrated by the rrule, and its end counterpart:\n\n  - 8h → 9h: duration = 60\n  - at 8pm: duration = 0\n  - all day: duration = 1439\n\n* ``span``: the character interval defining where the temporal expression was found in the text\n* ``continuous``: boolean flag, indicating if the time interval is continuous or not.\n* ``excluded``: a list of rrules exclusion rrules.\n* ``unlimited``: if True, the rrules are considered as infinite.\n\n### Rendering\n\nThe rendering step renders the export format in human readable formats, in a specific language.\n\nSeveral formats can be chosen from:\n\n * default\n * short: shorter than the default output, omits some information when possible (the year, for example), and contextualize the result\n * place: display the export as opening hours\n * SEO: synthetic information, only displaying the month and the year. Used for SEO purposes.\n\n```python\n\u003e\u003e\u003e import datection\n\u003e\u003e\u003e schedule = datection.export(u\"Le 5 mars 2015, 15h30 - 16h\", \"fr\")\n\n# default\n\u003e\u003e\u003e datection.display(schedule, 'fr')\nu'Le 5 mars 2015 de 15 h 30 à 16 h'\n\n# short\n\u003e\u003e\u003e datection.display(schedule, 'fr', short=True)\nu'Le 5 mars de 15 h 30 à 16 h'\n\u003e\u003e\u003e datection.display(schedule, 'fr', short=True, reference=date(2015, 3, 3))\nu'Ce jeudi de 15 h 30 à 16 h'\n\u003e\u003e\u003e datection.display(schedule, 'fr', short=True, reference=date(2015, 3, 4))\nu'Demain de 15 h 30 à 16 h'\n\u003e\u003e\u003e datection.display(schedule, 'fr', short=True, reference=date(2015, 3, 5))\nu\"Aujourd'hui de 15 h 30 ç 16 h\"\n\n# SEO\n\u003e\u003e\u003e datection.display(schedule, 'fr', seo=True)\nu'mars 2015'\n\n# opening hours / place\n\u003e\u003e\u003e schedule = datection.export(u\"Du lundi au vendredi de 8h à 12h30 et de 14h à 19h30\", \"fr\")\n\u003e\u003e\u003e datection.display(schedule, 'fr', place=True)\nu\"\"\"Lundi de 8 h à 12 h 30 et de 14 h à 19 h 30\nMardi de 8 h à 12 h 30 et de 14 h à 19 h 30\nMercredi de 8 h à 12 h 30 et de 14 h à 19 h 30\nJeudi de 8 h à 12 h 30 et de 14 h à 19 h 30\nVendredi de 8 h à 12 h 30 et de 14 h à 19 h 30\n\"\"\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapado%2Fdatection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapado%2Fdatection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapado%2Fdatection/lists"}