phonetic-languages-simplified-examples-array 0.15.2.2 → 0.16.0.0
raw patch · 10 files changed
+193/−97 lines, 10 filesdep +cli-argumentsdep ~basedep ~phonetic-languages-simplified-basedep ~phonetic-languages-simplified-examples-common
Dependencies added: cli-arguments
Dependency ranges changed: base, phonetic-languages-simplified-base, phonetic-languages-simplified-examples-common, phonetic-languages-simplified-properties-array, phonetic-languages-ukrainian-array
Files
- CHANGELOG.md +7/−1
- GetInfo/Main.hs +40/−15
- LICENSE +1/−1
- Lines/Main.hs +40/−17
- Phonetic/Languages/GetTextualInfo.hs +8/−6
- Phonetic/Languages/Lines.hs +8/−5
- Phonetic/Languages/Simple.hs +18/−14
- README +14/−8
- Simple/Main.hs +51/−24
- phonetic-languages-simplified-examples-array.cabal +6/−6
CHANGELOG.md view
@@ -194,5 +194,11 @@ * The fifteenth version revised D. Some documentation improvements. If you updated at least to the 0.15.0.0 version there is no need to reinstall the package, just check the new update for the documentation (see README links).-The istructions are intended to follow the strict scientific approach to the sources so the popular information moved to the+The instructions are intended to follow the strict scientific approach to the sources so the popular information moved to the direct hyperlinked citations, not into the Bibliography.++## 0.16.0.0 -- 2022-01-17++* The sixteenth version. Added cli-arguments as a new dependency. Changed the way the programs parse their arguments.+Added the possibility to use also minimal set of permutations (just one word). Updated the dependencies. Some code+improvements. Updated the documentation with the new material and fixed obsoleted output examples.
GetInfo/Main.hs view
@@ -26,27 +26,31 @@ import Phonetic.Languages.Common import Phonetic.Languages.Array.Ukrainian.PropertiesSyllablesG2 import Languages.UniquenessPeriods.Array.Constraints.Encoded+import CLI.Arguments+import CLI.Arguments.Parsing+import CLI.Arguments.Get+import Phonetic.Languages.Permutations.Represent main :: IO () main = do args50 <- getArgs- let !args0000 = filter (/= "+p") . (\xss -> takeWhile (/= "+d") xss `mappend` drop 2 (dropWhile (/= "+d") xss)) $ args50- !pairwisePermutations = any (== "+p") args50- !fileDu = concat . drop 1 . take 2 . dropWhile (/= "+d") $ args50- !args000 = filter (\ts -> take 2 ts /= "+x" && take 2 ts /= "+g") args0000- !growing = filter ((== "+g") . (take 2)) args0000+ let (!argsA,!argsB,argsC,argss) = args2Args31R fstCharsM specs1 args50+ !args0000 = snd . takeBsR [("+d",1),("+p",1)] $ args50+ !pairwisePermutations = bTransform2Perms . getB "+p" $ argsB+ !fileDu = concat . getB "+d" $ argsB+ !growing = concat . getB "+g" $ argsB (!gr1,!gr2) | null growing = (0,0)- | otherwise = let (nms,mms) = splitAt 1 . drop 2 . take 4 $ growing- nm = readMaybe (concat nms)::Maybe Int- mm = readMaybe (concat mms)::Maybe Int in case (nm,mm) of+ | otherwise = let (nms,mms) = splitAt 1 growing+ nm = readMaybe nms::Maybe Int+ mm = readMaybe mms::Maybe Int in case (nm,mm) of (Just n4,Just m4) -> if (m4 `rem` 7) < (n4 `rem` 7) then (n4 `rem` 7 + 1, m4 `rem` 7 + 1) else (0,0) _ -> (0,0)- !coeffsWX = readCF . drop 2 . concat . take 1 . filter (\xs -> take 2 xs == "+x") $ args0000 -- The command line argument that starts with \"+x\".- !args00 = filter (/= "+b") args000- !lstW = any (== "+b") args000- !args0 = takeWhile (/= "+m") args00 `mappend` drop 1 (dropWhile (/= "-m") args00)- !multiples = drop 1 . dropWhile (/= "+m") . takeWhile (/= "-m") $ args00 -- Arguments for multiple metrices mode+ !coeffsWX = readCF . concat . getB "+x" . fst . takeBsR [("+x",1)] $ args0000 -- The command line argument that starts with \"+x\".+ (!lstW0,!args00) = takeAsR [("+b",0)] . snd . takeBsR [("+g",1),("+x",1)] $ args0000+ !lstW = oneA "+b" lstW0+ (!mls,!args0) = takeCs1R fstCharsM cSpecs1 args00+ !multiples = getC "+m" mls -- Arguments for multiple metrices mode !args = filter (\xs -> all (/= ':') xs && all (/= '@') xs) args0 !coeffs = readCF . concat . take 1 $ args -- The first command line argument. If not sure, just enter \"1_\". !lInes = filter (any (== ':')) args0@@ -61,7 +65,7 @@ generalProc fileDu pairwisePermutations (gr1,gr2) lstW multiples lInes coeffs coeffsWX file gzS printLine toOneLine choice else do contents <- readFile file- fLinesNIO (if pairwisePermutations then 10 else 7) contents+ fLinesNIO (if pairwisePermutations /= P 0 then 10 else 7) contents else do let !file = concat . take 1 $ args if null numbersJustPrint then do@@ -72,4 +76,25 @@ generalProc fileDu pairwisePermutations (gr1,gr2) lstW multiples lInes coeffs coeffsWX file gzS printLine toOneLine choice else do contents <- readFile file- fLinesNIO (if pairwisePermutations then 10 else 7) contents+ fLinesNIO (if pairwisePermutations /= P 0 then 10 else 7) contents++aSpecs :: CLSpecifications+aSpecs = [("+b",0)]++aSpcs :: [String] -> Args+aSpcs = fst . takeAsR aSpecs++cSpecs1 :: CLSpecifications+cSpecs1 = [("+m",-1)]++fstCharsM :: FirstChars+fstCharsM = ('+','-')++bSpecs :: CLSpecifications+bSpecs = zip ["+d","+g","+p"] . cycle $ [1]++bSpcs :: [String] -> Args+bSpcs = fst . takeBsR bSpecs++specs1 :: CLSpecifications+specs1 = aSpecs `mappend` bSpecs `mappend` cSpecs1
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2020-2021 OleksandrZhabenko+Copyright (c) 2020-2022 OleksandrZhabenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
Lines/Main.hs view
@@ -1,10 +1,11 @@+ {-# OPTIONS_GHC -threaded -rtsopts #-} {-# OPTIONS_HADDOCK show-extensions #-} {-# LANGUAGE BangPatterns #-} -- | -- Module : Main--- Copyright : (c) OleksandrZhabenko 2020-2021+-- Copyright : (c) OleksandrZhabenko 2020-2022 -- License : MIT -- Stability : Experimental -- Maintainer : olexandr543@yahoo.com@@ -22,6 +23,11 @@ import Data.List (nub) import Phonetic.Languages.Common import Phonetic.Languages.Lines+import CLI.Arguments+import CLI.Arguments.Parsing+import CLI.Arguments.Get+import CLI.Arguments.BTransform2Perms+import Phonetic.Languages.Permutations.Represent -- | The function allows to rewrite the Ukrainian text in the file given as the first command line argument to a new file. In between, it is rewritten -- so that every last word on the lines is preserved at its position, and the rest of the line is rearranged using the specified other command line@@ -50,17 +56,13 @@ main :: IO () main = do args50 <- getArgs- let args00 = filter (/= "+p") . (\xss -> takeWhile (/= "+d") xss `mappend` drop 2 (dropWhile (/= "+d") xss)) $ args50- pairwisePermutations = any (== "+p") args50- fileDu = concat . drop 1 . take 2 . dropWhile (/= "+d") $ args50- multiple- | null . filter (== "+m") $ args00 = 0- | otherwise = 1- args0- | multiple == 1 = takeWhile (/= "+m") args00 `mappend` drop 1 (dropWhile (/= "-m") args00)- | otherwise = args00+ let (argsA,argsB,argsC,argss) = args2Args31R fstCharsM specs1 args50+ pairwisePermutations = bTransform2Perms . getB "+p" $ argsB+ compare2 = oneA "+c" argsA+ fileDu = concat . getB "+d" $ argsB+ args00 = snd . takeBsR [("+p",1)] . snd . takeBsR [("+d",1)] $ args50+ (choicesC,args0) = takeCs1R fstCharsM cSpecs1 args50 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 (args2,file3)@@ -72,18 +74,18 @@ compareFilesToOneCommon args2 file3 else compareFilesToOneCommon args2 file3 else do- let growing = filter ((== "+g") . (take 2)) args0+ let growing = concat . getB "+g" $ argsB (gr1,gr2) | null growing = (0,0)- | otherwise = let (nms,mms) = splitAt 1 . drop 2 . take 4 $ growing- nm = readMaybe (concat nms)::Maybe Int- mm = readMaybe (concat mms)::Maybe Int in case (nm,mm) of+ | otherwise = let (nms,mms) = splitAt 1 growing+ nm = readMaybe nms::Maybe Int+ mm = readMaybe mms::Maybe Int in case (nm,mm) of (Just n4,Just m4) -> if (m4 `rem` 7) < (n4 `rem` 7) then (n4 `rem` 7 + 1, m4 `rem` 7 + 1) else (0,0) _ -> (0,0) if isPair coeffs then do let !numericArgs = filter (all isDigit) . drop 3 $ args0 !choices- | multiple == 1 = drop 1 . dropWhile (/= "+m") . takeWhile (/= "-m") $ args00+ | oneC "+m" argsC = getC "+m" choicesC | otherwise = drop 2 . take 3 $ args0 !numberI = fromMaybe 1 (readMaybe (concat . take 1 $ numericArgs)::Maybe Int) !file = concat . drop 1 . take 2 $ args0@@ -91,8 +93,29 @@ else do let !numericArgs = filter (all isDigit) . drop 2 $ args0 !choices- | multiple == 1 = drop 1 . dropWhile (/= "+m") . takeWhile (/= "-m") $ args00+ | oneC "+m" argsC = getC "+m" choicesC | otherwise = drop 1 . take 2 $ args0 !numberI = fromMaybe 1 (readMaybe (concat . take 1 $ numericArgs)::Maybe Int) !file = concat . take 1 $ args0 generalProcessment fileDu pairwisePermutations (gr1,gr2) coeffs numericArgs choices numberI file++aSpecs :: CLSpecifications+aSpecs = [("+c",0)]++aSpcs :: [String] -> Args+aSpcs = fst . takeAsR aSpecs++cSpecs1 :: CLSpecifications+cSpecs1 = [("+m",-1)]++fstCharsM :: FirstChars+fstCharsM = ('+','-')++bSpecs :: CLSpecifications+bSpecs = zip ["+d","+g","+p"] . cycle $ [1]++bSpcs :: [String] -> Args+bSpcs = fst . takeBsR bSpecs++specs1 :: CLSpecifications+specs1 = aSpecs `mappend` bSpecs `mappend` cSpecs1
Phonetic/Languages/GetTextualInfo.hs view
@@ -39,12 +39,14 @@ import Phonetic.Languages.Simplified.StrictVG.Base import Phonetic.Languages.Permutations.Arr import Phonetic.Languages.Permutations.ArrMini+import Phonetic.Languages.Permutations.ArrMini1 import Phonetic.Languages.Simplified.DataG.Base import Languages.UniquenessPeriods.Array.Constraints.Encoded import Phonetic.Languages.Simplified.SimpleConstraints import Phonetic.Languages.Common import Melodics.Ukrainian.ArrInt8 (Sound8) import Phonetic.Languages.Simplified.Array.Ukrainian.ReadProperties+import Phonetic.Languages.Permutations.Represent {-| @ 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@@ -59,7 +61,7 @@ -} generalProc :: FilePath -- ^ Whether to use the own provided durations from the file specified here. Uses the 'readSyllableDurations' function.- -> Bool -- ^ Whether to use just pairwise permutations (if 'True') or the whole possible set of them (otherwise). The first corresponds to the quick evaluation mode.+ -> PermutationsType -- ^ Whether to use just one of the express permutations, or the full universal set. -> (Int,Int) -> Bool -> [String]@@ -77,13 +79,13 @@ syllableDurationsDs <- readSyllableDurations fileDu contents <- readFile file let !flines- | gr1 == 0 = fLinesN (if pairwisePermutations then 10 else 7) toOneLine contents- | otherwise = prepareGrowTextMN gr1 gr2 . unlines . fLinesN (if pairwisePermutations then 10 else 7) toOneLine $ contents+ | gr1 == 0 = fLinesN (if pairwisePermutations /= P 0 then 10 else 7) toOneLine contents+ | otherwise = prepareGrowTextMN gr1 gr2 . unlines . fLinesN (if pairwisePermutations /= P 0 then 10 else 7) toOneLine $ contents getData3 syllableDurationsDs pairwisePermutations lstW coeffs coeffsWX (getIntervalsNS lstW gzS flines) printLine choice multiples2 flines | otherwise = do syllableDurationsDs <- readSyllableDurations fileDu contents <- readFile file- let !flines = (if gr1 == 0 then id else prepareGrowTextMN gr1 gr2 . unlines) . fLinesN (if pairwisePermutations then 10 else 7) toOneLine . unlines . linesFromArgsG lInes . fLinesN (if pairwisePermutations then 10 else 7) 0 $ contents+ let !flines = (if gr1 == 0 then id else prepareGrowTextMN gr1 gr2 . unlines) . fLinesN (if pairwisePermutations /= P 0 then 10 else 7) toOneLine . unlines . linesFromArgsG lInes . fLinesN (if pairwisePermutations /= P 0 then 10 else 7) 0 $ contents getData3 syllableDurationsDs pairwisePermutations lstW coeffs coeffsWX (getIntervalsNS lstW gzS flines) printLine choice multiples2 flines linesFromArgs1 :: Int -> String -> [String] -> [String]@@ -97,7 +99,7 @@ getData3 :: [[[[Sound8]]] -> [[Double]]] -- ^ Whether to use the own provided durations.- -> Bool -- ^ Whether to use just pairwise permutations (if 'True') or the whole possible set of them (otherwise). The first corresponds to the quick evaluation mode.+ -> PermutationsType -- ^ Whether to use just one of the express permutations, or the full universal set. -> Bool -> Coeffs2 -> Coeffs2@@ -107,7 +109,7 @@ -> [String] -> [String] -> IO ()-getData3 syllableDurationsDs pairwisePermutations lstW coeffs coeffsWX gz printLine choice multiples3 zss = let !permsV4 = if pairwisePermutations then genPairwisePermutationsArrLN 10 else genPermutationsArrL in putStrLn (replicate (length multiples3 + 1) '\t' `mappend` show gz) >> mapM_ (process1Line syllableDurationsDs lstW coeffs coeffsWX gz printLine choice multiples3 permsV4) zss+getData3 syllableDurationsDs pairwisePermutations lstW coeffs coeffsWX gz printLine choice multiples3 zss = let !permsV4 = case pairwisePermutations of { P 2 -> genPairwisePermutationsArrLN 10; P 1 -> genElementaryPermutationsArrLN1 10; ~rrr -> genPermutationsArrL } in putStrLn (replicate (length multiples3 + 1) '\t' `mappend` show gz) >> mapM_ (process1Line syllableDurationsDs lstW coeffs coeffsWX gz printLine choice multiples3 permsV4) zss process1Line :: [[[[Sound8]]] -> [[Double]]] -- ^ Whether to use the own provided durations.
Phonetic/Languages/Lines.hs view
@@ -4,7 +4,7 @@ -- | -- Module : Phonetic.Languages.Lines--- Copyright : (c) OleksandrZhabenko 2020-2021+-- Copyright : (c) OleksandrZhabenko 2020-2022 -- License : MIT -- Stability : Experimental -- Maintainer : olexandr543@yahoo.com@@ -24,6 +24,7 @@ import Phonetic.Languages.Simplified.StrictVG.Base import Phonetic.Languages.Permutations.Arr import Phonetic.Languages.Permutations.ArrMini+import Phonetic.Languages.Permutations.ArrMini1 import Phonetic.Languages.Filters (unsafeSwapVecIWithMaxI) import Text.Read (readMaybe) import Data.Maybe (fromMaybe)@@ -33,6 +34,7 @@ import Melodics.Ukrainian.ArrInt8 (Sound8) import Phonetic.Languages.Ukrainian.PrepareText (prepareGrowTextMN) import Phonetic.Languages.Simplified.Array.Ukrainian.ReadProperties+import Phonetic.Languages.Permutations.Represent {-| @ 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@@ -50,7 +52,7 @@ -} generalProcessment :: FilePath -- ^ Whether to use the own provided durations from the file specified here. Uses the 'readSyllableDurations' function.- -> Bool -- ^ Whether to use just pairwise permutations (if 'True') or the whole possible set of them (otherwise). The first corresponds to the quick evaluation mode.+ -> PermutationsType -- ^ Whether to use just one of the express permutations, or the full universal set. -> (Int,Int) -> Coeffs2 -> [String]@@ -62,11 +64,12 @@ syllableDurationsDs <- readSyllableDurations fileDu contents <- readFile file let !permsV- | pairwisePermutations = genPairwisePermutationsArrLN 10+ | pairwisePermutations == P 2 = genPairwisePermutationsArrLN 10+ | pairwisePermutations == P 1 = genElementaryPermutationsArrLN1 10 | otherwise = genPermutationsArrL !flines- | gr1 == 0 = fLinesN (if pairwisePermutations then 10 else 7) 0 contents- | otherwise = prepareGrowTextMN gr1 gr2 . unlines . fLinesN (if pairwisePermutations then 10 else 7) 0 $ contents+ | gr1 == 0 = fLinesN (if pairwisePermutations /= P 0 then 10 else 7) 0 contents+ | otherwise = prepareGrowTextMN gr1 gr2 . unlines . fLinesN (if pairwisePermutations /= P 0 then 10 else 7) 0 $ contents !lasts = map (\ts -> if null . words $ ts then [] else last . words $ ts) flines if compare numberI 2 == LT then mapM_ (\choice -> toFileStr (choice ++ "." ++ file ++ ".new.txt") (circle2 syllableDurationsDs coeffs permsV choice [] $ flines)) choices
Phonetic/Languages/Simple.hs view
@@ -28,6 +28,7 @@ import Phonetic.Languages.Simplified.Array.Ukrainian.FuncRep2RelatedG2 import Phonetic.Languages.Permutations.Arr import Phonetic.Languages.Permutations.ArrMini+import Phonetic.Languages.Permutations.ArrMini1 import Data.SubG hiding (takeWhile,dropWhile) import Data.Maybe import Data.MinMax.Preconditions@@ -38,6 +39,7 @@ import Melodics.Ukrainian.ArrInt8 (Sound8) import Phonetic.Languages.Ukrainian.PrepareText (prepareTuneTextMN,isSpC,isUkrainianL) import Phonetic.Languages.Simplified.Array.Ukrainian.ReadProperties+import Phonetic.Languages.Permutations.Represent forMultiplePropertiesF :: [String] -> [(String,[String])] forMultiplePropertiesF (xs:xss)@@ -51,7 +53,7 @@ -} generalProc3G :: FilePath -- ^ Whether to use the own provided durations from the file specified here.- -> Bool -- ^ Whether to use just pairwise permutations, or the full universal set.+ -> PermutationsType -- ^ Whether to use just one of the express permutations, or the full universal set. -> [String] -> String -- ^ If empty, the function is just 'generalProc2G' with the arguments starting from the first 'Bool' here. -> Int@@ -78,7 +80,7 @@ | otherwise = mapM_ (\js -> do let !kss = lines js- if pairwisePermutations then do+ if pairwisePermutations /= P 0 then do let !wss | textProcessment1 `elem` [10,20,30,40,50,60,70,80,90] = kss | otherwise = prepareTuneTextMN m 1 . unwords $ kss@@ -124,7 +126,7 @@ -} generalProc2G :: [[[[Sound8]]] -> [[Double]]] -- ^ Whether to use the own provided durations.- -> Bool -- ^ Whether to use just pairwise permutations, or the full universal set.+ -> PermutationsType -- ^ Whether to use just one of the express permutations, or the full universal set. -> Bool -> Bool -> FilePath@@ -156,7 +158,7 @@ -- @ since 0.3.0.0 The result is not 'IO' (), but 'IO' 'String'. The type also changed generally. generalProc2 :: [[[[Sound8]]] -> [[Double]]] -- ^ Whether to use the own provided durations.- -> Bool -- ^ Whether to use just pairwise permutations, or the full universal set.+ -> PermutationsType -- ^ Whether to use just one of the express permutations, or the full universal set. -> Bool -> Bool -> Bool@@ -172,7 +174,7 @@ takeWhile (/= "-m") $ args0 if null argMss then do let (!numericArgs,!textualArgs) = L.span (all isDigit) $ args- !xs = concat . take 1 . prepareTuneTextMN (if pairwisePermutations then 10 else 7) 1 . unwords . drop 1 $ textualArgs+ !xs = concat . take 1 . prepareTuneTextMN (if pairwisePermutations /= P 0 then 10 else 7) 1 . unwords . drop 1 $ textualArgs !l = length . words $ xs !argCs = catMaybes (fmap (readMaybeECG (l - 1)) . (showB l lstW2:) . drop 1 . dropWhile (/= "+a") . takeWhile (/= "-a") $ args0)@@ -191,7 +193,8 @@ else do let !subs = subG " 01-" xs if null argCs then let !perms- | pairwisePermutations = genPairwisePermutationsLN l+ | pairwisePermutations == P 2 = genPairwisePermutationsLN l+ | pairwisePermutations == P 1 = genElementaryPermutationsLN1 l | otherwise = genPermutationsL l in do temp <- generalProcMs syllableDurationsDs coeffs coeffsWX perms subs (intervalNmbrs, arg0, numberI, choice) if recursiveMode then interactivePrintResultRecursive syllableDurationsDs pairwisePermutations recursiveMode nativeUkrainian interactive jstL0 args0 coeffs coeffsWX line temp args lstW2@@ -199,7 +202,7 @@ else do correct <- printWarning nativeUkrainian xs if correct == "n" then putStrLn (messageInfo 1 nativeUkrainian) >> return "" -- for the multiple variations mode (with curly brackets and slash in the text) the program does not stop here, but the variation is made empty and is proposed further as a variant.- else let !perms = decodeLConstraints argCs . (if pairwisePermutations then genPairwisePermutationsLN else genPermutationsL) $ l in do+ else let !perms = decodeLConstraints argCs . (if pairwisePermutations == P 2 then genPairwisePermutationsLN else if pairwisePermutations == P 0 then genPermutationsL else genElementaryPermutationsLN1) $ l in do temp <- generalProcMs syllableDurationsDs coeffs coeffsWX perms subs (intervalNmbrs, arg0, numberI, choice) if recursiveMode then interactivePrintResultRecursive syllableDurationsDs pairwisePermutations recursiveMode nativeUkrainian interactive jstL0 args0 coeffs coeffsWX line temp args lstW2 else if interactive then interactivePrintResult nativeUkrainian line temp else print1el jstL0 choice temp@@ -212,7 +215,7 @@ (\zs -> if null zs then [numberI] else L.nub zs) . L.sort . filter (<= numberI) . map (\t -> fromMaybe numberI $ (readMaybe t::Maybe Int)) . drop 2 $ us) $ numericArgss !argsZipped = L.zip4 intervalNmbrss arg0s numberIs choices- !xs = concat . take 1 . prepareTuneTextMN (if pairwisePermutations then 10 else 7) 1 . unwords $ args+ !xs = concat . take 1 . prepareTuneTextMN (if pairwisePermutations /= P 0 then 10 else 7) 1 . unwords $ args !l = length . words $ xs !argCs = catMaybes (fmap (readMaybeECG (l - 1)) . (showB l lstW2:) . drop 1 . dropWhile (/= "+a") . takeWhile (/= "-a") $ args0)@@ -224,13 +227,14 @@ else do let !subs = subG " 01-" xs if null argCs then let !perms- | pairwisePermutations = genPairwisePermutationsLN l+ | pairwisePermutations == P 2 = genPairwisePermutationsLN l+ | pairwisePermutations == P 1 = genElementaryPermutationsLN1 l | otherwise = genPermutationsL l in generalProcMMs syllableDurationsDs pairwisePermutations recursiveMode nativeUkrainian interactive jstL0 args0 coeffs coeffsWX argsZipped perms subs args lstW2 else do correct <- printWarning nativeUkrainian xs if correct == "n" then putStrLn (messageInfo 1 nativeUkrainian) >> return "" -- for the multiple variations mode (with curly brackets and slash in the text) the program does not stop here, but the variation is made empty and is proposed further as a variant.- else let !perms = decodeLConstraints argCs . (if pairwisePermutations then genPairwisePermutationsLN else genPermutationsL) $ l in generalProcMMs syllableDurationsDs pairwisePermutations recursiveMode nativeUkrainian interactive jstL0 args0 coeffs coeffsWX argsZipped perms subs args lstW2+ else let !perms = decodeLConstraints argCs . (if pairwisePermutations == P 2 then genPairwisePermutationsLN else if pairwisePermutations == P 0 then genPermutationsL else genElementaryPermutationsLN1) $ l in generalProcMMs syllableDurationsDs pairwisePermutations recursiveMode nativeUkrainian interactive jstL0 args0 coeffs coeffsWX argsZipped perms subs args lstW2 {-| -- @ since 0.4.0.0@@ -280,7 +284,7 @@ interactivePrintResultRecursive :: [[[[Sound8]]] -> [[Double]]] -- ^ Whether to use the own provided durations.- -> Bool -- ^ Whether to use just pairwise permutations, or the full universal set.+ -> PermutationsType -- ^ Whether to use just one of the express permutations, or the full universal set. -> Bool -> Bool -> Bool@@ -310,7 +314,7 @@ let strIntrpr = convStringInterpreter stringInterpreted ts !firstArgs = takeWhile (not . all isLetter) args wordsNN <-- if pairwisePermutations then do+ if pairwisePermutations /= P 0 then do putStrLn . messageInfo 8 $ nativeUkrainian mStr <- getLine let m = fromMaybe 10 (readMaybe mStr::Maybe Int) in return . take m . words $ strIntrpr@@ -352,7 +356,7 @@ -- @ since 0.3.0.0 The result is not 'IO' (), but 'IO' 'String'. The type also changed generally. generalProcMMs :: [[[[Sound8]]] -> [[Double]]] -- ^ Whether to use the own provided durations.- -> Bool -- ^ Whether to use just pairwise permutations, or the full universal set.+ -> PermutationsType -- ^ Whether to use just pairwise permutations, or the full universal set. -> Bool -> Bool -> Bool@@ -385,7 +389,7 @@ -- @ since 0.3.0.0 The result is not 'IO' (), but 'IO' 'String'. The type also changed generally. finalProc :: [[[[Sound8]]] -> [[Double]]] -- ^ Whether to use the own provided durations.- -> Bool -- ^ Whether to use just pairwise permutations, or the full universal set.+ -> PermutationsType -- ^ Whether to use just one of the express permutations, or the full universal set. -> Bool -> Bool -> Bool
README view
@@ -2,19 +2,19 @@ of the package phonetic-languages-simplified-examples-array in Ukrainian is here: -https://oleksandrzhabenko.github.io/uk/InstructionUkr.15.2.2.pdf+https://oleksandrzhabenko.github.io/uk/InstructionUkr.16.pdf or here: -https://web.archive.org/web/20211226220452/https://oleksandrzhabenko.github.io/uk/InstructionUkr.15.2.2.pdf+(try https://web.archive.org/save/https://oleksandrzhabenko.github.io/uk/InstructionUkr.16.pdf) The instruction in English is here: -https://oleksandrzhabenko.github.io/uk/InstructionEng.15.2.2.pdf+https://oleksandrzhabenko.github.io/uk/InstructionEng.16.pdf or here: -https://web.archive.org/web/20211226220229/https://oleksandrzhabenko.github.io/uk/InstructionEng.15.2.2.pdf+(try https://web.archive.org/save/https://oleksandrzhabenko.github.io/uk/InstructionEng.16.pdf) Since the version 0.2.0.0 there exists also comparative mode for the rewritePoemG3 executable. It allows to@@ -117,12 +117,12 @@ is incompatible with the constraints (+a ... -a). Since the 0.11.0.0 version there is also the most complex mode of multiple sources processment or-recursive interactive cycle mode. For this use *t_ ... ^t command line arguments group with the-_ being one of the following: 20, 21, 30, 31, 40, 41, 50, 51, 60, 61, 70, 71.+recursive interactive cycle mode. For this use +t {two-digits number} ... ^t command line arguments group with the+two-digits number being one of the following: 20, 21, 30, 31, 40, 41, 50, 51, 60, 61, 70, 71. For example: -lineVariantsG3 +r 3 w04 *t71 "sadok.txt" "other_poem.txt" "just_text.txt" ^t+lineVariantsG3 +r 3 w04 +t 71 "sadok.txt" "other_poem.txt" "just_text.txt" ^t 2) propertiesTextG3: @@ -144,7 +144,7 @@ propertiesTextG3 sadok0.txt +RTS -N --RTS s 1 0 03z +b | distributionTextG s 1 +W -propertiesTextG3 sadok0.txt +RTS -N --RTS s 1 0 03z +g73 +b | distributionTextG s 1 +W+propertiesTextG3 sadok0.txt +RTS -N --RTS s 1 0 03z +g 73 +b | distributionTextG s 1 +W propertiesTextG3 <filepath to the file with the Ukrainian text for analysis> @n @@ -168,3 +168,9 @@ own functions for the syllable durations. They are read from the file with special Haskell-like syntaxis. For more information, please, refer to the instructions above.++Since the 0.16.0.0 version you can use two reduced set of permutations modes+in addition to the default full universal set of permutations mode. To+use them, please, add "+p {1 or 2}" to the command line arguments.+For more information, please, refer to the instructions following the links+above.
Simple/Main.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Main--- Copyright : (c) OleksandrZhabenko 2020-2021+-- Copyright : (c) OleksandrZhabenko 2020-2022 -- License : MIT -- Stability : Experimental -- Maintainer : olexandr543@yahoo.com@@ -9,8 +9,6 @@ {-# OPTIONS_GHC -threaded -rtsopts #-} -{-# LANGUAGE BangPatterns #-}- module Main where import Phonetic.Languages.Array.Ukrainian.PropertiesSyllablesG2@@ -19,6 +17,10 @@ import Interpreter.StringConversion (readFileIfAny) import Data.Maybe (fromMaybe) import Text.Read (readMaybe)+import CLI.Arguments+import CLI.Arguments.Parsing+import CLI.Arguments.Get+import Phonetic.Languages.Permutations.Represent -- | Prints the rearrangements with the \"property\" information for the Ukrainian language text. The first command line argument must be a -- positive 'Int' number and is a number of printed variants for the line (if they are present, otherwise just all possible variants are printed).@@ -34,30 +36,55 @@ main :: IO () main = do args50 <- getArgs- let args0000 = filter (/= "+p") . (\xss -> takeWhile (/= "+d") xss `mappend` drop 2 (dropWhile (/= "+d") xss)) $ args50- pairwisePermutations = any (== "+p") args50- fileDu = concat . drop 1 . take 2 . dropWhile (/= "+d") $ args50- args000 = filter (not . null) (takeWhile (\xs -> take 2 xs /= "*t") args0000 `mappend` (drop 1 . dropWhile (\xs -> take 2 xs /= "^t") $ args0000))- textProcessmentFssFs = drop 1 . dropWhile (\xs -> take 2 xs /= "*t") . takeWhile (\xs -> take 2 xs /= "^t") $ args0000- textProcessment0 = concat . filter (\xs -> take 2 xs == "*t") $ args0000+ let (cfWX,args501) = takeBsR [("+x",1)] args50+ coeffsWX = readCF . concat . getB "+x" $ cfWX -- The command line argument that starts with \"+x\".+ (argsA,argsB,argsC1,argss) = args2Args31R fstCharsMA specs1 args501+ (argsC2,arg2ss) = takeCs1R fstCharsT cSpecs1T argss+ pairwisePermutations = bTransform2Perms . getB "+p" $ argsB+ fileDu = concat . getB "+d" $ argsB+ recursiveMode = oneA "+r" argsA -- Specifies whether to use the interactive recursive mode+ lstW = listA ["+b","+bl"] argsA -- If one of the command line options is \"+b\" or \"+bl\" then the last word of the line will remain the last one.+ jstL0 = listA ["+l","+bl"] argsA -- If one of the command line options is \"+l\" or \"+bl\" then the program outputs just lines without metrices values.+ nativeUkrainian = oneA "+u" argsA -- If one of the command line options is \"+u\" then the informational messages are printed in Ukrainian, otherwise (the default behaviour) they are in English.+ toFileMode1 = concat . getB "+f" $ argsB -- Prints the last resulting line of the interactive mode processment (the last selected variant) to the file and also to the stdout.+ interactiveP = recursiveMode || oneA "+i" argsA || oneB "+f" argsB -- If one of the command line options is \"+i\", or \"+f\" then the program prints the variants and then prompts for the preferred variant. Afterwards, it prints just that variant alone.+ textProcessmentFssFs = drop 1 . getC "+t" $ argsC2+ textProcessment0+ | null . concat . getB "+t" . fst . takeBsR [("+t",1)] $ argss = []+ | otherwise = "+t" `mappend` (concat . getB "+t" . fst . takeBsR [("+t",1)] $ argss) textProcessment1 = fromMaybe 70 (readMaybe (drop 2 textProcessment0)::Maybe Int)- args00 = filter (/= "+r") args000- recursiveMode = any (== "+r") args000 -- Specifies whether to use the interactive recursive mode- args0 = filter (\xs -> take 2 xs /= "+x" && xs /= "+b" && xs /= "+l" && xs /= "+bl" && xs /= "+i" && xs /= "+u") args00- lstW = if any (\x -> x == "+b" || x == "+bl") args00 then True else False -- If one of the command line options is \"+b\" or \"+bl\" then the last word of the line will remain the last one.- jstL0 = if any (\x -> x == "+l" || x == "+bl") args00 then True else False -- If one of the command line options is \"+l\" or \"+bl\" then the program outputs just lines without metrices values.- nativeUkrainian = if any (== "+u") args00 then True else False -- If one of the command line options is \"+u\" then the informational messages are printed in Ukrainian, otherwise (the default behaviour) they are in English.- toFileMode1 = concat . take 1 . drop 1 . dropWhile (/= "+f") $ args0 -- Prints the last resulting line of the interactive mode processment (the last selected variant) to the file and also to the stdout.- interactiveP = recursiveMode || if any (\xs -> xs == "+i" || xs == "+f") args00 then True else False -- If one of the command line options is \"+i\", or \"+f\" then the program prints the variants and then prompts for the preferred variant. Afterwards, it prints just that variant alone.- args01 = takeWhile (/= "+a") args0 `mappend` (drop 1 . dropWhile (/= "-a") $ args0)- args02- | null toFileMode1 = filter (/= "+f") args01- | otherwise = let (krs,lrs) = break (== "+f") args01- mrs = drop 2 lrs in krs `mappend` mrs- args = takeWhile (/= "+m") args02 `mappend` (drop 1 . dropWhile (/= "-m") $ args02)+ args0 = snd . takeAsR aSpecs . snd . takeBsR [("+d",1)] $ args501+ let args = snd . takeCs1R fstCharsMA [("+m",-1)] . snd . takeBsR [("+f",1)] . snd . takeCs1R fstCharsMA [("+a",-1)] $ arg2ss coeffs = readCF . concat . take 1 $ args -- The first command line argument.- coeffsWX = readCF . drop 2 . concat . take 1 . filter (\xs -> take 2 xs == "+x") $ args00 -- The command line argument that starts with \"+x\". textProcessmentFss0 <- mapM (readFileIfAny) textProcessmentFssFs let textProcessmentFss = filter (not . null) textProcessmentFss0 if isPair coeffs then generalProc3G fileDu pairwisePermutations textProcessmentFss textProcessment0 textProcessment1 recursiveMode nativeUkrainian toFileMode1 interactiveP jstL0 args0 coeffs coeffsWX (drop 1 args) lstW else generalProc3G fileDu pairwisePermutations textProcessmentFss textProcessment0 textProcessment1 recursiveMode nativeUkrainian toFileMode1 interactiveP jstL0 args0 coeffs coeffsWX args lstW++aSpecs :: CLSpecifications+aSpecs = zip ["+r","+b","+l","+bl","+i","+u"] . cycle $ [0]++aSpcs :: [String] -> Args+aSpcs = fst . takeAsR aSpecs++cSpecs1MA :: CLSpecifications+cSpecs1MA = zip ["+m","+a"] . cycle $ [-1]++fstCharsMA :: FirstChars+fstCharsMA = ('+','-')++cSpecs1T :: CLSpecifications+cSpecs1T = [("+t",-1)]++fstCharsT :: FirstChars+fstCharsT = ('+','^')++bSpecs :: CLSpecifications+bSpecs = zip ["+d","+f","+p"] . cycle $ [1]++bSpcs :: [String] -> Args+bSpcs = fst . takeBsR bSpecs++specs1 :: CLSpecifications+specs1 = aSpecs `mappend` bSpecs `mappend` cSpecs1MA+
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.15.2.2+version: 0.16.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@@ -10,7 +10,7 @@ license-file: LICENSE author: OleksandrZhabenko maintainer: olexandr543@yahoo.com-copyright: (c) 2020-2021 Oleksandr Zhabenko+copyright: (c) 2020-2022 Oleksandr Zhabenko category: Language, Math, Game build-type: Simple extra-source-files: CHANGELOG.md, README@@ -20,7 +20,7 @@ exposed-modules: Phonetic.Languages.Simplified.Array.Ukrainian.FuncRep2RelatedG2, Phonetic.Languages.Simple, Phonetic.Languages.Lines, Phonetic.Languages.GetTextualInfo, Phonetic.Languages.Parsing, Phonetic.Languages.Simplified.Array.Ukrainian.ReadProperties -- other-modules: other-extensions: BangPatterns- build-depends: base >=4.8 && <4.16, ukrainian-phonetics-basic-array >=0.4.2 && <1, phonetic-languages-simplified-base >=0.4.1 && <1, phonetic-languages-simplified-properties-array >=0.12 && <1, phonetic-languages-ukrainian-array >=0.8 && <1, phonetic-languages-filters-array >=0.3 && <1, uniqueness-periods-vector-stats >=0.2.1 && <1, parallel >=3.2.0.6 && <4, phonetic-languages-plus >=0.5.1 && <1, subG >= 0.4 && < 1, phonetic-languages-rhythmicity >=0.9.1 && <1, phonetic-languages-permutations-array >= 0.2 && <1, heaps >= 0.3.6.1 && <1, phonetic-languages-constraints-array >=0.1 && <1, phonetic-languages-simplified-examples-common >=0.4 && <1, mmsyn2-array >= 0.3 && <1, string-interpreter >=0.5.4.1 && <1+ build-depends: base >=4.8 && <5, ukrainian-phonetics-basic-array >=0.4.2 && <1, phonetic-languages-simplified-base >=0.4.5 && <1, phonetic-languages-simplified-properties-array >=0.12.2 && <1, phonetic-languages-ukrainian-array >=0.9.1 && <1, phonetic-languages-filters-array >=0.3 && <1, uniqueness-periods-vector-stats >=0.2.1 && <1, parallel >=3.2.0.6 && <4, phonetic-languages-plus >=0.5.1 && <1, subG >= 0.4 && < 1, phonetic-languages-rhythmicity >=0.9.1 && <1, phonetic-languages-permutations-array >= 0.2 && <1, heaps >= 0.3.6.1 && <1, phonetic-languages-constraints-array >=0.1 && <1, phonetic-languages-simplified-examples-common >=0.4.1 && <1, mmsyn2-array >= 0.3 && <1, string-interpreter >=0.5.4.1 && <1, cli-arguments >= 0.6 && <1 -- hs-source-dirs: default-language: Haskell2010 @@ -28,7 +28,7 @@ main-is: Main.hs other-modules: Phonetic.Languages.Simplified.Array.Ukrainian.FuncRep2RelatedG2, Phonetic.Languages.Simple, Phonetic.Languages.Parsing, Phonetic.Languages.Simplified.Array.Ukrainian.ReadProperties other-extensions: BangPatterns- build-depends: base >=4.8 && <4.16, ukrainian-phonetics-basic-array >=0.4.2 && <1, phonetic-languages-simplified-base >=0.4.1 && <1, phonetic-languages-simplified-properties-array >=0.12 && <1, phonetic-languages-ukrainian-array >=0.8 && <1, phonetic-languages-filters-array >=0.3 && <1, phonetic-languages-plus >=0.5.1 && <1, subG >=0.4 && < 1, mmsyn2-array >= 0.3 && <1, phonetic-languages-constraints-array >=0.1 && <1, phonetic-languages-permutations-array >= 0.2 && <1, heaps >= 0.3.6.1 && <1, phonetic-languages-simplified-examples-common >=0.4 && <1, string-interpreter >=0.5.4.1 && <1, mmsyn2-array >= 0.3 && <1+ build-depends: base >=4.8 && <5, ukrainian-phonetics-basic-array >=0.4.2 && <1, phonetic-languages-simplified-base >=0.4.5 && <1, phonetic-languages-simplified-properties-array >=0.12.2 && <1, phonetic-languages-ukrainian-array >=0.9.1 && <1, phonetic-languages-filters-array >=0.3 && <1, phonetic-languages-plus >=0.5.1 && <1, subG >=0.4 && < 1, mmsyn2-array >= 0.3 && <1, phonetic-languages-constraints-array >=0.1 && <1, phonetic-languages-permutations-array >= 0.2 && <1, heaps >= 0.3.6.1 && <1, phonetic-languages-simplified-examples-common >=0.4.1 && <1, string-interpreter >=0.5.4.1 && <1, mmsyn2-array >= 0.3 && <1, cli-arguments >= 0.6 && <1 ghc-options: -threaded -rtsopts hs-source-dirs: ., Simple default-language: Haskell2010@@ -37,7 +37,7 @@ main-is: Main.hs other-modules: Phonetic.Languages.Simplified.Array.Ukrainian.FuncRep2RelatedG2, Phonetic.Languages.Lines, Phonetic.Languages.Parsing, Phonetic.Languages.Simplified.Array.Ukrainian.ReadProperties other-extensions: BangPatterns- build-depends: base >=4.8 && <4.16, ukrainian-phonetics-basic-array >=0.4.2 && <1, phonetic-languages-simplified-base >=0.4.1 && <1, phonetic-languages-simplified-properties-array >=0.12 && <1, phonetic-languages-ukrainian-array >=0.8 && <1, phonetic-languages-filters-array >=0.3 && <1, phonetic-languages-plus >=0.5.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.2 && <1, heaps >= 0.3.6.1 && <1, phonetic-languages-simplified-examples-common >=0.4 && <1, mmsyn2-array >= 0.3 && <1, string-interpreter >=0.5.4.1 && <1+ build-depends: base >=4.8 && <5, ukrainian-phonetics-basic-array >=0.4.2 && <1, phonetic-languages-simplified-base >=0.4.5 && <1, phonetic-languages-simplified-properties-array >=0.12.2 && <1, phonetic-languages-ukrainian-array >=0.9.1 && <1, phonetic-languages-filters-array >=0.3 && <1, phonetic-languages-plus >=0.5.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.2 && <1, heaps >= 0.3.6.1 && <1, phonetic-languages-simplified-examples-common >=0.4.1 && <1, mmsyn2-array >= 0.3 && <1, string-interpreter >=0.5.4.1 && <1, cli-arguments >= 0.6 && <1 ghc-options: -threaded -rtsopts hs-source-dirs: ., Lines default-language: Haskell2010@@ -46,7 +46,7 @@ main-is: Main.hs other-modules: Phonetic.Languages.Simplified.Array.Ukrainian.FuncRep2RelatedG2, Phonetic.Languages.GetTextualInfo, Phonetic.Languages.Parsing, Phonetic.Languages.Simplified.Array.Ukrainian.ReadProperties other-extensions: BangPatterns- build-depends: base >=4.8 && <4.16, ukrainian-phonetics-basic-array >=0.4.2 && <1, phonetic-languages-simplified-base >=0.4.1 && <1, phonetic-languages-simplified-properties-array >=0.12 && <1, phonetic-languages-ukrainian-array >=0.8 && <1, phonetic-languages-filters-array >=0.3 && <1, uniqueness-periods-vector-stats >=0.2.1 && <1, parallel >=3.2.0.6 && <4, phonetic-languages-plus >=0.5.1 && <1, subG >= 0.4 && < 1, phonetic-languages-rhythmicity >=0.9.1 && <1, phonetic-languages-permutations-array >= 0.2 && <1, heaps >= 0.3.6.1 && <1, phonetic-languages-constraints-array >=0.1 && <1, phonetic-languages-simplified-examples-common >=0.4 && <1, mmsyn2-array >= 0.3 && <1, string-interpreter >=0.5.4.1 && <1+ build-depends: base >=4.8 && <5, ukrainian-phonetics-basic-array >=0.4.2 && <1, phonetic-languages-simplified-base >=0.4.5 && <1, phonetic-languages-simplified-properties-array >=0.12.2 && <1, phonetic-languages-ukrainian-array >=0.9.1 && <1, phonetic-languages-filters-array >=0.3 && <1, uniqueness-periods-vector-stats >=0.2.1 && <1, parallel >=3.2.0.6 && <4, phonetic-languages-plus >=0.5.1 && <1, subG >= 0.4 && < 1, phonetic-languages-rhythmicity >=0.9.1 && <1, phonetic-languages-permutations-array >= 0.2 && <1, heaps >= 0.3.6.1 && <1, phonetic-languages-constraints-array >=0.1 && <1, phonetic-languages-simplified-examples-common >=0.4.1 && <1, mmsyn2-array >= 0.3 && <1, string-interpreter >=0.5.4.1 && <1, cli-arguments >= 0.6 && <1 ghc-options: -threaded -rtsopts hs-source-dirs: ., GetInfo default-language: Haskell2010