{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}
module Text.Collate.Tailorings
( ducetCollation
, tailorings )
where
import Text.Collate.Lang
import Text.Collate.TH
import Text.Collate.Collation (suppressContractions, insertElements,
Collation, CollationElement(..))
import Data.Binary (decode)
ducetCollation :: Collation
ducetCollation :: Collation
ducetCollation = ByteString -> Collation
forall a. Binary a => ByteString -> a
decode (ByteString -> Collation) -> ByteString -> Collation
forall a b. (a -> b) -> a -> b
$! $(genCollation "data/allkeys.txt")
applyCJKOverrides :: [Int] -> Collation -> Collation
applyCJKOverrides :: [Int] -> Collation -> Collation
applyCJKOverrides [Int]
cps Collation
coll = ((Int, Word16) -> Collation -> Collation)
-> Collation -> [(Int, Word16)] -> Collation
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (Int, Word16) -> Collation -> Collation
addElt Collation
coll ([Int] -> [Word16] -> [(Int, Word16)]
forall a b. [a] -> [b] -> [(a, b)]
zip [Int]
cps [Word16
0x8000..])
where
addElt :: (Int, Word16) -> Collation -> Collation
addElt (Int
cp, Word16
weight) = [Int] -> [CollationElement] -> Collation -> Collation
insertElements [Int
cp]
[Bool -> Word16 -> Word16 -> Word16 -> Word16 -> CollationElement
CollationElement Bool
False Word16
weight Word16
0x0020 Word16
0x0002 Word16
0x0000]
tailorings :: [(Lang, Collation)]
tailorings :: [(Lang, Collation)]
tailorings =
[(Lang
"af", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/af.txt"))
,(Lang
"ar", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ar.txt"))
,(Lang
"as", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/as.txt"))
,(Lang
"az", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/az.txt"))
,(Lang
"be", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/be.txt"))
,(Lang
"bn", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/bn.txt"))
,(Lang
"ca", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ca.txt"))
,(Lang
"cs", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/cs.txt"))
,(Lang
"cu", [Int] -> Collation -> Collation
suppressContractions [Int
0x0418, Int
0x0438] (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/cu.txt"))
,(Lang
"cy", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/cy.txt"))
,(Lang
"da", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/da.txt"))
,(Lang
"de_AT_u_co_phonebk", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/de_at_ph.txt"))
,(Lang
"de_u_co_phonebk", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/de_phone.txt"))
,(Lang
"dsb", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/dsb.txt"))
,(Lang
"ee", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ee.txt"))
,(Lang
"eo", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/eo.txt"))
,(Lang
"es", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/es.txt"))
,(Lang
"es_u_co_trad", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/es_trad.txt"))
,(Lang
"et", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/et.txt"))
,(Lang
"fa", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/fa.txt"))
,(Lang
"fi", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/fi.txt"))
,(Lang
"fi_u_co_phonebk", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/fi_phone.txt"))
,(Lang
"fil", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/fil.txt"))
,(Lang
"fo", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/fo.txt"))
,(Lang
"fr_CA", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/fr_ca.txt"))
,(Lang
"gu", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/gu.txt"))
,(Lang
"ha", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ha.txt"))
,(Lang
"haw", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/haw.txt"))
,(Lang
"he", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/he.txt"))
,(Lang
"hi", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/hi.txt"))
,(Lang
"hr", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/hr.txt"))
,(Lang
"hu", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/hu.txt"))
,(Lang
"hy", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/hy.txt"))
,(Lang
"ig", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ig.txt"))
,(Lang
"is", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/is.txt"))
,(Lang
"ja", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ja.txt"))
,(Lang
"kk", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/kk.txt"))
,(Lang
"kl", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/kl.txt"))
,(Lang
"kn", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/kn.txt"))
,(Lang
"ko", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ko.txt"))
,(Lang
"kok", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/kok.txt"))
,(Lang
"lkt", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/lkt.txt"))
,(Lang
"ln", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ln.txt"))
,(Lang
"lt", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/lt.txt"))
,(Lang
"lv", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/lv.txt"))
,(Lang
"mk", [Int] -> Collation -> Collation
suppressContractions [Int
0x0418, Int
0x0438] (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/mk.txt"))
,(Lang
"ml", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ml.txt"))
,(Lang
"mr", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/mr.txt"))
,(Lang
"mt", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/mt.txt"))
,(Lang
"nb", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/nb.txt"))
,(Lang
"nn", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/nn.txt"))
,(Lang
"nso", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/nso.txt"))
,(Lang
"om", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/om.txt"))
,(Lang
"or", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/or.txt"))
,(Lang
"pa", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/pa.txt"))
,(Lang
"pl", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/pl.txt"))
,(Lang
"ro", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ro.txt"))
,(Lang
"sa", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/sa.txt"))
,(Lang
"se", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/se.txt"))
,(Lang
"si", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/si.txt"))
,(Lang
"si_u_co_dict", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/si_dict.txt"))
,(Lang
"sk", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/sk.txt"))
,(Lang
"sl", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/sl.txt"))
,(Lang
"sq", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/sq.txt"))
,(Lang
"sr", [Int] -> Collation -> Collation
suppressContractions [Int
0x0418, Int
0x0438] (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/sr.txt"))
,(Lang
"sv", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/sv.txt"))
,(Lang
"sv_u_co_reformed", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/sv_refo.txt"))
,(Lang
"ta", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ta.txt"))
,(Lang
"te", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/te.txt"))
,(Lang
"th", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/th.txt"))
,(Lang
"tn", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/tn.txt"))
,(Lang
"to", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/to.txt"))
,(Lang
"tr", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/tr.txt"))
,(Lang
"ug_Cyrl", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ug_cyrl.txt"))
,(Lang
"uk", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/uk.txt"))
,(Lang
"ur", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/ur.txt"))
,(Lang
"vi", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/vi.txt"))
,(Lang
"vo", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/vo.txt"))
,(Lang
"wae", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/wae.txt"))
,(Lang
"wo", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/wo.txt"))
,(Lang
"yo", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/yo.txt"))
,(Lang
"zh", ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/zh.txt"))
,(Lang
"zh_u_co_big5han", [Int] -> Collation -> Collation
applyCJKOverrides
(ByteString -> [Int]
forall a. Binary a => ByteString -> a
decode $(genCJKOverrides "data/cjk/Big5.txt")) (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/zh_big5.txt"))
,(Lang
"zh_u_co_gb2312", [Int] -> Collation -> Collation
applyCJKOverrides
(ByteString -> [Int]
forall a. Binary a => ByteString -> a
decode $(genCJKOverrides "data/cjk/GB2312.txt")) (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/zh_gb.txt"))
,(Lang
"zh_u_co_pinyin", [Int] -> Collation -> Collation
applyCJKOverrides
(ByteString -> [Int]
forall a. Binary a => ByteString -> a
decode $(genCJKOverrides "data/cjk/Pinyin.txt")) (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/zh_pin.txt"))
,(Lang
"zh_u_co_stroke", [Int] -> Collation -> Collation
applyCJKOverrides
(ByteString -> [Int]
forall a. Binary a => ByteString -> a
decode $(genCJKOverrides "data/cjk/Stroke.txt")) (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/zh_strk.txt"))
,(Lang
"zh_u_co_zhuyin", [Int] -> Collation -> Collation
applyCJKOverrides
(ByteString -> [Int]
forall a. Binary a => ByteString -> a
decode $(genCJKOverrides "data/cjk/Zhuyin.txt")) (Collation -> Collation) -> Collation -> Collation
forall a b. (a -> b) -> a -> b
$
ByteString -> Collation
forall a. Binary a => ByteString -> a
decode $(genCollation "data/tailorings/zh_zhu.txt"))
]