I have an NLP task which has 3 components. I tried few methods (mentioned in the end) but I am not able to get good results.
- Detecting temporal expressions in a statement
- Classifying then as either time stamp, time trigger or time period.
- Equate each expression to its DateTime equivalent.
Example:
Taking reference time as 2000 hrs, Thursday, July 20th, 2015
time stamp :
I want to book a cab 20 minutes from now
Answer: [tStamp]2020 hrs, Thursday, July 20th
time trigger :
Any timer after 2 is fine
Answer: [tTrigger] - start - 0200 hrs,July 21st 2015
Before 5 is good
[tTrigger] - start - now, 2000hrs, July 20th, 2015 : end - 0500 hrs, July 21st, 2015
time period:
I was working in san francisco for last two years
[tPeriod] - 2013-2015
I tried to do this with regex gives very generic results. Second option I read was to try to make the model learn from Naive Bays classifier but naive bays learns exact words and not phrases.
I came across parsedatetime 1.5 package in python which is awesome to some extent in converting phrases to timestamps which solves 3. of mentioned problem but still I am not able to solve detention and classification.