mirror of
https://github.com/facebook/duckling.git
synced 2024-08-17 09:10:29 +03:00
Init
Summary: Initialise TimeGrain for CA (Catalan) language Reviewed By: stroxler Differential Revision: D28299113 Pulled By: chessai fbshipit-source-id: ffcd4043554123f5de2d279ef2660db83eb9f475
This commit is contained in:
parent
0e3d0604a2
commit
f10c4db112
@ -22,6 +22,7 @@ import qualified Duckling.Distance.CA.Rules as Distance
|
||||
import qualified Duckling.Numeral.CA.Rules as Numeral
|
||||
import qualified Duckling.Ordinal.CA.Rules as Ordinal
|
||||
import qualified Duckling.Temperature.CA.Rules as Temperature
|
||||
import qualified Duckling.TimeGrain.CA.Rules as TimeGrain
|
||||
import qualified Duckling.Volume.CA.Rules as Volume
|
||||
import Duckling.Types
|
||||
|
||||
@ -45,7 +46,7 @@ langRules (Seal Quantity) = []
|
||||
langRules (Seal RegexMatch) = []
|
||||
langRules (Seal Temperature) = Temperature.rules
|
||||
langRules (Seal Time) = []
|
||||
langRules (Seal TimeGrain) = []
|
||||
langRules (Seal TimeGrain) = TimeGrain.rules
|
||||
langRules (Seal Url) = []
|
||||
langRules (Seal Volume) = Volume.rules
|
||||
langRules (Seal (CustomDimension _)) = []
|
||||
|
40
Duckling/TimeGrain/CA/Rules.hs
Normal file
40
Duckling/TimeGrain/CA/Rules.hs
Normal file
@ -0,0 +1,40 @@
|
||||
-- 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.
|
||||
|
||||
|
||||
{-# LANGUAGE GADTs #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Duckling.TimeGrain.CA.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 = [ ("segon (grain)", "seg(on)?s?", TG.Second)
|
||||
, ("minuts (grain)", "min(ut)?s?", TG.Minute)
|
||||
, ("hora (grain)", "h(or(a|es))?", TG.Hour)
|
||||
, ("dia (grain)", "d(í|i)(a|es)", TG.Day)
|
||||
, ("setmana (grain)", "setman(a|es)", TG.Week)
|
||||
, ("mes (grain)", "mes(os)?", TG.Month)
|
||||
, ("trimestre (grain)", "trimestres?", TG.Quarter)
|
||||
, ("any (grain)", "anys?", TG.Year)
|
||||
]
|
||||
|
||||
rules :: [Rule]
|
||||
rules = map go grains
|
||||
where
|
||||
go (name, regexPattern, grain) = Rule
|
||||
{ name = name
|
||||
, pattern = [regex regexPattern]
|
||||
, prod = \_ -> Just $ Token TimeGrain grain
|
||||
}
|
@ -785,6 +785,7 @@ library
|
||||
-- TimeGrain
|
||||
, Duckling.TimeGrain.AR.Rules
|
||||
, Duckling.TimeGrain.BG.Rules
|
||||
, Duckling.TimeGrain.CA.Rules
|
||||
, Duckling.TimeGrain.DA.Rules
|
||||
, Duckling.TimeGrain.DE.Rules
|
||||
, Duckling.TimeGrain.EN.Rules
|
||||
|
Loading…
Reference in New Issue
Block a user