packages feed

ukrainian-phonetics-basic-array 0.1.2.0 → 0.2.0.0

raw patch · 5 files changed

+66/−41 lines, 5 filesdep +hashabledep ~basedep ~mmsyn2-array

Dependencies added: hashable

Dependency ranges changed: base, mmsyn2-array

Files

CHANGELOG.md view
@@ -14,3 +14,7 @@  * First version revised B. Added new variants of the sound representation durations to the Languages.Phonetic.Ukrainian.Syllable.Double.Arr and Languages.Phonetic.Ukrainian.Syllable.Arr modules. Some documentation improvements.++## 0.2.0.0 -- 2021-10-30++* Second version. Switched to the Case.Hashable.Cuckoo.getBFstL' function where possible. Updated the dependencies.
Languages/Phonetic/Ukrainian/Syllable/Arr.hs view
@@ -19,7 +19,9 @@ import Data.Typeable import qualified Data.List as L (groupBy) import Melodics.ByteString.Ukrainian.Arr-import CaseBi.Arr+import Data.Bits (xor)+import Case.Hashable.Cuckoo+import Data.Hashable (Hashable(..)) import Data.List.InnToOut.Basic (mapI) import Data.Maybe (mapMaybe) @@ -37,18 +39,36 @@  data PhoneticType = W | S | O | D | K | L | M | N | E deriving ( Eq, Ord, Typeable ) +instance Hashable PhoneticType where+  hash x+    | x >= M =+       case x of { M -> 7; N -> 8; E -> 9 }+    | x >= K =+       case x of { K -> 5; L -> 6 }+    | x <= O =+       case x of { W -> 1; S -> 2; O -> 3 }+    | x == D = 4+    | otherwise = 5+  hashWithSalt salt x = salt `hashInt` hash x+    where hashInt s x = (s * 16777619) `xor` x -- Is taken from the @hashable@ package.+    -- Note: FNV-1 hash takes a byte of data at once, here we take an 'Int',+    -- which is 4 or 8 bytes. Whether that's bad or not, I don't know.+ type UZPP2 = UZPP Char PhoneticType  instance Show (UZPP Char PhoneticType) where   show (UZ x y)    | y `notElem` [O,K,M] =-       getBFstLSorted' "" [('-'," "),('0'," "),('1'," "),('A',"дз"),('B',"ж"),('C',"й"),('D',"сь"),('E',"ч"),('F',"ш"),('G',"щ"),('L',"\700"),('M',"\8217"),+       getBFstL' "" [('-'," "),('0'," "),('1'," "),('A',"дз"),('B',"ж"),('C',"й"),('D',"сь"),('E',"ч"),('F',"ш"),('G',"щ"),('L',"\700"),('M',"\8217"),         ('a',"а"),('b',"б"),('c',"ц"),('d',"д"),('e',"е"),('f',"ф"),('g',"ґ"),('h',"г"),('i',"і"),('j',"дж"),('k',"к"),('l',"л"),('m',"м"),('n',"н"),('o',"о"),('p',"п"),('q',"ь"),           ('r',"р"),('s',"с"),('t',"т"),('u',"у"),('v',"в"),('w',"ць"),('x',"х"),('y',"и"),('z',"з")] x    | otherwise =-       getBFstLSorted' "" [('-'," "),('0'," "),('1'," "),('A',"дзь"),('B',"жь"),('E',"чь"),('F',"шь"),('G',"щь"),('b',"бь"),('d',"дь"),('f',"фь"),('g',"ґь"),+       getBFstL' "" [('-'," "),('0'," "),('1'," "),('A',"дзь"),('B',"жь"),('E',"чь"),('F',"шь"),('G',"щь"),('b',"бь"),('d',"дь"),('f',"фь"),('g',"ґь"),         ('h',"гь"),('j',"джь"),('k',"кь"),('l',"ль"),('m',"мь"),('n',"нь"),('p',"пь"),('q',"ь"),('r',"рь"),('t',"ть"),('v',"вь"),('x',"хь"),('z',"зь")] x +instance Hashable UZPP2 where+  hashWithSalt salt (UZ x y) = hashWithSalt salt (x,y)+ phoneType :: UZPP2 -> PhoneticType phoneType (UZ _ y) = y {-# INLINE phoneType #-}@@ -59,14 +79,14 @@  str2UZPP2s :: String -> [UZPP2] str2UZPP2s (y:ys)-  | getBFstLSorted' False [('a',True),('e',True),('i',True),('o',True),('u',True),('y',True)] y = UZ y W:str2UZPP2s ys+  | getBFstL' False [('a',True),('e',True),('i',True),('o',True),('u',True),('y',True)] y = UZ y W:str2UZPP2s ys   | y == 'D' || y == 'w' = UZ y N:str2UZPP2s ys-  | (null ys || head ys /= 'q') && getBFstLSorted' False [('C',True),('l',True),('m',True),('n',True),('r',True),('v',True)] y = UZ y S:str2UZPP2s ys+  | (null ys || head ys /= 'q') && getBFstL' False [('C',True),('l',True),('m',True),('n',True),('r',True),('v',True)] y = UZ y S:str2UZPP2s ys   | (null ys || head ys /= 'q') &&-      getBFstLSorted' False [('A',True),('B',True),('b',True),('d',True),('g',True),('h',True),('j',True),('z',True)] y = UZ y D:str2UZPP2s ys+      getBFstL' False [('A',True),('B',True),('b',True),('d',True),('g',True),('h',True),('j',True),('z',True)] y = UZ y D:str2UZPP2s ys   | (null ys || head ys /= 'q') = UZ y L:str2UZPP2s ys-  | getBFstLSorted' False [('l',True),('m',True),('n',True),('r',True),('v',True)] y = UZ y O:str2UZPP2s (drop 1 ys)-  | getBFstLSorted' False [('A',True),('B',True),('b',True),('d',True),('g',True),('h',True),('j',True),('z',True)] y =+  | getBFstL' False [('l',True),('m',True),('n',True),('r',True),('v',True)] y = UZ y O:str2UZPP2s (drop 1 ys)+  | getBFstL' False [('A',True),('B',True),('b',True),('d',True),('g',True),('h',True),('j',True),('z',True)] y =       UZ y K:str2UZPP2s (drop 1 ys)   | otherwise = UZ y M:str2UZPP2s (drop 1 ys) str2UZPP2s _ = []@@ -78,7 +98,7 @@  -- | Function-predicate 'isVwl' checks whether its argument is a vowel representation in the 'Char' format. isVwl :: Char -> Bool-isVwl = getBFstLSorted' False [('a',True),('e',True),('i',True),('o',True),('u',True),('y',True)]+isVwl = getBFstL' False [('a',True),('e',True),('i',True),('o',True),('u',True),('y',True)] {-# INLINE isVwl #-}  -- | Function-predicate 'isSonorous1' checks whether its argument is a sonorous consonant representation in the 'UZPP2' format.@@ -181,7 +201,7 @@ -- | Is inspired by the DobutokO.Sound.DIS5G6G module from @dobutokO2@ package. -- See: 'https://hackage.haskell.org/package/dobutokO2-0.43.0.0/docs/DobutokO-Sound-DIS5G6G.html'. The 'Float' data are gotten from there. str2Durat1 :: String -> Float-str2Durat1 = getBFstLSorted' 0.153016 [("-", (0.101995)), ("0", (0.051020)), ("1", (0.153016)), ("а", 0.138231), ("б", 0.057143),+str2Durat1 = getBFstL' 0.153016 [("-", (0.101995)), ("0", (0.051020)), ("1", (0.153016)), ("а", 0.138231), ("б", 0.057143),   ("в", 0.082268), ("г", 0.076825), ("д", 0.072063), ("дж", 0.048934), ("дз", 0.055601), ("е", 0.093605), ("ж", 0.070658), ("з", 0.056054),     ("и", 0.099955), ("й", 0.057143), ("к", 0.045351), ("л", 0.064036), ("м", 0.077370), ("н", 0.074240), ("о", 0.116463), ("п", 0.134830),       ("р", 0.049206), ("с", 0.074603), ("сь", 0.074558), ("т", 0.110658), ("у", 0.109070), ("ф", 0.062268), ("х", 0.077188), ("ц", 0.053061),@@ -194,7 +214,7 @@ -- \"ABCEFXYabcdefghijklmnopqrstuvxyz\" (for more information, pleas, refer to the -- https://hackage.haskell.org/package/r-glpk-phonetic-languages-ukrainian-durations). uzpp2Durat2 :: UZPP2 -> Float-uzpp2Durat2 = getBFstLSorted' 0.06408817 [(UZ 'A' D, 0.07729654), (UZ 'A' K, 0.07729654), (UZ 'B' D, 0.08048113), (UZ 'B' K, 0.08048113),+uzpp2Durat2 = getBFstL' 0.06408817 [(UZ 'A' D, 0.07729654), (UZ 'A' K, 0.07729654), (UZ 'B' D, 0.08048113), (UZ 'B' K, 0.08048113),   (UZ 'C' S, 0.08226452), (UZ 'D' N, 0.07512999), (UZ 'E' L, 0.12541547), (UZ 'E' M, 0.12541547), (UZ 'F' L, 0.12838476), (UZ 'F' M, 0.12838476),     (UZ 'a' W, 0.27161466), (UZ 'b' D, 0.10977617), (UZ 'b' K, 0.10977617), (UZ 'c' D, 0.05616409), (UZ 'd' D, 0.06586550), (UZ 'd' K, 0.06586550),       (UZ 'e' W, 0.27192511), (UZ 'f' L, 0.15776219), (UZ 'f' M, 0.15776219), (UZ 'g' D, 0.07751571), (UZ 'g' K, 0.07751571), (UZ 'h' D, 0.05392745),@@ -207,7 +227,7 @@ {-# DEPRECATED uzpp2Durat2 "Please, if possible, use the corresponding functions from the Languages.Phonetic.Ukrainian.Syllable.Double.Arr module." #-}  uzpp2Durat1 :: UZPP2 -> Float-uzpp2Durat1 = getBFstLSorted' 0.051020 [(UZ 'A' D, 0.055601), (UZ 'A' K, 0.055601), (UZ 'B' D, 0.070658), (UZ 'B' K, 0.070658), (UZ 'C' S, 0.057143), (UZ 'D' N, 0.074558),+uzpp2Durat1 = getBFstL' 0.051020 [(UZ 'A' D, 0.055601), (UZ 'A' K, 0.055601), (UZ 'B' D, 0.070658), (UZ 'B' K, 0.070658), (UZ 'C' S, 0.057143), (UZ 'D' N, 0.074558),   (UZ 'E' L, 0.057596), (UZ 'E' M, 0.057596), (UZ 'F' L, 0.066077), (UZ 'F' M, 0.066077), (UZ 'a' W, 0.138231), (UZ 'b' D, 0.057143), (UZ 'b' K, 0.057143), (UZ 'c' D, 0.053061),    (UZ 'd' D, 0.072063), (UZ 'd' K, 0.072063), (UZ 'e' W, 0.093605), (UZ 'f' L, 0.062268), (UZ 'f' M, 0.062268),  (UZ 'g' D, 0.062948), (UZ 'g' K, 0.062948), (UZ 'h' D, 0.076825),     (UZ 'h' K, 0.076825), (UZ 'i' W, 0.094150), (UZ 'j' D, 0.048934), (UZ 'j' K, 0.048934), (UZ 'k' L, 0.045351), (UZ 'k' M, 0.045351), (UZ 'l' S, 0.064036), (UZ 'l' O, 0.064036),@@ -217,7 +237,7 @@ {-# DEPRECATED uzpp2Durat1 "Please, if possible, use the corresponding functions from the Languages.Phonetic.Ukrainian.Syllable.Double.Arr module." #-}  uzpp2Durat3 :: UZPP2 -> Float-uzpp2Durat3 = getBFstLSorted' 0.05779993 [(UZ 'A' D, 0.08453724), (UZ 'A' K, 0.08453724),+uzpp2Durat3 = getBFstL' 0.05779993 [(UZ 'A' D, 0.08453724), (UZ 'A' K, 0.08453724),  (UZ 'B' D, 0.09996042), (UZ 'B' K, 0.09996042), (UZ 'C' S, 0.10975353), (UZ 'D' N, 0.08190674),   (UZ 'E' L, 0.11906522), (UZ 'E' M, 0.11906522), (UZ 'F' L, 0.13985258), (UZ 'F' M, 0.13985258),    (UZ 'a' W, 0.25872483), (UZ 'b' D, 0.13787716), (UZ 'b' K, 0.13787716), (UZ 'c' D, 0.05901357),@@ -234,7 +254,7 @@ {-# DEPRECATED uzpp2Durat3 "Please, if possible, use the corresponding functions from the Languages.Phonetic.Ukrainian.Syllable.Double.Arr module." #-}  uzpp2Durat4 :: UZPP2 -> Float-uzpp2Durat4 = getBFstLSorted' 0.14160713 [(UZ 'A' D, 0.08508446), (UZ 'A' K, 0.08508446), (UZ 'B' D, 0.17053331),+uzpp2Durat4 = getBFstL' 0.14160713 [(UZ 'A' D, 0.08508446), (UZ 'A' K, 0.08508446), (UZ 'B' D, 0.17053331),  (UZ 'B' K, 0.17053331), (UZ 'C' S, 0.06241711), (UZ 'D' N, 0.12159184), (UZ 'E' L, 0.21173804), (UZ 'E' M, 0.21173804),   (UZ 'F' L, 0.24441358), (UZ 'F' M, 0.24441358), (UZ 'a' W, 0.20859653), (UZ 'b' D, 0.07768941),    (UZ 'b' K, 0.07768941), (UZ 'c' D, 0.05705798), (UZ 'd' D, 0.12987485), (UZ 'd' K, 0.12987485),
Languages/Phonetic/Ukrainian/Syllable/Double/Arr.hs view
@@ -10,13 +10,13 @@  module Languages.Phonetic.Ukrainian.Syllable.Double.Arr where -import CaseBi.Arr+import Case.Hashable.Cuckoo import Languages.Phonetic.Ukrainian.Syllable.Arr (UZPP(..),UZPP2,PhoneticType(..))  -- | Is inspired by the DobutokO.Sound.DIS5G6G module from @dobutokO2@ package. -- See: 'https://hackage.haskell.org/package/dobutokO2-0.43.0.0/docs/DobutokO-Sound-DIS5G6G.html'. The 'Double' data are gotten from there. str2DuratD1 :: String -> Double-str2DuratD1 = getBFstLSorted' 0.153016 [("-", (0.101995)), ("0", (0.051020)), ("1", (0.153016)), ("а", 0.138231), ("б", 0.057143),+str2DuratD1 = getBFstL' 0.153016 [("-", (0.101995)), ("0", (0.051020)), ("1", (0.153016)), ("а", 0.138231), ("б", 0.057143),   ("в", 0.082268), ("г", 0.076825), ("д", 0.072063), ("дж", 0.048934), ("дз", 0.055601), ("е", 0.093605), ("ж", 0.070658), ("з", 0.056054),     ("и", 0.099955), ("й", 0.057143), ("к", 0.045351), ("л", 0.064036), ("м", 0.077370), ("н", 0.074240), ("о", 0.116463), ("п", 0.134830),       ("р", 0.049206), ("с", 0.074603), ("сь", 0.074558), ("т", 0.110658), ("у", 0.109070), ("ф", 0.062268), ("х", 0.077188), ("ц", 0.053061),@@ -28,7 +28,7 @@ -- \"ABCEFXYabcdefghijklmnopqrstuvxyz\" (for more information, pleas, refer to the -- https://hackage.haskell.org/package/r-glpk-phonetic-languages-ukrainian-durations). uzpp2DuratD2 :: UZPP2 -> Double-uzpp2DuratD2 = getBFstLSorted' 0.06408817 [(UZ 'A' D, 0.07729654), (UZ 'A' K, 0.07729654), (UZ 'B' D, 0.08048113), (UZ 'B' K, 0.08048113),+uzpp2DuratD2 = getBFstL' 0.06408817 [(UZ 'A' D, 0.07729654), (UZ 'A' K, 0.07729654), (UZ 'B' D, 0.08048113), (UZ 'B' K, 0.08048113),   (UZ 'C' S, 0.08226452), (UZ 'D' N, 0.07512999), (UZ 'E' L, 0.12541547), (UZ 'E' M, 0.12541547), (UZ 'F' L, 0.12838476), (UZ 'F' M, 0.12838476),     (UZ 'a' W, 0.27161466), (UZ 'b' D, 0.10977617), (UZ 'b' K, 0.10977617), (UZ 'c' D, 0.05616409), (UZ 'd' D, 0.06586550), (UZ 'd' K, 0.06586550),       (UZ 'e' W, 0.27192511), (UZ 'f' L, 0.15776219), (UZ 'f' M, 0.15776219), (UZ 'g' D, 0.07751571), (UZ 'g' K, 0.07751571), (UZ 'h' D, 0.05392745),@@ -40,7 +40,7 @@                   (UZ 'y' W, 0.20509350), (UZ 'z' D, 0.06099951), (UZ 'z' K, 0.06099951)]  uzpp2DuratD1 :: UZPP2 -> Double-uzpp2DuratD1 = getBFstLSorted' 0.051020 [(UZ 'A' D, 0.055601), (UZ 'A' K, 0.055601), (UZ 'B' D, 0.070658), (UZ 'B' K, 0.070658), (UZ 'C' S, 0.057143), (UZ 'D' N, 0.074558),+uzpp2DuratD1 = getBFstL' 0.051020 [(UZ 'A' D, 0.055601), (UZ 'A' K, 0.055601), (UZ 'B' D, 0.070658), (UZ 'B' K, 0.070658), (UZ 'C' S, 0.057143), (UZ 'D' N, 0.074558),   (UZ 'E' L, 0.057596), (UZ 'E' M, 0.057596), (UZ 'F' L, 0.066077), (UZ 'F' M, 0.066077), (UZ 'a' W, 0.138231), (UZ 'b' D, 0.057143), (UZ 'b' K, 0.057143), (UZ 'c' D, 0.053061),    (UZ 'd' D, 0.072063), (UZ 'd' K, 0.072063), (UZ 'e' W, 0.093605), (UZ 'f' L, 0.062268), (UZ 'f' M, 0.062268),  (UZ 'g' D, 0.062948), (UZ 'g' K, 0.062948), (UZ 'h' D, 0.076825),     (UZ 'h' K, 0.076825), (UZ 'i' W, 0.094150), (UZ 'j' D, 0.048934), (UZ 'j' K, 0.048934), (UZ 'k' L, 0.045351), (UZ 'k' M, 0.045351), (UZ 'l' S, 0.064036), (UZ 'l' O, 0.064036),@@ -49,7 +49,7 @@        (UZ 'v' O, 0.082268), (UZ 'w' N, 0.089342), (UZ 'x' L, 0.077188), (UZ 'x' M, 0.077188), (UZ 'y' W, 0.099955), (UZ 'z' D, 0.056054), (UZ 'z' K, 0.056054)]  uzpp2DuratD3 :: UZPP2 -> Double-uzpp2DuratD3 = getBFstLSorted' 0.05779993 [(UZ 'A' D, 0.08453724), (UZ 'A' K, 0.08453724),+uzpp2DuratD3 = getBFstL' 0.05779993 [(UZ 'A' D, 0.08453724), (UZ 'A' K, 0.08453724),  (UZ 'B' D, 0.09996042), (UZ 'B' K, 0.09996042), (UZ 'C' S, 0.10975353), (UZ 'D' N, 0.08190674),   (UZ 'E' L, 0.11906522), (UZ 'E' M, 0.11906522), (UZ 'F' L, 0.13985258), (UZ 'F' M, 0.13985258),    (UZ 'a' W, 0.25872483), (UZ 'b' D, 0.13787716), (UZ 'b' K, 0.13787716), (UZ 'c' D, 0.05901357),@@ -65,7 +65,7 @@              (UZ 'z' D, 0.06643842), (UZ 'z' K, 0.06643842)]  uzpp2DuratD4 :: UZPP2 -> Double-uzpp2DuratD4 = getBFstLSorted' 0.14160713 [(UZ 'A' D, 0.08508446), (UZ 'A' K, 0.08508446), (UZ 'B' D, 0.17053331),+uzpp2DuratD4 = getBFstL' 0.14160713 [(UZ 'A' D, 0.08508446), (UZ 'A' K, 0.08508446), (UZ 'B' D, 0.17053331),  (UZ 'B' K, 0.17053331), (UZ 'C' S, 0.06241711), (UZ 'D' N, 0.12159184), (UZ 'E' L, 0.21173804), (UZ 'E' M, 0.21173804),   (UZ 'F' L, 0.24441358), (UZ 'F' M, 0.24441358), (UZ 'a' W, 0.20859653), (UZ 'b' D, 0.07768941),    (UZ 'b' K, 0.07768941), (UZ 'c' D, 0.05705798), (UZ 'd' D, 0.12987485), (UZ 'd' K, 0.12987485),
Melodics/ByteString/Ukrainian/Arr.hs view
@@ -28,7 +28,8 @@ import Data.Maybe (fromJust) import Data.Char import GHC.Arr-import CaseBi.Arr+--import CaseBi.Arr+import Case.Hashable.Cuckoo import qualified Data.ByteString.Char8 as B  {-@@ -44,7 +45,7 @@  isUkrainianL :: Char -> Bool isUkrainianL y | (y >= '\1070' && y <= '\1097') = True-               | otherwise = getBFstLSorted' False (map (\x -> (x, True)) "'-\700\1028\1030\1031\1068\1100\1102\1103\1108\1110\1111\1168\1169\8217") y+               | otherwise = getBFstL' False (map (\x -> (x, True)) "'-\700\1028\1030\1031\1068\1100\1102\1103\1108\1110\1111\1168\1169\8217") y  changeIotated :: String -> String changeIotated (x:y:zs)@@ -53,24 +54,24 @@ changeIotated xs = xs  isConsNotJ :: Char -> Bool-isConsNotJ = getBFstLSorted' False (zip "\1073\1074\1075\1076\1078\1079\1082\1083\1084\1085\1087\1088\1089\1090\1092\1093\1094\1095\1096\1097\1169" (repeat True))+isConsNotJ = getBFstL' False (zip "\1073\1074\1075\1076\1078\1079\1082\1083\1084\1085\1087\1088\1089\1090\1092\1093\1094\1095\1096\1097\1169" (repeat True))  filterUkr :: String -> B.ByteString filterUkr = B.pack . map toBSUkr  toBSUkr :: Char -> Char-toBSUkr x = getBFstLSorted' x (zip "\700\1072\1073\1074\1075\1076\1077\1078\1079\1080\1081\1082\1083\1084\1085\1086\1087\1088\1089\1090\1091\1092\1093\1094\1095\1096\1097\1100\1102\1103\1108\1110\1111\1169\8217" "LabvhdeBzyCklmnoprstufxcEFGqHIJiKgM") x+toBSUkr x = getBFstL' x (zip "\700\1072\1073\1074\1075\1076\1077\1078\1079\1080\1081\1082\1083\1084\1085\1086\1087\1088\1089\1090\1091\1092\1093\1094\1095\1096\1097\1100\1102\1103\1108\1110\1111\1169\8217" "LabvhdeBzyCklmnoprstufxcEFGqHIJiKgM") x  secondConv :: B.ByteString -> B.ByteString secondConv = B.concatMap f   where f y          | isSpace y || isControl y = B.singleton '1'-         | otherwise = getBFstLSorted' (B.singleton y) (zip "'-GHIJKLM" [B.singleton '0',B.singleton '0',"FE","Cu","Ca","Ce","Ci",B.singleton '0',B.singleton '0']) y+         | otherwise = getBFstL' (B.singleton y) (zip "'-GHIJKLM" [B.singleton '0',B.singleton '0',"FE","Cu","Ca","Ce","Ci",B.singleton '0',B.singleton '0']) y  createTuplesByAnalysis :: B.ByteString -> [(B.ByteString, Triple)] createTuplesByAnalysis x   | B.null x = []-  | getBFstLSorted' False (zip "BEFcdfhknpstxz" (repeat True)) . B.head $ x = initialA x+  | getBFstL' False (zip "BEFcdfhknpstxz" (repeat True)) . B.head $ x = initialA x   | not (B.null . B.tail $ x) && (B.index x 1 == 'C' && isConsNotJ (B.head x)) = (B.copy . B.singleton . B.head $ x, T):(B.singleton 'q', Z):createTuplesByAnalysis (B.drop 2 x)   | otherwise = (B.copy . B.singleton . B.head $ x, Z):createTuplesByAnalysis (B.tail x) @@ -80,9 +81,9 @@   | B.null t1 = []   | canChange t == O = (B.singleton '1', Z):initialA ts   | canChange t == Z = (B.singleton t, Z):initialA ts-  | getBFstLSorted' False (zip "cdnstx" (repeat True)) t =+  | getBFstL' False (zip "cdnstx" (repeat True)) t =      let (us,vs) = B.splitAt 2 t1 in-       if getBFstLSorted' False (zip ["cq","dB","dz","nt","sq","st","tq","ts","xh"] (repeat True)) us+       if getBFstL' False (zip ["cq","dB","dz","nt","sq","st","tq","ts","xh"] (repeat True)) us         then (B.copy us, T):initialA vs         else (B.singleton t, T):initialA ts   | otherwise = (B.singleton t, T):initialA ts@@ -91,7 +92,7 @@ canChange :: Char -> Triple canChange x   | isSpace x || isControl x || x == '-' = O-  | getBFstLSorted' False (zip "BEFcdfhknpstxz" (repeat True)) x = T+  | getBFstL' False (zip "BEFcdfhknpstxz" (repeat True)) x = T   | otherwise = Z  bsToCharUkr :: [(B.ByteString,Triple)] -> [(Char,Triple)]@@ -100,7 +101,7 @@  | otherwise = map g zs      where g (ts,k)              | B.null ts = ('0',Z)-             | otherwise = (getBFstLSorted' (B.head ts) (zip ["cq","dB","dz","nt","sq","st","tq","ts","xh"]  "wjANDOPch") ts,k)+             | otherwise = (getBFstL' (B.head ts) (zip ["cq","dB","dz","nt","sq","st","tq","ts","xh"]  "wjANDOPch") ts,k)  applyChanges :: [(Char, Triple)] -> [(Char, Triple)] applyChanges [] = []@@ -109,27 +110,27 @@         f x xs           | null xs = (:[]) . (\(y,_) -> (y, Z)) $ x           | snd x == T =-               getBFstLSorted' (fst x, Z) (zip "ABDEFNOPcdfhkpstwxz" [дзT xs, жT xs,  сьT xs, чT xs, шT xs, нтT xs, стT xs, тьT xs,+               getBFstL' (fst x, Z) (zip "ABDEFNOPcdfhkpstwxz" [дзT xs, жT xs,  сьT xs, чT xs, шT xs, нтT xs, стT xs, тьT xs,                  цT xs, дT xs, фT xs, гT xs, кT xs, пT xs, сT xs, тT xs, цьT xs, хT xs, зT xs]) (fst x):xs           | otherwise = x:xs  isVoicedObstruent :: B.ByteString -> Bool-isVoicedObstruent = getBFstLSorted' False [("A",True),("B",True),("Q",True),("R",True),("T",True),("b",True),("d",True),("g",True),("h",True),+isVoicedObstruent = getBFstL' False [("A",True),("B",True),("Q",True),("R",True),("T",True),("b",True),("d",True),("g",True),("h",True),   ("j",True),("z", True)] . B.take 1  isVoicedObstruentH :: B.ByteString -> Bool-isVoicedObstruentH = getBFstLSorted' False [("A",True),("B",True),("b",True),("d",True),("g",True),("h",True),("j",True),("z", True)] . B.take 1+isVoicedObstruentH = getBFstL' False [("A",True),("B",True),("b",True),("d",True),("g",True),("h",True),("j",True),("z", True)] . B.take 1  isVoicedObstruentS :: B.ByteString -> Bool isVoicedObstruentS = (\u -> any (== u) ["Q","R","T"]) . B.take 1  isSoftDOrL :: [(Char, Triple)] -> Bool-isSoftDOrL xs = getBFstLSorted' False (zip ["bq","cq","dq","fq","lq","mq","nq","pq","sq","tq","vq"] (repeat True)) (takeFromFT_ 2 xs) ||-  getBFstLSorted' False (zip ["P","Q","R","S","T"] . repeat $ True) (takeFromFT_ 1 xs)+isSoftDOrL xs = getBFstL' False (zip ["bq","cq","dq","fq","lq","mq","nq","pq","sq","tq","vq"] (repeat True)) (takeFromFT_ 2 xs) ||+  getBFstL' False (zip ["P","Q","R","S","T"] . repeat $ True) (takeFromFT_ 1 xs)  isSoftDen :: [(Char, Triple)] -> Bool-isSoftDen xs = getBFstLSorted' False (zip ["Aq","cq","dq","lq","nq","sq","tq","zq"] . repeat $ True) (takeFromFT_ 2 xs) ||-  getBFstLSorted' False (zip ["P","Q","R","S","T"] . repeat $ True) (takeFromFT_ 1 xs)+isSoftDen xs = getBFstL' False (zip ["Aq","cq","dq","lq","nq","sq","tq","zq"] . repeat $ True) (takeFromFT_ 2 xs) ||+  getBFstL' False (zip ["P","Q","R","S","T"] . repeat $ True) (takeFromFT_ 1 xs)  -- in the further ??T functions the last (, T) means that it must be afterwards be separated with the soft sign into two tuples (1 additional function in the composition) -- need further processing means that there should be additional checks and may be transformations. May be they can be omitted@@ -290,7 +291,7 @@ correctSomeW zs = zs  divideToParts :: (Char, Triple) -> [Char]-divideToParts (x, z) = getBFstLSorted' [x] (zip "NOPQRST" ["nt", "st", "tq", "Aq", "zq", "nq", "dq"]) . fst $ (x, z)+divideToParts (x, z) = getBFstL' [x] (zip "NOPQRST" ["nt", "st", "tq", "Aq", "zq", "nq", "dq"]) . fst $ (x, z)  correctB :: [Char] -> [Char] correctB ys@(x:xs)@@ -303,7 +304,7 @@ convertToProperUkrainianB = B.pack . convertToProperUkrainianS  linkFileName :: Char -> Char-linkFileName x = getBFstLSorted' x (zip "ABCDEFLMabcdefghijklmnopqrstuvwxyz" "GILUbc00ABZEHXfDeFMNOPQRdSTVWCaYKJ") x+linkFileName x = getBFstL' x (zip "ABCDEFLMabcdefghijklmnopqrstuvwxyz" "GILUbc00ABZEHXfDeFMNOPQRdSTVWCaYKJ") x  showInteresting :: String -> B.ByteString showInteresting = S.fromString . convertToProperUkrainianS
ukrainian-phonetics-basic-array.cabal view
@@ -2,7 +2,7 @@ -- further documentation, see http://haskell.org/cabal/users-guide/  name:                ukrainian-phonetics-basic-array-version:             0.1.2.0+version:             0.2.0.0 synopsis:            A library to work with the basic Ukrainian phonetics and syllable segmentation. description:         A library to work with the basic Ukrainian phonetics and syllable segmentation. Rewritten from the mmsyn6ukr and mmsyn7s packages. Comparing to the ukrainian-phonetics-basic package, all the vector-related functionality removed, it also removed from the dependencies and the mmsyn2 is changed to mmsyn2-array. homepage:            https://hackage.haskell.org/package/ukrainian-phonetics-basic-array@@ -20,6 +20,6 @@   exposed-modules:     Languages.Phonetic.Ukrainian.Syllable.Arr, Melodics.ByteString.Ukrainian.Arr, Languages.Phonetic.Ukrainian.Syllable.Double.Arr   -- other-modules:   other-extensions:    DeriveDataTypeable, FlexibleInstances, OverloadedStrings-  build-depends:       base >=4.7 && <4.15, mmsyn2-array >=0.1.1 && <1, bytestring >=0.10 && <0.13, mmsyn5 >=0.5 && <1+  build-depends:       base >=4.9 && <4.15, mmsyn2-array >=0.2.1.1 && <1, bytestring >=0.10 && <0.13, mmsyn5 >=0.5 && <1, hashable >= 1.2.7 && <2   -- hs-source-dirs:   default-language:    Haskell2010