packages feed

phladiprelio-ukrainian-simple 0.8.1.0 → 0.9.0.0

raw patch · 5 files changed

+74/−25 lines, 5 filesdep +asyncPVP ok

version bump matches the API change (PVP)

Dependencies added: async

API changes (from Hackage documentation)

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

Files

CHANGELOG.md view
@@ -123,3 +123,9 @@ * Eigth version revised A. Switched to the updated version of dependencies so that it can be built on the GHC-9.6.* series of compiler. +## 0.9.0.0 -- 2023-07-30++* Ninth version. Added asynchronous concurrent calculations and async as a package dependency. Added+  the possibility to calculate for the text with maximum 9 words or their combinations (using +x+command line option). Added new draft papers with improved theory about the usage of the software.+
Main.hs view
@@ -1,8 +1,11 @@ {-# LANGUAGE NoImplicitPrelude, BangPatterns #-} +{-# OPTIONS_GHC -rtsopts -threaded #-}+ module Main where  import GHC.Base+import GHC.Num (abs) import Text.Read (readMaybe) import System.IO (putStrLn) import Rhythmicity.MarkerSeqs hiding (id) @@ -27,6 +30,7 @@       (argsA, argsB, argsC, arg2s) = args2Args31R ('+','-') (aSpecs `mappend` bSpecs `mappend` cSpecs) args       fileDu = concat . getB "+d" $ argsB       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       prepare = oneA "-p" argsA       grpp = grouppingR . concat . getB "+r" $ argsB@@ -38,11 +42,12 @@       argCs = catMaybes (fmap (readMaybeECG l) -- . (showB l lstW2:)                                                     . getC "+a" $ argsC)       filedata = getB "+f" argsB+      concurrently = oneA "-C" argsA       (filesave,codesave)           | null filedata = ("",-1)         | length filedata == 2 = (head filedata, fromMaybe 0 (readMaybe (last filedata)::Maybe Int))         | otherwise = (head filedata,0)-      ll = take 7 . (if prepare then id else words . mconcat . prepareText . unwords) $ arg2s+      ll = take maxNumWords . (if prepare then id else words . mconcat . prepareText . unwords) $ arg2s       l = length ll       !perms          | not (null argCBs) = filterGeneralConv l argCBs . genPermutationsL $ l@@ -53,7 +58,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>] [+r <groupping info>] [-t <number of the test or its absence if 1 is here>] [+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>] <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>] [+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 ""       putStrLn "+n \t— if specified then the order of sorting and printing is descending (the reverse one to the default otherwise). "       putStrLn ""@@ -87,15 +92,19 @@       putStrLn "If you use here the values from the range of 20-99 then it corresponds to the reduced set of values with all the intermediate elements included: e. g. 2, 3, 4 and 5."       putStrLn "If you use here the values from the range of 100-179 then there are only primary numbers used for the number of syllables in the groups - just 2, 3, 5, or 7 or some subset of this set. This lead to some fastening the computation and can be beneficial to overall performance and presenting. Nevertheless, some important or valuable results can be omitted due to omittion of the composed numbers (4 and 6). Use with this caution."       putStrLn ""+      putStrLn "-C \t— If specified with +RTS -N -RTS rtsoptions for the multicore computers with -t option then it can speed up the full computation of the all tests using more resources. Uses asynchcronous concurrent threads in computation. This groups (-C and rtsoptions) can be specified in any position as command line groups of arguments. The output is in this case not sorted in the order of 2,3,4,5,6,7, but can vary depending on your CPU configurations and states and / or some other factors."+      putStrLn ""       putStrLn "+k \t— and then the number greater than 2 (better, greater than 12, the default value if not specified is 20). The greater value leads to greater numbers. The number less than some infimum here leads to wiping of some information from the result and, therefore, probably is not the desired behaviour. For most cases the default value is just enough sensible, but you can give it a try for other values."       putStrLn ""-  else generalF fileDu numTest hc grpp sylD descending hashStep emptyline splitting (filesave, codesave) variants1 >> return ()+      putStrLn "+x \t— If specified with the further natural number then means that instead of maximum 7 words or their concatenations that can be analysed together as a line there will be taken the specified number here or 9 if the number is greater than 8. More words leads to more computations, therefore, please, use with this caution in mind. It can be useful mostly for the cases with the additional constraints specified (+a ... -a or +b ... -b groups, see above)."+      putStrLn ""+  else generalF fileDu numTest hc grpp sylD descending hashStep emptyline splitting (filesave, codesave) concurrently variants1 >> return ()  bSpecs :: CLSpecifications-bSpecs = (zip ["+c","+d","+k","+r","+s","-t","+w"] . cycle $ [1]) `mappend` [("+f",2)] +bSpecs = (zip ["+c","+d","+k","+r","+s","-t","+w","+x"] . cycle $ [1]) `mappend` [("+f",2)]   aSpecs :: CLSpecifications-aSpecs = zip ["-h", "+l", "+n","-p"] . cycle $ [0]+aSpecs = zip ["-h", "+l", "+n","-p", "-C"] . cycle $ [0]  cSpecs :: CLSpecifications cSpecs = [("+a",-1)]
Phladiprelio/Ukrainian/IO.hs view
@@ -13,7 +13,7 @@ import Rhythmicity.MarkerSeqs hiding (id)  import Data.List hiding (foldr) import Data.Maybe (isNothing,fromJust) -import Data.Tuple (fst)+import Data.Tuple (fst,snd) import Phladiprelio.Ukrainian.Syllable  import Phladiprelio.Ukrainian.SyllableDouble import Phladiprelio.Ukrainian.Melodics @@ -24,9 +24,24 @@ import Phladiprelio.Halfsplit import System.Directory (readable,writable,getPermissions,Permissions(..)) import Data.ReversedScientific+import Data.Either+import Control.Concurrent.Async (mapConcurrently) -generalF :: FilePath -> Int -> HashCorrections -> (Int8,[Int8]) -> Int -> Bool -> Int -> Bool -> Int8 -> (FilePath, Int) -> [String] -> IO [String]-generalF file numTest hc (grps,mxms) k descending hashStep emptyline splitting (fs,code) universalSet@(u1:u2:us) = do+generalF+ :: FilePath + -> Int + -> HashCorrections + -> (Int8,[Int8]) + -> Int + -> Bool + -> Int + -> Bool + -> Int8 + -> (FilePath, Int) + -> Bool  -- ^ Whether to run tests concurrently or not. 'True' corresponds to concurrent execution that can speed up the getting results but use more resources.+ -> [String] + -> IO [String]+generalF file numTest hc (grps,mxms) k descending hashStep emptyline splitting (fs,code) concurrently universalSet@(u1:u2:us) = do    syllableDurationsDs <- readSyllableDurations file    let syllN = countSyll . concat . take 1 $ universalSet --       universalSet = map unwords . permutations . words $ rs@@ -36,13 +51,16 @@    hSetNewlineMode stdout universalNewlineMode    if numTest >= 0 && numTest <= 179 && numTest /= 1 then do      putStrLn "Feet   Val  Stat   Proxim" -     mapM (\(q,qs) -> let m = stat1 syllN (q,qs)-                          (min1, max1) = minMax11ByCList (comparing (f syllableDurationsDs q qs)) universalSet -                          mx = f syllableDurationsDs q qs max1 -                          strTest = (show (fromEnum q) `mappend` "   |   " `mappend`  show mx `mappend` "     " `mappend` show m `mappend` "  -> " `mappend` -                             showFFloat (Just 3) (100 * fromIntegral mx / fromIntegral m) "%" `mappend` (if rem numTest 10 >= 4 -                                                                                                             then ("\n" `mappend` min1 `mappend` "\n" `mappend` max1 `mappend` "\n")-                                                                                                             else "")) in putStrLn strTest >> return strTest) . zip (sel2 numTest) $ (sel numTest)+     (if concurrently +          then mapConcurrently+          else mapM) (\(q,qs) -> +                          let m = stat1 syllN (q,qs)+                              (min1, max1) = minMax11ByCList (comparing (f syllableDurationsDs q qs)) universalSet +                              mx = f syllableDurationsDs q qs max1 +                              strTest = (show (fromEnum q) `mappend` "   |   " `mappend`  show mx `mappend` "     " `mappend` show m `mappend` "  -> " `mappend` +                                  showFFloat (Just 3) (100 * fromIntegral mx / fromIntegral m) "%" `mappend` (if rem numTest 10 >= 4 +                                                                                                                          then ("\n" `mappend` min1 `mappend` "\n" `mappend` max1 `mappend` "\n")+                                                                                                                          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@@ -142,8 +160,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 
README.md view
@@ -1,6 +1,6 @@ The executable is the new implementation of the ideas related to PhLADiPreLiO (Phonetic Languages Approach to Discovering the Preferred Line Options) for Ukrainian language. It uses hashes and-has at the moment (as of the version 0.7.0.0) not the full functionality. The previous implementation +has at the moment (as of the version 0.9.0.0) not the full functionality. The previous implementation  and its documentation are at the links:  https://hackage.haskell.org/package/phonetic-languages-simplified-examples-array@@ -9,7 +9,15 @@  [English documentation](https://oleksandrzhabenko.github.io/uk/rhythmicity/PhLADiPreLiO.Eng.21.pdf) -The documentation for  the  new implementation is available at the following links.+The draft scientific papers on prosody and the software that is based on the question of why some+lines are easy to pronounce and read while others are not. They are in two languages by the +following links:++[Ukranian text](https://www.academia.edu/105067723/%D0%A7%D0%BE%D0%BC%D1%83_%D0%B4%D0%B5%D1%8F%D0%BA%D1%96_%D1%80%D1%8F%D0%B4%D0%BA%D0%B8_%D0%BB%D0%B5%D0%B3%D0%BA%D0%BE_%D0%B2%D0%B8%D0%BC%D0%BE%D0%B2%D0%BB%D1%8F%D1%82%D0%B8_%D0%B0_%D1%96%D0%BD%D1%88%D1%96_%D0%BD%D1%96_%D0%B0%D0%B1%D0%BE_%D0%BF%D1%80%D0%BE%D1%81%D0%BE%D0%B4%D0%B8%D1%87%D0%BD%D0%B0_%D0%BD%D0%B5%D1%81%D0%BF%D1%80%D0%BE%D0%B3%D0%BD%D0%BE%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D1%96%D1%81%D1%82%D1%8C_%D1%8F%D0%BA_%D1%85%D0%B0%D1%80%D0%B0%D0%BA%D1%82%D0%B5%D1%80%D0%B8%D1%81%D1%82%D0%B8%D0%BA%D0%B0_%D1%82%D0%B5%D0%BA%D1%81%D1%82%D1%83)++[English text](https://www.academia.edu/105067761/Why_some_lines_are_easy_to_pronounce_and_others_are_not_or_prosodic_unpredictability_as_a_characteristic_of_text)++The old documentation for the implementation is available at the following links. [Новий текст теорії](https://oleksandr-zhabenko.github.io/uk/rhythmicity/phladiprelioUkr.7.pdf)  [New implementation](https://oleksandr-zhabenko.github.io/uk/rhythmicity/phladiprelioEng.7.pdf)@@ -45,6 +53,7 @@  ========  P.S.: the author would like to devote this project to support the Foundation GASTROSTARS.+The version 0.9.0.0 is devoted to Vico Kok.  At the day of publication of the first version of the package (12/03/2023) there is the foundation founder's (this is [Emma Kok](https://www.emmakok.nl)) Birthday.@@ -66,8 +75,15 @@  On the 15/06/2023 there is the final bachelor's exam for Enzo Kok in violin playing in Amsterdam.  +On the 30/07/2023 there is the Birthday of the Vico Kok and also International Friendship Day. +Therefore, the release version 0.9.0.0 is devoted to Vico.+ If you would like to share some financial support, please, contact the mentioned foundation using the URL:  [Contact Foundation GASTROSTARS](https://gastrostars.nl/hou-mij-op-de-hoogte)++or ++[Donation Page](https://gastrostars.nl/doneren) 
phladiprelio-ukrainian-simple.cabal view
@@ -1,12 +1,12 @@ cabal-version:      2.4 name:               phladiprelio-ukrainian-simple-version:            0.8.1.0+version:            0.9.0.0  -- A short (one-line) description of the package.-synopsis:           A PhLADiPreLiO implementation for Ukrainian that uses hashes+synopsis:           A PhLADiPreLiO implementation for Ukrainian that uses hashes and asynchronous concurrency.  -- A longer description of the package.-description:        It is another project that is based on the similar ideas as [phonetic-languages-simplified-examples-array package](https://hackage.haskell.org/package/phonetic-languages-simplified-examples-array). For documentation for these ideas, see: [PhLADiPreLiO.Ukr.21.pdf](https://oleksandrzhabenko.github.io/uk/rhythmicity/PhLADiPreLiO.Ukr.21.pdf) [PhLADiPreLiO.Eng.21.pdf](https://oleksandrzhabenko.github.io/uk/rhythmicity/PhLADiPreLiO.Eng.21.pdf)+description:        It is another project that is based on the similar ideas as [phonetic-languages-simplified-examples-array package](https://hackage.haskell.org/package/phonetic-languages-simplified-examples-array). For actual usage ideas see the documentation by the links [English draft paper](https://www.academia.edu/105067761/Why_some_lines_are_easy_to_pronounce_and_others_are_not_or_prosodic_unpredictability_as_a_characteristic_of_text) and [Ukrainian draft paper](https://www.academia.edu/105067723/%D0%A7%D0%BE%D0%BC%D1%83_%D0%B4%D0%B5%D1%8F%D0%BA%D1%96_%D1%80%D1%8F%D0%B4%D0%BA%D0%B8_%D0%BB%D0%B5%D0%B3%D0%BA%D0%BE_%D0%B2%D0%B8%D0%BC%D0%BE%D0%B2%D0%BB%D1%8F%D1%82%D0%B8_%D0%B0_%D1%96%D0%BD%D1%88%D1%96_%D0%BD%D1%96_%D0%B0%D0%B1%D0%BE_%D0%BF%D1%80%D0%BE%D1%81%D0%BE%D0%B4%D0%B8%D1%87%D0%BD%D0%B0_%D0%BD%D0%B5%D1%81%D0%BF%D1%80%D0%BE%D0%B3%D0%BD%D0%BE%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D1%96%D1%81%D1%82%D1%8C_%D1%8F%D0%BA_%D1%85%D0%B0%D1%80%D0%B0%D0%BA%D1%82%D0%B5%D1%80%D0%B8%D1%81%D1%82%D0%B8%D0%BA%D0%B0_%D1%82%D0%B5%D0%BA%D1%81%D1%82%D1%83)  -- A URL where users can report bugs. -- bug-reports:@@ -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.3.0.0, ukrainian-phonetics-basic-array ==0.7.0.0, phonetic-languages-ukrainian-array ==0.10.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.2.0.0, directory >=1.3.4.0 && <2, rev-scientific ==0.2.1.0+    build-depends:    base >=4.13 && <5, rhythmic-sequences ==0.3.0.0, ukrainian-phonetics-basic-array ==0.7.0.0, phonetic-languages-ukrainian-array ==0.10.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.2.0.0, directory >=1.3.4.0 && <2, rev-scientific ==0.2.1.0, async >=2.2.2 && <3     hs-source-dirs:   .     default-language: Haskell2010 @@ -37,10 +37,10 @@      -- Modules included in this executable, other than Main.     other-modules:    Phladiprelio.Ukrainian.IO-    -- ghc-options:      -threaded -rtsopts+    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.3.0.0, ukrainian-phonetics-basic-array ==0.7.0.0, phonetic-languages-ukrainian-array ==0.10.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.2.0.0, directory >=1.3.4.0 && <2, rev-scientific ==0.2.1.0+    build-depends:    base >=4.13 && <5, rhythmic-sequences ==0.3.0.0, ukrainian-phonetics-basic-array ==0.7.0.0, phonetic-languages-ukrainian-array ==0.10.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.2.0.0, directory >=1.3.4.0 && <2, rev-scientific ==0.2.1.0, async >= 2.2.2 && <3     hs-source-dirs:   .     default-language: Haskell2010