In my Python3 project, I use SUTime together with Stanford CoreNLP to retrieve normalized time expression in the Timex3 standard. I access CoreNLP using pycorenlp. How can I parse the resulting time expression in Timex3 (part of the TimeML standard) into a datetime
or another temporal instance? I guess that datetime
is probably not sufficient since it cannot represent dateranges
For instance, Timex3 expressions are:
2017-11
referring to the whole month November
2017-10-07
referring to the whole seventh day in November
I've already tried parsing them with the Python library parsedatetime
, which is able to read almost any input containing a temporal expression, but the library is obviously not suited for the Timex3 format, i.e., it converts 2017-11
to a datetime of the current day (assuming it's November 2017):
>>> dateparser.parse('2017-11')
datetime.datetime(2017, 11, 27, 0, 0)
Isn't there a Python library for converting Timex3 expressions into datetime or something equivalent? Someone commented that 2017-11
cannot be converted into a datetime (as each only reflects a single points in time). But there's for example the pandas
library, which contains date ranges as well.