packages feed

phonetic-languages-simplified-examples-array 0.11.3.0 → 0.12.0.0

raw patch · 5 files changed

+93/−48 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Phonetic.Languages.Lines: compareFilesToOneCommon :: FilePath -> FilePath -> FilePath -> IO ()
+ Phonetic.Languages.Lines: compareFilesToOneCommon :: [FilePath] -> FilePath -> IO ()
- Phonetic.Languages.Lines: generalProcessment :: (Int, Int) -> Coeffs2 -> [String] -> String -> Int -> FilePath -> IO ()
+ Phonetic.Languages.Lines: generalProcessment :: (Int, Int) -> Coeffs2 -> [String] -> [String] -> Int -> FilePath -> IO ()

Files

CHANGELOG.md view
@@ -143,3 +143,8 @@  * The eleventh version revised D. Updated the README file with the hyperlinks to the updated documentation related to the usage of the package.++## 0.12.0.0 -- 2021-09-14++* The twelth version. Added multiple properties mode to the rewritePoemG3 program and extended the comparative mode+for it up to 7 different input source files. Some documentation improvements.
Lines/Main.hs view
@@ -19,6 +19,7 @@ import Data.Maybe (fromMaybe) import System.Environment (getArgs) import Data.Char (isDigit)+import Data.List (nub) import Phonetic.Languages.Common import Phonetic.Languages.Lines @@ -41,20 +42,28 @@ -- There is also the possibility to use \'line growing\' that is to use the 'prepereGrowTextMN' function -- with the 'Int' arguments from the first argument tuple. This allows to rearrange the given text and then -- to rewrite it. For this you need to specify somewhere (withot \"+c\" modifier) \"+g73\" or something similar.+--+-- @ since 0.12.0.0+-- You can run the comparative mode on the up to 7 different files simultaneously. main :: IO () main = do- args0 <- getArgs- let coeffs = readCF . concat . take 1 $ args0 -- The first command line argument. If not sure, pass just \"1_\".+ args00 <- getArgs+ let multiple = if null . filter (== "+m") $ args00 then 0 else 1+     args0+       | multiple == 1 = takeWhile (/= "+m") args00 `mappend` drop 1 (dropWhile (/= "-m") args00)+       | otherwise = args00+     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. "+       (args2,file3)+         | null args1 = ([],[])+         | otherwise = (init . nub $ args1,last args1)+   if null file3 then do+       putStrLn "Please, specify the file to save the data to. "+       file3 <- getLine+       compareFilesToOneCommon args2 file3+   else compareFilesToOneCommon args2 file3  else do   let growing = filter ((== "+g") . (take 2)) args0       (gr1,gr2)@@ -66,13 +75,17 @@                                   _ -> (0,0)   if isPair coeffs then do    let !numericArgs = filter (all isDigit) . drop 3 $ args0-       !choice = concat . drop 2 . take 3 $ args0+       !choices+          | multiple == 1 = drop 1 . dropWhile (/= "+m") . takeWhile (/= "-m") $ args00+          | otherwise = drop 2 . take 3 $ args0        !numberI = fromMaybe 1 (readMaybe (concat . take 1 $ numericArgs)::Maybe Int)        !file = concat . drop 1 . take 2 $ args0-   generalProcessment (gr1,gr2) coeffs numericArgs choice numberI file+   generalProcessment (gr1,gr2) coeffs numericArgs choices numberI file   else do    let !numericArgs = filter (all isDigit) . drop 2 $ args0-       !choice = concat . drop 1 . take 2 $ args0+       !choices+          | multiple == 1 = drop 1 . dropWhile (/= "+m") . takeWhile (/= "-m") $ args00+          | otherwise = drop 1 . take 2 $ args0        !numberI = fromMaybe 1 (readMaybe (concat . take 1 $ numericArgs)::Maybe Int)        !file = concat . take 1 $ args0-   generalProcessment (gr1,gr2) coeffs numericArgs choice numberI file+   generalProcessment (gr1,gr2) coeffs numericArgs choices numberI file
Phonetic/Languages/Lines.hs view
@@ -20,7 +20,7 @@ import Data.SubG import Data.MinMax.Preconditions import GHC.Arr-import Data.List (sort,nub)+import Data.List (sort,nub,zip,zip3,zip4,zip5,zip6,zip7) import Phonetic.Languages.Array.Ukrainian.PropertiesSyllablesG2 import Phonetic.Languages.Simplified.StrictVG.Base import Phonetic.Languages.Permutations.Arr@@ -33,6 +33,7 @@ import Phonetic.Languages.Simplified.Array.Ukrainian.FuncRep2RelatedG2 import Data.Monoid (mappend) import Phonetic.Languages.Common+import Interpreter.StringConversion  {-| @ since 0.5.0.0 -- The meaning of the first command line argument (and 'Coeffs2' here everywhere in the module) depends on the 'String' argument -- whether it starts with \'w\', \'x\' or otherwise. In the first case it represents@@ -44,16 +45,20 @@ to rewrite it. Besides there are new lines of the arguments for the 'String' argument that can begin with \"c\", \"s\", \"t\", \"u\", \"v\", \"C\", \"N\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\" and \"Z\" letters. For more information, please, refer to the 'Phonetic.Languages.Array.Ukrainian.PropertiesSyllablesG2.rhythmicity'.+@ since 0.12.0.0 -- Changed the arguments. Now it can run multiple rewritings for the one given data file+on the given list of choices for the properties given as the second ['String'] argument. Every new file is being+saved with the choice prefix. -}-generalProcessment :: (Int,Int) -> Coeffs2 -> [String] -> String -> Int -> FilePath -> IO ()-generalProcessment (gr1,gr2) coeffs numericArgs choice numberI file = do+generalProcessment :: (Int,Int) -> Coeffs2 -> [String] -> [String] -> Int -> FilePath -> IO ()+generalProcessment (gr1,gr2) coeffs numericArgs choices numberI file = do   contents <- readFile file   let !permsV = genPermutationsArrL       !flines         | gr1 == 0 = fLines 0 contents         | otherwise = prepareGrowTextMN gr1 gr2 . unlines . fLines 0 $ contents       !lasts = map (\ts -> if null . words $ ts then [] else last . words $ ts) flines-  if compare numberI 2 == LT then toFileStr (file ++ ".new.txt") (circle2 coeffs permsV choice [] $ flines)+  if compare numberI 2 == LT then+    mapM_ (\choice -> toFileStr (choice ++ "." ++ file ++ ".new.txt") (circle2 coeffs permsV choice [] $ flines)) choices   else do     let !intervalNmbrs = (\vs -> if null vs then [numberI] else nub vs) . sort . filter (<= numberI) .            map (\t -> fromMaybe numberI (readMaybe t::Maybe Int)) . drop 2 $ numericArgs@@ -61,28 +66,28 @@         !l2 = (subtract 3) . length $ us     if compare l2 0 /= LT then do       let !perms2 = unsafeAt permsV $ l2-          (!minE,!maxE) = let !frep20 = chooseMax id coeffs choice in minMax11C . map (toPropertiesF' frep20) .-                    uniquenessVariants2GNPBL [] (concat . take 1 $ lasts) ' ' id id id perms2 . init $ us-      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))+          minMaxTuples = let !frep20Zip = zip choices . map (chooseMax id coeffs) $ choices in+            map (\(choice,frep20) -> minMax11C . map (toPropertiesF' frep20) .+              uniquenessVariants2GNPBL [] (concat . take 1 $ lasts) ' ' id id id perms2 . init $ us) frep20Zip+      mapM_ (\(choice, (minE,maxE)) -> toFileStr (choice ++ "." ++ file ++ ".new.txt") (circle2I coeffs permsV choice [] numberI intervalNmbrs minE maxE $ flines)) . zip choices $ minMaxTuples+    else mapM_ (\choice -> toFileStr (choice ++ "." ++ file ++ ".new.txt") ((concat . take 1 $ flines):+      (circle2I coeffs permsV choice [] numberI intervalNmbrs 0.0 0.0 . drop 1 $ flines))) choices -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+compareFilesToOneCommon :: [FilePath] -> FilePath -> IO ()+compareFilesToOneCommon files file3 = do+ contentss <- mapM ((\(j,ks) -> do {readFileIfAny ks >>= \fs -> return (j, zip [1..] . lines $ fs)})) . zip [1..7] . take 7 $ files+ compareF contentss file3+   where compareF :: [(Int,[(Int,String)])] -> FilePath -> IO ()+         compareF ysss file3 = mapM_ (\i -> do+          putStr "Please, specify which variant to use as the result, "+          putStrLn "maximum number is the quantity of the files from which the data is read: "+          let strs = map (\(j,ks) -> (\ts -> if null ts then (j,"")+                      else let (k,rs) = head ts in  (j,rs)) .+                       filter ((== i) . fst) $ ks) ysss+          mapM_ (\(i,xs) -> putStrLn $ show i ++ ":\t" ++ xs) strs+          ch <- getLine+          let choice2 = fromMaybe 0 (readMaybe ch::Maybe Int)+          toFileStr file3 ((\us -> if null us then [""] else [snd . head $ us]) . filter ((== choice2) . fst) $ strs)) [1..]  -- | Processment without rearrangements. circle2 :: Coeffs2 -> Array Int [Array Int Int] -> String -> [String] -> [String] -> [String]@@ -97,7 +102,17 @@                uniquenessVariants2GNPBL [] (last rs) ' ' id id id (unsafeAt permsG1 (l - 3)) . init $ rs  -- | Processment with rearrangements.-circle2I :: Coeffs2 -> Array Int [Array Int Int] -> String -> [String] -> Int -> [Int] -> Double -> Double -> [String] -> [String]+circle2I+ :: Coeffs2+ -> Array Int [Array Int Int]+ -> String+ -> [String]+ -> Int+ -> [Int]+ -> Double+ -> Double+ -> [String]+ -> [String] circle2I coeffs permsG1 choice yss numberI intervNbrs minE maxE xss  | null xss = yss  | otherwise = circle2I coeffs permsG1 choice (yss `mappend` [ws]) numberI intervNbrs minE1 maxE1 tss@@ -107,8 +122,9 @@             !rs = words . concat $ zss             !l = length rs             !frep2 = chooseMax (unsafeSwapVecIWithMaxI minE maxE numberI intervNbrs) coeffs choice-            !ws = if compare (length rs) 3 == LT then unwords rs else line . maximumElR . map (toResultR frep2) .-               uniquenessVariants2GNPBL [] (last rs) ' ' id id id (unsafeAt permsG1 (l - 3)) . init $ rs+            !ws = if compare (length rs) 3 == LT then unwords rs else line . maximumElR .+                    map (toResultR frep2) .+                      uniquenessVariants2GNPBL [] (last rs) ' ' id id id (unsafeAt permsG1 (l - 3)) . init $ rs             (!minE1,!maxE1)              | compare l3 0 /= LT =                let !perms3 = unsafeAt permsG1 l3
README view
@@ -2,12 +2,20 @@ of the package phonetic-languages-simplified-examples-array in Ukrainian is here: -https://oleksandrzhabenko.github.io/uk/InstructionUkr.11.3.pdf+https://oleksandrzhabenko.github.io/uk/InstructionUkr.12.pdf +or here:++https://web.archive.org/web/20210914215220/https://oleksandrzhabenko.github.io/uk/InstructionUkr.12.pdf+ The instruction in English is here: -https://oleksandrzhabenko.github.io/uk/InstructionEng.11.3.pdf+https://oleksandrzhabenko.github.io/uk/InstructionEng.12.pdf +or here:++https://web.archive.org/web/20210914215340/https://oleksandrzhabenko.github.io/uk/InstructionEng.12.pdf+ Since the version 0.2.0.0 there exists also comparative mode for the rewritePoemG3 executable. It allows to create from two files with the text variants the new one.@@ -133,10 +141,13 @@  3) rewritePoemG3: -rewritePoemG3 <first argument> [<whether to grow lines>] <file with the Ukrainian text> <property type> <numeric arguments>+rewritePoemG3 <first argument > [<whether to grow lines>] <Ukrainian text file> \+  <property type> <numerical arguments> -rewritePoemG3 +c <file1> <file2> <file3> (all the files must be different and simultaneously the first two ones must-exist already with some text, otherwise, the program gives no meaningful result).+rewritePoemG3 <first argument > [<whether to grow lines>] <Ukrainian text file> \+  +m <properties types> -m <numerical arguments>++rewritePoemG3 +c <files to read text variants from> <final file>  Since the 0.9.0.0 version there is a possibility to run lineVariantsG3 in the recursive mode. It is not
phonetic-languages-simplified-examples-array.cabal view
@@ -2,7 +2,7 @@ -- further documentation, see http://haskell.org/cabal/users-guide/  name:                phonetic-languages-simplified-examples-array-version:             0.11.3.0+version:             0.12.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 lightweight. Deal the Ukrainian as one of the phonetic languages. For the brief introduction in English, please, refer to: https://functional-art.org/2020/papers/Poetry-OleksandrZhabenko.pdf. Since the version 0.3.0.0 the package has the multiple variations mode for @lineVariantsG3@ executable that allows to use modifications in the text, e. g. synonyms, paraphrases etc. homepage:            https://hackage.haskell.org/package/phonetic-languages-simplified-examples-array@@ -37,7 +37,7 @@   main-is:             Main.hs   other-modules:       Phonetic.Languages.Simplified.Array.Ukrainian.FuncRep2RelatedG2, Phonetic.Languages.Lines, Phonetic.Languages.Parsing   other-extensions:    BangPatterns-  build-depends:       base >=4.8 && <4.16, ukrainian-phonetics-basic-array >=0.1.2 && <1, phonetic-languages-simplified-base >=0.1 && <1, phonetic-languages-simplified-properties-array >=0.8.1 && <1, phonetic-languages-ukrainian-array >=0.6.1 && <1, phonetic-languages-filters-array >=0.1 && <1, phonetic-languages-plus >=0.4.1 && <1, subG >= 0.4 && < 1, phonetic-languages-rhythmicity >=0.9.1 && <1, phonetic-languages-constraints-array >=0.1 && <1, phonetic-languages-permutations-array >= 0.1 && <1, heaps >= 0.3.6.1 && <1, phonetic-languages-simplified-examples-common >=0.1.4 && <1, mmsyn2-array >= 0.1.3 && <1+  build-depends:       base >=4.8 && <4.16, ukrainian-phonetics-basic-array >=0.1.2 && <1, phonetic-languages-simplified-base >=0.1 && <1, phonetic-languages-simplified-properties-array >=0.8.1 && <1, phonetic-languages-ukrainian-array >=0.6.1 && <1, phonetic-languages-filters-array >=0.1 && <1, phonetic-languages-plus >=0.4.1 && <1, subG >= 0.4 && < 1, phonetic-languages-rhythmicity >=0.9.1 && <1, phonetic-languages-constraints-array >=0.1 && <1, phonetic-languages-permutations-array >= 0.1 && <1, heaps >= 0.3.6.1 && <1, phonetic-languages-simplified-examples-common >=0.1.4 && <1, mmsyn2-array >= 0.1.3 && <1, string-interpreter >=0.5.2 && <1   ghc-options:         -threaded -rtsopts   hs-source-dirs:      ., Lines   default-language:    Haskell2010