Skip to content

Commit a0ff48f

Browse files
committed
限制"2月2"一类的表达
1 parent af3a3f8 commit a0ff48f

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

duckling-fork-chinese/core/src/main/scala/com/xiaomi/duckling/dimension/time/date/Rules.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ trait Rules extends DimRules {
205205
val ruleNamedMonthDayOfMonth = Rule(
206206
name = "date: <named-month> <day-of-month>",
207207
pattern =
208-
List(and(isAMonth, isHint(Hint.MonthOnly)).predicate, isIntegerBetween(1, 31).predicate),
208+
List(and(isAMonth, isHint(Hint.MonthOnly)).predicate, isIntegerBetween(11, 31).predicate),
209209
prod = tokens {
210210
case Token(Date, td: TimeData) :: token :: _ =>
211211
for (td <- intersectDOM(td, token)) yield {

duckling-fork-chinese/learning/src/main/scala/com/xiaomi/duckling/dimension/time/Examples.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,13 +508,14 @@ object Examples extends DimExamples {
508508
(ymd(2013, 8, 15, holiday = "中秋节", calendar = Lunar(false)), List("下一个中秋节")),
509509
// (ymd(2012, 2, 12), List("一年前的今天")),
510510
(ymd(2022, 10, 1, direction = IntervalDirection.Before), List("2022年10月1号之前")),
511+
(ymd(2013, 7, 19, direction = IntervalDirection.Before), List("七月十九日之前")),
511512
(ymd(2022, 10, 1, direction = IntervalDirection.After), List("2022年10月1号之后")),
512513
(h(12), List("今天12点")),
513514
(h(15), List("今天3点")),
514515
// 8点,不是20点
515516
(datetime(LocalDateTime.of(2013, 2, 11, 8, 0, 0), Hour), List("2013年2月11号8点")),
516517
(datetime(LocalDateTime.of(2013, 2, 14, 8, 0, 0), Hour), List("2月14号8点")),
517-
(datetime(LocalDateTime.of(2013, 2, 2, 0, 0, 0), Day), List("2013年2月2", "2013年2月第二天", "今年2月的第二天", "本月第二天")),
518+
(datetime(LocalDateTime.of(2013, 2, 2, 0, 0, 0), Day), List("2013年2月第二天", "今年2月的第二天", "本月第二天")),
518519
(datetime(LocalDateTime.of(2013, 1, 2, 0, 0, 0), Day), List("2013年的第二天", "今年的第二天", "今年倒数第364天")),
519520
(datetime(LocalDateTime.of(2013, 5, 31, 0, 0, 0), Day), List("5月的最后一天", "5月最后一天", "5月第31天"))
520521
)

duckling-fork-chinese/learning/src/main/scala/com/xiaomi/duckling/task/NaiveBayesDebug.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ object NaiveBayesDebug {
4949
val targets = FullDimensions.convert(dim.split(","))
5050
val options = Options(targets = targets, withLatent = false, full = true)
5151
options.rankOptions.setRanker(Some(Ranker.NaiveBayes))
52-
options.rankOptions.setWinnerOnly(true)
52+
options.rankOptions.setWinnerOnly(false)
5353
options.rankOptions.setCombinationRank(false)
5454
options.rankOptions.setRangeRankAhead(false)
5555
options.timeOptions.setResetTimeOfDay(false)

0 commit comments

Comments
 (0)