phladiprelio-general-simple 0.4.2.0 → 0.5.0.0
raw patch · 4 files changed
+94/−11 lines, 4 filesdep ~phonetic-languages-constraints-arrayPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: phonetic-languages-constraints-array
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- Phladiprelio/General/Simple.hs +81/−6
- README.md +5/−2
- phladiprelio-general-simple.cabal +3/−3
CHANGELOG.md view
@@ -66,3 +66,8 @@ parentheses still does not work properly. This is a known issue and should be fixed in the further releases. So this is an intermediate testing release. +## 0.5.0.0 -- 2023-06-02++* Fifth version. Fixed issues with incorrect parentheses behaviour for +b ... -b command line+ arguments group. Updated the corresponding dependency boundaries. Added much more variants of+tests (to improve mostly performance characteristics).
Phladiprelio/General/Simple.hs view
@@ -3,8 +3,8 @@ module Phladiprelio.General.Simple where import GHC.Base-import GHC.Enum (fromEnum)-import GHC.Real (fromIntegral,(/))+import GHC.Enum (fromEnum,toEnum)+import GHC.Real (fromIntegral,(/),quot,rem) import Text.Show (show) import Phladiprelio.General.PrepareText import Phladiprelio.General.Syllables @@ -27,6 +27,7 @@ import Phladiprelio.ConstraintsEncoded import Phladiprelio.PermutationsArr import Phladiprelio.StrictVG+import Numeric (showFFloat) generalF :: GWritingSystemPRPLX -- ^ Data used to obtain the phonetic language representation of the text.@@ -53,18 +54,92 @@ if numTest `elem` 0:[2..9] then do hSetNewlineMode stdout universalNewlineMode putStrLn "Feet Val Stat Proxim" - mapM (\(q,qs) -> let m = stat1 syllN (q,qs) in let max1 = maximumBy (comparing (f q qs)) universalSet in let mx = f q qs max1 in putStrLn (show (fromEnum q) `mappend` " | " `mappend` show mx `mappend` " " `mappend` show m `mappend` " -> " `mappend` show (100 * fromIntegral mx / fromIntegral m) `mappend` "%" `mappend` (if numTest >= 4 then let min1 = minimumBy (comparing (f q qs)) universalSet in ("\n" `mappend` min1 `mappend` "\n" `mappend` max1 `mappend` "\n") else ""))) . zip [2..7] $ (sel numTest)+ mapM (\(q,qs) -> let m = stat1 syllN (q,qs)+ (min1,max1) = minMax11ByCList (comparing (f q qs)) universalSet + mx = f q qs max1 in + putStrLn (show (fromEnum q) `mappend` " | " `mappend` show mx `mappend` " " `mappend` show m `mappend` " -> " `mappend` showFFloat (Just 3) (100 * fromIntegral mx / fromIntegral m) "%" `mappend` (if numTest >= 4 then let min1 = minimumBy (comparing (f q qs)) universalSet in ("\n" `mappend` min1 `mappend` "\n" `mappend` max1 `mappend` "\n") else ""))) . zip (sel2 numTest) $ (sel numTest) else (if emptyline then mapM (\tss -> mapM (\(x, y) -> putStrLn (show x `mappend` (' ':y))) tss >> putStrLn "") . groupBy (\(x1,_) (x2,_) -> x1 == x2) else mapM (\(x,y) -> putStrLn (show x `mappend` (' ':y)))) . (let h1 (u,w) = if descending then ((-1)*u,w) else (u,w) in sortOn h1) . map (\xss -> (f grps mxms xss, xss)) $ universalSet- where sel x - | x == 0 || x == 4 = [[1],[2,1],[3,2],[4,3,2],[5,4,3],[6,5,4,3,2]]+ where sel x + | x == 1 || x < 0 || x > 179 = []+ | x == 0 || x == 4 = [[1],[2,1],[3,2],[4,3,2],[5,4,3],[6,5,4,3,2]] -- all cases are present: 2, 3, 4, 5, 6, 7. Therefore, the slowest ones. | x == 2 || x == 5 = [[1],[2],[3],[4,3],[5,4],[6,5,4]] | x == 7 = [[0],[1,0],[1,0],[1,0],[1,0],[1,0]] | x == 8 = [[0],[1,0],[1,0],[2,1,0],[2,1,0],[2,1,0]] | x == 9 = [[0],[1,0],[1,0],[2,1,0],[3,2,1,0],[3,2,1,0]]- | otherwise = [[1],[2,1],[3,2,1],[3,2],[4,3,2]]+-----------------------------------------------------------------------------+ | x >= 20 && x <= 26 && x /= 21 = [[1]] -- at least 7 is omitted, but probably 6, or even 5, or even 4, or even 3. 2 is however present.+ | x >= 27 && x <= 29 = [[0]]+ | x == 30 || x == 34 = [[1],[2,1]]+ | x == 32 || x == 35 = [[1],[2]]+ | x >= 37 && x <= 39 = [[0],[1,0]]+ | x == 40 || x == 44 = [[1],[2,1],[3,2]]+ | x == 42 || x == 45 = [[1],[2],[3]]+ | x >= 47 && x <= 49 = [[0],[1,0],[1,0]]+ | x == 50 || x == 54 = [[1],[2,1],[3,2],[4,3,2]]+ | x == 52 || x == 55 = [[1],[2],[3],[4,3]]+ | x == 57 = [[0],[1,0],[1,0],[1,0]]+ | x == 58 || x == 59 = [[0],[1,0],[1,0],[2,1,0]]+ | x == 60 || x == 64 = [[1],[2,1],[3,2],[4,3,2],[5,4,3]]+ | x == 62 || x == 65 = [[1],[2],[3],[4,3],[5,4]]+ | x == 67 = [[0],[1,0],[1,0],[1,0],[1,0]]+ | x == 68 = [[0],[1,0],[1,0],[2,1,0],[2,1,0]]+ | x == 69 = [[0],[1,0],[1,0],[2,1,0],[3,2,1,0]]+-----------------------------------------------------------------+ | x == 70 || x == 74 = [[2,1],[3,2],[4,3,2],[5,4,3],[6,5,4,3,2]] -- at least 2 is omitted, but probably 3 and even 4. 5, 6 and 7 are present.+ | x == 72 || x == 75 = [[2],[3],[4,3],[5,4],[6,5,4]]+ | x == 77 = [[1,0],[1,0],[1,0],[1,0],[1,0]]+ | x == 78 = [[1,0],[1,0],[2,1,0],[2,1,0],[2,1,0]]+ | x == 79 = [[1,0],[1,0],[2,1,0],[3,2,1,0],[3,2,1,0]]+ | x == 80 || x == 84 = [[3,2],[4,3,2],[5,4,3],[6,5,4,3,2]]+ | x == 82 || x == 85 = [[3],[4,3],[5,4],[6,5,4]]+ | x == 87 = [[1,0],[1,0],[1,0],[1,0]]+ | x == 88 = [[1,0],[2,1,0],[2,1,0],[2,1,0]]+ | x == 89 = [[1,0],[2,1,0],[3,2,1,0],[3,2,1,0]]+ | x == 90 || x == 94 = [[4,3,2],[5,4,3],[6,5,4,3,2]]+ | x == 92 || x == 95 = [[4,3],[5,4],[6,5,4]]+ | x == 97 = [[1,0],[1,0],[1,0]]+ | x == 98 = [[2,1,0],[2,1,0],[2,1,0]]+ | x == 99 = [[2,1,0],[3,2,1,0],[3,2,1,0]]+-----------------------------------------------------------------------------------+ | x == 100 || x == 104 = [[1],[2,1],[4,3,2],[6,5,4,3,2]] -- 4 and 6 are omitted, just present the ones from: 2, 3, 5, 7.+ | x == 102 || x == 105 = [[1],[2],[4,3],[6,5,4]]+ | x == 107 = [[0],[1,0],[1,0],[1,0]]+ | x == 108 = [[0],[1,0],[2,1,0],[2,1,0]]+ | x == 109 = [[0],[1,0],[2,1,0],[3,2,1,0]]+-----------------------------------------------------------------------------+ | x == 150 || x == 154 = [[1],[2,1],[4,3,2]] -- 4, 6, 7 are omitted but 2, 3, 5 are present.+ | x == 152 || x == 155 = [[1],[2],[4,3]]+ | x == 157 = [[0],[1,0],[1,0]]+ | x == 158 || x == 159 = [[0],[1,0],[2,1,0]]+-----------------------------------------------------------------+ | x == 170 || x == 174 = [[2,1],[4,3,2],[6,5,4,3,2]] -- just 3, 5 and 7 are present+ | x == 172 || x == 175 = [[2],[4,3],[6,5,4]]+ | x == 177 = [[1,0],[1,0],[1,0]]+ | x == 178 = [[1,0],[2,1,0],[2,1,0]]+ | x == 179 = [[1,0],[2,1,0],[3,2,1,0]]+---------------------------------------------------------------------------------- + | otherwise = [[1],[1],[2,1],[3,2,1],[3,2],[4,3,2]]+--------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------+ sel2 y + | y == 1 || y < 0 || y > 179 = []+ | (rem y 10 `elem` [1,3,6]) || y >= 0 && y <= 9 = [2..7]+ | y >= 20 && y <= 69 = [2..toEnum (y `quot` 10)]+ | y >= 70 && y <= 99 = [toEnum (y `quot` 10) - 4..7]+ | y >= 100 && y <= 109 = [2,3,5,7]+ | y >= 150 && y <= 159 = [2,3,5]+ | y >= 170 && y <= 179 = [3,5,7]+ | otherwise = [2..7]+ minMax11ByCList :: Ord a => (a -> a -> Ordering) -> [a] -> (a, a) -- Is rewritten from the 'Data.MinMax.Preconditions.minMax11ByC' from @subG@ package.+ minMax11ByCList g xs@(x:y:ys) = foldr f (if x > y then (y, x) else (x, y)) ys+ where f z (x,y)+ | g z x == LT = (z,y)+ | g z y == GT = (x,z)+ | otherwise = (x,y)+ minMax11ByCList _ _ = undefined -- Is not intended to be used for lists with less than two elements. countSyll :: GWritingSystemPRPLX -- ^ Data used to obtain the phonetic language representation of the text.
README.md view
@@ -1,6 +1,6 @@ The library is the new implementation of the ideas related to PhLADiPreLiO (Phonetic Languages Approach to Discovering the Preferred Line Options) for different languages. It uses hashes and-has at the moment (as of the version 0.4.2.0) not the full functionality. The previous implementation +has at the moment (as of the version 0.5.0.0) not the full functionality. The previous implementation and its documentation are at the links: https://hackage.haskell.org/package/phonetic-languages-simplified-generalized-examples-array@@ -14,7 +14,7 @@ [New implementation](https://oleksandr-zhabenko.github.io/uk/rhythmicity/phladiprelioEng.5.2.pdf) -Examples of the new functionality in the version 0.5.0.0 of the related prototype project for +Examples of the new functionality in the version 0.5.1.1 of the related prototype project for Ukrainian is in the videos: https://www.facebook.com/Oleksandr.S.Zhabenko/posts/pfbid033gzq8MCRQsm65mPrzJL25MZNgvW7mezQSywULiVMnqmTBMtSW2jW4ABh6HVMWZNLl@@ -27,6 +27,9 @@ https://www.facebook.com/Oleksandr.S.Zhabenko/videos/796964592047546 https://www.facebook.com/Oleksandr.S.Zhabenko/posts/pfbid02EaC4Zwn4YVjfVFWpUhLoHYomiFHZQaiMdorLa6PPx9kXBXepTYPFEFMv8iyV4wAYl++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 Devotion ========
phladiprelio-general-simple.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: phladiprelio-general-simple-version: 0.4.2.0+version: 0.5.0.0 -- A short (one-line) description of the package. synopsis: A generalized functionality of PhLADiPreLiO for different languages that uses hash algorithms.@@ -26,8 +26,8 @@ exposed-modules: Phladiprelio.General.Simple -- LANGUAGE extensions used by modules in this package.- other-extensions: NoImplicitPrelude- build-depends: base >=4.13 && <5, rhythmic-sequences ==0.3.0.0, phonetic-languages-phonetics-basics ==0.10.0.2, phladiprelio-general-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.1.0, phonetic-languages-simplified-base ==0.7.0.0+ other-extensions: NoImplicitPrelude, BangPatterns+ build-depends: base >=4.13 && <5, rhythmic-sequences ==0.3.0.0, phonetic-languages-phonetics-basics ==0.10.0.2, phladiprelio-general-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.2.0, phonetic-languages-simplified-base ==0.7.0.0 hs-source-dirs: . default-language: Haskell2010