0

I am building an api.ai agent, but I'm struggling to get unbounded date-period parameters understood correctly.

For example:

  • before 2000 is interpreted as ["2000-01-01/2000-12-31"]
  • after 1999 is interpreted as ["1999-01-01/1999-12-31"]
  • after January 2007 is interpreted as ["2007-01-01/2007-01-31"]

This makes me think only the date (2000/January 2007) is used for calculating the date-range, ignoring the adverb (before/after).

Is there a way to understand before 2000 as ["0000-01-01/2000-01-01"] (or at least ["1970-01-01/2000-12-31"] if Epoch-based)?

Community
  • 1
  • 1
PLNech
  • 3,087
  • 1
  • 23
  • 52

1 Answers1

1

The before and after isn't matched, you are right.

You can add a custom entity, like temporal preposition, to deal with this.

before: prior to, previous to, earlier than, preparatory to, in preparation for, preliminary to, in anticipation of, in expectation of; in advance of, ahead of, leading up to

after: following, subsequent to, succeeding, at the close/end of, in the wake of, later than

You may create a composite entity (see in the docs). There you can compose the new preposition entity with the sys.date entity. So you will bound them together logically.

MrEbbinghaus
  • 963
  • 7
  • 15
  • So if I get you right, I should send this new entity to my fulfilment webhook and handle `temporal modifiers` in its code? I would expect a more direct solution, but I'll accept your answer if I don't get any! – PLNech Aug 27 '17 at 10:32
  • 1
    Since you can't change the behavior of system entities.. You have to do something own. Additionally you can create a composite entity. I'll add this to the answer. – MrEbbinghaus Aug 27 '17 at 10:40