1

我正在构建一个api.ai代理,但我很难date-period正确理解无界参数。

例如:

  • before 2000被解释为["2000-01-01/2000-12-31"]
  • after 1999被解释为["1999-01-01/1999-12-31"]
  • after January 2007被解释为["2007-01-01/2007-01-31"]

这让我认为只有日期(2000/ January 2007)用于计算日期范围,忽略副词(before/ after)。

有没有办法理解before 2000["0000-01-01/2000-01-01"](或者至少["1970-01-01/2000-12-31"]是基于 Epoch 的)?

4

1 回答 1

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.

于 2017-08-27T10:18:38.907 回答