packages feed

phladiprelio-general-simple 0.1.2.0 → 0.2.0.0

raw patch · 4 files changed

+58/−12 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Phladiprelio.General.Simple: countSyll :: GWritingSystemPRPLX -> CharPhoneticClassification -> String -> String -> String -> Int
+ Phladiprelio.General.Simple: stat1 :: Int -> (Int8, [Int8]) -> Int
- Phladiprelio.General.Simple: generalF :: GWritingSystemPRPLX -> [(Char, Char)] -> CharPhoneticClassification -> SegmentRulesG -> String -> String -> ([[[PRS]]] -> [[Double]]) -> HashCorrections -> (Int8, [Int8]) -> [String] -> IO [()]
+ Phladiprelio.General.Simple: generalF :: GWritingSystemPRPLX -> [(Char, Char)] -> CharPhoneticClassification -> SegmentRulesG -> String -> String -> ([[[PRS]]] -> [[Double]]) -> Int -> HashCorrections -> (Int8, [Int8]) -> Bool -> [String] -> IO [()]
- Phladiprelio.General.Simple: processingF :: GWritingSystemPRPLX -> [(Char, Char)] -> CharPhoneticClassification -> SegmentRulesG -> String -> String -> ([[[PRS]]] -> [[Double]]) -> HashCorrections -> (Int8, [Int8]) -> [[String]] -> [[String]] -> String -> IO ()
+ Phladiprelio.General.Simple: processingF :: GWritingSystemPRPLX -> [(Char, Char)] -> CharPhoneticClassification -> SegmentRulesG -> String -> String -> ([[[PRS]]] -> [[Double]]) -> Int -> HashCorrections -> (Int8, [Int8]) -> [[String]] -> [[String]] -> Bool -> String -> IO ()

Files

