phladiprelio-general-simple 0.10.0.0 → 0.11.0.0
raw patch · 4 files changed
+60/−22 lines, 4 filesdep +phonetic-languages-basisPVP ok
version bump matches the API change (PVP)
Dependencies added: phonetic-languages-basis
API changes (from Hackage documentation)
+ Phladiprelio.General.Simple: selectSounds :: (String -> String) -> String -> String
- Phladiprelio.General.Simple: argsProcessing :: [[String]] -> [[String]] -> String -> IO (String, String, Int, Bool, Int8, FilePath, Int, Bool, String, [String])
+ Phladiprelio.General.Simple: argsProcessing :: [[String]] -> [[String]] -> String -> IO (String, String, String, Int, Bool, Int8, FilePath, Int, Bool, String, [String])
- Phladiprelio.General.Simple: generalF :: (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 :: 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: processingF :: GWritingSystemPRPLX -> [(Char, Char)] -> CharPhoneticClassification -> SegmentRulesG -> String -> String -> ([[[PRS]]] -> [[Double]]) -> Int -> HashCorrections -> (Int8, [Int8]) -> [[String]] -> [[String]] -> Bool -> Int -> String -> IO ()
+ Phladiprelio.General.Simple: processingF :: (String -> String) -> GWritingSystemPRPLX -> [(Char, Char)] -> CharPhoneticClassification -> SegmentRulesG -> String -> String -> ([[[PRS]]] -> [[Double]]) -> Int -> HashCorrections -> (Int8, [Int8]) -> [[String]] -> [[String]] -> Bool -> Int -> String -> IO ()
Files
- CHANGELOG.md +7/−0
- Phladiprelio/General/Simple.hs +45/−20
- README.md +6/−0
- phladiprelio-general-simple.cabal +2/−2
CHANGELOG.md view
@@ -122,3 +122,10 @@ and music composing. Fixed issue with +x command line arguments. Updated dependencies. Some documentation improvements. +## 0.11.0.0 -- 2023-11-01++* Eleventh version. Added a new command line argument "+ul" with additional argument to compute not+ usual rhythmicity properties, but diversity property of the sounds represented by the encoded +additional string. Added video example for the parallel project phladiprelio-ukrainian-simple+showing the new functionality usage for Ukrainian language.+
Phladiprelio/General/Simple.hs view
@@ -35,9 +35,12 @@ import Control.Concurrent.Async (mapConcurrently) import Phladiprelio.Tests import Phladiprelio.General.Datatype (readBasic3, readBasic4, readBasic1G)+import Phladiprelio.UniquenessPeriodsG generalF - :: (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.+ :: 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. -> GWritingSystemPRPLX -- ^ Data used to obtain the phonetic language representation of the text. -> [(Char,Char)] -- ^ The pairs of the 'Char' that corresponds to the similar phonetic languages consonant phenomenon (e. g. allophones). Must be sorted in the ascending order to be used correctly. @@ -58,13 +61,15 @@ -> String -- ^ An initial string to be analyzed. -> [String] -> IO [String] -generalF (prestr,poststr) lineNmb wrs ks arr gs us vs h numTest hc (grps,mxms) descending hashStep emptyline splitting (fs, code) concurrently initstr universalSet +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 | 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 let syllN = countSyll wrs arr us vs initstr -- universalSet = map unwords . permutations $ rss- f grps mxms = sum . countHashes2G hashStep hc grps mxms . readBasic3 (h . createSyllablesPL wrs ks arr gs us vs) (mconcat)+ f grps mxms + | null selStr = sum . countHashes2G hashStep hc grps mxms . readBasic3 (h . createSyllablesPL wrs ks arr gs us vs) (mconcat)+ | otherwise = fromIntegral . diverse2GGL (selectSounds selFun selStr) (us `mappend` vs) . concatMap string1 . stringToXG wrs . filter (\c -> not (isDigit c) && c /= '_') hSetNewlineMode stdout universalNewlineMode if numTest >= 0 && numTest <= 179 && numTest /= 1 then do putStrLn "Feet Val Stat Proxim" @@ -93,18 +98,22 @@ let writ = writable permiss readab = readable permiss if writ && readab then do- let lineOption = head . filter (\(S k _ ts) -> k == num) $ sRepresent- textP = (\(S _ _ ts) -> ts) lineOption- sylls = createSyllablesPL wrs ks arr gs us vs textP- if code >= 10 && code <= 19 && grps == 2- then do- let qqs = readBasic4 (h . createSyllablesPL wrs ks arr gs us vs) (mconcat) (mconcat . createSyllablesPL wrs ks arr gs us vs) (map (map charS)) . readBasic1G $ textP- (breaks,rs) = showZerosFor2PeriodMusic qqs- putStrLn textP- putStrLn breaks- putStrLn . show $ rs- appendFile fs ((if code >= 15 then (show rs `mappend` "\n" `mappend` breaks `mappend` "\n") else "") `mappend` outputSel lineOption code)- else appendFile fs (outputSel lineOption code)+ if null selStr then do + let lineOption = head . filter (\(S k _ ts) -> k == num) $ sRepresent+ textP = (\(S _ _ ts) -> ts) lineOption+ sylls = createSyllablesPL wrs ks arr gs us vs textP+ if code >= 10 && code <= 19 && grps == 2+ then do+ let qqs = readBasic4 (h . createSyllablesPL wrs ks arr gs us vs) (mconcat) (mconcat . createSyllablesPL wrs ks arr gs us vs) (map (map charS)) . readBasic1G $ textP+ (breaks,rs) = showZerosFor2PeriodMusic qqs+ putStrLn textP+ putStrLn breaks+ putStrLn . show $ rs+ appendFile fs ((if code >= 15 then (show rs `mappend` "\n" `mappend` breaks `mappend` "\n") else "") `mappend` outputSel lineOption code)+ else appendFile fs (outputSel lineOption code)+ else do+ let lineOption = head . filter (\(S k _ ts) -> k == num) $ sRepresent+ appendFile fs (outputSel lineOption code) else error "The specified file cannot be used for appending the text! Please, specify another file!" return [] where jjj kk = let (q1,r1) = quotRem kk (if kk < 0 then -10 else 10) in jjj' q1 r1 emptyline@@ -165,7 +174,7 @@ :: [[String]] -> [[String]] -> String - -> IO (String, String, Int, Bool, Int8, FilePath, Int, Bool, String, [String]) -- ^ These ones are intended to be used inside 'generalF'.+ -> IO (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@@ -174,6 +183,7 @@ emptyline = any (== "+l") args11 splitting = fromMaybe 50 (readMaybe (concat . getB "+w" $ argsB)::Maybe Int8) concurrently = any (== "-C") args11+ selStr = concat . getB "+ul" $ argsB filedata = getB "+f" argsB multiline2 = getB "+m" argsB (fileread,lineNmb)@@ -214,10 +224,11 @@ | otherwise = decodeLConstraints argCs . genPermutationsL $ l basiclineoption = unwords arg3s variants1 = uniquenessVariants2GNBL ' ' id id id perms ll- return (prestr, poststr, lineNmb, emptyline, splitting, filesave, codesave, concurrently, basiclineoption, variants1)+ return (selStr, prestr, poststr, lineNmb, emptyline, splitting, filesave, codesave, concurrently, basiclineoption, variants1) processingF- :: GWritingSystemPRPLX -- ^ Data used to obtain the phonetic language representation of the text.+ :: (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.+ -> GWritingSystemPRPLX -- ^ Data used to obtain the phonetic language representation of the text. -> [(Char,Char)] -- ^ The pairs of the 'Char' that corresponds to the similar phonetic languages consonant phenomenon (e. g. allophones). Must be sorted in the ascending order to be used correctly. -> CharPhoneticClassification -> SegmentRulesG@@ -233,7 +244,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 wrs ks arr gs us vs h numTest hc (grps,mxms) ysss zsss descending hashStep xs = argsProcessing ysss zsss xs >>= \(prestr, poststr, lineNmb, emptyline, splitting, filesave, codesave, concurrently, basiclineoption, variants1) -> generalF (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 >>= \(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 () {-# INLINE processingF #-} -- | Specifies the group of the command line arguments for 'processingF', which specifies the@@ -243,4 +254,18 @@ cSpecs = zip ["+a","+b"] . cycle $ [-1] bSpecs :: CLSpecifications-bSpecs = [("+f",2), ("+w",1), ("+m",2)]+bSpecs = [("+f",2),("+m",2),("+ul",1),("+w",1)]++{-| '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.+ -}+selectSounds + :: (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+selectSounds g xs = f . sort . concatMap g . words . map (\c -> if c == '.' then ' ' else c) $ us+ where (ts,us) = break (== '.') . filter (\c -> c /= 'H' && c /= 'G') $ xs+ f (x:ts@(y:xs)) + | x == y = f ts+ | otherwise = x:f ts+ f xs = xs+
README.md view
@@ -50,6 +50,10 @@ https://www.facebook.com/Oleksandr.S.Zhabenko/posts/pfbid02EaC4Zwn4YVjfVFWpUhLoHYomiFHZQaiMdorLa6PPx9kXBXepTYPFEFMv8iyV4wAYl +See the demonstration video for the new functionality in version 0.11.0.0 by the link on the example+of the parallel project usage:+[https://www.youtube.com/watch?v=zapAPpQ-fc4](https://www.youtube.com/watch?v=zapAPpQ-fc4)+ For the list of bash aliases a few of which are used in the videos, see: https://github.com/Oleksandr-Zhabenko/phladiprelio-alias/blob/main/.bashrc @@ -96,6 +100,8 @@ works with PhilZuid, Sophie sings in the classical manner. Nathalie Kok with love to her family and appreciation for André's Rieu support also celebrates the Day. In Ukraine this day has several important celebrations — Intercession of the Holy Theotokos (Pokrova), Cossacks' Day, Day of Defenders of Ukraine (especially relevant during the Russian war against Ukraine).++On the 01/11/2023 there is All Saints Solemnity for Roman Catholics. All support is welcome, including donations for the needs of the Ukrainian army, IDPs and refugees.
phladiprelio-general-simple.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: phladiprelio-general-simple-version: 0.10.0.0+version: 0.11.0.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+ 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 hs-source-dirs: . default-language: Haskell2010