Time/RO: don't parse 'sa' as Saturday

Summary: In Romanian, `sa` is fairly common: hai sa ne vedem (let's see), hai sa mergem (let's go).

Reviewed By: blandinw

Differential Revision: D5801345

fbshipit-source-id: db677e4
This commit is contained in:
Julien Odent 2017-09-09 10:40:04 -07:00 committed by Facebook Github Bot
parent 83ea150d94
commit 1eea25049f
5 changed files with 23 additions and 14 deletions

View File

@ -19,4 +19,4 @@ import qualified Data.HashMap.Strict as HashMap
import Data.String
classifiers :: Classifiers
classifiers = HashMap.fromList []
classifiers = HashMap.fromList []

View File

@ -137,8 +137,8 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("sambata",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.791759469228055,
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods = HashMap.fromList [("", 0.0)], n = 3},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),

View File

@ -9,10 +9,12 @@
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Time.RO.Corpus
( corpus ) where
( corpus
, negativeCorpus
) where
import Prelude
import Data.String
import Prelude
import Duckling.Lang
import Duckling.Resolve
@ -20,6 +22,13 @@ import Duckling.Time.Corpus
import Duckling.TimeGrain.Types hiding (add)
import Duckling.Testing.Types hiding (examples)
negativeCorpus :: NegativeCorpus
negativeCorpus = (testContext, examples)
where
examples =
[ "sa"
]
corpus :: Corpus
corpus = (testContext {lang = RO}, allExamples)
@ -69,7 +78,6 @@ allExamples = concat
[ "sambata"
, "sâmbătă"
, "sam"
, "sa"
]
, examples (datetime (2013, 2, 17, 0, 0, 0) Day)
[ "duminica"

View File

@ -1213,13 +1213,13 @@ ruleHhmmss = Rule
daysOfWeek :: [(Text, String)]
daysOfWeek =
[ ( "luni" , "lu(n(ea|i)?)?" )
, ( "marti" , "ma(r((t|ț)(ea|i))?)?" )
, ( "miercuri" , "mi(e(rcur(ea|i))?)?" )
, ( "joi" , "jo(ia?)?" )
, ( "vineri" , "vi(n(er(ea|i))?)?" )
, ( "sambata" , "s(a|â)mb(a|ă)t(a|ă)|s(a|â)m|s(a|â)")
, ( "duminica" , "du(m(inic(a|ă))?)?" )
[ ( "luni" , "lu(n(ea|i)?)?" )
, ( "marti" , "ma(r((t|ț)(ea|i))?)?" )
, ( "miercuri" , "mi(e(rcur(ea|i))?)?" )
, ( "joi" , "jo(ia?)?" )
, ( "vineri" , "vi(n(er(ea|i))?)?" )
, ( "sambata" , "s(a|â)mb(a|ă)t(a|ă)|s(a|â)m" )
, ( "duminica" , "du(m(inic(a|ă))?)?" )
]
ruleDaysOfWeek :: [Rule]

View File

@ -9,8 +9,8 @@
module Duckling.Time.RO.Tests
( tests ) where
import Prelude
import Data.String
import Prelude
import Test.Tasty
import Duckling.Dimensions.Types
@ -20,4 +20,5 @@ import Duckling.Time.RO.Corpus
tests :: TestTree
tests = testGroup "RO Tests"
[ makeCorpusTest [This Time] corpus
, makeNegativeCorpusTest [This Time] negativeCorpus
]