How to write a simple rule-based datetime range parser in python?

The dateparser package fails to detect texts like the following and generate a date range 'last 2 weeks of 2020': Should return 18th December 2020 - 31st December 2020 'first three quarters of 2018': Should return 1st January 2018 - 30th September 2018 'last 3 days of September 2020': Should return 28th September - 30th September 2020

Is there a simple rule-based parser in python that can detect the words last, first, 2, 3, 2020, 2018 etc. and give a date range in the datetime format? I do not want to rely on heavy packages like SUtime to achieve this.

Topic regex parsing nlp

Category Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.