Skip to main content

Extract dates from text

Project description

Build Status

Requirements Status

Hex.pm

date-extractor

date-extractor helps you extract dates from text

Installation

pip3 install date-extractor

Use

from date_extractor import extract_dates

text = "I arrived in that city on January 4, 1937"
dates = extract_dates(text)
# [datetime.datetime(1937, 1, 4, 0, 0, tzinfo=<UTC>)]

Date extractor also works on dates with hours, minutes and seconds:

from date_extractor import extract_date

date = extract_date("2018-06-07 16:31:54")
# datetime.datetime(2018, 6, 7, 16, 31, 54, tzinfo=<UTC>)

Returning Precision

from date_extractor import extract_date

text = "I arrived in that city in 1937"
date, precision = extract_date(text, return_precision=True)
# precision = 'year'

Features

Languages Supported
Arabic
Chinese (incl. Taiwan)
English
French
Sorani (Kurdish)
Turkish

Testing

To test the package run

python3 -m unittest date_extractor.tests.test

Support

Contact Daniel Dufour at daniel.j.dufour@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

date-extractor-5.1.5.tar.gz (16.7 kB view details)

Uploaded Source

File details

Details for the file date-extractor-5.1.5.tar.gz.

File metadata

  • Download URL: date-extractor-5.1.5.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for date-extractor-5.1.5.tar.gz
Algorithm Hash digest
SHA256 d6e0744c913fe72e5bd7494902dc0939d39aba5019327efa6c88532952d974a7
MD5 5ad0fcd1fb8af019ab9f71bf9eebd110
BLAKE2b-256 d84c1075398fdb6033186d3c673f49b50fee41637b87d219de62e804bc2e5b4c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page