Skip to content

Commit 5d03b45

Browse files
st0yanovfacebook-github-bot
authored andcommitted
Setup Bulgarian language and Numeral Dimension
Summary: - Setup Bulgarian (BG) language - Added Numeral Dimension Closes #78 Reviewed By: niteria Differential Revision: D5575513 Pulled By: patapizza fbshipit-source-id: e566155
1 parent 9037126 commit 5d03b45

File tree

13 files changed

+513
-0
lines changed

13 files changed

+513
-0
lines changed

Duckling/Dimensions.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import qualified Data.HashSet as HashSet
2121
import Duckling.Dimensions.Types
2222
import qualified Duckling.Dimensions.Common as CommonDimensions
2323
import qualified Duckling.Dimensions.AR as ARDimensions
24+
import qualified Duckling.Dimensions.BG as BGDimensions
2425
import qualified Duckling.Dimensions.CS as CSDimensions
2526
import qualified Duckling.Dimensions.DA as DADimensions
2627
import qualified Duckling.Dimensions.DE as DEDimensions
@@ -78,6 +79,7 @@ dependents (This Volume) = HashSet.singleton (This Numeral)
7879

7980
langDimensions :: Lang -> [Some Dimension]
8081
langDimensions AR = ARDimensions.allDimensions
82+
langDimensions BG = BGDimensions.allDimensions
8183
langDimensions CS = CSDimensions.allDimensions
8284
langDimensions DA = DADimensions.allDimensions
8385
langDimensions DE = DEDimensions.allDimensions

Duckling/Dimensions/BG.hs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-- Copyright (c) 2016-present, Facebook, Inc.
2+
-- All rights reserved.
3+
--
4+
-- This source code is licensed under the BSD-style license found in the
5+
-- LICENSE file in the root directory of this source tree. An additional grant
6+
-- of patent rights can be found in the PATENTS file in the same directory.
7+
8+
9+
module Duckling.Dimensions.BG
10+
( allDimensions
11+
) where
12+
13+
import Duckling.Dimensions.Types
14+
15+
allDimensions :: [Some Dimension]
16+
allDimensions =
17+
[ This Numeral
18+
]

Duckling/Lang.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import qualified TextShow as TS
2323

2424
data Lang
2525
= AR
26+
| BG
2627
| CS
2728
| DA
2829
| DE

Duckling/Numeral/BG/Corpus.hs

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
-- Copyright (c) 2016-present, Facebook, Inc.
2+
-- All rights reserved.
3+
--
4+
-- This source code is licensed under the BSD-style license found in the
5+
-- LICENSE file in the root directory of this source tree. An additional grant
6+
-- of patent rights can be found in the PATENTS file in the same directory.
7+
8+
9+
{-# LANGUAGE OverloadedStrings #-}
10+
11+
module Duckling.Numeral.BG.Corpus
12+
( corpus ) where
13+
14+
import Data.String
15+
import Prelude
16+
17+
import Duckling.Lang
18+
import Duckling.Numeral.Types
19+
import Duckling.Resolve
20+
import Duckling.Testing.Types
21+
22+
corpus :: Corpus
23+
corpus = (testContext {lang = BG}, allExamples)
24+
25+
allExamples :: [Example]
26+
allExamples = concat
27+
[ examples (NumeralValue 0)
28+
[ "0"
29+
, "нула"
30+
]
31+
, examples (NumeralValue 1)
32+
[ "1"
33+
, "един"
34+
, "една"
35+
, "едно"
36+
]
37+
, examples (NumeralValue 2)
38+
[ "2"
39+
, "02"
40+
, "две"
41+
, "два"
42+
]
43+
, examples (NumeralValue 3)
44+
[ "3"
45+
, "03"
46+
, "три"
47+
]
48+
, examples (NumeralValue 4)
49+
[ "4"
50+
, "04"
51+
, "четири"
52+
]
53+
, examples (NumeralValue 5)
54+
[ "5"
55+
, "05"
56+
, "пет"
57+
]
58+
, examples (NumeralValue 33)
59+
[ "33"
60+
, "0033"
61+
, "тридесет и три"
62+
]
63+
, examples (NumeralValue 14)
64+
[ "14"
65+
, "четиринадесет"
66+
, "четиринайсет"
67+
]
68+
, examples (NumeralValue 15)
69+
[ "15"
70+
, "петнадесет"
71+
, "петнайсет"
72+
]
73+
, examples (NumeralValue 16)
74+
[ "16"
75+
, "шестнадесет"
76+
, "шестнайсет"
77+
]
78+
, examples (NumeralValue 17)
79+
[ "17"
80+
, "седемнадесет"
81+
, "седемнайсет"
82+
]
83+
, examples (NumeralValue 18)
84+
[ "18"
85+
, "осемнадесет"
86+
, "осемнайсет"
87+
]
88+
, examples (NumeralValue 525)
89+
[ "525"
90+
, "петстотин двадесет и пет"
91+
]
92+
, examples (NumeralValue 1.1)
93+
[ "1.1"
94+
, "1.10"
95+
, "01.10"
96+
, "1 цяло и 1"
97+
, "едно цяло и едно"
98+
]
99+
, examples (NumeralValue 0.77)
100+
[ "0.77"
101+
, ".77"
102+
]
103+
, examples (NumeralValue 100000)
104+
[ "100000"
105+
, "100к"
106+
, "100К"
107+
]
108+
, examples (NumeralValue 3000000)
109+
[ ""
110+
, "3000К"
111+
, "3000000"
112+
, "3,000,000"
113+
]
114+
, examples (NumeralValue 1200000)
115+
[ "1200000"
116+
, "1.2М"
117+
, "1200К"
118+
, ".0012Г"
119+
]
120+
, examples (NumeralValue (-1200000))
121+
[ "-1200000"
122+
, "минус 1200000"
123+
, "-1.2М"
124+
, "-1200К"
125+
, "-.0012Г"
126+
]
127+
]

0 commit comments

Comments
 (0)