duckling/Duckling/TimeGrain/IT/Rules.hs
FBShipIt 3f8e52e70a Initial commit
fbshipit-source-id: 301a10f448e9623aa1c953544f42de562909e192
2017-03-08 10:33:56 -08:00

42 lines
1.2 KiB
Haskell

-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree. An additional grant
-- of patent rights can be found in the PATENTS file in the same directory.
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.TimeGrain.IT.Rules
( rules ) where
import Data.Text (Text)
import Prelude
import Data.String
import Duckling.Dimensions.Types
import qualified Duckling.TimeGrain.Types as TG
import Duckling.Types
grains :: [(Text, String, TG.Grain)]
grains = [ ("seconde (grain)", "second[oi]", TG.Second)
, ("minute (grain)", "minut[oi]", TG.Minute)
, ("heure (grain)", "or[ae]", TG.Hour)
, ("jour (grain)", "giorn[oi]", TG.Day)
, ("semaine (grain)", "settiman[ae]", TG.Week)
, ("mois (grain)", "mes[ei]", TG.Month)
, ("trimestre (grain)", "trimestr[ei]", TG.Quarter)
, ("année (grain)", "ann?[oi]", TG.Year)
]
rules :: [Rule]
rules = map go grains
where
go (name, regexPattern, grain) = Rule
{ name = name
, pattern = [regex regexPattern]
, prod = \_ -> Just $ Token TimeGrain grain
}