Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMP修改【duration+内】interval范围等同【未来+duration】 #208

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading