Member-only story

How to Extract Date Information from a String with Python? (Basic NLP in 3 Minutes)

Machine Learning Quick Reads
3 min readMar 13, 2021

--

We will explore how to use the Regular Expressions Regex library in python to perform simple NLP / text mining tasks such as extracting date information from a string.

Photo by Mark Rasmuson on Unsplash

There are many conventions to write a date, e.g.:

Photo by Behnam Norouzi on Unsplash

24–11–2020
24/11/2020
24/11/20
11/24/2020
24 Nov 2020
24 November 2020
Nov 24,2020
November 24, 2020
5–11–2020
5/11/2020
5/11/20
11/5/2020
5 Nov 2020
5 November 2020
Nov 5,2020
24–9–2020
24/9/2020
24/9/20
9/24/2020
24 Sep 2020
24 September 2020

If any one of the above dates appears in a sting,

how can we extract date information…

--

--

Machine Learning Quick Reads
Machine Learning Quick Reads

Written by Machine Learning Quick Reads

Lead Author: Yaokun Lin, Actuary | ML Practitioner | Apply Tomorrow's Technology to Solve Today's Problems

No responses yet