4

I've been experimenting with a number of NLP text parsers, but have found that most fail at even some of the simplest tasks that occur in actual texts (aren't preprocessed to show how "great" the systems are. An example is the following:

From Sundays until Thursdays every week

I've yet to find a single parser that can parse this correctly. I've tried with quite a number including Stanford's sutime. Can anyone recommend software that can handle natural text dates?

user2694306
  • 3,832
  • 10
  • 47
  • 95
  • 1
    How are you expecting this sentence to provide a date? Even implicitly, this sentence has no date. If you simply want to extract the elements that are related to the calendar (i.e. day, hour, month, etc.), then you should look into semantic role labeling. – Chthonic Project Aug 12 '14 at 00:32
  • possible duplicate of [How do you think the "Quick Add" feature in Google Calendar works?](http://stackoverflow.com/questions/2959458/how-do-you-think-the-quick-add-feature-in-google-calendar-works) – Aditya Mukherji Aug 12 '14 at 02:29
  • I tacked in a question which I think yours is a dupe of.. Short answer is that there probably isn't any off-the-shelf solution for you to use, but its not hard for you to build something that gets the job done 80% of the time in the real world (i.e. with realistic human input) – Aditya Mukherji Aug 12 '14 at 02:31
  • 1
    Which other NLP time parsers have you tried so that we don't recommend thoe same? If no off the shelf tool solves your problem (as it often happens), you can consider extending existing ones by adding custom rules to fix where they fail... Some other ones I've tried asides SUTime are: [PyTimeParse](https://github.com/wroberts/pytimeparse) [NattyDateparser](http://natty.joestelmach.com/) Then for additional information on implementing a time expression parser, [this paper on the SUTime implementation](http://web.stanford.edu/~jurafsky/2012-naacl-temporal.pdf) might be useful – pelumi Jan 21 '15 at 13:08

1 Answers1

1

I did not find one either when I went looking so I wrote my own. It's part of my natural language engine for .NET.

Here's what the demo shows when you enter that phrase (qualified to next week rather than every week - it can handle that too but it's infinite):

Sample output

Some comments:

1) Handling all possible english language temporal expressions is a huge task. I've been working on this problem for years to come up with a clean way to represent temporal expressions plus the many rules needed to parse english expressions of time.

2) In addition to finding a way to represent typical calendar date times and ranges of such, you also need ways to represent infinite sequences like 'every monday', and half-infinite sequences like 'every weekday before ...'. And then you'll need an algebra on top of that for combining temporal expressions.

3) Temporal expressions are often ambiguous in the English language and interpretation may vary from culture to culture.

4) The result must often be interpreted in the context of the sentence and/or the conversation history. "Who called Monday?" is a different Monday from "Remind me on Monday" and is different again from "Show me statistics for Monday".

Ian Mercer
  • 38,490
  • 8
  • 97
  • 133