Вы можете попробовать библиотеку dateparser
. Ссылка на документы
pip install dateparser
Пример:
from dateparser import parse
from dateparser.search import search_dates
print(parse('Tomorrow'))
print(parse('01/01/20'))
print(search_dates("I will go to the show tomorrow"))
print(search_dates("The client arrived to the office for the first time in March 3rd, 2004 and got serviced, after a couple of months, on May 6th 2004, the customer returned indicating a defect on the part"))
вывод :
2020-01-30 21:03:17.551187
2020-01-01 00:00:00
[('tomorrow', datetime.datetime(2020, 1, 30, 21, 6, 19, 545368))]
[('in March 3rd, 2004 and', datetime.datetime(2004, 3, 3, 0, 0)),
('on May 6th 2004', datetime.datetime(2004, 5, 6, 0, 0))]