{"id":31289214,"url":"https://github.com/ishirav/date-detector","last_synced_at":"2025-09-24T13:56:30.662Z","repository":{"id":62566874,"uuid":"115305854","full_name":"ishirav/date-detector","owner":"ishirav","description":"A Python module for scanning text and extracting dates from it, regardless of language or date format","archived":false,"fork":false,"pushed_at":"2017-12-30T16:20:49.000Z","size":25,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-03T23:35:42.424Z","etag":null,"topics":["dates","parser","python"],"latest_commit_sha":null,"homepage":"","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/ishirav.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}},"created_at":"2017-12-25T04:11:49.000Z","updated_at":"2025-07-26T19:39:52.000Z","dependencies_parsed_at":"2022-11-03T16:30:24.699Z","dependency_job_id":null,"html_url":"https://github.com/ishirav/date-detector","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ishirav/date-detector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishirav%2Fdate-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishirav%2Fdate-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishirav%2Fdate-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishirav%2Fdate-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ishirav","download_url":"https://codeload.github.com/ishirav/date-detector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishirav%2Fdate-detector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276761907,"owners_count":25700223,"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-24T02:00:09.776Z","response_time":97,"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":["dates","parser","python"],"created_at":"2025-09-24T13:56:29.372Z","updated_at":"2025-09-24T13:56:30.657Z","avatar_url":"https://github.com/ishirav.png","language":"Python","readme":"Overview\n========\nThe purpose of this module is to efficiently find dates inside text, in almost any format. For example:\n\n```python\ntext = \"\"\"\n                         24/5/2017\n   Dear Morty,\n   I will be visiting New York between December 22nd, 2017 and January 1, 2018.\n   Yours,\n   Ben\n\"\"\"\n\nfrom date_detector import Parser\nparser = Parser()\nfor match in parser.parse(text):\n     print(match)\n\n\u003e\u003e\u003e Match(date=datetime.date(2017, 5, 24), offset=26, text='24/5/2017')\n\u003e\u003e\u003e Match(date=datetime.date(2017, 12, 22), offset=90, text='December 22nd, 2017')\n\u003e\u003e\u003e Match(date=datetime.date(2018, 1, 1), offset=114, text='January 1, 2018')\n```\n\nHow does it work?\n-----------------\nThe text is broken up into tokens, which are sequences of characters from a single type: digits, letters, whitespace or other. The algorithm then tries to find sequences of tokens which might be a part of a date, for example `2017`, `09` or `December`. Any sequence that can be interpreted as a valid date is returned. Some sequences can be interpreted as as several different dates, in which case they are all returned (for example: `01/02/03`).\n\nSimilar projects\n----------------\n* datefinder (https://github.com/akoumjian/datefinder)\n* dateparser (https://github.com/scrapinghub/dateparser)\n* date-extractor (https://github.com/DanielJDufour/date-extractor)\n* parsedatetime (https://github.com/bear/parsedatetime)\n* python-natty (https://github.com/eadmundo/python-natty)\n\nUsage\n=====\nTo look for dates in a text, first construct a `Parser`:\n```python\nfrom date_detector import Parser\nparser = Parser()\n```\nThen use the `parse` method to get a generator returning `Match` objects. Each match has three fields: `date`, `offset`, and `text`.\n```python\nfor match in parser.parse(text):\n    # Do something with match.date\n```\nParser options\n--------------\nWhen constructing a `Parser` instance, you can pass several options:\n* `dictionaries`: a list of language codes of dictionaries to use (default: [\"en\"]). See below for more information about dictionaries.\n* `month_before_day`: whether to prefer M/D/Y dates (American) over D/M/Y (default: `False`).\n* `min_date`: the minimal date to consider (default: 1950-01-01).\n* `max_date`: the maximal date to consider (default: 2049-12-31).\n* `tokenizer_class`: the class to use for tokenizing text (default: `Tokenizer`)\n\nLanguage Dictionaries\n---------------------\nCurrently the following languages are supported:\n* English (en)\n* Hebrew (he)\n\nTo support additional languages, dictionary files need to be added. They should be located under the `date_detector/dictionaries` directory. Take a look at the existing dictionaries to see how they are formatted.\n\nNote: dictionaries are case-insensitive.\n\nContributing\n============\nAfter checking out the code, build the project by running the following commands:\n\n    easy_install -U infi.projector\n    projector devenv build --use-isolated-python\n\nRunning tests\n-------------\nTo run the tests:\n\n    cd src\n    ../bin/nosetests\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fishirav%2Fdate-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fishirav%2Fdate-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fishirav%2Fdate-detector/lists"}