packages feed

mmsyn6ukr 0.3.3.0 → 0.3.4.0

raw patch · 3 files changed

+31/−19 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Melodics.Ukrainian: instance GHC.Read.Read Melodics.Ukrainian.Triple

Files

ChangeLog.md view
@@ -34,3 +34,8 @@ ## 0.3.3.0 -- 2019-12-03  * Third version revised D. Changed all non-silent sounds. Added support for '-'.++## 0.3.4.0 -- 2019-12-03++* Third version revised E. Fixed issues with the jotted sounds.+
Melodics/Ukrainian.hs view
@@ -9,7 +9,6 @@ -- especially for poets, translators and writers.  -- - module Melodics.Ukrainian (   appendS16LEFile,   convertToProperUkrainian, @@ -30,7 +29,7 @@ -}  data Triple = Z | O | T-  deriving (Eq,Ord,Show,Read)+  deriving (Eq,Ord,Show)  takeData :: FilePath -> IO B.ByteString takeData file = do@@ -68,20 +67,26 @@ -- | 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 imression of the Ukrainian sounding. convertToProperUkrainian :: String -> V.Vector String-convertToProperUkrainian ys = toVector . correctA . createTuplesByAnalysis . filterUkr $ ys+convertToProperUkrainian ys = let ks = createTuplesByAnalysis . wasFstConverted . filterUkr $ ys in toVector . correctA $ ks  filterUkr :: String -> String -filterUkr xs = concatMap (\x -> if isUkrainian x then [toLower x] else if isSpace x || isControl x || x == '-' then [x] else []) xs+filterUkr xs = concatMap (\x -> if isUkrainian x then [toLower x] else if isSpace x || isControl x then [x] else []) xs +-- Need testing!! It does not work properly! createTuplesByAnalysis :: String -> [(String, Triple)]-createTuplesByAnalysis x@(y:ys) | canChange [y] == O = ("1", Z):createTuplesByAnalysis ys-                                | canChange [y] == T = applyChanges . initialA . groupBy isSimilar . changeJotted . wasFstConverted $ x+createTuplesByAnalysis x@(y:ys) | isSpace y || isControl y || y == '-' = ("1", Z):createTuplesByAnalysis ys+                                | getBFst' (False, V.fromList $ zip "\1075\1076\1078\1079\1082\1085\1087\1089\1090\1092\1093\1094\1095\1096" (repeat True)) y = +  let ts = changeJotted x in applyChanges . initialA . groupBy isSimilar $ ts+                                | not (null ys) && head ys == '\1081' && isConsNotJ y = case y of +  '\1089' -> ("\1089\1100", T):createTuplesByAnalysis (tail ys)+  '\1094' -> ("\1094\1100", T):createTuplesByAnalysis (tail ys)+  _       -> ([y], T):("\1100", Z):createTuplesByAnalysis (tail ys)                                 | otherwise = ([y], Z):createTuplesByAnalysis ys createTuplesByAnalysis _ = []  canChange :: String -> Triple canChange ~(x:_) | isSpace x || isControl x || x == '-' = O-                 | getBFst' (False, V.fromList $ zip ['\1075','\1076','\1079','\1078','\1082','\1087','\1089','\1090','\1092','\1093','\1094','\1095','\1096'] (repeat True)) x = T+                 | getBFst' (False, V.fromList $ zip "\1075\1076\1078\1079\1082\1085\1087\1089\1090\1092\1093\1094\1095\1096" (repeat True)) x = T                  | otherwise = Z                      isVoicedObstruent :: String -> Bool@@ -97,29 +102,28 @@     if getBFst' (False, V.fromList $ zip ["\1076\1078","\1076\1079","\1085\1090","\1089\1090","\1089\1100","\1090\1089","\1090\1100","\1093\1075","\1094\1100"] (repeat True)) us       then (us, T):initialA (vs:ts)       else (ht, T):initialA (tail t:ts)-   else case (getBFst' (False, V.fromList $ zip ["\1075","\1078","\1079","\1082","\1092","\1095","\1096"] (repeat True)) ht) of+   else case (getBFst' (False, V.fromList $ zip ["\1075","\1078","\1079","\1082","\1087","\1092","\1095","\1096"] (repeat True)) ht) of           ~True -> (ht, T):initialA (tail t:ts)                 | otherwise = (ht, Z):initialA (tail t:ts)                        where ht = [head t]                              tu = canChange ht initialA _ = []-    wasFstConverted :: String -> String wasFstConverted = mapI mustBeConverted convertionFst  mustBeConverted :: Char -> Bool-mustBeConverted c = getBFst' (False, V.fromList $ zip "'\700\1097\1102\1103\1108\1111\8217" (repeat True)) c+mustBeConverted c = getBFst' (False, V.fromList $ zip "'-\700\1097\1102\1103\1108\1111\8217" (repeat True)) c  convertionFst :: Char -> String-convertionFst u = getBFst' ([u], V.fromList $ zip "'\700\1097\1102\1103\1108\1111\8217" ["0","0","\1096\1095","\1081\1091","\1081\1072","\1081\1077","\1081\1110","0"]) u+convertionFst u = getBFst' ([u], V.fromList $ zip "'-\700\1097\1102\1103\1108\1111\8217" ["0","0","0","\1096\1095","\1081\1091","\1081\1072","\1081\1077","\1081\1110","0"]) u -isConsonant :: Char -> Bool-isConsonant = getBFst' (False, V.fromList $ zip "\1073\1074\1075\1076\1078\1079\1081\1082\1083\1084\1085\1087\1088\1089\1090\1092\1093\1094\1095\1096\1169" (repeat True))+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\1169" (repeat True))  changeJotted :: String -> String-changeJotted (x:y:z:zs) | (not (isNotVowel z)) && (y == '\1081') && (isConsonant x) = x:'\1100':z:changeJotted zs-                        | isConsonant x && y == '\1110' = x:'\1100':y:changeJotted (z:zs)+changeJotted (x:y:z:zs) | (getBFst' (False, V.fromList $ zip "\1072\1077\1080\1091\1110" (repeat True)) z) && (y == '\1081') && (isConsNotJ x) = x:'\1100':z:changeJotted zs+                        | isConsNotJ x && y == '\1110' = x:'\1100':y:changeJotted (z:zs)                         | otherwise = x:changeJotted (y:z:zs) changeJotted xs = xs @@ -297,7 +301,11 @@   if takeFromFT 2 xs == "\1095\1085"     then x:y:z:("\1096", Z):correctSomeW (tail xs)     else x:correctSomeW (y:z:xs)-correctSomeW zs = zs    +                        | fst x == "\1090" && fst y == "\1100" && fst z == "\1089\1100" && not (null xs) && (not . null . fst . head $ xs) = +  if (fst . head $ xs) == "\1072" +    then ("\1094\1100", Z):("\1094\1100", Z):("\1072", Z):correctSomeW (tail xs)+    else x:correctSomeW (y:z:xs)+correctSomeW zs = zs  takeFromFT :: Int -> [(String, Triple)] -> String takeFromFT n ts | compare n 0 == GT = if null ts @@ -312,9 +320,8 @@ takeFromFT_ :: Int -> [(String, Triple)] -> String takeFromFT_ n ts = takeFromFT n (map (\(xs, y) -> (filter (/='_') xs, y)) ts) - toVector :: [(String, Triple)] -> V.Vector String-toVector ts = V.fromList . map fst $ ts+toVector ts = V.fromList . mapI2 (\x -> not . null . fst $ x) fst (\y -> []) $ ts  isUkrainian :: Char -> Bool isUkrainian y | (y >= '\1040' && y <= '\1065') || (y >= '\1070' && y <= '\1097') = True
mmsyn6ukr.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                mmsyn6ukr-version:             0.3.3.0+version:             0.3.4.0 synopsis:            A musical instrument synthesizer or a tool for Ukrainian language listening description:         A program can be used as a musical instrument synthesizer or for Ukrainian speech synthesis especially for poets and writers homepage:            https://hackage.haskell.org/package/mmsyn6ukr