mirror of
https://github.com/facebook/duckling.git
synced 2024-09-11 21:27:13 +03:00
Adds german times rules like "Übernächste Woche" (week after next) (#330)
Summary: fixes https://github.com/facebook/duckling/issues/329 and allows for recognizing of terms like übernächste woche Pull Request resolved: https://github.com/facebook/duckling/pull/330 Reviewed By: girifb Differential Revision: D26284196 Pulled By: chessai fbshipit-source-id: 160e73668b835c83adb0fd1c396a8a2977e86516
This commit is contained in:
parent
ff4a1a5bae
commit
998b13bceb
@ -396,8 +396,8 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("month (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.3978952727983707,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 9},
|
||||
ClassData{prior = 0.0, unseen = -2.4849066497880004,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 10},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
@ -923,8 +923,8 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("year (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.639057329615259,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 12},
|
||||
ClassData{prior = 0.0, unseen = -2.70805020110221,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 13},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
@ -1229,8 +1229,8 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("week (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -3.332204510175204,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 26},
|
||||
ClassData{prior = 0.0, unseen = -3.367295829986474,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 27},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
@ -1411,6 +1411,22 @@ classifiers
|
||||
ClassData{prior = -2.1972245773362196,
|
||||
unseen = -1.0986122886681098,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
|
||||
("after next <cycle>",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.833213344056216,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -2.0794415416798357),
|
||||
("month (grain)", -2.0794415416798357),
|
||||
("year (grain)", -2.0794415416798357),
|
||||
("week (grain)", -2.0794415416798357),
|
||||
("quarter", -2.0794415416798357), ("year", -2.0794415416798357),
|
||||
("month", -2.0794415416798357),
|
||||
("quarter (grain)", -2.0794415416798357)],
|
||||
n = 4},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -2.1972245773362196,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("Simchat Torah",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||
@ -2512,8 +2528,8 @@ classifiers
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 6}}),
|
||||
("quarter (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
|
||||
ClassData{prior = 0.0, unseen = -1.9459101490553135,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 5},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
|
@ -151,18 +151,27 @@ allExamples = concat
|
||||
, examples (datetime (2013, 2, 18, 0, 0, 0) Week)
|
||||
[ "nächste woche"
|
||||
]
|
||||
, examples (datetime (2013, 2, 25, 0, 0, 0) Week)
|
||||
[ "übernächste woche"
|
||||
]
|
||||
, examples (datetime (2013, 1, 0, 0, 0, 0) Month)
|
||||
[ "letzten monat"
|
||||
]
|
||||
, examples (datetime (2013, 3, 0, 0, 0, 0) Month)
|
||||
[ "nächsten monat"
|
||||
]
|
||||
, examples (datetime (2013, 4, 0, 0, 0, 0) Month)
|
||||
[ "übernächsten monat"
|
||||
]
|
||||
, examples (datetime (2013, 1, 1, 0, 0, 0) Quarter)
|
||||
[ "dieses quartal"
|
||||
]
|
||||
, examples (datetime (2013, 4, 1, 0, 0, 0) Quarter)
|
||||
[ "nächstes quartal"
|
||||
]
|
||||
, examples (datetime (2013, 7, 1, 0, 0, 0) Quarter)
|
||||
[ "übernächstes quartal"
|
||||
]
|
||||
, examples (datetime (2013, 7, 1, 0, 0, 0) Quarter)
|
||||
[ "drittes quartal"
|
||||
]
|
||||
@ -178,6 +187,9 @@ allExamples = concat
|
||||
, examples (datetime (2014, 0, 0, 0, 0, 0) Year)
|
||||
[ "nächstes jahr"
|
||||
]
|
||||
, examples (datetime (2015, 0, 0, 0, 0, 0) Year)
|
||||
[ "übernächstes jahr"
|
||||
]
|
||||
, examples (datetime (2013, 2, 10, 0, 0, 0) Day)
|
||||
[ "letzten sonntag"
|
||||
, "sonntag der letzten woche"
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
|
||||
{-# LANGUAGE GADTs #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE NoRebindableSyntax #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
@ -14,7 +15,6 @@ module Duckling.Time.DE.Rules
|
||||
) where
|
||||
|
||||
import Prelude
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as Text
|
||||
|
||||
import Duckling.Dimensions.Types
|
||||
@ -707,6 +707,19 @@ ruleNextCycle = Rule
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
ruleAfterNextCycle :: Rule
|
||||
ruleAfterNextCycle = Rule
|
||||
{ name = "after next <cycle>"
|
||||
, pattern =
|
||||
[ regex "(ü)ber ?n(ä)chste[ns]?"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \case
|
||||
(_:Token TimeGrain grain:_) ->
|
||||
tt $ cycleNth grain 2
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
ruleTimeofdayApproximately :: Rule
|
||||
ruleTimeofdayApproximately = Rule
|
||||
{ name = "<time-of-day> approximately"
|
||||
@ -1844,6 +1857,7 @@ rules =
|
||||
, ruleNamedmonthDayofmonthNonOrdinal
|
||||
, ruleNamedmonthDayofmonthOrdinal
|
||||
, ruleNextCycle
|
||||
, ruleAfterNextCycle
|
||||
, ruleNextNCycle
|
||||
, ruleNextTime
|
||||
, ruleNight
|
||||
|
Loading…
Reference in New Issue
Block a user