CHANGELOG.md view
@@ -13,3 +13,9 @@  * First version revised B. Updated the dependencies and documentation. +## 0.2.0.0 -- 2023-03-19++* Second version. Added new functionality related to the reverse order of sorting and printing+the results in the default modes and the test for 'smoothness' of the line while reading,+speaking, singing etc.+
Phladiprelio/General/Simple.hs view
@@ -3,23 +3,26 @@ module Phladiprelio.General.Simple where  import GHC.Base+import GHC.Enum (fromEnum)+import GHC.Real (fromIntegral,(/)) import Text.Show (show) import Phladiprelio.General.PrepareText  import Phladiprelio.General.Syllables  import Phladiprelio.General.Base import System.Environment (getArgs)-import GHC.Num ((-))+import GHC.Num ((+),(-),(*)) import Text.Read (readMaybe) import System.IO (putStrLn, FilePath) import Rhythmicity.MarkerSeqs hiding (id)  import Rhythmicity.BasicF -import Data.List-import Data.Maybe (fromMaybe) +import Data.List hiding (foldr)+import Data.Maybe (fromMaybe, mapMaybe)  import Data.Tuple (fst,snd) import CLI.Arguments import CLI.Arguments.Get import CLI.Arguments.Parsing import GHC.Int (Int8)+import Data.Ord (comparing)  generalF   :: GWritingSystemPRPLX -- ^ Data used to obtain the phonetic language representation of the text.@@ -29,13 +32,42 @@  -> String -- ^ Corresponds to the 100 delimiter in the @ukrainian-phonetics-basic-array@ package.  -> String -- ^ Corresponds to the 101 delimiter in the @ukrainian-phonetics-basic-array@ package.  -> ([[[PRS]]] -> [[Double]])+ -> Int  -> HashCorrections - -> (Int8,[Int8]) + -> (Int8,[Int8])+ -> Bool   -> [String]   -> IO [()] -generalF wrs ks arr gs us vs h hc (grps,mxms) = mapM (\(x,y) -> putStrLn (show x `mappend` (' ':y)))  . sortOn id . map ((\xss -> (f xss, xss)) . unwords) . permutations-               where f = sum . countHashesG hc grps mxms . mconcat . h . createSyllablesPL wrs ks arr gs us vs+generalF wrs ks arr gs us vs h numTest hc (grps,mxms) descending rss = do+   let syllN = sum . map (countSyll wrs arr us vs) $ rss+       universalSet = map unwords . permutations $ rss+       f grps mxms = sum . countHashesG hc grps mxms . mconcat . h . createSyllablesPL wrs ks arr gs us vs+   if numTest == 0 then do+      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` "%")) $ [(2,[1]),(3,[2,1]),(4,[3,2]),(5,[4,3,2]),(6,[5,4,3]),(7,[6,5,4,3,2])]+   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 +countSyll +  :: GWritingSystemPRPLX -- ^ Data used to obtain the phonetic language representation of the text.+  -> CharPhoneticClassification +  ->  String -- ^ Corresponds to the 100 delimiter in the @ukrainian-phonetics-basic-array@ package.+  -> String -- ^ Corresponds to the 101 delimiter in the @ukrainian-phonetics-basic-array@ package.+  -> String +  -> Int+countSyll wrs arr us vs xs = fromEnum . foldr (\x y -> if createsSyllable x then y + 1 else y) 0 . concatMap (str2PRSs arr) . words1 . mapMaybe g . concatMap string1 . stringToXG wrs $ xs+   where g :: Char -> Maybe Char+         g x+          | x `elem` us = Nothing+          | x `notElem` vs = Just x+          | otherwise = Just ' '+         words1 xs = if null ts then [] else w : words1 s'' -- Practically this is an optimized version for this case 'words' function from Prelude.+           where ts = dropWhile (== ' ') xs+                 (w, s'') = break (== ' ') ts+         {-# NOINLINE words1 #-}++stat1 :: Int -> (Int8,[Int8]) -> Int+stat1 n (k, ks) = fst (n `quotRemInt` fromEnum k) * length ks+ processingF  :: 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. @@ -44,15 +76,17 @@  -> String -- ^ Corresponds to the 100 delimiter in the @ukrainian-phonetics-basic-array@ package.  -> String -- ^ Corresponds to the 101 delimiter in the @ukrainian-phonetics-basic-array@ package.  -> ([[[PRS]]] -> [[Double]])-  -> HashCorrections + -> Int+ -> HashCorrections   -> (Int8,[Int8])   -> [[String]]   -> [[String]] + -> Bool  -> String   -> IO ()-processingF wrs ks arr gs us vs h hc (grps,mxms) ysss zsss xs = do+processingF wrs ks arr gs us vs h numTest hc (grps,mxms) ysss zsss descending xs = do   args <- getArgs   let str1 = take 7 . words . mconcat . prepareText ysss zsss xs . unwords $ args-  generalF wrs ks arr gs us vs h hc (grps,mxms) str1 >> return ()+  generalF wrs ks arr gs us vs h numTest hc (grps,mxms) descending str1 >> return ()  
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.1.1.0) not the full functionality. The previous implementation +has at the moment (as of the version 0.2.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,6 +14,11 @@  [New implementation](https://oleksandr-zhabenko.github.io/uk/rhythmicity/phladiprelioEng.pdf) +Example of the new functionality in the version 0.3.0.0 of the related prototype project for +Ukrainian is in the video:++https://www.facebook.com/Oleksandr.S.Zhabenko/posts/pfbid0QT1BCWf9fmgQHasfUrSSqCenR9YT1C6CtL8PV4ieGrCTWGwatRh6TTUcxho8irkHl+ Video recordings as examples of the working prototype usage and how you can listen to  Ukrainian text using Google services are at the links below: @@ -27,7 +32,8 @@ P.S.: the author would like to devote this project to support the Foundation GASTROSTARS. 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.-And on the 17/03/2023 there is the author's Birthday.+And on the 17/03/2023 there is the author's Birthday. And at the 19/03/2023 is +St. Joseph the Betrothed Day. If you would like to share some financial support, please, contact the foundation using the URL: 
phladiprelio-general-simple.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               phladiprelio-general-simple-version:            0.1.2.0+version:            0.2.0.0  -- A short (one-line) description of the package. synopsis:           A generalized functionality of PhLADiPreLiO for different languages that uses hash algorithms.