简体   繁体   中英

NLP approaches to identify dates/time expressions in text

I need to develop an application which identifies the date inside the given text using some NLP approach. Let's assume I have a data in DB with dates column "from", "to" and if the text is below,

Get data between 1st August and 15th August

I need to identify the dates and form the query to retrieve the data. I used Natty NLP and I was able to identify the dates. But I'm stuck for more complex time expressions like:

Get data uploaded next week
Get data uploaded last week

Here for the first one I need to identify next week Monday's date and Sunday's date and form the query same for the 2nd one. But with Natty it gives me next week from today's date. What other solutions exist? Or do I need to manipulate the expression by coding? I am using Java.

Your questions is a bit confusing, but I guess you want to achieve two things:

  1. Identify words that represent a time expression

  2. Map these words to a formal machine-readable representation

If that is what you need check the duckling framework , it identifies time expressions, and it normalise them into a single unique formal date representation. Note that you need to pass a reference date, for ambiguous time expressions.

You can run it as a service and call it from your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM