3
$\begingroup$

Let's say I have a sentences that goes like this:

Hi, how are the kids. I will be going to Los Angeles next Friday and will come back the following Monday.

If the date today is October 16 (Wednesday), then next Friday would be October 25th. The sentence later says that the person will come back the following Monday. We know they mean the Monday after next Friday so the 28th of October. If I use the dateutil library, then it would classify both Friday and Monday, but it won't take into account the next before Friday or that we are saying the following Monday.

I was thinking of creating a solution that will split the sentence up into words and then check what comes before actual dates. However, I'd like to capture not only this type of adverb of time, but others as well. For example, next day, this Thursday, 2 days from today, etc. How do I build a framework that will detect these types of date texts and then print out their respective dates?

$\endgroup$
1
$\begingroup$

If you have enough data to train a machine learning model, I believe LSTMs are what you need. Long short-term memory (LSTM) is an artificial recurrent neural network (RNN) architecture used in the field of deep learning.

LSTM networks are well-suited to classifying, processing and making predictions based on time series data, since there can be lags of unknown duration between important events in a time series.

Initially, you can use Pandas LSTM library, you design it from scratch by using Python Tensorflow library. Look at the following links:

Wikipedia

LSTM in python tutorial

| improve this answer | |
$\endgroup$
0
$\begingroup$

Only if you have enough amount of data then LSTM would work here.

You can also look for building a parswr that will look for the words related with date in sentence for example the days and then relate with the previous and next words to find out the exact relation. This parser solution would be easier because there is very limited number of stocks in the day names.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.