phonetic-languages-simplified-examples-array 0.1.2.0 → 0.2.0.0
raw patch · 5 files changed
+59/−16 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Phonetic.Languages.Lines: compareFilesToOneCommon :: FilePath -> FilePath -> FilePath -> IO ()
Files
- CHANGELOG.md +5/−0
- Lines/Main.hs +29/−13
- Phonetic/Languages/Lines.hs +18/−0
- README.md +5/−1
- phonetic-languages-simplified-examples-array.cabal +2/−2
CHANGELOG.md view
@@ -12,3 +12,8 @@ * First version revised A. Removed the unneeded dependency of mmsyn2 (and all the vector-related functionality). Some cabal file improvements.++## 0.2.0.0 -- 2021-01-04++* Second version. Added a comparative mode to the possibilities of the rewritePoemG3 and the Phonetic.Languages.Lines+ module. Some documentation improvements.
Lines/Main.hs view
@@ -31,19 +31,35 @@ -- package -- 'https://hackage.haskell.org/package/uniqueness-periods-vector-filters' --+-- @since 0.2.0.0+-- You can also run program in a \'comparative\' mode by specifying \"+C\" as one of the command line arguments and then+-- three files -- the first two -- the existing ones with probably rewritten text by the program for different arguments+-- and the third one is the resulting file. While running in such a mode the program outputs line-by-line the contents of+-- the two first files and writes one of them (or an empty line if neither one) to the third file. main :: IO () main = do- args <- getArgs- let coeffs = readCF . concat . take 1 $ args -- The first command line argument. If not sure, pass just \"1_\".- if isPair coeffs then do- let !numericArgs = filter (all isDigit) . drop 3 $ args- !choice = concat . drop 2 . take 3 $ args- !numberI = fromMaybe 1 (readMaybe (concat . take 1 $ numericArgs)::Maybe Int)- !file = concat . drop 1 . take 2 $ args- generalProcessment coeffs numericArgs choice numberI file+ args0 <- getArgs+ let coeffs = readCF . concat . take 1 $ args0 -- The first command line argument. If not sure, pass just \"1_\".+ compare2 = (\xs -> if null xs then False else True) . filter (== "+C") $ args0+ if compare2 then do+ let args1 = filter (/= "+C") args0+ file1 = concat . take 1 $ args1+ file2 = concat . drop 1 . take 2 $ args1+ file3 = concat . drop 2 . take 3 $ args1+ if file3 /= file1 && file3 /= file2 then compareFilesToOneCommon file1 file2 file3+ else do+ putStrLn "You specified some files twice being in the comparative mode, the program has no well-defined behaviour in such a mode. "+ putStrLn "Please, run it again and specify the three different arguments with the first two being the existing files. " else do- let !numericArgs = filter (all isDigit) . drop 2 $ args- !choice = concat . drop 1 . take 2 $ args- !numberI = fromMaybe 1 (readMaybe (concat . take 1 $ numericArgs)::Maybe Int)- !file = concat . take 1 $ args- generalProcessment coeffs numericArgs choice numberI file+ if isPair coeffs then do+ let !numericArgs = filter (all isDigit) . drop 3 $ args0+ !choice = concat . drop 2 . take 3 $ args0+ !numberI = fromMaybe 1 (readMaybe (concat . take 1 $ numericArgs)::Maybe Int)+ !file = concat . drop 1 . take 2 $ args0+ generalProcessment coeffs numericArgs choice numberI file+ else do+ let !numericArgs = filter (all isDigit) . drop 2 $ args0+ !choice = concat . drop 1 . take 2 $ args0+ !numberI = fromMaybe 1 (readMaybe (concat . take 1 $ numericArgs)::Maybe Int)+ !file = concat . take 1 $ args0+ generalProcessment coeffs numericArgs choice numberI file
Phonetic/Languages/Lines.hs view
@@ -53,6 +53,24 @@ toFileStr (file ++ ".new.txt") (circle2I coeffs permsV choice [] numberI intervalNmbrs minE maxE $ flines) else toFileStr (file ++ ".new.txt") ((concat . take 1 $ flines):(circle2I coeffs permsV choice [] numberI intervalNmbrs 0.0 0.0 . drop 1 $ flines)) +compareFilesToOneCommon :: FilePath -> FilePath -> FilePath -> IO ()+compareFilesToOneCommon file1 file2 file3 = do+ contents1 <- fmap lines . readFile $ file1+ contents2 <- fmap lines . readFile $ file2+ let linesZipped = zip contents1 contents2+ compare2F linesZipped file3+ where compare2F :: [(String,String)] -> FilePath -> IO ()+ compare2F yss file3 = mapM_ (\xs -> do+ putStrLn "Please, specify which variant to use as the result, either 1 or 2: "+ putStrLn $ "1:\t" ++ fst xs+ putStrLn $ "2:\t" ++ snd xs+ ch <- getLine+ let choice2 = fromMaybe 0 (readMaybe ch::Maybe Int)+ case choice2 of+ 1 -> toFileStr file3 [fst xs]+ 2 -> toFileStr file3 [snd xs]+ _ -> toFileStr file3 [""]) yss+ -- | Processment without rearrangements. circle2 :: Coeffs2 -> Array Int [Array Int Int] -> String -> [String] -> [String] -> [String] circle2 coeffs permsG1 choice yss xss
README.md view
@@ -1,4 +1,8 @@ The short (possibly) instruction how to use the programs of the package phonetic-languages-simplified-examples-array in Ukrainian is here: -https://web.archive.org/web/20210102195934/https://github.com/OleksandrZhabenko/uk/blob/master/Instruction_phonetic-languages-simplified-examples-array-0.1.0.0.pdf+https://web.archive.org/web/20210104162220/https://github.com/OleksandrZhabenko/uk/blob/master/Instruction_phonetic-languages-simplified-examples-array-0.2.0.0.pdf++Since the version 0.2.0.0 there exist also comparative mode for the rewritePoemG3 executable. It allows to create from two+files with the text variants the new one. For more information in Ukrainian, please, refer to the instruction above to the+part of the rewritePoemG3 executable.
phonetic-languages-simplified-examples-array.cabal view
@@ -2,9 +2,9 @@ -- further documentation, see http://haskell.org/cabal/users-guide/ name: phonetic-languages-simplified-examples-array-version: 0.1.2.0+version: 0.2.0.0 synopsis: Helps to create Ukrainian texts with the given phonetic properties.-description: Uses more functionality of the arrays and lists. The vector-related functionality is removed and this made the executables and libraries much more leightweight. Deal the Ukrainian as one of the phonetic languages. For the short introduction in English, please, refer to: https://functional-art.org/2020/papers/Poetry-OleksandrZhabenko.pdf.+description: Uses more functionality of the arrays and lists. The vector-related functionality is removed and this made the executables and libraries much more lightweight. Deal the Ukrainian as one of the phonetic languages. For the short introduction in English, please, refer to: https://functional-art.org/2020/papers/Poetry-OleksandrZhabenko.pdf. homepage: https://hackage.haskell.org/package/phonetic-languages-simplified-examples-array license: MIT license-file: LICENSE