phladiprelio-general-simple 0.11.0.0 → 0.11.1.0
raw patch · 3 files changed
+24/−12 lines, 3 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.General.Simple: argsProcessing :: [[String]] -> [[String]] -> String -> IO (String, String, String, Int, Bool, Int8, FilePath, Int, Bool, String, [String])
+ Phladiprelio.General.Simple: argsProcessing :: [[String]] -> [[String]] -> String -> IO (Bool, FilePath, String, String, String, Int, Bool, Int8, FilePath, Int, Bool, String, [String])
- Phladiprelio.General.Simple: generalF :: String -> (String -> String) -> (String, String) -> Int -> GWritingSystemPRPLX -> [(Char, Char)] -> CharPhoneticClassification -> SegmentRulesG -> String -> String -> ([[[PRS]]] -> [[Double]]) -> Int -> HashCorrections -> (Int8, [Int8]) -> Bool -> Int -> Bool -> Int8 -> (FilePath, Int) -> Bool -> String -> [String] -> IO [String]
+ Phladiprelio.General.Simple: generalF :: Bool -> FilePath -> String -> (String -> String) -> (String, String) -> Int -> GWritingSystemPRPLX -> [(Char, Char)] -> CharPhoneticClassification -> SegmentRulesG -> String -> String -> ([[[PRS]]] -> [[Double]]) -> Int -> HashCorrections -> (Int8, [Int8]) -> Bool -> Int -> Bool -> Int8 -> (FilePath, Int) -> Bool -> String -> [String] -> IO [String]
Files
- CHANGELOG.md +6/−0
- Phladiprelio/General/Simple.hs +16/−10
- phladiprelio-general-simple.cabal +2/−2
CHANGELOG.md view
@@ -129,3 +129,9 @@ additional string. Added video example for the parallel project phladiprelio-ukrainian-simple showing the new functionality usage for Ukrainian language. +## 0.11.1.0 -- 2023-11-06++* Eleventh version revised A. 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.+
Phladiprelio/General/Simple.hs view
@@ -12,7 +12,7 @@ import System.Environment (getArgs) import GHC.Num ((+),(-),(*),Integer) import Text.Read (readMaybe)-import System.IO (putStrLn, FilePath,stdout,universalNewlineMode,hSetNewlineMode,getLine,appendFile,readFile)+import System.IO (putStrLn, FilePath,stdout,universalNewlineMode,hSetNewlineMode,getLine,appendFile,readFile,writeFile) import Rhythmicity.MarkerSeqs hiding (id) import Rhythmicity.BasicF import Data.List hiding (foldr)@@ -30,7 +30,7 @@ import Phladiprelio.StrictVG import Numeric (showFFloat) import Phladiprelio.Halfsplit-import System.Directory (doesFileExist,readable,writable,getPermissions,Permissions(..))+import System.Directory (doesFileExist,readable,writable,getPermissions,Permissions(..),doesFileExist,getCurrentDirectory) import Data.ReversedScientific import Control.Concurrent.Async (mapConcurrently) import Phladiprelio.Tests@@ -38,7 +38,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) -- ^ A function that specifies what 'Char's in the list the first argument makes to be the function sensitive to. Analogue of the @g@ function in the definition: https://hackage.haskell.org/package/phonetic-languages-simplified-examples-array-0.21.0.0/docs/src/Phonetic.Languages.Simplified.Array.Ukrainian.FuncRep2RelatedG2.html#selectSounds. Use just small 'Char' if they are letters, do not use \'.\' and spaces. -> (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.@@ -61,7 +63,7 @@ -> String -- ^ An initial string to be analyzed. -> [String] -> IO [String] -generalF selStr selFun (prestr,poststr) lineNmb wrs ks arr gs us vs h numTest hc (grps,mxms) descending hashStep emptyline splitting (fs, code) concurrently initstr universalSet +generalF html dcfile selStr selFun (prestr,poststr) lineNmb wrs ks arr gs us vs h numTest hc (grps,mxms) descending hashStep emptyline splitting (fs, code) concurrently initstr universalSet | null universalSet = 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 | length universalSet == 1 = mapM putStrLn universalSet >> return universalSet | otherwise = do@@ -82,9 +84,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 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@@ -174,7 +176,7 @@ :: [[String]] -> [[String]] -> String - -> IO (String, String, String, Int, Bool, Int8, FilePath, Int, Bool, String, [String]) -- ^ These ones are intended to be used inside 'generalF'.+ -> IO (Bool, FilePath, String, String, String, Int, Bool, Int8, FilePath, Int, Bool, String, [String]) -- ^ These ones are intended to be used inside 'generalF'. argsProcessing ysss zsss xs = do args0 <- getArgs let (argsC, args) = takeCs1R ('+','-') cSpecs args0@@ -183,6 +185,10 @@ emptyline = any (== "+l") args11 splitting = fromMaybe 50 (readMaybe (concat . getB "+w" $ argsB)::Maybe Int8) concurrently = any (== "-C") args11+ dcspecs = getB "+dc" argsB+ (html,dcfile) + | null dcspecs = (False, "")+ | otherwise = (head dcspecs == "1",last dcspecs) selStr = concat . getB "+ul" $ argsB filedata = getB "+f" argsB multiline2 = getB "+m" argsB@@ -224,7 +230,7 @@ | otherwise = decodeLConstraints argCs . genPermutationsL $ l basiclineoption = unwords arg3s variants1 = uniquenessVariants2GNBL ' ' id id id perms ll- return (selStr, prestr, poststr, lineNmb, emptyline, splitting, filesave, codesave, concurrently, basiclineoption, variants1)+ return (html, dcfile, selStr, prestr, poststr, lineNmb, emptyline, splitting, filesave, codesave, concurrently, basiclineoption, variants1) processingF :: (String -> String) -- ^ A function that specifies what 'Char's in the list the first argument makes to be the function sensitive to. Analogue of the @g@ function in the definition: https://hackage.haskell.org/package/phonetic-languages-simplified-examples-array-0.21.0.0/docs/src/Phonetic.Languages.Simplified.Array.Ukrainian.FuncRep2RelatedG2.html#parsey0Choice. Use just small 'Char' if they are letters, do not use \'.\' and spaces.@@ -244,7 +250,7 @@ -> Int -- ^ The hashing function step. The default value is 20. Is expected to be greater than 2, and better greater than 12. -> String -> IO ()-processingF selFun wrs ks arr gs us vs h numTest hc (grps,mxms) ysss zsss descending hashStep xs = argsProcessing ysss zsss xs >>= \(selStr, prestr, poststr, lineNmb, emptyline, splitting, filesave, codesave, concurrently, basiclineoption, variants1) -> generalF selStr selFun (prestr,poststr) lineNmb wrs ks arr gs us vs h numTest hc (grps,mxms) descending hashStep emptyline splitting (filesave, codesave) concurrently basiclineoption variants1 >> return ()+processingF selFun wrs ks arr gs us vs h numTest hc (grps,mxms) ysss zsss descending hashStep xs = argsProcessing ysss zsss xs >>= \(html, dcfile, selStr, prestr, poststr, lineNmb, emptyline, splitting, filesave, codesave, concurrently, basiclineoption, variants1) -> generalF html dcfile selStr selFun (prestr,poststr) lineNmb wrs ks arr gs us vs h numTest hc (grps,mxms) descending hashStep emptyline splitting (filesave, codesave) concurrently basiclineoption variants1 >> return () {-# INLINE processingF #-} -- | Specifies the group of the command line arguments for 'processingF', which specifies the@@ -254,7 +260,7 @@ cSpecs = zip ["+a","+b"] . cycle $ [-1] bSpecs :: CLSpecifications-bSpecs = [("+f",2),("+m",2),("+ul",1),("+w",1)]+bSpecs = [("+f",2),("+m",2),("+ul",1),("+w",1),("+dc",2)] {-| 'selectSounds' converts the argument after \"+ul\" command line argument into a list of sound representations that is used for evaluation of \'uniqueness periods\' properties of the line. Is a modified Phonetic.Languages.Simplified.Array.General.FuncRep2RelatedG2.parsey0Choice from the @phonetic-languages-simplified-generalized-examples-array-0.19.0.1@ package. -}
phladiprelio-general-simple.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: phladiprelio-general-simple-version: 0.11.0.0+version: 0.11.1.0 -- A short (one-line) description of the package. synopsis: A generalized functionality of PhLADiPreLiO for different languages that uses hash algorithms.@@ -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, phonetic-languages-phonetics-basics ==0.10.1.0, phladiprelio-general-shared ==0.1.1.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, phonetic-languages-basis ==0.3.0.0+ build-depends: base >=4.13 && <5, rhythmic-sequences ==0.4.1.0, phonetic-languages-phonetics-basics ==0.10.1.0, phladiprelio-general-shared ==0.1.1.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, phonetic-languages-basis ==0.3.0.0 hs-source-dirs: . default-language: Haskell2010