mmsyn7s 0.4.0.0 → 0.5.0.0
raw patch · 4 files changed
+83/−15 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ MMSyn7s: show7s9 :: String -> [String]
+ MMSyn7s: uniqMax :: String -> Int
+ MMSyn7s: uniqMin :: String -> Int
+ MMSyn7s: uniqPeriodsDispersion :: String -> Double
+ MMSyn7s: uniqPeriodsMean :: String -> Double
+ MMSyn7s: uniqStdQDeviation :: String -> Double
+ MMSyn7s: uniquenessPeriods :: String -> [Int]
Files
- CHANGELOG.md +5/−0
- MMSyn7s.hs +76/−10
- README.markdown +1/−4
- mmsyn7s.cabal +1/−1
CHANGELOG.md view
@@ -37,3 +37,8 @@ * 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.++## 0.5.0.0 -- 2020-02-26++* Fifth version. Added a function 'show7s9' and some descriptive statistics functions. For the first command line argument "-s" the program now prints some+descriptive statistics metrices for the given text.
MMSyn7s.hs view
@@ -26,13 +26,20 @@ , show7s6 , show7s7 , show7s8+ , show7s9 -- *** Inner predicate (auxiliary) , eqSnds -- *** Inner backward conversion function , listToString- -- *** Some statistic metrics+ -- * Some descriptive statistics metrics , countSnds , sndsDensity+ , uniquenessPeriods+ , uniqMax+ , uniqMin+ , uniqPeriodsMean+ , uniqPeriodsDispersion+ , uniqStdQDeviation ) where import Data.Char (isSpace)@@ -50,8 +57,7 @@ -- -- \"-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;+-- \"-s\" -- prints some general descriptive statistics metrices for the given text; -- -- \"1\" -- prints the list of String being unique (without silence) and then the rest of the text with whitespaces and some phonetical conversions; -- @@ -75,17 +81,16 @@ ; putStrLn "SYNOPSYS: " ; putStrLn "mmsyn7s -h OR: " ; putStrLn "mmsyn7s -v OR: "- ; putStrLn "mmsyn7s -s OR: "+ ; putStrLn "mmsyn7s -s {Ukrainian text} 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 " the third one prints some general descriptive statistics metrices for the given text; "+ ; 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 \"2\" option prints the list of String for the whole text where every sound representation is unique; "@@ -93,8 +98,18 @@ ; putStrLn "created if every sound is unique; " ; putStrLn " the other beginning is equivalent to the previous one behaviour." }- "-v" -> putStrLn "mmsyn7s: version 0.4.0.0"- "-s" -> putStrLn . show . sndsDensity . unwords . drop 1 $ texts+ "-v" -> putStrLn "mmsyn7s: version 0.5.0.0"+ "-s" -> let ys = unwords . drop 1 $ texts in+ do { putStrLn $ "Possibly unique sounds representations density: " ++ (show . sndsDensity $ ys)+ ; putStrLn $ "Number of sounds representation that are enough to cover the text: " ++ (show . countSnds . show7s6 $ ys)+ ; putStrLn $ "Possibly unique sounds representations density: " ++ (show . sndsDensity $ ys)+ ; putStrLn $ "Uniqueness periods: " ++ (show . uniquenessPeriods $ ys)+ ; putStrLn $ "Mean for uniqueness periods list: " ++ (show . uniqPeriodsMean $ ys)+ ; putStrLn $ "Dispersion for uniqueness periods list: " ++ (show . uniqPeriodsDispersion $ ys)+ ; putStrLn $ "Standard quadratic deviation for uniqueness periods list: " ++ (show . uniqStdQDeviation $ ys)+ ; putStrLn $ "The maximum element in the uniqueness periods list: " ++ (show . uniqMax $ ys)+ ; putStrLn $ "The minimum element in the uniqueness periods list: " ++ (show . uniqMin $ ys)+ } "1" -> putStrLn . show . fst . show7s5 . unwords . drop 1 $ texts "-1" -> putStrLn . snd . show7s5 . unwords . drop 1 $ texts "0" -> putStrLn . show7s2 . unwords . drop 1 $ texts@@ -214,3 +229,54 @@ show7s8 :: String -> [String] show7s8 t@(_:_) = (fst . show7s7 $ t):(show7s8 . snd . show7s7 $ t) show7s8 _ = []++-- | Function 'show7s9' takes a Ukrainian text being a @String@ and returns a list of Strings. Each String is a Ukrainian sound representation of the duplicated +-- non-silent sounds, it begins a new second list of Strings in the 'show7s4' function. This information can be helpful e. g. in music and composing.+show7s9 :: String -> [String]+show7s9 xs@(_:_) = (if not . null . snd . show7s4 $ xs then head . snd . show7s4 $ xs else []):(show7s9 . snd . show7s5 $ xs)+show7s9 _ = []++-- | Function 'uniquenessPeriods' takes a Ukrainian text being a @String@ and returns a list of Ints. Each Int value is a number of +-- the Ukrainian sounds representations (non-silent ones) being unique and not duplicated alongside the given text starting from the beginning to the end.+-- This function provides some important information about the phonetical and in some cases semantical structures of the text.+uniquenessPeriods :: String -> [Int]+uniquenessPeriods xs | not . null . filter (not . isSpace) $ xs = map length . show7s6 $ xs+ | otherwise = [0::Int]++-- | Function 'uniqPeriodsMean' is a mathematical expectation for the list obtained by 'uniquenessPeriods' function. It is a statistic metrics.+-- It is a mean for the quantities of the unique (not duplicated, not repeated) Ukrainian sounds in the given Ukrainian text as a @String@.+-- If there are no Ukrainian letters in the text, it is equal to 0.0. The greater it is, the more diverse (phonetically) is the text.+uniqPeriodsMean :: String -> Double+uniqPeriodsMean xs | not . null . filter (not . isSpace) $ xs = let ys = uniquenessPeriods xs in (fromIntegral . sum $ ys) / (fromIntegral . length $ ys)+ | otherwise = 0.0++-- | Function 'uniqPeriodsDispersion' is a dispersion for the list obtained by 'uniquenessPeriods' function. It is a statistic metrics.+-- It is a dispersion for the quantities of the unique (not duplicated, not repeated) Ukrainian sounds in the given Ukrainian text as a @String@.+-- If there are no Ukrainian letters in the text, it is equal to 0.0. The greater it is, the more suitable for changing pronunciation for the sounds +-- (and may be for intonation changes, too) the text is.+uniqPeriodsDispersion :: String -> Double+uniqPeriodsDispersion xs | not . null . filter (not . isSpace) $ xs =+ let ys = uniquenessPeriods xs+ z = uniqPeriodsMean xs+ l = length ys in+ (sum . map (\t -> (fromIntegral t - z) * (fromIntegral t - z)) $ ys) / fromIntegral l+ | otherwise = 0.0++-- | Function 'uniqStdQDeviation' is a standard quadratic deviation for the list obtained by 'uniquenessPeriods' function. It is a statistic metrics.+-- It is a standard quadratic deviation for the quantities of the unique (not duplicated, not repeated) Ukrainian sounds in the given Ukrainian text as a @String@.+-- If there are no Ukrainian letters in the text, it is equal to 0.0. The greater it is, the more suitable for changing pronunciation for the sounds+-- (and may be for intonation changes, too) the text is.+uniqStdQDeviation :: String -> Double+uniqStdQDeviation xs = sqrt . uniqPeriodsDispersion $ xs++-- | Function 'uniqMax' is a maximum element in the 'uniquenessPeriods' function for the same argument. It is provided as a standard element for the+-- descriptive statistics.+uniqMax :: String -> Int+uniqMax xs | not . null . filter (not . isSpace) $ xs = maximum . uniquenessPeriods $ xs+ | otherwise = 0::Int++-- | Function 'uniqMin' is a minimum element in the 'uniquenessPeriods' function for the same argument. It is provided as a standard element for the+-- descriptive statistics.+uniqMin :: String -> Int+uniqMin xs | not . null . filter (not . isSpace) $ xs = minimum . uniquenessPeriods $ xs+ | otherwise = 0::Int
README.markdown view
@@ -11,10 +11,7 @@ "-h" -- prints help 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;+"-s" -- prints some general descriptive statistics metrices for the given text; "-v" -- prints version number and exits;
mmsyn7s.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn7s-version: 0.4.0.0+version: 0.5.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