Skip to content

Commit

Permalink
修复当前时间段不在过去中的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
du00cs committed Jul 26, 2024
1 parent 663775f commit 859e2fa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ package object time {
case ahead #:: _ =>
val happened =
td.timePred match {
case _: TimeDatePredicate => timeBefore(ahead, refTime, td.timeGrain)
case _: TimeDatePredicate | _: TimeIntervalsPredicate => timeStartsBeforeTheEndOf(ahead)(refTime)
case _ => false
}
if (happened) Some(ahead)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ class TimeDataTest extends UnitSpec with LazyLogging {
}
}

val testCases = Table( ("query", "year", "month", "day"),
("最近三天", 2013, 2, 9)
val testCases = Table( ("query", "year", "month", "day")
, ("凌晨", 2013, 2, 12)
, ("最近三天", 2013, 2, 9)
, ("过去三天", 2013, 2, 9)
, ("昨天", 2013, 2, 11)
, ("今天", 2013, 2, 12)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ object NaiveBayesConsole extends LazyLogging {
"seasons",
"sequence",
"fuzzy-on",
"before-end-of-interval"
"before-end-of-interval",
"recent-in-future",
"always-in-future"
),
NullCompleter.INSTANCE
)
Expand Down Expand Up @@ -127,6 +129,8 @@ object NaiveBayesConsole extends LazyLogging {
case "sequence" => options.timeOptions.setSequence(value); options
case "fuzzy-on" => options.timeOptions.setDurationFuzzyOn(value); options
case "before-end-of-interval" => options.timeOptions.setBeforeEndOfInterval(value); options
case "recent-in-future" => options.timeOptions.setRecentInFuture(value); options
case "always-in-future" => options.timeOptions.setAlwaysInFuture(value); options
case _ => options
}
opt
Expand Down

0 comments on commit 859e2fa

Please sign in to comment.