mirror of
https://github.com/facebook/duckling.git
synced 2024-12-23 12:13:30 +03:00
1393098bcc
Summary: Hi, in this pr: * Added time dimension to Arabic language, thanks to Hussein-Dahir & Yazeed-Obaid for writing time corpus. * Fixed some bugs in numeral & ordinals and added more test cases for them. Also, I don't really understand why do we use classifiers in time dimension? Closes https://github.com/facebook/duckling/pull/123 Reviewed By: blandinw Differential Revision: D6583313 Pulled By: patapizza fbshipit-source-id: f7acdef0c032d7b7fd7d224832fdaf484d2df825
42 lines
1.5 KiB
Haskell
42 lines
1.5 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 OverloadedStrings #-}
|
||
|
||
module Duckling.TimeGrain.AR.Rules
|
||
( rules
|
||
) where
|
||
|
||
import Data.String
|
||
import Data.Text (Text)
|
||
import Prelude
|
||
|
||
import Duckling.Dimensions.Types
|
||
import Duckling.Types
|
||
import qualified Duckling.TimeGrain.Types as TG
|
||
|
||
grains :: [(Text, String, TG.Grain)]
|
||
grains = [ ("second (grain) ", "(ثاني(ة|ه)?|ثواني|لحظ(ة|ه|ات))" , TG.Second)
|
||
, ("minute (grain)" , "دق(يق(ة|ه)|ائق)" , TG.Minute)
|
||
, ("hour (grain)" , "ساع(ة|ه|ات)" , TG.Hour)
|
||
, ("day (grain)" , "يوم|(ا|أ)يام" , TG.Day)
|
||
, ("week (grain)" , "(ا|أ|إ)س(بوع|ابيع)" , TG.Week)
|
||
, ("month (grain)" , "شهر|(ا|أ|إ)شهر" , TG.Month)
|
||
, ("quarter (grain)", "(ربع(ين|ان)|[أا]رباع)(سنة|عام)?" , TG.Quarter)
|
||
, ("year (grain)" , "سن(ة|ين)|عام" , TG.Year)
|
||
]
|
||
|
||
rules :: [Rule]
|
||
rules = map go grains
|
||
where
|
||
go (name, regexPattern, grain) = Rule
|
||
{ name = name
|
||
, pattern = [regex regexPattern]
|
||
, prod = \_ -> Just $ Token TimeGrain grain
|
||
}
|