mmsyn7s 0.1.1.0 → 0.2.0.0
raw patch · 4 files changed
+45/−13 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ MMSyn7s: eqSnds :: String -> String -> Bool
+ MMSyn7s: show7s' :: [String] -> ([String], [String])
+ MMSyn7s: show7s3 :: String -> ([String], [String])
Files
- CHANGELOG.md +4/−0
- MMSyn7s.hs +38/−8
- Main.hs +2/−4
- mmsyn7s.cabal +1/−1
CHANGELOG.md view
@@ -8,3 +8,7 @@ * First version revised A. Added a function show7s2 for the usage in the mmsyn7ukr package. +## 0.2.0.0 -- 2020-02-24++* Second version. Added functions that can be used to divide a given text to parts with the unique Ukrainian sounds representations (except silent ones) and+the rest of the text being represented. Changed code for mmsyn7s function for readability. Some minor documentation improvements.
MMSyn7s.hs view
@@ -2,33 +2,63 @@ -- Module : MMSyn7s -- Copyright : (c) OleksandrZhabenko 2020 -- License : MIT--- -- Maintainer : olexandr543@yahoo.com -- -- A program and a library that show a sorted list of the Ukrainian sounds --- representations that can be used by mmsyn7 series of programs+-- representations that can be used by mmsyn7 series of programs. -- -module MMSyn7s where+module MMSyn7s (+ -- * Used in the program+ main7s+ -- * Library functions+ -- ** For the text as a whole object+ , show7s+ , show7s2+ -- ** For the text being treated as partial one+ , show7s'+ , show7s3+ -- *** Inner predicate (auxiliary)+ , eqSnds+) where import qualified Data.Vector as V-import Data.List (sort, nub)+import Data.List (sort, nub,(\\),nubBy) import Melodics.Ukrainian (convertToProperUkrainian) import System.Environment (getArgs) - -- | Function takes Ukrainian text being written without quotes as command line arguments and prints the sorted list of the Ukrainian sounds representations -- that can be used further in mmsyn7 series of programs. main7s :: IO () main7s = do texts <- getArgs putStrLn ""- putStrLn . show . sort . nub . V.toList . V.filter (\x -> x /= "-" && x /= "1" && x /= "0") . convertToProperUkrainian . unwords $ texts+ putStrLn . show7s2 . unwords $ texts --- | Function takes Ukrainian text being a @String@ and returns a sorted list of the Ukrainian sounds representations that can be used further in mmsyn7 series of programs.+-- | Function takes Ukrainian text being a @String@ and returns a sorted list of the Ukrainian sounds representations that can be used further in mmsyn7 series of+-- programs. show7s :: String -> [String] show7s xs = sort . nub . V.toList . V.filter (\x -> x /= "-" && x /= "1" && x /= "0") . convertToProperUkrainian $ xs --- | Function takes Ukrainian text being a @String@ and returns a @String@ that is shown sorted list of the Ukrainian sounds representations that can be used further in mmsyn7 series of programs.+-- | Function takes Ukrainian text being a @String@ and returns a @String@ that shows a sorted list of the Ukrainian sounds representations that can be used further+-- in mmsyn7 series of programs. show7s2 :: String -> String show7s2 xs = show . sort . nub . V.toList . V.filter (\x -> x /= "-" && x /= "1" && x /= "0") . convertToProperUkrainian $ xs++-- | Function 'show7s3' takes Ukrainian text being a @String@ and returns a tuple, the first element of which is a list of Strings that correspond to the Ukrainian +-- sounds representations that (except pauses) are unique and are not repeated starting from the beginning of the given text, and the second one is a remainder+-- list of Strings starting from the first duplicated non-silent Ukrainian sound representation.+show7s3 :: String -> ([String], [String])+show7s3 xs = show7s' . V.toList . convertToProperUkrainian $ xs++-- | Function 'eqSnds' compares two non-silent Strings representations for Ukranianian sounds by equality. If one of them is a representation for silence (e. g. pause),+-- then the predicate is @False@.+eqSnds :: String -> String -> Bool+eqSnds xs ys | xs `elem` ["-","0","1"] || ys `elem` ["-","0","1"] = False+ | otherwise = xs == ys++-- | Function @show7s'@ is auxiliary to the 'show7s3' and is used internally in the latter one.+show7s' :: [String] -> ([String],[String])+show7s' zss = let (xss, yss) = splitAt 68 zss in + let uss = xss \\ (nubBy eqSnds xss) in let (wss,vss) = if null uss then (xss,[]) else (takeWhile (/= head uss) xss ++ head uss:(takeWhile (/= head uss) . tail . dropWhile (/= head uss) $ xss), dropWhile (/= head uss) . tail . dropWhile (/= head uss) $ xss) in+ (wss,vss ++ yss)
Main.hs view
@@ -2,11 +2,10 @@ -- Module : MMSyn7s -- Copyright : (c) OleksandrZhabenko 2020 -- License : MIT--- -- Maintainer : olexandr543@yahoo.com -- -- A program and a library that show a sorted list of the Ukrainian sounds --- representations that can be used by mmsyn7 series of programs+-- representations that can be used by mmsyn7 series of programs. -- module Main where@@ -15,10 +14,9 @@ -- | The main function used in the executable @mmsyn7s@. main :: IO ()-main = do +main = do putStrLn "You could specify the Ukrainian text now as the command line arguments by simply adding the Ukrainian text without initial quotes as a command line arguments! " putStrLn "" putStrLn "Now the program will output the list of Ukrainian sounds representations used by the mmsyn6ukr and mmsyn7 programs. " putStrLn "" main7s-
mmsyn7s.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn7s-version: 0.1.1.0+version: 0.2.0.0 synopsis: Shows a sorted list of the Ukrainian sounds representations that can be used by mmsyn7 series of programs description: A program and a library that show a sorted list of the Ukrainian sounds representations that can be used by mmsyn7 series of programs homepage: https://hackage.haskell.org/package/mmsyn7s