mmsyn7s 0.3.1.1 → 0.4.0.0
raw patch · 4 files changed
+88/−11 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ MMSyn7s: countSnds :: [[String]] -> Int
+ MMSyn7s: show7s6 :: String -> [[String]]
+ MMSyn7s: show7s7 :: String -> (String, String)
+ MMSyn7s: show7s8 :: String -> [String]
+ MMSyn7s: sndsDensity :: String -> Double
Files
- CHANGELOG.md +6/−0
- MMSyn7s.hs +67/−8
- README.markdown +14/−2
- mmsyn7s.cabal +1/−1
CHANGELOG.md view
@@ -31,3 +31,9 @@ ## 0.3.1.1 -- 2020-02-25 * Third version revised C. Fixed issue with being not complete the "-h" first command line argument information.++## 0.4.0.0 -- 2020-02-26++* Fourth version. Fixed issue with the documentation for the 'show7s5' function. Added some new library functions. Added the possibility to get some statistic metrics+and to obtain a list of lists of Strings -- the information about how many and what actually Ukrainian sounds representations are needed to be created if every sound+representation is unique.
MMSyn7s.hs view
@@ -23,12 +23,19 @@ , show7s3 , show7s4 , show7s5+ , show7s6+ , show7s7+ , show7s8 -- *** Inner predicate (auxiliary) , eqSnds -- *** Inner backward conversion function , listToString+ -- *** Some statistic metrics+ , countSnds+ , sndsDensity ) where +import Data.Char (isSpace) import qualified Data.Vector as V import Data.List (sort, nub,(\\),nubBy) import Melodics.Ukrainian (convertToProperUkrainian)@@ -42,12 +49,20 @@ -- \"-h\" -- prints help and exits; -- -- \"-v\" -- prints version number and exits;+--+-- \"-s\" -- prints a ratio of the total number of the Ukrainian sounds representations needed if every one is used just once +-- (except silent) to the total number of the represenations if they are the same no matter where the corresponding sound is located; -- -- \"1\" -- prints the list of String being unique (without silence) and then the rest of the text with whitespaces and some phonetical conversions; -- -- \"-1\" -- prints the rest of the text after the first duplicated sound representation (except silent ones) including it with whitespaces and some phonetical conversions; -- -- \"0\" -- prints the list of String for the whole text.+--+-- \"2\" -- prints the list of String for the whole text where every sound representation is unique; +--+-- \"3\" -- prints the list of lists of Strings for the whole text, which shows what sound representations are needed to be +-- created if every sound is unique; -- -- All other variants of the beginning for the command line arguments are the same as \"0\" (the arguments are treated as a Ukrainian text -- and processed as a whole one object).@@ -60,36 +75,44 @@ ; putStrLn "SYNOPSYS: " ; putStrLn "mmsyn7s -h OR: " ; putStrLn "mmsyn7s -v OR: "+ ; putStrLn "mmsyn7s -s OR: " ; putStrLn "mmsyn7s 1 {Ukrainian text} OR: " ; putStrLn "mmsyn7s -1 {Ukrainian text} OR: " ; putStrLn "mmsyn7s 0 {Ukrainian text} OR: " ; putStrLn "mmsyn7s {Ukrainian text}" ; putStrLn "where the first one prints this help message; " ; putStrLn " the second one prints a version number; "+ ; putStr " the third one prints a ratio of the total number of the Ukrainian sounds representations needed if every one is used just once "+ ; putStrLn "(except silent) to the total number of the represenations if they are the same no matter where the corresponding sound is located; " ; putStrLn " the \"1\" option prints the list of String being unique (without silence)" ; putStr " the \"-1\" option prints the rest of the text after the first duplicated sound representation (except silent ones) " ; putStrLn "including it with whitespaces and some phonetical conversions; "- ; putStrLn " the \"0\" option prints the list of String for the whole text"+ ; putStrLn " the \"0\" option prints the list of String for the whole text; "+ ; putStrLn " the \"2\" option prints the list of String for the whole text where every sound representation is unique; "+ ; putStr " the \"3\" option prints the list of lists of Strings for the whole text, which shows what sound representations are needed to be "+ ; putStrLn "created if every sound is unique; " ; putStrLn " the other beginning is equivalent to the previous one behaviour." }- "-v" -> putStrLn "mmsyn7s: version 0.3.1.1"+ "-v" -> putStrLn "mmsyn7s: version 0.4.0.0"+ "-s" -> putStrLn . show . sndsDensity . unwords . drop 1 $ texts "1" -> putStrLn . show . fst . show7s5 . unwords . drop 1 $ texts "-1" -> putStrLn . snd . show7s5 . unwords . drop 1 $ texts "0" -> putStrLn . show7s2 . unwords . drop 1 $ texts+ "2" -> putStrLn . show . show7s8 . unwords . drop 1 $ texts+ "3" -> putStrLn . show . show7s6 . unwords . drop 1 $ 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+-- | Function takes a 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 shows a sorted list of the Ukrainian sounds representations that can be used further+-- | Function takes a 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 +-- | Function 'show7s3' takes a 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])@@ -120,7 +143,7 @@ dropWhile (/= head uss) . tail . dropWhile (/= head uss) $ xss) in (sort . filter (\x -> x /= "-" && x /= "1" && x /= "0") $ wss,vss ++ yss) --- | Function 'show7s4' 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 +-- | Function 'show7s4' takes a 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 (this list is filtered from -- the representations for the silence and then sorted in the ascending order), and the second one is a remainder -- list of Strings starting from the first duplicated non-silent Ukrainian sound representation.@@ -148,10 +171,46 @@ dropWhile (/= head uss) . tail . dropWhile (/= head uss) $ xss) in (sort . filter (\x -> x /= "-" && x /= "1" && x /= "0") $ wss, listToString $ vss ++ yss) --- | Function 'show7s4' 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 +-- | Function 'show7s5' takes a 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 (this list is filtered from -- the representations for the silence and then sorted in the ascending order), and the second one is a @String@ obtained from the remainder -- list of Strings starting from the first duplicated non-silent Ukrainian sound representation with whitespaces (whitespaces are substituted -- instead of punctiuation symbols, too) and some phonetical conversions. show7s5 :: String -> ([String], String) show7s5 xs = show7s''' . V.toList . convertToProperUkrainian $ xs++-- | Function 'show7s6' takes a Ukrainian text being a @String@ and returns a list of lists of Strings, each latter one of which is obtained for the unique parts of+-- the text from the Ukrainian sounds representations point of view. It can show how many and what sound representations are needed to be created to completely cover+-- the given text providing all the needed sound parameters.+show7s6 :: String -> [[String]]+show7s6 t@(_:_) = (fst . show7s5 $ t):(show7s6 . snd . show7s5 $ t)+show7s6 _ = []++-- | Function 'countSnds' counts total number of Strings in the list of list of Strings. It can be successfully used to count how many Ukrainian sounds representations+-- are needed to be created to completely cover the given Ukrainian text. It can be used as a some statistics parameter for the text.+countSnds :: [[String]] -> Int+countSnds xss = sum . map length $ xss++-- | Function 'sndsDensity' counts the ratio of total number of Ukrainian sounds representations (each of which gives an opportunity to use a unique ones) to the+-- total number of the Ukrainian sounds representations if all the non-silent sounds in the text are the same for the one sound representation no matter where it is+-- located. It can be used as a some statistics parameter for the text. The greater is the result, the greater number of the Ukrainian sounds representations+-- is needed to be created for the text to create a unique sound for every location alongside the text. If it is equal to 1.0, then every non-silent sound+-- in the text appears just once (if any).+sndsDensity :: String -> Double+sndsDensity xs | null . filter (not . isSpace) $ xs = 1.0+ | otherwise =+ let x = countSnds . show7s6 $ xs+ y = length . show7s $ xs in fromIntegral x / fromIntegral y++-- | Function 'show7s7' takes a Ukrainian text being a @String@ and returns a tuple of Strings. The first element is a String corresponding to the beginning of the+-- text with only unique non-silent sounds representations, and the second one is the rest of the text. Each resulting String is modified so that it contains some+-- phonetical conversions and (may be) changed punctuation and whitespaces.+show7s7 :: String -> (String, String)+show7s7 xs = (listToString . fst $ y, listToString . snd $ y)+ where y = show7s3 xs++-- | Function 'show7s8' takes a Ukrainian text being a @String@ and returns a list of Strings. Each String contains only unique Ukrainian sounds representations so+-- that being sequenced from head of the list they all correspond to the whole text.+show7s8 :: String -> [String]+show7s8 t@(_:_) = (fst . show7s7 $ t):(show7s8 . snd . show7s7 $ t)+show7s8 _ = []
README.markdown view
@@ -11,15 +11,27 @@ "-h" -- prints help and exits; -"-v" -- prints version number and exits;+"-s" -- prints a ratio of the total number of the Ukrainian sounds+representations needed if every one is used just once (except silent)+to the total number of the represenations if they are the same no matter+where the corresponding sound is located; -"1" -- prints the list of String being unique (without silence);+"-v" -- prints version number and exits; "-1" -- prints the rest of the text after the first duplicated sound representation (except silent ones) including it with whitespaces and some phonetical conversions; "0" -- prints the list of String for the whole text.++"1" -- prints the list of String being unique (without silence);++"2" -- prints the list of String for the whole text where every sound+representation is unique; ++"3" -- prints the list of lists of Strings for the whole text, which+shows what sounds representations are needed to be created if every+sound representation is unique; All other variants of the beginning for the command line arguments are the same as "0" (the arguments are treated as a Ukrainian text
mmsyn7s.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn7s-version: 0.3.1.1+version: 0.4.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