From f382a22030e02e551b849951fdf75f6b40eb9d7f Mon Sep 17 00:00:00 2001 From: zhangsonglei Date: Wed, 28 Feb 2024 11:45:54 +0800 Subject: [PATCH] =?UTF-8?q?imp:=E6=94=AF=E6=8C=81=E5=90=8E=E9=9D=A2/?= =?UTF-8?q?=E5=B0=86=E6=9D=A5=E5=8D=81=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scala/com/xiaomi/duckling/dimension/time/Rules.scala | 4 ++-- .../com/xiaomi/duckling/dimension/time/Examples.scala | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/duckling-fork-chinese/core/src/main/scala/com/xiaomi/duckling/dimension/time/Rules.scala b/duckling-fork-chinese/core/src/main/scala/com/xiaomi/duckling/dimension/time/Rules.scala index 8cdda10..92d3e25 100644 --- a/duckling-fork-chinese/core/src/main/scala/com/xiaomi/duckling/dimension/time/Rules.scala +++ b/duckling-fork-chinese/core/src/main/scala/com/xiaomi/duckling/dimension/time/Rules.scala @@ -211,7 +211,7 @@ trait Rules extends DimRules { } ) - private val RecentPattern = "(上|下|近|这|前|后)|(后面|过去|未来|接下来|之前|往前|向前|今后|之后|往后|向后|最近)的?" + private val RecentPattern = "(上|下|近|这|前|后面?)|(过去|未来|接下来|之前|往前|向前|今后|之后|往后|向后|最近|将来)的?" /** * 时间区间: @@ -228,7 +228,7 @@ trait Rules extends DimRules { val s = if (StringUtils.isBlank(g1)) g2 else g1 // 月必须是x个月 s match { - case "下" | "后" | "接下来" | "未来" | "今后" | "之后" | "向后" | "往后" | "后面" => + case "下" | "后" | "接下来" | "未来" | "今后" | "之后" | "向后" | "往后" | "后面" | "将来" => val td: Option[TimeData] = // 未来一周=未来七天 if ((s == "未来" || s == "接下来") && g == Week) { diff --git a/duckling-fork-chinese/learning/src/main/scala/com/xiaomi/duckling/dimension/time/Examples.scala b/duckling-fork-chinese/learning/src/main/scala/com/xiaomi/duckling/dimension/time/Examples.scala index 1d3a050..ff3c855 100644 --- a/duckling-fork-chinese/learning/src/main/scala/com/xiaomi/duckling/dimension/time/Examples.scala +++ b/duckling-fork-chinese/learning/src/main/scala/com/xiaomi/duckling/dimension/time/Examples.scala @@ -291,6 +291,14 @@ object Examples extends DimExamples { ), List("未来一周", "一周内") ), + ( + localDateTimeInterval( + LocalDateTime.of(2013, 2, 12, 0, 0, 0), + LocalDateTime.of(2013, 2, 22, 0, 0, 0), + Day + ), + List("未来十天", "将来十天", "后面十天", "后十天", "之后十天") + ), ( datetime(LocalDateTime.of(2013, 3, 5, 4, 30, 0), Second), List("三星期后", "三星期之后", "三个礼拜后", "三个礼拜之后", "三星期以后", "三星期过后")