mmsyn7s 0.2.0.0 → 0.3.0.0
raw patch · 5 files changed
+126/−15 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ MMSyn7s: listToString :: [String] -> String
+ MMSyn7s: show7s'' :: [String] -> ([String], [String])
+ MMSyn7s: show7s''' :: [String] -> ([String], String)
+ MMSyn7s: show7s4 :: String -> ([String], [String])
+ MMSyn7s: show7s5 :: String -> ([String], String)
Files
- CHANGELOG.md +6/−0
- MMSyn7s.hs +91/−7
- Main.hs +1/−6
- README.markdown +26/−0
- mmsyn7s.cabal +2/−2
CHANGELOG.md view
@@ -12,3 +12,9 @@ * 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.++## 0.3.0.0 -- 2020-02-25++* Third version. Added README.markdown file. Added the analysis for the first command line argument. Added the possibility to process a Ukrainian text as a whole+or alternatively by parts, each of which contains only unique String Ukrainian sounds representations (except for the silent ones). Some minor code and documentation+improvements.
MMSyn7s.hs view
@@ -2,6 +2,7 @@ -- Module : MMSyn7s -- Copyright : (c) OleksandrZhabenko 2020 -- License : MIT+-- Stability : Experimental -- Maintainer : olexandr543@yahoo.com -- -- A program and a library that show a sorted list of the Ukrainian sounds @@ -17,9 +18,15 @@ , show7s2 -- ** For the text being treated as partial one , show7s'+ , show7s''+ , show7s''' , show7s3+ , show7s4+ , show7s5 -- *** Inner predicate (auxiliary) , eqSnds+ -- *** Inner backward conversion function+ , listToString ) where import qualified Data.Vector as V@@ -27,13 +34,41 @@ 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.+-- | Function takes the first command line argument and (may be) a Ukrainian text being written without quotes as the next command line arguments+-- and prints the sorted list of the Ukrainian sounds representations that can be used further in mmsyn7 series of programs.+--+-- Depending on the first command line argument the program behaves as follows:+-- \"-h\" -- prints help and exits;+-- \"-v\" -- prints version number and exits;+-- \"1\" -- prints the list of String being unique (without silence) and then the rest of the text with whitespaces and some phonetical conversions;+-- \"0\" -- prints the list of String for the whole text.+-- 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). main7s :: IO () main7s = do texts <- getArgs putStrLn ""- putStrLn . show7s2 . unwords $ texts+ let arg1 = concat . take 1 $ texts in+ case arg1 of+ "-h" -> do { putStrLn "mmsyn7s: "+ ; putStrLn "SYNOPSYS: "+ ; putStrLn "mmsyn7s -h OR: "+ ; putStrLn "mmsyn7s -v 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; "+ ; putStrLn " the \"1\" option prints the list of String being unique (without silence) and then the rest of the text with whitespaces and some phonetical conversions; "+ ; putStrLn " the \"0\" option prints the list of String for the whole text"+ ; putStrLn " the other beginning is equivalent to the previous one behaviour."+ }+ "-v" -> putStrLn "mmsyn7s: version 0.3.0.0"+ "1" -> do { putStrLn . show . fst . show7s5 . unwords . drop 1 $ texts+ ; putStrLn . snd . show7s5 . unwords . drop 1 $ texts }+ "0" -> putStrLn . show7s2 . 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 -- programs.@@ -51,7 +86,7 @@ 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),+-- | Function 'eqSnds' compares two non-silent Strings representations for Ukrainian 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@@ -59,6 +94,55 @@ -- | 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)+show7s' zss =+ let (xss, yss) = splitAt 68 zss+ uss = xss \\ (nubBy eqSnds xss)+ (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)++-- | The same as @show7s'@, but the first list in the tuple is filtered from the silent representations and is sorted not in the order of appearance in the text,+-- but in the ascending order.+show7s'' :: [String] -> ([String],[String])+show7s'' zss =+ let (xss, yss) = splitAt 68 zss+ uss = xss \\ (nubBy eqSnds xss)+ (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 + (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 +-- 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.+show7s4 :: String -> ([String], [String])+show7s4 xs = show7s'' . V.toList . convertToProperUkrainian $ xs++-- | Function 'listToString' converts the list of Strings being the sequential Ukrainian sounds representations into the Ukrainian text with whitespaces+-- (whitespaces are substituted instead of punctiuation symbols, too) and some phonetical conversions.+listToString :: [String] -> String+listToString xss =+ concatMap (\t ->+ case t of+ "0" -> " "+ "1" -> " "+ "-" -> " "+ x -> x) xss++-- | The same as @show7s''@, but the second element in the resulting tuple is again the Ukrainian text with whitespaces (whitespaces are substituted+-- instead of punctiuation symbols, too) and some phonetical conversions.+show7s''' :: [String] -> ([String],String)+show7s''' zss =+ let (xss, yss) = splitAt 68 zss+ uss = xss \\ (nubBy eqSnds xss)+ (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 + (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 +-- 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
Main.hs view
@@ -14,9 +14,4 @@ -- | The main function used in the executable @mmsyn7s@. main :: IO ()-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+main = main7s
+ README.markdown view
@@ -0,0 +1,26 @@+ ***** Usage *****+ -----------------++The package provides a library functions and the executable. The executable+takes the first command line argument and (may be) a Ukrainian text+being written without quotes as the next command line arguments+and prints the sorted list of the Ukrainian sounds representations+that can be used further in mmsyn7 series of programs.++Depending on the first command line argument the program behaves as follows:+"-h" -- prints help and exits;+"-v" -- prints version number and exits;+"1" -- prints the list of String being unique (without silence) and then+the rest of the text with whitespaces;+"0" -- prints the list of String for the whole text.+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). ++The resulting Strings and lists of Strings can be used further in the+programs:+[mmsyn7ukr](https://hackage.haskell.org/package/mmsyn7ukr)+[mmsyn7h](https://hackage.haskell.org/package/mmsyn7h)++The results of the previous ones can be processed also by the program: +[mmsyn7l](https://hackage.haskell.org/package/mmsyn7l)
mmsyn7s.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn7s-version: 0.2.0.0+version: 0.3.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@@ -13,7 +13,7 @@ copyright: (c) OleksandrZhabenko 2020 category: Language build-type: Simple-extra-source-files: CHANGELOG.md+extra-source-files: CHANGELOG.md, README.markdown cabal-version: >=1.10 library