packages feed

phladiprelio-ukrainian-simple 0.12.0.1 → 0.12.1.0

raw patch · 4 files changed

+29/−14 lines, 4 filesdep ~halfsplitPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: halfsplit

API changes (from Hackage documentation)

- Phladiprelio.Ukrainian.IO: generalF :: String -> (String, String) -> Int -> FilePath -> Int -> HashCorrections -> (Int8, [Int8]) -> Int -> Bool -> Int -> Bool -> Int8 -> (FilePath, Int) -> Bool -> String -> [String] -> IO [String]
+ Phladiprelio.Ukrainian.IO: generalF :: Bool -> FilePath -> String -> (String, String) -> Int -> FilePath -> Int -> HashCorrections -> (Int8, [Int8]) -> Int -> Bool -> Int -> Bool -> Int8 -> (FilePath, Int) -> Bool -> String -> [String] -> IO [String]

Files

CHANGELOG.md view
@@ -162,3 +162,10 @@  * Twelfth version revised A. Added video example and fixed issue with documentation. ++## 0.12.1.0 -- 2023-11-06++* Twelfth version revised B. Added a possibility to use +dc group of command line arguments that +allow to specify whether to add <br> html tag to each line in the two-column output and to what file+print additionally two-column output.+
Main.hs view
@@ -32,6 +32,10 @@       sylD = let k = snd (fromMaybe 2 (readMaybe (concat . getB "+s" $ argsB)::Maybe Int) `quotRemInt` 4) in if k == 0 then 4 else k       maxNumWords = let k = fromMaybe 7 (readMaybe (concat . getB "+x" $ argsB)::Maybe Int) in if k == 0 || abs k >= 9 then 9 else max (abs k) 2       hc = readHashCorrections . concat . getB "+c" $ argsB+      dcspecs = getB "+dc" argsB+      (html,dcfile) +        | null dcspecs = (False, "")+        | otherwise = (head dcspecs == "1",last dcspecs)       prepare = oneA "-p" argsA       selStr = concat . getB "+ul" $ argsB       grpp = grouppingR . concat . getB "+r" $ argsB@@ -85,7 +89,7 @@   if helpMessage then do       putStrLn "SYNOPSIS:"       putStrLn ""-      putStrLn "phladiprelioUkr [+a <PhLADiPreLiO constraints> -a] [+b <extended algebraic PhLADiPreLiO constraints> -b] [+c <HashCorrections encoded>] [+n] [+l] [+d <FilePath to file with durations>] [+k <number - hash step>] [+ul <diversity property encoding string>] [+r <groupping info>] [-t <number of the test or its absence if 1 is here> [-C +RTS -N -RTS]] [+s <syllable durations function number>] [-p] [+w <splitting parameter>] [+f <FilePath to the file to be appended the resulting String> <control parameter for output parts>] [+x <maximum number of words taken>] <Ukrainian textual line>"+      putStrLn "phladiprelioUkr [+a <PhLADiPreLiO constraints> -a] [+b <extended algebraic PhLADiPreLiO constraints> -b] [+c <HashCorrections encoded>] [+n] [+l] [+d <FilePath to file with durations>] [+k <number - hash step>] [+ul <diversity property encoding string>] [+r <groupping info>] [-t <number of the test or its absence if 1 is here> [-C +RTS -N -RTS]] [+s <syllable durations function number>] [-p] [+w <splitting parameter>] [+f <FilePath to the file to be appended the resulting String> <control parameter for output parts>] [+x <maximum number of words taken>] [+dc <whether to print <br> tag at the end of each line for two-column output> <FilePath to the file where the two-column output will be written in addition to stdout>] <Ukrainian textual line>"       putStrLn ""       putStrLn "+n \t— if specified then the order of sorting and printing is descending (the reverse one to the default otherwise). "       putStrLn ""@@ -103,6 +107,8 @@       putStrLn "The second arguments greater or equal to 10 take effect only if the meter consists of two syllables (in case of \"+r 21\" command line options given). If it is 10 in such a case then before appending the line option itself to the given file there is hashes information for this line option displayed. If it is 11 — the same hashes information is displayed before processing as for 1. If it is 12 — the same hashes information is displayed before processing as for 2 and so on for 13, 14. If it is 15 up to 19 — it is analogically to the the 10–14 but the hashes information is not only printed on the screen, but appended to the file specified. These values are intended to test the interesting hypothesis about where the pauses can occur. For more information on the hypothesis, see: "       putStrLn "https://www.academia.edu/105067761/Why_some_lines_are_easy_to_pronounce_and_others_are_not_or_prosodic_unpredictability_as_a_characteristic_of_text"       putStrLn ""+      putStrLn "+dc \t— if specified with two further arguments then the first one can be 1 or something  else. If it is 1 then additionally to every line as usual there is printed also <br> html tag at the end of the line for the two-columns output. Otherwise, nothing is added to each line. The second argument further is a FilePath to the writable existing file or to the new file that will be located in the writable by the user directory. The two-column output will be additionally written to this file if it is possible, otherwise the program will end with an exception."+      putStrLn ""       putStrLn "+a ... -a \t— if present contains a group of constraints for PhLADiPreLiO. For more information, see: "       putStrLn "https://oleksandr-zhabenko.github.io/uk/rhythmicity/PhLADiPreLiO.Eng.21.html#constraints in English or in Ukrainian: "       putStrLn "https://oleksandr-zhabenko.github.io/uk/rhythmicity/PhLADiPreLiO.Ukr.21.html#%D0%BE%D0%B1%D0%BC%D0%B5%D0%B6%D0%B5%D0%BD%D0%BD%D1%8F-constraints"@@ -137,11 +143,11 @@       putStrLn ""       putStrLn "For the \"music\" mode the number of syllables printed for the line does not include the inserts. So the property value can be greater than this number."       putStrLn ""-  else generalF selStr (prestr, poststr) lineNmb fileDu numTest hc grpp sylD descending hashStep emptyline splitting (filesave, codesave) concurrently (unwords arg3s) variants1 >> return ()+  else generalF html dcfile selStr (prestr, poststr) lineNmb fileDu numTest hc grpp sylD descending hashStep emptyline splitting (filesave, codesave) concurrently (unwords arg3s) variants1 >> return ()   bSpecs :: CLSpecifications-bSpecs = (zip ["+c","+d","+k","+r","+s","-t","+ul","+w","+x"] . cycle $ [1]) `mappend` [("+f",2),("+m",2)] +bSpecs = (zip ["+c","+d","+k","+r","+s","-t","+ul","+w","+x"] . cycle $ [1]) `mappend` [("+f",2),("+m",2),("+dc",2)]   aSpecs :: CLSpecifications aSpecs = zip ["-h", "+l", "+n","-p", "-C"] . cycle $ [0]
Phladiprelio/Ukrainian/IO.hs view
@@ -10,7 +10,7 @@ import Text.Show (Show(..)) import Text.Read (readMaybe) import Data.Char (isDigit, isAlpha,toLower)-import System.IO (putStrLn, FilePath,stdout,hSetNewlineMode,universalNewlineMode,getLine,appendFile,print)+import System.IO (putStrLn, FilePath,stdout,hSetNewlineMode,universalNewlineMode,getLine,appendFile,print,writeFile) import Rhythmicity.MarkerSeqs hiding (id)  import Data.List hiding (foldr) import Data.Maybe (isNothing,fromJust) @@ -24,7 +24,7 @@ import Data.Ord (comparing) import Numeric (showFFloat) import Phladiprelio.Halfsplit-import System.Directory (readable,writable,getPermissions,Permissions(..))+import System.Directory (readable,writable,getPermissions,Permissions(..),doesFileExist,getCurrentDirectory) import Data.ReversedScientific import Control.Concurrent.Async (mapConcurrently) import Phladiprelio.Tests@@ -32,7 +32,9 @@ import Phladiprelio.UniquenessPeriodsG  generalF- :: String -- ^ If not null than instead of rhythmicity evaluation using hashes and and feets, there is computed a diversity property for the specified 'String' here using the 'selectSounds' function. For more information, see: 'https://oleksandr-zhabenko.github.io/uk/rhythmicity/PhLADiPreLiO.Eng.21.html#types'+ :: Bool -- ^ If 'True' then adds \"<br>\" to line endings for double column output+ -> FilePath -- ^ A path to the file to save double columns output to. If empty then just prints to 'stdout'.+ -> String -- ^ If not null than instead of rhythmicity evaluation using hashes and and feets, there is computed a diversity property for the specified 'String' here using the 'selectSounds' function. For more information, see: 'https://oleksandr-zhabenko.github.io/uk/rhythmicity/PhLADiPreLiO.Eng.21.html#types'  -> (String, String)  -- ^ If the next element is not equal to -1, then the prepending and appending lines to be displayed. Used basically for working with the multiline textual input data.  -> Int -- ^ The number of the line in the file to be read the lines from. If equal to -1 then neither reading from the file is done nor the first argument influences the processment results.  -> FilePath -- ^ The file to read the sound representation durations from.@@ -49,7 +51,7 @@  -> String -- ^ An initial string to be analysed.  -> [String]   -> IO [String]-generalF selStr (prestr, poststr) lineNmb file numTest hc (grps,mxms) k descending hashStep emptyline splitting (fs,code) concurrently initstr universalSet@(u1:u2:us) = do+generalF html dcfile selStr (prestr, poststr) lineNmb file numTest hc (grps,mxms) k descending hashStep emptyline splitting (fs,code) concurrently initstr universalSet@(u1:u2:us) = do    syllableDurationsDs <- readSyllableDurations file    let syllN = countSyll initstr --       universalSet = map unwords . permutations . words $ rs@@ -72,9 +74,9 @@                                                                                                                           else "")) in putStrLn strTest >> return strTest) . zip (sel2 numTest) $ (sel numTest)    else let sRepresent = zipWith (\k (x, ys) -> S k x ys) [1..] .                     (let h1 = if descending then (\(u,w) -> ((-1) * u, w)) else id in sortOn h1) . map (\xss -> (f syllableDurationsDs grps mxms xss, xss)) $ universalSet-            strOutput = (:[]) . halfsplit (\(S _ y _) -> y) (jjj splitting) $ sRepresent+            strOutput = (:[]) . halfsplit1G (\(S _ y _) -> y) (if html then "<br>" else "") (jjj splitting) $ sRepresent                         in do-                             _ <- mapM putStrLn strOutput+                             _ <- (if null dcfile then mapM putStrLn strOutput else do {mapM putStrLn strOutput >> doesFileExist dcfile >>= \exist -> if exist then do {getPermissions dcfile >>= \perms -> if writable perms then mapM (writeFile dcfile) strOutput else error $ "Phladiprelio.Ukrainian.IO.generalF: File " `mappend` dcfile `mappend` " is not writable!"} else do {getCurrentDirectory >>= \currdir -> do {getPermissions currdir >>= \perms -> if writable perms then mapM (writeFile dcfile) strOutput else error $ "Phladiprelio.Ukrainian.IO.generalF: Directory of the file " `mappend` dcfile `mappend` " is not writable!"}}})                              let l1 = length sRepresent                              if code == -1                                   then if lineNmb == -1 then return strOutput@@ -113,8 +115,8 @@                   | r1 == 1 || r1 == 3 = 10*q1 + (if emptyline then 5 else r1)                   | r1 < 0 = -10*q1 + (if emptyline then -4 else r1)                   | otherwise = 10*q1 + (if emptyline then 4 else r1)-generalF _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ [u1] = mapM putStrLn [u1] >> return [u1]-generalF _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ = let strOutput = ["You have specified the data and constraints on it that lead to no further possible options.", "Please, specify another data and constraints."] in mapM putStrLn strOutput >> return strOutput+generalF _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ [u1] = mapM putStrLn [u1] >> return [u1]+generalF _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ = let strOutput = ["You have specified the data and constraints on it that lead to no further possible options.", "Please, specify another data and constraints."] in mapM putStrLn strOutput >> return strOutput  data PhladiprelioUkr = S Int Integer String deriving Eq 
phladiprelio-ukrainian-simple.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               phladiprelio-ukrainian-simple-version:            0.12.0.1+version:            0.12.1.0  -- A short (one-line) description of the package. synopsis:           A PhLADiPreLiO implementation for Ukrainian that uses hashes and asynchronous concurrency.@@ -28,7 +28,7 @@      -- LANGUAGE extensions used by modules in this package.     other-extensions: NoImplicitPrelude, BangPatterns-    build-depends:    base >=4.13 && <5, rhythmic-sequences ==0.4.1.0, ukrainian-phonetics-basic-array ==0.7.0.0, phonetic-languages-ukrainian-array ==0.11.0.0, phladiprelio-ukrainian-shared ==0.1.0.0, cli-arguments ==0.7.0.0, phonetic-languages-permutations-array ==0.4.0.0, phonetic-languages-constraints-array ==0.7.3.0, phonetic-languages-simplified-base ==0.7.1.0, halfsplit ==0.3.0.0, directory >=1.3.4.0 && <2, rev-scientific ==0.2.1.0, async >= 2.2.2 && <3, phladiprelio-tests ==0.1.0.0, phladiprelio-general-datatype ==0.3.1.0, mmsyn2-array ==0.3.1.1, phonetic-languages-basis ==0.3.0.0+    build-depends:    base >=4.13 && <5, rhythmic-sequences ==0.4.1.0, ukrainian-phonetics-basic-array ==0.7.0.0, phonetic-languages-ukrainian-array ==0.11.0.0, phladiprelio-ukrainian-shared ==0.1.0.0, cli-arguments ==0.7.0.0, phonetic-languages-permutations-array ==0.4.0.0, phonetic-languages-constraints-array ==0.7.3.0, phonetic-languages-simplified-base ==0.7.1.0, halfsplit ==0.4.1.0, directory >=1.3.4.0 && <2, rev-scientific ==0.2.1.0, async >= 2.2.2 && <3, phladiprelio-tests ==0.1.0.0, phladiprelio-general-datatype ==0.3.1.0, mmsyn2-array ==0.3.1.1, phonetic-languages-basis ==0.3.0.0     hs-source-dirs:   .     default-language: Haskell2010 @@ -40,7 +40,7 @@     ghc-options:      -threaded -rtsopts     -- LANGUAGE extensions used by modules in this package.     other-extensions: NoImplicitPrelude, BangPatterns-    build-depends:    base >=4.13 && <5, rhythmic-sequences ==0.4.1.0, ukrainian-phonetics-basic-array ==0.7.0.0, phonetic-languages-ukrainian-array ==0.11.0.0, phladiprelio-ukrainian-shared ==0.1.0.0, cli-arguments ==0.7.0.0, phonetic-languages-permutations-array ==0.4.0.0, phonetic-languages-constraints-array ==0.7.3.0, phonetic-languages-simplified-base ==0.7.1.0, halfsplit ==0.3.0.0, directory >=1.3.4.0 && <2, rev-scientific ==0.2.1.0, async >= 2.2.2 && <3, phladiprelio-tests ==0.1.0.0, phladiprelio-general-datatype ==0.3.1.0, mmsyn2-array ==0.3.1.1, phonetic-languages-basis ==0.3.0.0+    build-depends:    base >=4.13 && <5, rhythmic-sequences ==0.4.1.0, ukrainian-phonetics-basic-array ==0.7.0.0, phonetic-languages-ukrainian-array ==0.11.0.0, phladiprelio-ukrainian-shared ==0.1.0.0, cli-arguments ==0.7.0.0, phonetic-languages-permutations-array ==0.4.0.0, phonetic-languages-constraints-array ==0.7.3.0, phonetic-languages-simplified-base ==0.7.1.0, halfsplit ==0.4.1.0, directory >=1.3.4.0 && <2, rev-scientific ==0.2.1.0, async >= 2.2.2 && <3, phladiprelio-tests ==0.1.0.0, phladiprelio-general-datatype ==0.3.1.0, mmsyn2-array ==0.3.1.1, phonetic-languages-basis ==0.3.0.0     hs-source-dirs:   .     default-language: Haskell2010