Skip to content

Commit

Permalink
IMP修改【duration+内】interval范围等同【未来+duration】 (#208)
Browse files Browse the repository at this point in the history
Co-authored-by: zhangsonglei <[email protected]>
  • Loading branch information
zhangsonglei and zhangsonglei authored Oct 20, 2023
1 parent 61f8e43 commit 8e91e92
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,15 @@ trait Rules extends DimRules {
*/
val ruleInAInterval = Rule(
name = "in a <duration>",
pattern = List(isNotLatentDuration.predicate, "".regex),
pattern = List(isNotLatentDuration.predicate, "[之以]?".regex),
prod = tokens {
case Token(Duration, DurationData(value, grain, _, _, _)) :: _ =>
tt(cycleN(notImmediate = false, grain, value, NoGrain))
val (g, v) = grain match {
case Month => (Day, value * 30)
case Week => (Day, value * 7)
case _ => (grain, value)
}
tt(cycleN(notImmediate = false, g, v))
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ object Examples extends DimExamples {
LocalDateTime.of(2016, 1, 1, 0, 0, 0),
Year
),
List("下三年", "未来三年")
List("下三年", "未来三年", "三年内")
),
(
localDateTimeInterval(
Expand Down Expand Up @@ -216,7 +216,7 @@ object Examples extends DimExamples {
LocalDateTime.of(2013, 2, 12, 4, 45, 0),
Minute
),
List("未来一刻钟", "之后一刻钟", "向后一刻钟", "往后一刻钟")
List("未来一刻钟", "之后一刻钟", "向后一刻钟", "往后一刻钟", "一刻钟以内")
)
)

Expand Down Expand Up @@ -271,15 +271,15 @@ object Examples extends DimExamples {
LocalDateTime.of(2013, 3, 5, 0, 0, 0),
Day
),
List("接下来三周")
List("接下来三周", "三周内")
),
(
localDateTimeInterval(
LocalDateTime.of(2013, 2, 12, 0, 0, 0),
LocalDateTime.of(2013, 2, 19, 0, 0, 0),
Day
),
List("未来一周")
List("未来一周", "一周内")
),
(
datetime(LocalDateTime.of(2013, 3, 5, 4, 30, 0), Second),
Expand Down

0 comments on commit 8e91e92

Please sign in to comment.