duckling
duckling copied to clipboard
Utterance "winter 2020" not parsed correctly.
Utterance winter 2020
is broken down into two entities - winter
and 2020
. For all other seasons, the correct date range is returned (e.g. summer 2020
, fall 2021
, etc.).
Having a hard time finding the right rules to edit on this one. Assuming it has something to do with these lines:
ruleSeason :: Rule
ruleSeason = Rule
{ name = "last|this|next <season>"
, pattern =
[ regex "(this|current|next|last|past|previous) seasons?"
]
, prod = \case
(Token RegexMatch (GroupMatch (match:_)):_) -> do
n <- case Text.toLower match of
"this" -> Just 0
"current" -> Just 0
"last" -> Just (-1)
"past" -> Just (-1)
"previous" -> Just (-1)
"next" -> Just 1
_ -> Nothing
tt $ predNth n False season
_ -> Nothing
}
ruleSeasons :: [Rule]
ruleSeasons = mkRuleSeasons
[ ( "summer", "summer" , monthDay 6 21, monthDay 9 23 )
, ( "fall" , "fall|autumn", monthDay 9 23, monthDay 12 21 )
, ( "winter", "winter" , monthDay 12 21, monthDay 3 20 )
, ( "spring", "spring" , monthDay 3 20, monthDay 6 21 )
]
in lines 956-982 of Duckling/Time/En/Rules.hs
This is a pretty big one, it will affect all winter months beyond just EN. So far, I'm seeing duplicate behavior in ES, FR, RO, and PT (at least).
The root of the problem has to do with winter overlapping years, if I change the rules to have winter last from 12-21 to 12-30, we get the correct behavior, though I cannot tell why. Why would the time boundary for the rule affect whether or not we enter the intersection rule for a given language?
I am facing the same issue. Can anyone help me in fixing it?
Indeed @xtianjohns seems correct - there is some bug involving intersection when you cross year boundaries (at the very least). I investigated a bit yesterday, going to continue doing so now.