packages feed

ukrainian-phonetics-basic 0.1.5.0 → 0.1.6.0

raw patch · 4 files changed

+26/−23 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -23,3 +23,7 @@ ## 0.1.5.0 -- 2020-10-27  * First version revised E. Added two new functions to the module Languages.Phonetics.Ukrainian.Syllable to work with Data.Vector.Vector of Char.++## 0.1.6.0 -- 2020-10-28++* First version revised F. Fixed some issues with palatalization and some combinations that were not properly handled. 
Languages/Phonetic/Ukrainian/Syllable.hs view
@@ -176,7 +176,6 @@ createSyllablesUkrP = map (map representProlonged . divVwls . reSyllableCntnts . groupSnds . vec2UZPP2s) . vecWords . V.filter (/='0') . convertToProperUkrainian . map (\x -> if x == '-' then ' ' else x) {-# INLINE createSyllablesUkrP #-} - createSyllablesUkrV :: VB.Vector Char -> [[[UZPP2]]] createSyllablesUkrV = map (divVwls . reSyllableCntnts . groupSnds . vec2UZPP2s) . vecWords . V.filter (/='0') . convertToProperUkrainianV . VB.map (\x -> if x == '-' then ' ' else x) {-# INLINE createSyllablesUkrV #-}
Melodics/ByteString/Ukrainian.hs view
@@ -4,12 +4,12 @@ -- License     :  MIT -- Maintainer  :  olexandr543@yahoo.com ----- Functions provide functionality of a musical instrument synthesizer or for Ukrainian speech synthesis +-- Functions provide functionality of a musical instrument synthesizer or for Ukrainian speech synthesis -- especially for poets, translators and writers. Is rewritten from the module Melodics.Ukrainian from the -- @mmsyn6ukr@ package : 'https://hackage.haskell.org/package/mmsyn6ukr' -- Phonetic material is taken from the :--- --- Solomija Buk, Ján Mačutek, Andrij Rovenchak. Some properties of +--+-- Solomija Buk, Ján Mačutek, Andrij Rovenchak. Some properties of -- the Ukrainian writing system. [Electronic resource] https://arxiv.org/ftp/arxiv/papers/0802/0802.4198.pdf  {-# LANGUAGE OverloadedStrings #-}@@ -46,13 +46,13 @@ data Triple = Z | O | T   deriving (Eq,Ord,Show) --- | The function that converts a written Ukrainian text into the sounding in the program phonetical respesentation. +-- | The function that converts a written Ukrainian text into the sounding in the program phonetical respesentation. -- It is not exact phonetically but you can make for yourself a general impression of the Ukrainian sounding. convertToProperUkrainian :: String -> V.Vector Char convertToProperUkrainian ys = toVector . convertToProperUkrainianS $ ys {-# INLINE convertToProperUkrainian #-} --- | The function that converts a written Ukrainian text into the sounding in the program phonetical respesentation. +-- | The function that converts a written Ukrainian text into the sounding in the program phonetical respesentation. -- It is not exact phonetically but you can make for yourself a general impression of the Ukrainian sounding. convertToProperUkrainianV :: VB.Vector Char -> V.Vector Char convertToProperUkrainianV v = toVector . convertToProperUkrainianV2S $ v@@ -73,12 +73,12 @@ convertToProperUkrainianS :: String -> String convertToProperUkrainianS ys = correctB . correctA . applyChanges . bsToCharUkr . createTuplesByAnalysis . secondConv . filterUkr . changeJotted .    filter (\x -> isUkrainianL x || isSpace x || isControl x || isPunctuation x) . map toLower $ ys-{-# INLINE convertToProperUkrainianS #-}   +{-# INLINE convertToProperUkrainianS #-}  convertToProperUkrainianV2S :: VB.Vector Char -> String convertToProperUkrainianV2S v = correctB . correctA . applyChanges . bsToCharUkr . createTuplesByAnalysis . secondConv . filterUkr . changeJotted . VB.toList .   VB.filter (\x -> isUkrainianL x || isSpace x || isControl x || isPunctuation x) . VB.map toLower $ v-{-# INLINE convertToProperUkrainianV2S #-}   +{-# INLINE convertToProperUkrainianV2S #-}  isUkrainianL :: Char -> Bool isUkrainianL y | (y >= '\1070' && y <= '\1097') = True@@ -96,10 +96,10 @@ changeJotted xs = xs  isConsNotJ :: Char -> Bool-isConsNotJ = getBFst' (False, V.fromList $ 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 = getBFst' (False, V.fromList $ 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 +filterUkr :: String -> B.ByteString+filterUkr = B.pack . map toBSUkr  toBSUkr :: Char -> Char toBSUkr x = getBFst' (x, V.fromList . 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@@ -124,8 +124,8 @@   | B.null t1 = []   | canChange t == O = (B.singleton '1', Z):initialA ts   | canChange t == Z = (B.singleton t, Z):initialA ts-  | getBFst' (False, V.fromList $ zip "cdnstx" (repeat True)) t = -     let (us,vs) = B.splitAt 2 t1 in +  | getBFst' (False, V.fromList $ zip "cdnstx" (repeat True)) t =+     let (us,vs) = B.splitAt 2 t1 in        if X.getBFst' (False, VB.fromList $ 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@@ -149,7 +149,7 @@ applyChanges [] = [] applyChanges [(x, _)] = [(x, Z)] applyChanges xs-  | snd z == T = +  | snd z == T =     X.getBFst' ((fst z, Z), VB.fromList . zip "ABDEFNOPcdfhkpstwxz" $       [дзT zs, жT zs,  сьT zs, чT zs, шT zs, нтT zs, стT zs, тьT zs, цT zs, дT zs, фT zs, гT zs, кT zs, пT zs, сT zs, тT zs, цьT zs, хT zs, зT zs]) (fst z):applyChanges zs   | otherwise = z:applyChanges zs@@ -164,7 +164,7 @@ isSoftDOrL = X.getBFst' (False, VB.fromList . zip ["bq","cq","dq","fq","lq","mq","nq","pq","sq","tq","vq"] $ (repeat True)) . takeFromFT_ 2  isSoftDen :: [(Char, Triple)] -> Bool-isSoftDen = X.getBFst' (False, VB.fromList . zip ["Aq","cq","dq","lq","nq","sq","tq","zq"] $ (repeat True)) . takeFromFT_ 2 +isSoftDen = X.getBFst' (False, VB.fromList . zip ["Aq","cq","dq","lq","nq","sq","tq","zq"] $ (repeat True)) . takeFromFT_ 2  -- 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@@ -177,8 +177,8 @@ дT :: [(Char, Triple)] -> (Char, Triple) дT t1@(_:_) | takeFromFT_ 1 t1 `elem` ["B","E","F"] = ('j', Z) -- need further processing д дж             | takeFromFT_ 2 t1 `elem` ["sq","cq"] = ('Q', T) -- need further processing д дзь-            | takeFromFT_ 1 t1 `elem` ["D","w"] = ('Q', T) -- need further processing д дзь            -            | takeFromFT_ 1 t1 `elem` ["z","s","c"] = ('A', Z) -- need further processing  д дз             +            | takeFromFT_ 1 t1 `elem` ["D","w"] = ('Q', T) -- need further processing д дзь+            | takeFromFT_ 1 t1 `elem` ["z","s","c"] = ('A', Z) -- need further processing  д дз             | otherwise = ('d', Z) дT _ = ('d', Z) @@ -194,7 +194,7 @@ жT _ = ('B', Z)  зT :: [(Char, Triple)] -> (Char, Triple)-зT t1@(_:_) | takeFromFT_ 1 t1 `elem` ["B","E","F"] || takeFromFT_ 2 t1 == "dB" || takeFromFT_ 1 t1 == "j" = ('B', Z) +зT t1@(_:_) | takeFromFT_ 1 t1 `elem` ["B","E","F"] || takeFromFT_ 2 t1 == "dB" || takeFromFT_ 1 t1 == "j" = ('B', Z)             | isSoftDOrL t1 = ('R', T)             | takeFromFT 1 t1 `elem` ["E","F"] = ('F', Z) -- need further processing з ш             | takeFromFT 1 t1  `elem` ["s","c"] || takeFromFT_ 1 t1 `elem` ["k","p","t","f","x"] = ('s', Z) -- need further processing з с@@ -209,7 +209,7 @@ нтT :: [(Char, Triple)] -> (Char, Triple) нтT t1@(_:_) | takeFromFT 2 t1 == "st" || takeFromFT 1 t1 == "O" = ('n', Z)              | takeFromFT 3 t1 == "sqk" || takeFromFT 2 t1 == "Dk" = ('S', T)-             | otherwise = ('N', Z)+             | otherwise = ('N', T) нтT _ = ('N', T)  пT :: [(Char, Triple)] -> (Char, Triple)@@ -314,12 +314,12 @@ {-# INLINE correctA #-}  separateSoftS :: [(Char, Triple)] -> [Char]-separateSoftS = map fst . mapI (\x -> snd x == T) divideToParts+separateSoftS = map fst . mapI ((== T) . snd) divideToParts {-# INLINE separateSoftS #-}  correctSomeW :: [Char] -> [Char] correctSomeW (x:y:z:xs) | x == 'w' && y == 'D' && z == 'a' = x:'w':z:correctSomeW xs-                        | (x == '1' || x == '0') && y == 'C' && z == 'a' = +                        | (x == '1' || x == '0') && y == 'C' && z == 'a' =   if take 2 xs == "En"     then x:y:z:'F':correctSomeW (tail xs)     else x:correctSomeW (y:z:xs)@@ -359,4 +359,4 @@ linkFileName x = getBFst' (x,V.fromList . zip "ABCDEFLMabcdefghijklmnopqrstuvwxyz" $ "GILUbc00ABZEHXfDeFMNOPQRdSTVWCaYKJ") x  showInteresting :: String -> B.ByteString-showInteresting = S.fromString . V.toList . convertToProperUkrainian +showInteresting = S.fromString . V.toList . convertToProperUkrainian
ukrainian-phonetics-basic.cabal view
@@ -2,7 +2,7 @@ -- further documentation, see http://haskell.org/cabal/users-guide/  name:                ukrainian-phonetics-basic-version:             0.1.5.0+version:             0.1.6.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. homepage:            https://hackage.haskell.org/package/ukrainian-phonetics-basic