packages feed

phonetic-languages-simplified-base 0.5.0.0 → 0.9.0.0

raw patch · 11 files changed

Files

CHANGELOG.md view
@@ -50,3 +50,29 @@  * Fifth version. Added functionality to find more straightforward (and probably thus more efficient) partitioning schemes. Added for this also a new module Phonetic.Languages.Simplified.DataG.Partir. Changed the dependencies schemes to make the development process for phonetic languages simpler.++## 0.6.0.0 -- 2022-08-09++* Sixth version. Added the functionality related to the Result2 data type in parallel to the old Result data type related one.++## 0.6.1.0 -- 2022-09-13++* Sixth version revised A. Updated the dependencies boundaries to use the new functionality.++## 0.7.0.0 -- 2023-02-01++* Seventh version. Switched to NoImplicitPrelude extension. Changed the names of the modules. Updated the dependencies boundaries.++## 0.7.1.0 -- 2023-06-24++* Seventh version revised A. Fixed constraints in the function declarations so that the code can+  successfully be compiled for GHC-9.6.2 compiler.++## 0.8.0.0 -- 2024-01-24++* Eighth version. Added bug-tracker on Github. Generalized functions with specializing. Updated the dependencies, switched to minmax and monoid-insertleft instead of subG.++ ## 0.9.0.0 -- 2024-03-08++* Ninth version. Added a new module Data.ChooseLine with common functionality for PhLADiPreLiO mostly taken and rewritten from previous implementations. +
+ Data/ChooseLine.hs view
@@ -0,0 +1,67 @@+{-# OPTIONS_HADDOCK show-extensions #-}++-- |+-- Module      :  Data.ChooseLine+-- Copyright   :  (c) Oleksandr Zhabenko 2021-2024+-- License     :  MIT+-- Stability   :  Experimental+-- Maintainer  :  oleksandr.zhabenko@yahoo.com+--+-- General shared by phladiprelio-ukrainian-simple and phladiprelio-general-simple functionality to compare contents of the up to 14 files line-by-line +-- and to choose the resulting option. ++{-# LANGUAGE NoImplicitPrelude, ScopedTypeVariables #-}++module Data.ChooseLine where++import GHC.Base+import Data.Foldable (mapM_) +import Data.Maybe (fromMaybe) +import Text.Show (Show(..))+import Text.Read (readMaybe)+import System.IO (putStrLn, FilePath,getLine,appendFile,putStr,readFile)+import Data.List+import Data.Tuple (fst,snd)+import Control.Exception (IOException,catch) ++-- | Is rewritten from the <https://hackage.haskell.org/package/phonetic-languages-simplified-examples-array-0.21.0.0/docs/src/Phonetic.Languages.Lines.html#compareFilesToOneCommon>+-- Given a list of different filepaths and the resulting filepath for the accumulated data provides a simple way to compare options of the lines in every file in the+-- first argument and to choose that option for the resulting file. Therefore, the resulting file can combine options for lines from various sources.+compareFilesToOneCommon + :: Int -- ^ A number of files to be read and treated as sources of lines to choose from.+ -> [FilePath] + -> FilePath + -> IO ()+compareFilesToOneCommon n files file3 = do+ contentss <- mapM ((\(j,ks) -> do {readFileIfAny ks >>= \fs -> return (j, zip [1..] . lines $ fs)})) . zip [1..] . take n $ files+ compareF contentss file3+   where compareF :: [(Int,[(Int,String)])] -> FilePath -> IO ()+         compareF ysss file3 = mapM_ (\i -> do+          putStr "Please, specify which variant to use as the result, "+          putStrLn "maximum number is the quantity of the files from which the data is read: "+          let strs = map (\(j,ks) -> (\ts -> if null ts then (j,"")+                      else let (_,rs) = head ts in  (j,rs)) .+                       filter ((== i) . fst) $ ks) ysss+          putStrLn . unlines . map (\(i,xs) -> show i ++ ":\t" ++ xs) $ strs+          ch <- getLine+          let choice2 = fromMaybe 0 (readMaybe ch::Maybe Int)+          toFileStr file3 ((\us -> if null us then [""] else [snd . head $ us]) . filter ((== choice2) . fst) $ strs)) $ [1..]++{-| Inspired by: 'https://hackage.haskell.org/package/base-4.15.0.0/docs/src/GHC-IO.html#catch' + Is taken from the +https://hackage.haskell.org/package/string-interpreter-0.8.0.0/docs/src/Interpreter.StringConversion.html#readFileIfAny+to reduce general quantity of dependencies.+Reads a textual file given by its 'FilePath' and returns its contents lazily. If there is+some 'IOException' thrown or an empty file then returns just "". Raises an exception for the binary file. -}+readFileIfAny :: FilePath -> IO String+readFileIfAny file = catch (readFile file) (\(_ :: IOException) -> return "")+{-# INLINE readFileIfAny #-}++-- | Prints list of 'String's to the file as a multiline 'String' with default line ending. Uses 'appendFile' function inside.+toFileStr ::+  FilePath -- ^ The 'FilePath' to the file to be written in the 'AppendMode' (actually appended with) the information output.+  -> [String] -- ^ Each element is appended on the new line to the file.+  -> IO ()+toFileStr file = appendFile file . unlines+{-# INLINE toFileStr #-}+
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2020-2022 OleksandrZhabenko+Copyright (c) 2020-2024 Oleksandr Zhabenko  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
+ Phladiprelio/DataG.hs view
@@ -0,0 +1,301 @@+{-# OPTIONS_HADDOCK show-extensions #-}++-- |+-- Module      :  Phladiprelio.DataG+-- Copyright   :  (c) Oleksandr Zhabenko 2020-2024+-- License     :  MIT+-- Stability   :  Experimental+-- Maintainer  :  oleksandr.zhabenko@yahoo.com+--+-- Simplified version of the @phonetic-languages-common@ and @phonetic-languages-general@ packages.+-- Uses less dependencies.++{-# LANGUAGE BangPatterns, FlexibleContexts, NoImplicitPrelude #-}++module Phladiprelio.DataG where++import GHC.Base+import GHC.Num ((-))+import GHC.Real+import qualified Data.Foldable as F+import Data.InsertLeft (InsertLeft(..),mapG,partitionG) +import Data.MinMax1+import Data.Maybe (fromJust) +import Phladiprelio.Basis++maximumEl+  :: (F.Foldable t2, Ord c) => FuncRep2 (t a) b c+  -> t2 (t a)+  -> Result t a b c+maximumEl !frep2 data0 =+  let !l = F.maximumBy (\x y -> compare (getAC frep2 x) (getAC frep2 y)) data0+      !m = getAB frep2 l+      !tm = getBC frep2 m in R {line = l, propertiesF = m, transPropertiesF = tm}+{-# INLINE maximumEl #-}+{-# SPECIALIZE maximumEl :: (Ord c) => FuncRep2 [a] Double c -> [[a]] -> Result [] a Double c #-}++-- | Is intended to be used for the structures with at least two elements, though it is not checked.+minMaximumEls+  :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord (t a), Ord c) => FuncRep2 (t a) b c+  -> t2 (t a)+  -> (Result t a b c,Result t a b c)+minMaximumEls !frep2 data0 =+  let (!ln,!lx) = fromJust . minMax11By (\x y -> compare (getAC frep2 x) (getAC frep2 y)) $ data0+      !mn = getAB frep2 ln+      !mx = getAB frep2 lx+      !tmn = getBC frep2 mn+      !tmx = getBC frep2 mx in (R {line = ln, propertiesF = mn, transPropertiesF = tmn}, R {line = lx, propertiesF = mx, transPropertiesF = tmx})+{-# INLINE minMaximumEls #-}+{-# SPECIALIZE minMaximumEls :: (Ord a, Ord c) => FuncRep2 [a] Double c -> [[a]] -> (Result [] a Double c, Result [] a Double c) #-}++maximumElR+  :: (F.Foldable t2, Ord c) => t2 (Result t a b c)+  -> Result t a b c+maximumElR = F.maximumBy (\x y -> compare (transPropertiesF x) (transPropertiesF y))+{-# INLINE maximumElR #-}+{-# SPECIALIZE maximumElR :: (Ord c) => [Result [] a Double c] -> Result [] a Double c #-}++-- | Is intended to be used for the structures with at least two elements, though it is not checked.+minMaximumElRs+  :: (InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), Ord (t a), Ord b, Ord c) => t2 (Result t a b c)+  -> (Result t a b c,Result t a b c)+minMaximumElRs = fromJust . minMax11By (\x y -> compare (transPropertiesF x) (transPropertiesF y))+{-# INLINE minMaximumElRs #-}+{-# SPECIALIZE minMaximumElRs :: (Ord a, Ord c) => [Result [] a Double c] -> (Result [] a Double c, Result [] a Double c) #-}++-----------------------------------------------------------------------------------++-- | The second argument must be not empty for the function to work correctly.+innerPartitioning+  :: (InsertLeft t2 (t a), Monoid (t2 (t a)), InsertLeft t2 c, Monoid (t2 c), Ord c) => FuncRep2 (t a) b c+  -> t2 (t a)+  -> (t2 (t a), t2 (t a))+innerPartitioning !frep2 data0 =+  let !l = F.maximum . mapG (toTransPropertiesF' frep2) $ data0 in partitionG ((== l) . getAC frep2) data0+{-# INLINE innerPartitioning #-}+{-# SPECIALIZE innerPartitioning :: (Eq a, Ord c) => FuncRep2 [a] Double c -> [[a]] -> ([[a]], [[a]]) #-}++-- | The first argument must be not empty for the function to work correctly.+innerPartitioningR+  :: (InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c) => t2 (Result t a b c)+  -> (t2 (Result t a b c), t2 (Result t a b c))+innerPartitioningR dataR =+  let !l = F.maximum . mapG transPropertiesF $ dataR in partitionG ((== l) . transPropertiesF) dataR+{-# INLINE innerPartitioningR #-}+{-# SPECIALIZE innerPartitioningR :: (Eq a, Ord c) => [Result [] a Double c] -> ([Result [] a Double c], [Result [] a Double c]) #-}++maximumGroupsClassification+  :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d+  -> FuncRep2 (t a) b c+  -> (t2 (t a), t2 (t a))+  -> (t2 (t a), t2 (t a))+maximumGroupsClassification !nGroups !frep2 (dataT,dataF)+ | F.null dataF = (dataT,mempty)+ | nGroups <= 0 = (dataT,dataF)+ | otherwise = maximumGroupsClassification (nGroups - 1) frep2 (dataT `mappend` partT,partF)+     where (!partT,!partF) = innerPartitioning frep2 dataF+{-# NOINLINE maximumGroupsClassification #-}++maximumGroupsClassification1+  :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d+  -> FuncRep2 (t a) b c+  -> t2 (t a)+  -> (t2 (t a), t2 (t a))+maximumGroupsClassification1 !nGroups !frep2 data0+ | F.null data0 = (mempty,mempty)+ | nGroups <= 0 = innerPartitioning frep2 data0+ | otherwise = maximumGroupsClassification (nGroups - 1) frep2 . innerPartitioning frep2 $ data0+{-# NOINLINE maximumGroupsClassification1 #-}++maximumGroupsClassificationR2+  :: (Eq a, Eq b, Eq (t a), InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d+  -> (t2 (Result t a b c), t2 (Result t a b c))+  -> (t2 (Result t a b c), t2 (Result t a b c))+maximumGroupsClassificationR2 !nGroups (dataT,dataF)+ | F.null dataF = (dataT,mempty)+ | nGroups <= 0 = (dataT,dataF)+ | otherwise = maximumGroupsClassificationR2 (nGroups - 1) (dataT `mappend` partT,partF)+     where (!partT,!partF) = innerPartitioningR dataF+{-# NOINLINE maximumGroupsClassificationR2 #-}++maximumGroupsClassificationR+  :: (Eq a, Eq b, Eq (t a), InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c, Integral d) => d+  -> t2 (Result t a b c)+  -> (t2 (Result t a b c), t2 (Result t a b c))+maximumGroupsClassificationR !nGroups dataR+ | F.null dataR = (mempty,mempty)+ | nGroups <= 0 = innerPartitioningR dataR+ | otherwise = maximumGroupsClassificationR2 (nGroups - 1) . innerPartitioningR $ dataR+{-# NOINLINE maximumGroupsClassificationR #-}++toResultR+  :: FuncRep2 (t a) b c+  -> t a+  -> Result t a b c+toResultR !frep2 !ys = R { line = ys, propertiesF = m, transPropertiesF = tm}+  where !m = getAB frep2 ys+        !tm = getBC frep2 m+{-# INLINE toResultR #-}++toPropertiesF'+  :: FuncRep2 (t a) b c+  -> t a+  -> b+toPropertiesF' !frep2 !ys = getAB frep2 ys+{-# INLINE toPropertiesF' #-}++toTransPropertiesF'+  :: FuncRep2 (t a) b c+  -> t a+  -> c+toTransPropertiesF' !frep2 !ys = getAC frep2 ys+{-# INLINE toTransPropertiesF' #-}++-- | The second argument must be not empty for the function to work correctly.+partiR+  :: (InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), InsertLeft t2 c) => (c -> Bool)+  -> t2 (Result t a b c)+  -> (t2 (Result t a b c), t2 (Result t a b c))+partiR p dataR = partitionG (p . transPropertiesF) dataR+{-# INLINE partiR #-}+{-# SPECIALIZE partiR :: (Eq a, Eq c) => (c -> Bool) -> [Result [] a Double c] -> ([Result [] a Double c], [Result [] a Double c])  #-}++-----------------------------------------------------------++maximumEl2+  :: (F.Foldable t2, Ord c) => FuncRep2 a b c+  -> t2 a+  -> Result2 a b c+maximumEl2 !frep2 data0 =+  let !l = F.maximumBy (\x y -> compare (getAC frep2 x) (getAC frep2 y)) data0+      !m = getAB frep2 l+      !tm = getBC frep2 m in R2 {line2 = l, propertiesF2 = m, transPropertiesF2 = tm}+{-# INLINE maximumEl2 #-}+{-# SPECIALIZE maximumEl2 :: (Ord c) => FuncRep2 a Double c -> [a] -> Result2 a Double c  #-}++-- | Is intended to be used with the structures with at least two elements, though it is not checked.+minMaximumEls2+  :: (InsertLeft t2 a, Monoid (t2 a), Ord a, Ord c) => FuncRep2 a b c+  -> t2 a+  -> (Result2 a b c,Result2 a b c)+minMaximumEls2 !frep2 data0 =+  let (!ln,!lx) = fromJust . minMax11By (\x y -> compare (getAC frep2 x) (getAC frep2 y)) $ data0+      !mn = getAB frep2 ln+      !mx = getAB frep2 lx+      !tmn = getBC frep2 mn+      !tmx = getBC frep2 mx in (R2 {line2 = ln, propertiesF2 = mn, transPropertiesF2 = tmn}, R2 {line2 = lx, propertiesF2 = mx, transPropertiesF2 = tmx})+{-# INLINE minMaximumEls2 #-}+{-# SPECIALIZE minMaximumEls2 :: (Ord a, Ord c) => FuncRep2 a Double c -> [a] -> (Result2 a Double c, Result2 a Double c) #-}++maximumElR2+  :: (F.Foldable t2, Ord c) => t2 (Result2 a b c)+  -> Result2 a b c+maximumElR2 = F.maximumBy (\x y -> compare (transPropertiesF2 x) (transPropertiesF2 y))+{-# INLINE maximumElR2 #-}+{-# SPECIALIZE maximumElR2 :: (Ord c) => [Result2 a Double c] -> Result2 a Double c #-}++-- | Is intended to be used with the structures with at least two elements, though it is not checked.+minMaximumElRs2+  :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), Ord a, Ord b, Ord c) => t2 (Result2 a b c)+  -> (Result2 a b c,Result2 a b c)+minMaximumElRs2 = fromJust . minMax11By (\x y -> compare (transPropertiesF2 x) (transPropertiesF2 y))+{-# INLINE minMaximumElRs2 #-}+{-# SPECIALIZE minMaximumElRs2 :: (Ord a, Ord c) => [Result2 a Double c] -> (Result2 a Double c, Result2 a Double c) #-}++-----------------------------------------------------------------------------------++-- | The second argument must be not empty for the function to work correctly.+innerPartitioning2+  :: (InsertLeft t2 a, Monoid (t2 a), InsertLeft t2 c, Monoid (t2 c), Ord c) => FuncRep2 a b c+  -> t2 a+  -> (t2 a, t2 a)+innerPartitioning2 !frep2 data0 =+  let !l = F.maximum . mapG (toTransPropertiesF'2 frep2) $ data0 in partitionG ((== l) . getAC frep2) data0+{-# INLINE innerPartitioning2 #-}+{-# SPECIALIZE innerPartitioning2 :: (Eq a, Ord c) => FuncRep2 a Double c -> [a] -> ([a], [a])  #-}++-- | The first argument must be not empty for the function to work correctly.+innerPartitioningR2+  :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c) => t2 (Result2 a b c)+  -> (t2 (Result2 a b c), t2 (Result2 a b c))+innerPartitioningR2 dataR =+  let !l = F.maximum . mapG transPropertiesF2 $ dataR in partitionG ((== l) . transPropertiesF2) dataR+{-# INLINE innerPartitioningR2 #-}+{-# SPECIALIZE innerPartitioningR2 :: (Eq a, Ord c) => [Result2 a Double c] -> ([Result2 a Double c], [Result2 a Double c]) #-}++maximumGroupsClassification2+  :: (InsertLeft t2 a, Monoid (t2 a), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d+  -> FuncRep2 a b c+  -> (t2 a, t2 a)+  -> (t2 a, t2 a)+maximumGroupsClassification2 !nGroups !frep2 (dataT,dataF)+ | F.null dataF = (dataT,mempty)+ | nGroups <= 0 = (dataT,dataF)+ | otherwise = maximumGroupsClassification2 (nGroups - 1) frep2 (dataT `mappend` partT,partF)+     where (!partT,!partF) = innerPartitioning2 frep2 dataF+{-# NOINLINE maximumGroupsClassification2 #-}++maximumGroupsClassification12+  :: (InsertLeft t2 a, Monoid (t2 a), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d+  -> FuncRep2 a b c+  -> t2 a+  -> (t2 a, t2 a)+maximumGroupsClassification12 !nGroups !frep2 data0+ | F.null data0 = (mempty,mempty)+ | nGroups <= 0 = innerPartitioning2 frep2 data0+ | otherwise = maximumGroupsClassification2 (nGroups - 1) frep2 . innerPartitioning2 frep2 $ data0+{-# NOINLINE maximumGroupsClassification12 #-}++maximumGroupsClassificationR2_2+  :: (Eq a, Eq b, InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d+  -> (t2 (Result2 a b c), t2 (Result2 a b c))+  -> (t2 (Result2 a b c), t2 (Result2 a b c))+maximumGroupsClassificationR2_2 !nGroups (dataT,dataF)+ | F.null dataF = (dataT,mempty)+ | nGroups <= 0 = (dataT,dataF)+ | otherwise = maximumGroupsClassificationR2_2 (nGroups - 1) (dataT `mappend` partT,partF)+     where (!partT,!partF) = innerPartitioningR2 dataF+{-# NOINLINE maximumGroupsClassificationR2_2 #-}++maximumGroupsClassificationR_2+  :: (Eq a, Eq b, InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c, Integral d) => d+  -> t2 (Result2 a b c)+  -> (t2 (Result2 a b c), t2 (Result2 a b c))+maximumGroupsClassificationR_2 !nGroups dataR+ | F.null dataR = (mempty,mempty)+ | nGroups <= 0 = innerPartitioningR2 dataR+ | otherwise = maximumGroupsClassificationR2_2 (nGroups - 1) . innerPartitioningR2 $ dataR+{-# NOINLINE maximumGroupsClassificationR_2 #-}++toResultR2+  :: FuncRep2 a b c+  -> a+  -> Result2 a b c+toResultR2 !frep2 !y = R2 { line2 = y, propertiesF2 = m, transPropertiesF2 = tm}+  where !m = getAB frep2 y+        !tm = getBC frep2 m+{-# INLINE toResultR2 #-}++toPropertiesF'2+  :: FuncRep2 a b c+  -> a+  -> b+toPropertiesF'2 !frep2 !y = getAB frep2 y+{-# INLINE toPropertiesF'2 #-}++toTransPropertiesF'2+  :: FuncRep2 a b c+  -> a+  -> c+toTransPropertiesF'2 !frep2 !y = getAC frep2 y+{-# INLINE toTransPropertiesF'2 #-}++-- | The second argument must be not empty for the function to work correctly.+partiR2+  :: (InsertLeft t2 (Result2 a b c), Monoid (t2 (Result2 a b c)), InsertLeft t2 c) => (c -> Bool)+  -> t2 (Result2 a b c)+  -> (t2 (Result2 a b c), t2 (Result2 a b c))+partiR2 p dataR = partitionG (p . transPropertiesF2) dataR+{-# INLINE partiR2 #-}+{-# SPECIALIZE partiR2 :: (Eq a, Eq c) => (c -> Bool) -> [Result2 a Double c] -> ([Result2 a Double c], [Result2 a Double c]) #-}+
+ Phladiprelio/Partir.hs view
@@ -0,0 +1,83 @@+{-# OPTIONS_HADDOCK show-extensions #-}++-- |+-- Module      :  Phladiprelio.Partir+-- Copyright   :  (c) Oleksandr Zhabenko 2022-2024+-- License     :  MIT+-- Stability   :  Experimental+-- Maintainer  :  oleksandr.zhabenko@yahoo.com+--+-- ++{-# LANGUAGE BangPatterns, FlexibleContexts, MultiParamTypeClasses, NoImplicitPrelude #-}++module Phladiprelio.Partir where++import GHC.Base+import GHC.Num+import GHC.Real+import GHC.Float+import qualified Data.Foldable as F+import Data.InsertLeft (InsertLeft(..)) +import Phladiprelio.DataG+import Phladiprelio.Basis+import Data.Char (isDigit)+import Data.List (uncons, filter, null)+import Data.Maybe (fromJust, fromMaybe)+import Text.Read (readMaybe)++class F.Foldable t => ConstraintsG t a where+  decodeCDouble :: t a -> Double -> Bool++instance ConstraintsG [] Char where+  decodeCDouble xs !y+    | null xxs = True+    | t < '2' = (if t == '0' then (>) else (<)) y (fromIntegral . fromMaybe 1 $ (readMaybe ts :: Maybe Integer))+    | otherwise = getScale c cs t y+       where xxs = filter isDigit xs+             (t,ts) = fromJust . uncons $ xxs+             (c,cs) = fromMaybe ('0',"1") . uncons $ ts+             getScale c0 ws t0 y0  +               | c0 == '1' = (ords t0) (logBase 10 y0) base+               | c0 == '2' = (ords t0) (637.0 * atan y0) base -- atan Infinity * 637.0 \approx 1000.0+               | c0 == '3' = (ords t0) (sin (k * y0)) (0.01 * base1)+               | c0 == '4' = (ords t0) (cos (k * y0)) (0.01 * base1)+               | c0 == '5' = (ords t0) (sin (k * y0)) (0.001 * base2)+               | c0 == '6' = (ords t0) (cos (k * y0)) (0.001 * base2)+               | c0 == '7' = (ords t0) (sin (k * y0)) (-0.01 * base1)+               | c0 == '8' = (ords t0) (cos (k * y0)) (-0.01 * base1)+               | otherwise = (ords t0) (y0 ** k) base1+                  where base = fromIntegral . fromMaybe 1 $ (readMaybe ws :: Maybe Integer)+                        ords t0+                          | t0 == '2' = (>)+                          | otherwise = (<)+                        (w,wws) = fromMaybe ('2',"") . uncons $ ws+                        base1 = fromIntegral . fromMaybe 50 $ (readMaybe wws :: Maybe Integer)+                        base2 = fromIntegral . fromMaybe 500 $ (readMaybe wws :: Maybe Integer)+                        k = fromIntegral . fromMaybe 2 $ (readMaybe [w] :: Maybe Integer)+             +partitioningR+  :: (InsertLeft t2 (Result [] Char b Double), Monoid (t2 (Result [] Char b Double)), InsertLeft t2 Double, Monoid (t2 Double)) => String+  -> t2 (Result [] Char b Double)+  -> (t2 (Result [] Char b Double), t2 (Result [] Char b Double))+partitioningR !xs dataR+ | F.null dataR = (mempty,mempty)+ | otherwise = partiR (decodeCDouble xs) dataR+{-# INLINE partitioningR #-}+{-# SPECIALIZE  partitioningR +  :: String+  -> [Result [] Char Double Double]+  -> ([Result [] Char Double Double], [Result [] Char Double Double])#-}++partitioningR2+  :: (InsertLeft t2 (Result2 a b Double), Monoid (t2 (Result2 a b Double)), InsertLeft t2 Double, Monoid (t2 Double)) => String+  -> t2 (Result2 a b Double)+  -> (t2 (Result2 a b Double), t2 (Result2 a b Double))+partitioningR2 !xs dataR+ | F.null dataR = (mempty,mempty)+ | otherwise = partiR2 (decodeCDouble xs) dataR+{-# INLINE partitioningR2 #-}+{-# SPECIALIZE partitioningR2 :: (Eq a) => String+  -> [Result2 a Double Double]+  -> ([Result2 a Double Double], [Result2 a Double Double]) #-}+
+ Phladiprelio/StrictVG.hs view
@@ -0,0 +1,59 @@+{-# OPTIONS_HADDOCK show-extensions #-}++-- |+-- Module      :  Phladiprelio.StrictVG+-- Copyright   :  (c) Oleksandr Zhabenko 2020-2024+-- License     :  MIT+-- Stability   :  Experimental+-- Maintainer  :  oleksandr.zhabenko@yahoo.com+--+-- Simplified version of the @phonetic-languages-common@ package.+-- Uses less dependencies.++{-# LANGUAGE BangPatterns, NoImplicitPrelude #-}++module Phladiprelio.StrictVG (+  -- * Working with lists+  uniquenessVariants2GNBL+  , uniquenessVariants2GNPBL+) where++import GHC.Base+import GHC.Num ((-))+import Phladiprelio.PermutationsArr+import qualified Data.Foldable as F+import Data.InsertLeft (InsertLeft(..)) +import GHC.Arr++uniquenessVariants2GNBL ::+  (Eq a, F.Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => a -- ^ The first most common element in the \"whitespace symbols\" structure+  -> (t a -> [a]) -- ^ The function that is used internally to convert to the @[a]@ so that the function can process further the permutations+  -> ((t (t a)) -> [[a]]) -- ^ The function that is used internally to convert to the @[[a]]@ so that the function can process further+  -> ([a] -> t a) -- ^ The function that is used internally to convert to the needed representation so that the function can process further+  -> [Array Int Int] -- ^ The permutations of 'Int' indices starting from 0 and up to n (n is probably less than 8).+  -> t (t a) -- ^ Must be obtained as 'subG' @whspss xs@ or in equivalent way+  -> [t a]+uniquenessVariants2GNBL !hd f1 f2 f3 perms !subs = uniquenessVariants2GNPBL mempty mempty hd f1 f2 f3 perms subs+{-# INLINE uniquenessVariants2GNBL #-}+{-# SPECIALIZE uniquenessVariants2GNBL :: Char -> (String -> String) -> ([String] -> [String]) -> (String -> String) -> [Array Int Int] ->  [String] -> [String] #-}++uniquenessVariants2GNPBL ::+  (Eq a, F.Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => t a+  -> t a+  ->  a -- ^ The first most common element in the whitespace symbols structure+  -> (t a -> [a]) -- ^ The function that is used internally to convert to the @[a]@ so that the function can process further the permutations+  -> ((t (t a)) -> [[a]]) -- ^ The function that is used internally to convert to the @[[a]]@ so that the function can process further+  -> ([a] -> t a) -- ^ The function that is used internally to convert to the needed representation that the function can process further+  -> [Array Int Int] -- ^ The permutations of 'Int' indices starting from 0 and up to n (n is probably less than 8).+  -> t (t a) -- ^ Must be obtained as @subG whspss xs@ or in equivalent way+  -> [t a]+uniquenessVariants2GNPBL !ts !us !hd f1 f2 f3 perms !subs+  | F.null subs = mempty+  | otherwise = map f3 ns+   where !uss = (hd %@ us) %^ mempty+         !base0 = map (hd %@) . f2 $ subs+         !l = F.length base0+         !baseArr = listArray (0,l - 1) base0+         !ns = universalSetGL ts uss f1 f2 perms baseArr -- in map f3 ns+{-# INLINE uniquenessVariants2GNPBL #-}+{-# SPECIALIZE uniquenessVariants2GNPBL :: String -> String -> Char -> (String -> String) -> ([String] -> [String]) -> (String -> String) -> [Array Int Int] ->  [String] -> [String] #-}
− Phonetic/Languages/Simplified/DataG/Base.hs
@@ -1,151 +0,0 @@-{-# OPTIONS_HADDOCK show-extensions #-}---- |--- Module      :  Phonetic.Languages.Simplified.DataG.Base--- Copyright   :  (c) OleksandrZhabenko 2020-2022--- License     :  MIT--- Stability   :  Experimental--- Maintainer  :  olexandr543@yahoo.com------ Simplified version of the @phonetic-languages-common@ and @phonetic-languages-general@ packages.--- Uses less dependencies.--{-# LANGUAGE BangPatterns, FlexibleContexts #-}--module Phonetic.Languages.Simplified.DataG.Base where--import qualified Data.Foldable as F-import Data.Monoid-import Data.SubG-import Data.MinMax.Preconditions-import Phonetic.Languages.Basis--maximumEl-  :: (Foldable t2, Ord c) => FuncRep2 (t a) b c-  -> t2 (t a)-  -> Result t a b c-maximumEl !frep2 data0 =-  let !l = F.maximumBy (\x y -> compare (getAC frep2 x) (getAC frep2 y)) data0-      !m = getAB frep2 l-      !tm = getBC frep2 m in R {line = l, propertiesF = m, transPropertiesF = tm}-{-# INLINE maximumEl #-}--minMaximumEls-  :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord (t a), Ord c) => FuncRep2 (t a) b c-  -> t2 (t a)-  -> (Result t a b c,Result t a b c)-minMaximumEls !frep2 data0 =-  let (!ln,!lx) = minMax11ByC (\x y -> compare (getAC frep2 x) (getAC frep2 y)) data0-      !mn = getAB frep2 ln-      !mx = getAB frep2 lx-      !tmn = getBC frep2 mn-      !tmx = getBC frep2 mx in (R {line = ln, propertiesF = mn, transPropertiesF = tmn}, R {line = lx, propertiesF = mx, transPropertiesF = tmx})-{-# INLINE minMaximumEls #-}--maximumElR-  :: (Foldable t2, Ord c) => t2 (Result t a b c)-  -> Result t a b c-maximumElR = F.maximumBy (\x y -> compare (transPropertiesF x) (transPropertiesF y))-{-# INLINE maximumElR #-}--minMaximumElRs-  :: (InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), Ord (t a), Ord b, Ord c) => t2 (Result t a b c)-  -> (Result t a b c,Result t a b c)-minMaximumElRs = minMax11ByC (\x y -> compare (transPropertiesF x) (transPropertiesF y))-{-# INLINE minMaximumElRs #-}----------------------------------------------------------------------------------------- | The second argument must be not empty for the function to work correctly.-innerPartitioning-  :: (InsertLeft t2 (t a), Monoid (t2 (t a)), InsertLeft t2 c, Monoid (t2 c), Ord c) => FuncRep2 (t a) b c-  -> t2 (t a)-  -> (t2 (t a), t2 (t a))-innerPartitioning !frep2 data0 =-  let !l = F.maximum . mapG (toTransPropertiesF' frep2) $ data0 in partitionG ((== l) . getAC frep2) data0-{-# INLINE innerPartitioning #-}---- | The first argument must be not empty for the function to work correctly.-innerPartitioningR-  :: (InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c) => t2 (Result t a b c)-  -> (t2 (Result t a b c), t2 (Result t a b c))-innerPartitioningR dataR =-  let !l = F.maximum . mapG transPropertiesF $ dataR in partitionG ((== l) . transPropertiesF) dataR-{-# INLINE innerPartitioningR #-}--maximumGroupsClassification-  :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d-  -> FuncRep2 (t a) b c-  -> (t2 (t a), t2 (t a))-  -> (t2 (t a), t2 (t a))-maximumGroupsClassification !nGroups !frep2 (dataT,dataF)- | F.null dataF = (dataT,mempty)- | nGroups <= 0 = (dataT,dataF)- | otherwise = maximumGroupsClassification (nGroups - 1) frep2 (dataT `mappend` partT,partF)-     where (!partT,!partF) = innerPartitioning frep2 dataF-{-# NOINLINE maximumGroupsClassification #-}--maximumGroupsClassification1-  :: (InsertLeft t2 (t a), Monoid (t2 (t a)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d-  -> FuncRep2 (t a) b c-  -> t2 (t a)-  -> (t2 (t a), t2 (t a))-maximumGroupsClassification1 !nGroups !frep2 data0- | F.null data0 = (mempty,mempty)- | nGroups <= 0 = innerPartitioning frep2 data0- | otherwise = maximumGroupsClassification (nGroups - 1) frep2 . innerPartitioning frep2 $ data0-{-# NOINLINE maximumGroupsClassification1 #-}--maximumGroupsClassificationR2-  :: (InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), Ord c, InsertLeft t2 c, Monoid (t2 c), Integral d) => d-  -> (t2 (Result t a b c), t2 (Result t a b c))-  -> (t2 (Result t a b c), t2 (Result t a b c))-maximumGroupsClassificationR2 !nGroups (dataT,dataF)- | F.null dataF = (dataT,mempty)- | nGroups <= 0 = (dataT,dataF)- | otherwise = maximumGroupsClassificationR2 (nGroups - 1) (dataT `mappend` partT,partF)-     where (!partT,!partF) = innerPartitioningR dataF-{-# NOINLINE maximumGroupsClassificationR2 #-}--maximumGroupsClassificationR-  :: (InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), InsertLeft t2 c, Monoid (t2 c), Ord c, Integral d) => d-  -> t2 (Result t a b c)-  -> (t2 (Result t a b c), t2 (Result t a b c))-maximumGroupsClassificationR !nGroups dataR- | F.null dataR = (mempty,mempty)- | nGroups <= 0 = innerPartitioningR dataR- | otherwise = maximumGroupsClassificationR2 (nGroups - 1) . innerPartitioningR $ dataR-{-# NOINLINE maximumGroupsClassificationR #-}--toResultR-  :: FuncRep2 (t a) b c-  -> t a-  -> Result t a b c-toResultR !frep2 !ys = R { line = ys, propertiesF = m, transPropertiesF = tm}-  where !m = getAB frep2 ys-        !tm = getBC frep2 m-{-# INLINE toResultR #-}--toPropertiesF'-  :: FuncRep2 (t a) b c-  -> t a-  -> b-toPropertiesF' !frep2 !ys = getAB frep2 ys-{-# INLINE toPropertiesF' #-}--toTransPropertiesF'-  :: FuncRep2 (t a) b c-  -> t a-  -> c-toTransPropertiesF' !frep2 !ys = getAC frep2 ys-{-# INLINE toTransPropertiesF' #-}---- | The second argument must be not empty for the function to work correctly.-partiR-  :: (InsertLeft t2 (Result t a b c), Monoid (t2 (Result t a b c)), InsertLeft t2 c) => (c -> Bool)-  -> t2 (Result t a b c)-  -> (t2 (Result t a b c), t2 (Result t a b c))-partiR p dataR = partitionG (p . transPropertiesF) dataR-{-# INLINE partiR #-}--
− Phonetic/Languages/Simplified/DataG/Partir.hs
@@ -1,64 +0,0 @@-{-# OPTIONS_HADDOCK show-extensions #-}---- |--- Module      :  Phonetic.Languages.Simplified.DataG.Partir--- Copyright   :  (c) OleksandrZhabenko 2022--- License     :  MIT--- Stability   :  Experimental--- Maintainer  :  olexandr543@yahoo.com------ --{-# LANGUAGE BangPatterns, FlexibleContexts, MultiParamTypeClasses #-}--module Phonetic.Languages.Simplified.DataG.Partir where--import qualified Data.Foldable as F-import Data.Monoid-import Data.SubG-import Data.MinMax.Preconditions-import Phonetic.Languages.Simplified.DataG.Base-import Phonetic.Languages.Basis-import Data.Char (isDigit)-import Data.List (uncons)-import Data.Maybe (fromJust, fromMaybe)-import Text.Read (readMaybe)--class Foldable t => ConstraintsG t a where-  decodeCDouble :: t a -> Double -> Bool--instance ConstraintsG [] Char where-  decodeCDouble xs !y-    | null xxs = True-    | t < '2' = (if t == '0' then (>) else (<)) y (fromIntegral . fromMaybe 1 $ (readMaybe ts :: Maybe Integer))-    | otherwise = getScale c cs t y-       where xxs = filter isDigit xs-             (t,ts) = fromJust . uncons $ xxs-             (c,cs) = fromMaybe ('0',"1") . uncons $ ts-             getScale c0 ws t0 y0  -               | c0 == '1' = (ords t0) (logBase 10 y0) base-               | c0 == '2' = (ords t0) (637.0 * atan y0) base -- atan Infinity * 637.0 \approx 1000.0-               | c0 == '3' = (ords t0) (sin (k * y0)) (0.01 * base1)-               | c0 == '4' = (ords t0) (cos (k * y0)) (0.01 * base1)-               | c0 == '5' = (ords t0) (sin (k * y0)) (0.001 * base2)-               | c0 == '6' = (ords t0) (cos (k * y0)) (0.001 * base2)-               | c0 == '7' = (ords t0) (sin (k * y0)) (-0.01 * base1)-               | c0 == '8' = (ords t0) (cos (k * y0)) (-0.01 * base1)-               | otherwise = (ords t0) (y0 ** k) base1-                  where base = fromIntegral . fromMaybe 1 $ (readMaybe ws :: Maybe Integer)-                        ords t0-                          | t0 == '2' = (>)-                          | otherwise = (<)-                        (w,wws) = fromMaybe ('2',"") . uncons $ ws-                        base1 = fromIntegral . fromMaybe 50 $ (readMaybe wws :: Maybe Integer)-                        base2 = fromIntegral . fromMaybe 500 $ (readMaybe wws :: Maybe Integer)-                        k = fromIntegral . fromMaybe 2 $ (readMaybe [w] :: Maybe Integer)-             -partitioningR-  :: (InsertLeft t2 (Result [] Char b Double), Monoid (t2 (Result [] Char b Double)), InsertLeft t2 Double, Monoid (t2 Double)) => String-  -> t2 (Result [] Char b Double)-  -> (t2 (Result [] Char b Double), t2 (Result [] Char b Double))-partitioningR !xs dataR- | F.null dataR = (mempty,mempty)- | otherwise = partiR (decodeCDouble xs) dataR-{-# INLINABLE partitioningR #-}
− Phonetic/Languages/Simplified/StrictVG/Base.hs
@@ -1,56 +0,0 @@-{-# OPTIONS_HADDOCK show-extensions #-}---- |--- Module      :  Phonetic.Languages.Simplified.StrictVG.Base--- Copyright   :  (c) OleksandrZhabenko 2020-2021--- License     :  MIT--- Stability   :  Experimental--- Maintainer  :  olexandr543@yahoo.com------ Simplified version of the @phonetic-languages-common@ package.--- Uses less dependencies.--{-# LANGUAGE BangPatterns #-}--module Phonetic.Languages.Simplified.StrictVG.Base (-  -- * Working with lists-  uniquenessVariants2GNBL-  , uniquenessVariants2GNPBL-) where--import Phonetic.Languages.Permutations.Arr-import qualified Data.Foldable as F-import Data.SubG-import GHC.Arr-import Data.Monoid--uniquenessVariants2GNBL ::-  (Eq a, Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => a -- ^ The first most common element in the \"whitespace symbols\" structure-  -> (t a -> [a]) -- ^ The function that is used internally to convert to the @[a]@ so that the function can process further the permutations-  -> ((t (t a)) -> [[a]]) -- ^ The function that is used internally to convert to the @[[a]]@ so that the function can process further-  -> ([a] -> t a) -- ^ The function that is used internally to convert to the needed representation so that the function can process further-  -> [Array Int Int] -- ^ The permutations of 'Int' indices starting from 0 and up to n (n is probably less than 8).-  -> t (t a) -- ^ Must be obtained as 'subG' @whspss xs@-  -> [t a]-uniquenessVariants2GNBL !hd f1 f2 f3 perms !subs = uniquenessVariants2GNPBL mempty mempty hd f1 f2 f3 perms subs-{-# INLINE uniquenessVariants2GNBL #-}--uniquenessVariants2GNPBL ::-  (Eq a, Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => t a-  -> t a-  ->  a -- ^ The first most common element in the whitespace symbols structure-  -> (t a -> [a]) -- ^ The function that is used internally to convert to the @[a]@ so that the function can process further the permutations-  -> ((t (t a)) -> [[a]]) -- ^ The function that is used internally to convert to the @[[a]]@ so that the function can process further-  -> ([a] -> t a) -- ^ The function that is used internally to convert to the needed representation that the function can process further-  -> [Array Int Int] -- ^ The permutations of 'Int' indices starting from 0 and up to n (n is probably less than 8).-  -> t (t a) -- ^ Must be obtained as @subG whspss xs@-  -> [t a]-uniquenessVariants2GNPBL !ts !us !hd f1 f2 f3 perms !subs-  | F.null subs = mempty-  | otherwise = map f3 ns-   where !uss = (hd %@ us) %^ mempty-         !base0 = map (hd %@) . f2 $ subs-         !l = length base0-         !baseArr = listArray (0,l - 1) base0-         !ns = universalSetGL ts uss f1 f2 perms baseArr -- in map f3 ns-{-# INLINE uniquenessVariants2GNPBL #-}
+ README.md view
@@ -0,0 +1,24 @@+ Devotion+ ========++The author would like to devote this project to support the [Foundation Gastrostars](https://gastrostars.nl).++The foundation founder is [Emma Kok](https://www.emmakok.nl).++On the 06/01/2024 there is Sophie's Kok, a sister of Emma Kok, 19th Birthday (she is 18). Therefore, the version 0.8.0.0 is additionally devoted also to her. On the 22/01/2023 there is Day of Unity of Ukraine, and on the 23/01/2024 the Orthodox Christians have memory of St. Paulinus of Nola.++On the 08/03/2024 there is International Women's Day.++Besides, you can support Ukraine and Ukrainian people. ++All support is welcome, including donations for the needs of the Ukrainian army, IDPs and refugees.++If you would like to share some financial support with Gastrostars, 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)+
phonetic-languages-simplified-base.cabal view
@@ -3,24 +3,26 @@ -- http://haskell.org/cabal/users-guide/  name:                phonetic-languages-simplified-base-version:             0.5.0.0+version:             0.9.0.0 synopsis:            A basics of the phonetic-languages functionality that can be groupped.-description:         The  common for different realizations functionality. Just the necessary one.+description:         The  common for different realizations of PhLADiPreLiO functionality. Just the necessary one. homepage:            https://hackage.haskell.org/package/phonetic-languages-simlified-base+bug-reports:         https://github.com/Oleksandr-Zhabenko/phonetic-languages-simplified-base/issues license:             MIT license-file:        LICENSE author:              OleksandrZhabenko-maintainer:          olexandr543@yahoo.com+maintainer:          oleksandr.zhabenko@yahoo.com copyright:           Oleksandr Zhabenko category:            Language,Math,Game build-type:          Simple-extra-source-files:  CHANGELOG.md+extra-source-files:  CHANGELOG.md, README.md cabal-version:       >=1.10  library-  exposed-modules:     Phonetic.Languages.Simplified.DataG.Base, Phonetic.Languages.Simplified.StrictVG.Base, Phonetic.Languages.Simplified.DataG.Partir+  exposed-modules:     Phladiprelio.DataG, Phladiprelio.StrictVG, Phladiprelio.Partir, Data.ChooseLine   -- other-modules:-  other-extensions:    BangPatterns, FlexibleContexts, MultiParamTypeClasses-  build-depends:       base >=4.8 && <5, subG ==0.5.3.0, phonetic-languages-permutations-array ==0.3.4.0, phonetic-languages-basis ==0.1.0.0+  -- ghc-options:         -Wall+  other-extensions:    BangPatterns, FlexibleContexts, MultiParamTypeClasses, NoImplicitPrelude, ScopedTypeVariables+  build-depends:       base >=4.13 && <5, monoid-insertleft ==0.1.0.1, phonetic-languages-permutations-array ==0.5.0.0, phonetic-languages-basis ==0.3.0.0, minmax ==0.1.1.0   -- hs-source-dirs:   default-language:    Haskell2010