我正在构建一个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
)。
我正在构建一个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 的)?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.