packages feed

phonetic-languages-rhythmicity 0.6.0.1 → 0.7.0.0

raw patch · 5 files changed

+461/−59 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Rhythmicity.PolyRhythm: rhythmicityPolyG01 :: Ord a => (Int -> Double -> Double -> Double) -> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
+ Rhythmicity.PolyRhythm: rhythmicityPolyG02 :: Ord a => (Double -> Double -> Double) -> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
+ Rhythmicity.PolyRhythm: rhythmicityPolyG1 :: Ord a => (Int -> Double -> Double -> Double) -> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
+ Rhythmicity.PolyRhythm: rhythmicityPolyG12 :: Ord a => (Double -> Double -> Double) -> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
+ Rhythmicity.PolyRhythm: rhythmicityPolyGE :: Ord a => Either (Double -> Double -> Double) (Int -> Double -> Double -> Double) -> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
+ Rhythmicity.PolyRhythm: rhythmicityPolyGE0 :: Ord a => Either (Double -> Double -> Double) (Int -> Double -> Double -> Double) -> Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
+ Rhythmicity.PolyRhythm: rhythmicityPolyWeightedF2 :: Ord a => Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
+ Rhythmicity.PolyRhythm: rhythmicityPolyWeightedF20 :: Ord a => Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
+ Rhythmicity.PolyRhythm: rhythmicityPolyWeightedF3 :: Ord a => Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
+ Rhythmicity.PolyRhythm: rhythmicityPolyWeightedF30 :: Ord a => Double -> Int -> PolyChoices -> PolyRhythmBasis -> [a] -> Double
+ Rhythmicity.PolyRhythm: similarityFG0 :: Double -> (Int -> Double -> Double -> Double) -> Char -> PolyMrks -> PolyMrks -> Double -> Double
+ Rhythmicity.PolyRhythm: similarityFG02 :: Double -> (Double -> Double -> Double) -> Char -> PolyMrks -> PolyMrks -> Double -> Double
+ Rhythmicity.PolyRhythm: similarityFG1 :: Double -> (Int -> Double -> Double -> Double) -> Char -> PolyMrks -> PolyMrks -> Double -> Double
+ Rhythmicity.PolyRhythm: similarityFG12 :: Double -> (Double -> Double -> Double) -> Char -> PolyMrks -> PolyMrks -> Double -> Double
+ Rhythmicity.PolyRhythm: similarityFGE0 :: Double -> Either (Double -> Double -> Double) (Int -> Double -> Double -> Double) -> Char -> PolyMrks -> PolyMrks -> Double -> Double
+ Rhythmicity.PolyRhythm: similarityFGE1 :: Double -> Either (Double -> Double -> Double) (Int -> Double -> Double -> Double) -> Char -> PolyMrks -> PolyMrks -> Double -> Double
+ Rhythmicity.PolyRhythm: similarityLogicsG0 :: Double -> (Int -> Double -> Double -> Double) -> Char -> Double -> [PolyMrks] -> [PolyMrks] -> Double
+ Rhythmicity.PolyRhythm: similarityLogicsG02 :: Double -> (Double -> Double -> Double) -> Char -> Double -> [PolyMrks] -> [PolyMrks] -> Double
+ Rhythmicity.PolyRhythm: similarityLogicsG1 :: Double -> (Int -> Double -> Double -> Double) -> Char -> Double -> [PolyMrks] -> [PolyMrks] -> Double
+ Rhythmicity.PolyRhythm: similarityLogicsG12 :: Double -> (Double -> Double -> Double) -> Char -> Double -> [PolyMrks] -> [PolyMrks] -> Double
+ Rhythmicity.PolyRhythm: similarityLogicsGE :: Double -> Either (Double -> Double -> Double) (Int -> Double -> Double -> Double) -> Char -> Double -> [PolyMrks] -> [PolyMrks] -> Double
+ Rhythmicity.PolyRhythm: similarityLogicsGE0 :: Double -> Either (Double -> Double -> Double) (Int -> Double -> Double -> Double) -> Char -> Double -> [PolyMrks] -> [PolyMrks] -> Double
+ Rhythmicity.PolyRhythm: similarityPoly2 :: [PolyMrks] -> Char -> Double -> [[PolyMrks]] -> Double
+ Rhythmicity.PolyRhythm: similarityPoly20 :: [PolyMrks] -> Char -> Double -> [[PolyMrks]] -> Double
+ Rhythmicity.PolyRhythm: similarityPolyG0 :: (Int -> Double -> Double -> Double) -> Char -> Double -> [(Int, [PolyMrks])] -> Double
+ Rhythmicity.PolyRhythm: similarityPolyG02 :: (Double -> Double -> Double) -> Char -> Double -> [(Int, [PolyMrks])] -> Double
+ Rhythmicity.PolyRhythm: similarityPolyG1 :: (Int -> Double -> Double -> Double) -> Char -> Double -> [(Int, [PolyMrks])] -> Double
+ Rhythmicity.PolyRhythm: similarityPolyG12 :: (Double -> Double -> Double) -> Char -> Double -> [(Int, [PolyMrks])] -> Double
+ Rhythmicity.PolyRhythm: similarityPolyGE :: Either (Double -> Double -> Double) (Int -> Double -> Double -> Double) -> Char -> Double -> [(Int, [PolyMrks])] -> Double
+ Rhythmicity.PolyRhythm: similarityPolyGE0 :: Either (Double -> Double -> Double) (Int -> Double -> Double -> Double) -> Char -> Double -> [(Int, [PolyMrks])] -> Double
+ Rhythmicity.PolyRhythm: similarityPolyGEE :: (Int, [PolyMrks]) -> Either (Double -> Double -> Double) (Int -> Double -> Double -> Double) -> Char -> Double -> [(Int, [PolyMrks])] -> Double
+ Rhythmicity.PolyRhythm: similarityPolyGEE0 :: (Int, [PolyMrks]) -> Either (Double -> Double -> Double) (Int -> Double -> Double -> Double) -> Char -> Double -> [(Int, [PolyMrks])] -> Double
+ Rhythmicity.PolyRhythm: simpleF2 :: Double -> Double -> Double
+ Rhythmicity.PolyRhythm: simpleF3 :: Int -> Double -> Double -> Double

Files

CHANGELOG.md view
@@ -46,7 +46,7 @@ ## 0.5.1.0 -- 2021-07-30  * Fifth version revised A. Fixed issues with fixed point 1.0 for increasing and decreasing functions in the module-Rhythmicity.PolyRhythm. +Rhythmicity.PolyRhythm.  ## 0.5.2.0 -- 2021-08-04 @@ -72,3 +72,8 @@ ## 0.6.0.1 -- 2021-08-09  * Sixth version revised A. Fixed issues with deprecated documentation for the polyrhythmicity functions.++## 0.7.0.0 -- 2021-08-14++* Seventh version. The library tries more completely include the information for analysis. Besides,+there are first weigted increasing and decreasing functions and functionality respectively.
README.md view
@@ -24,11 +24,11 @@ code mostly a letter designation.  Then each subsequence will consist of the same number of-elements of one nature (in particular, numbers of the +elements of one nature (in particular, numbers of the type Double), in each subsequence there will be selected several subgroups of "similar" elements in value (and order, if the subsequences are sorted by the value),-each of which will have its own index as a symbol +each of which will have its own index as a symbol (most often in the code -- the characters). Subgroups must have (actually approximately) the same number of elements (in the code it is not strictly used for simplification@@ -72,7 +72,7 @@ may not be the only possible option, but in many cases it is crucial and influences the course of the rhythmization process (formation, change or disappearance of the-rhythm). It is also known that the presence of the +rhythm). It is also known that the presence of the statistical relationship does not mean the existence of deeper connections between phenomena, in particular -- the causality. "Correlation does not mean causality."@@ -101,3 +101,8 @@ linearized and there is also library possibility to specify kernels for them to control which parts of the line are more important and which are less.++Since the 0.7.0.0 version the program tries more+completely include the information for analysis. Besides,+there are first weigted increasing and decreasing+functions and functionality respectively.
Rhythmicity/PolyRhythm.hs view
@@ -22,6 +22,7 @@ import GHC.Float (int2Double) import qualified Rhythmicity.TwoFourth as TF import Text.Read (readMaybe)+import qualified Data.Either as Either (Either(..))  data Marker4s = D | E | F | G deriving (Eq,Ord,Show) @@ -74,7 +75,7 @@ fromIntermediate :: Intermediate a -> Maybe PolyMrks fromIntermediate (I k) = Just (RP k) fromIntermediate _ = Nothing-     + getPolyChRhData   :: (Ord a) => Char -- ^ The start of the 'RP' 'PolyMarkers' count in case of 'PolyMrks' with 'Char's. The usual one can be \'a\' or \'h\'.   -> Int -- ^ If the argument is less or equal to 4, then 'Marker4s' is used, if it is greater than 4, then 'PolyMarkers' is used.@@ -191,7 +192,7 @@                                      | otherwise -> r) us             | otherwise = let ws = sort vs in case j of                False -> let !k = ws !! (y - 1) in-                                gPoly (drop 1 wws) (PolyCh js l) (PolyRhythm ys) (filter (> k) vs) +                                gPoly (drop 1 wws) (PolyCh js l) (PolyRhythm ys) (filter (> k) vs)                                  (map (\r -> if                                               | isJI r -> (\q@(J rr) -> if                                                                          | rr <= k -> I (PolyMs (head wws))@@ -222,7 +223,7 @@  | x < 1 = x ** (1.0 / int2Double n)  | x <= 1.1 = x + 1.0 / int2Double n  | otherwise = x ^ n-{-# INLINE increasingF #-} +{-# INLINE increasingF #-}  increasingF1  :: Int@@ -242,7 +243,7 @@ increasingFG n k f x  | n <= 0 = error $ "Rhythmicity.PolyRhythm.increasingFG: not defined for the argument. " ++ show n  | otherwise = x + abs (f n k x)-{-# INLINE increasingFG #-} +{-# INLINE increasingFG #-}  decreasingF1  :: Int@@ -251,7 +252,7 @@ decreasingF1 n x  | n <= 0 = error $ "Rhythmicity.PolyRhythm.decreasingF1: not defined for the argument. " ++ show n  | otherwise = x - int2Double n-{-# INLINE decreasingF1 #-} +{-# INLINE decreasingF1 #-}  decreasingFG  :: Int@@ -262,7 +263,7 @@ decreasingFG n k f x  | n <= 0 = error $ "Rhythmicity.PolyRhythm.decreasingFG: not defined for the argument. " ++ show n  | otherwise = x - abs (f n k x)-{-# INLINE decreasingFG #-} +{-# INLINE decreasingFG #-}  decreasingFG2  :: Int@@ -284,7 +285,7 @@ increasingFG2 n k f x  | n <= 0 = error $ "Rhythmicity.PolyRhythm.increasingFG2: not defined for the argument. " ++ show n  | otherwise = x + int2Double n * abs (f k x)-{-# INLINE increasingFG2 #-} +{-# INLINE increasingFG2 #-}  decreasingF  :: Int@@ -297,7 +298,7 @@  | x < 1 = x ** int2Double n  | x <= 1.1 = 1.0 / (x + 1.0 / int2Double n)  | otherwise = x ** (1.0 / int2Double n)-{-# INLINE decreasingF #-} +{-# INLINE decreasingF #-}  similarityF1  :: Char -- ^ The start of the counting.@@ -305,23 +306,8 @@  -> PolyMrks  -> Double -- ^ The initial value.  -> Double-similarityF1 c m1 m2 x0- | is4s m1 = if-    | m1 == m2 -> case (\(R4 t0) -> t0) m1 of-        D -> increasingF1 4 x0-        E -> increasingF1 3 x0-        F -> increasingF1 2 x0-        _ -> increasingF1 1 x0-    | otherwise -> case (\(R4 t0) -> t0) . min m1 $ m2 of-        D -> decreasingF1 4 x0-        E -> decreasingF1 3 x0-        F -> decreasingF1 2 x0-        _ -> decreasingF1 1 x0- | otherwise = let n = length [c..(\(RP (PolyMs t0)) -> t0) (min m1 m2)] in-     if-       | m1 == m2 -> increasingF1 n x0-       | otherwise -> decreasingF1 n x0-{-# INLINE similarityF1 #-} +similarityF1 = similarityFG12 1.0 (\_ _ -> 1.0)+{-# INLINE similarityF1 #-}  {-| The more straightforward variant of the 'similarityF1' function. -} similarityF0@@ -330,22 +316,103 @@  -> PolyMrks  -> Double -- ^ The initial value.  -> Double-similarityF0 c m1 m2 x0- | is4s m1 = if-    | m1 == m2 -> case (\(R4 t0) -> t0) m1 of-        D -> increasingF1 4 x0-        E -> increasingF1 3 x0-        F -> increasingF1 2 x0-        _ -> increasingF1 1 x0-    | otherwise -> x0- | otherwise = let n = length [c..(\(RP (PolyMs t0)) -> t0) (min m1 m2)] in+similarityF0 = similarityFG02 1.0 (\_ _ -> 1.0)+{-# INLINE similarityF0 #-}++similarityFGE1+ :: Double+ -> Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)+ -> Char+ -> PolyMrks+ -> PolyMrks+ -> Double+ -> Double+similarityFGE1 k f c m1 m2 x+ | is4s m1 = let !h = case (\(R4 t0) -> t0) m1 of { D -> 4 ; E -> 3 ; F -> 2 ; ~rrr -> 1 } in case m1 == m2 of+     True -> case f of+              Either.Left f2 -> increasingFG2 h k f2 x+              Either.Right f3 -> increasingFG h k f3 x+     _ -> case f of+           Either.Left f2 -> decreasingFG2 h k f2 x+           Either.Right f3 -> decreasingFG h k f3 x+ | otherwise = let l = length [c..(\(RP (PolyMs t0)) -> t0) (min m1 m2)] in      if-       | m1 == m2 -> increasingF1 n x0-       | otherwise -> x0-{-# INLINE similarityF0 #-} +       | m1 == m2 -> case f of+          Either.Left f2 -> increasingFG2 l k f2 x+          Either.Right f3 -> increasingFG l k f3 x+       | otherwise -> case f of+          Either.Left f2 -> decreasingFG2 l k f2 x+          Either.Right f3 -> decreasingFG l k f3 x+{-# INLINE similarityFGE1 #-} +similarityFG1+ :: Double+ -> (Int -> Double -> Double -> Double)+ -> Char+ -> PolyMrks+ -> PolyMrks+ -> Double+ -> Double+similarityFG1 k f = similarityFGE1 k (Right f)+{-# INLINE similarityFG1 #-}++similarityFG12+ :: Double+ -> (Double -> Double -> Double)+ -> Char+ -> PolyMrks+ -> PolyMrks+ -> Double+ -> Double+similarityFG12 k f = similarityFGE1 k (Left f)+{-# INLINE similarityFG12 #-}++similarityFGE0+ :: Double+ -> Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)+ -> Char+ -> PolyMrks+ -> PolyMrks+ -> Double+ -> Double+similarityFGE0 k f c m1 m2 x+ | is4s m1 = let h = case (\(R4 t0) -> t0) m1 of { D -> 4 ; E -> 3 ; F -> 2 ; ~rrr -> 1 } in case m1 == m2 of+     True -> case f of+              Either.Left f2 -> increasingFG2 h k f2 x+              Either.Right f3 -> increasingFG h k f3 x+     _ -> x+ | otherwise = let l = length [c..(\(RP (PolyMs t0)) -> t0) (min m1 m2)] in+     if+       | m1 == m2 -> case f of+          Either.Left f2 -> increasingFG2 l k f2 x+          Either.Right f3 -> increasingFG l k f3 x+       | otherwise -> x+{-# INLINE similarityFGE0 #-}++similarityFG0+ :: Double+ -> (Int -> Double -> Double -> Double)+ -> Char+ -> PolyMrks+ -> PolyMrks+ -> Double+ -> Double+similarityFG0 k f = similarityFGE0 k (Right f)+{-# INLINE similarityFG0 #-}++similarityFG02+ :: Double+ -> (Double -> Double -> Double)+ -> Char+ -> PolyMrks+ -> PolyMrks+ -> Double+ -> Double+similarityFG02 k f = similarityFGE0 k (Left f)+{-# INLINE similarityFG02 #-}+ {-| The function that uses a simple arithmetic logics to calculate the similarity of the two equal by length (if not they are truncated to the least one)-lists of 'PolyMrks'. Uses both increasing and decreasing functions. +lists of 'PolyMrks'. Uses both increasing and decreasing functions. -} similarityLogics   :: Char -- ^ The start of the counting.@@ -366,31 +433,229 @@ similarityLogics0 c x0 (x:xs) (y:ys) = similarityLogics0 c (similarityF0 c x y x0) xs ys similarityLogics0 c x0 _ _ = x0 +{-|+-}+similarityLogicsGE+  :: Double+  -> Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)+  -> Char -- ^ The start of the counting.+  -> Double -- ^ An initial value.+  -> [PolyMrks]+  -> [PolyMrks]+  -> Double+similarityLogicsGE k f c x0 (x:xs) (y:ys) = similarityLogicsGE k f c (similarityFGE1 k f c x y x0) xs ys+similarityLogicsGE k f c x0 _ _ = x0++{-|+-}+similarityLogicsG1+  :: Double+  -> (Int -> Double -> Double -> Double)+  -> Char -- ^ The start of the counting.+  -> Double -- ^ An initial value.+  -> [PolyMrks]+  -> [PolyMrks]+  -> Double+similarityLogicsG1 k f = similarityLogicsGE k (Either.Right f)+{-# INLINE similarityLogicsG1 #-}++{-|+-}+similarityLogicsG12+  :: Double+  -> (Double -> Double -> Double)+  -> Char -- ^ The start of the counting.+  -> Double -- ^ An initial value.+  -> [PolyMrks]+  -> [PolyMrks]+  -> Double+similarityLogicsG12 k f = similarityLogicsGE k (Either.Left f)+{-# INLINE similarityLogicsG12 #-}+++{-| The more straightforward variant of the 'similarityLogicsGE' function. -}+similarityLogicsGE0+  :: Double+  -> Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)+  -> Char -- ^ The start of the counting.+  -> Double -- ^ An initial value.+  -> [PolyMrks]+  -> [PolyMrks]+  -> Double+similarityLogicsGE0 k f c x0 (x:xs) (y:ys) = similarityLogicsGE0 k f c (similarityFGE0 k f c x y x0) xs ys+similarityLogicsGE0 k f c x0 _ _ = x0++{-|+-}+similarityLogicsG0+  :: Double+  -> (Int -> Double -> Double -> Double)+  -> Char -- ^ The start of the counting.+  -> Double -- ^ An initial value.+  -> [PolyMrks]+  -> [PolyMrks]+  -> Double+similarityLogicsG0 k f = similarityLogicsGE0 k (Either.Right f)+{-# INLINE similarityLogicsG0 #-}++{-|+-}+similarityLogicsG02+  :: Double+  -> (Double -> Double -> Double)+  -> Char -- ^ The start of the counting.+  -> Double -- ^ An initial value.+  -> [PolyMrks]+  -> [PolyMrks]+  -> Double+similarityLogicsG02 k f = similarityLogicsGE0 k (Either.Left f)+{-# INLINE similarityLogicsG02 #-}+ {-| The function that uses a simple arithmetic logics to calculate the similarity of the two equal by length (if not they are truncated to the least one) lists of 'PolyMrks'. Uses 'similarityLogics' inside.--}           +-} similarityPoly  :: Char -- ^ The start of the counting.  -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.  -> [[PolyMrks]]  -> Double  -- ^ The greater one corresponds to (probably) more rhythmic list.-similarityPoly c z (xs:ys:xss) = similarityPoly c (z * similarityLogics c z xs ys) (ys:xss)-similarityPoly _ z _ = z+similarityPoly c z ts+ | null ts = z+ | otherwise = similarityPoly2 (head ts) c z ts+{-# INLINE similarityPoly #-} +{-|+-}+similarityPoly2+ :: [PolyMrks]+ -> Char -- ^ The start of the counting.+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> [[PolyMrks]]+ -> Double+similarityPoly2 ks c z (xs:ys:xss) = similarityPoly2 ks c (z * similarityLogics c z xs ys) (ys:xss)+similarityPoly2 ks c z [ys] = z * similarityLogics c z ys ks+similarityPoly2 _ _ z _ = z++{-|+-}+similarityPolyGEE+ :: (Int,[PolyMrks])+ -> Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)+ -> Char -- ^ The start of the counting.+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> [(Int,[PolyMrks])]+ -> Double+similarityPolyGEE r f c z ((i,xs):(j,ys):xss) =+   similarityPolyGEE r f c (z * similarityLogicsGE (int2Double i) f c z xs ys) ((j,ys):xss)+similarityPolyGEE (_,ts) f c z [(j,ys)] = z * similarityLogicsGE (int2Double j) f c z ys ts+similarityPolyGEE _ _ _ z _ = z++similarityPolyGE+ :: Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)+ -> Char -- ^ The start of the counting.+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> [(Int,[PolyMrks])]+ -> Double+similarityPolyGE f c z ts+ | null ts = z+ | otherwise = similarityPolyGEE (head ts) f c z ts+{-# INLINE similarityPolyGE #-}++{-|+-}+similarityPolyG1+ :: (Int -> Double -> Double -> Double)+ -> Char -- ^ The start of the counting.+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> [(Int,[PolyMrks])]+ -> Double+similarityPolyG1 f = similarityPolyGE (Either.Right f)+{-# INLINE similarityPolyG1 #-}++{-|+-}+similarityPolyG12+ :: (Double -> Double -> Double)+ -> Char -- ^ The start of the counting.+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> [(Int,[PolyMrks])]+ -> Double+similarityPolyG12 f = similarityPolyGE (Either.Left f)+{-# INLINE similarityPolyG12 #-}+ {-| The function that uses a simple arithmetic logics to calculate the similarity of the two equal by length (if not they are truncated to the least one) lists of 'PolyMrks'. Uses 'similarityLogics0' inside. The more straightforward variant of the 'similarityPoly' function.--}           +-} similarityPoly0  :: Char -- ^ The start of the counting.  -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.  -> [[PolyMrks]]  -> Double  -- ^ The greater one corresponds to (probably) more rhythmic list.-similarityPoly0 c z (xs:ys:xss) = similarityPoly0 c (z * similarityLogics0 c z xs ys) (ys:xss)-similarityPoly0 _ z _ = z+similarityPoly0 c z ts+ | null ts = z+ | otherwise = similarityPoly20 (head ts) c z ts+{-# INLINE similarityPoly0 #-} +{-|+-}+similarityPoly20+ :: [PolyMrks]+ -> Char -- ^ The start of the counting.+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> [[PolyMrks]]+ -> Double+similarityPoly20 ks c z (xs:ys:xss) = similarityPoly20 ks c (z * similarityLogics c z xs ys) (ys:xss)+similarityPoly20 ks c z [ys] = z * similarityLogics c z ys ks+similarityPoly20 _ _ z _ = z +{-|+-}+similarityPolyGEE0+ :: (Int,[PolyMrks])+ -> Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)+ -> Char -- ^ The start of the counting.+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> [(Int,[PolyMrks])]+ -> Double+similarityPolyGEE0 r f c z ((i,xs):(j,ys):xss) =+   similarityPolyGEE0 r f c (z * similarityLogicsGE0 (int2Double i) f c z xs ys) ((j,ys):xss)+similarityPolyGEE0 (_,ts) f c z [(j,ys)] = z * similarityLogicsGE0 (int2Double j) f c z ys ts+similarityPolyGEE0 _ _ _ z _ = z +similarityPolyGE0+ :: Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)+ -> Char -- ^ The start of the counting.+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> [(Int,[PolyMrks])]+ -> Double+similarityPolyGE0 f c z ts+ | null ts = z+ | otherwise = similarityPolyGEE0 (head ts) f c z ts+{-# INLINE similarityPolyGE0 #-}++{-|+-}+similarityPolyG0+ :: (Int -> Double -> Double -> Double)+ -> Char -- ^ The start of the counting.+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> [(Int,[PolyMrks])]+ -> Double+similarityPolyG0 f = similarityPolyGE0 (Either.Right f)+{-# INLINE similarityPolyG0 #-}++{-|+-}+similarityPolyG02+ :: (Double -> Double -> Double)+ -> Char -- ^ The start of the counting.+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> [(Int,[PolyMrks])]+ -> Double+similarityPolyG02 f = similarityPolyGE0 (Either.Left f)+{-# INLINE similarityPolyG02 #-}+ {-| General function to estimate the inner rhythmicity of the 'Ord'ered list of values. For many cases its arguments can be guessed or approximated by some reasonable values. Nevertheless, it is a highly experimental one. -}@@ -406,8 +671,80 @@  {-| General function to estimate the inner rhythmicity of the 'Ord'ered list of values. For many cases its arguments can be guessed or approximated by some reasonable values. Nevertheless, it is a highly experimental one.-The more straightforward variant of the 'rhythmicityPoly' function.  -}+rhythmicityPolyGE+  :: (Ord a) => Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)+  -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+  -> Int -- ^ If the argument is less or equal to 4, then 'Marker4s' is used, if it is greater than 4, then 'PolyMarkers' is used.+  -> PolyChoices+  -> PolyRhythmBasis+  -> [a]+  -> Double+rhythmicityPolyGE f x0 r choices rhythm = similarityPolyGE f 'a' x0 . zip [0..] . getPolyChRhData 'a' r choices rhythm+{-# INLINE rhythmicityPolyGE #-}++rhythmicityPolyG1+ :: (Ord a) => (Int -> Double -> Double -> Double)+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> Int -- ^ If the argument is less or equal to 4, then 'Marker4s' is used, if it is greater than 4, then 'PolyMarkers' is used.+ -> PolyChoices+ -> PolyRhythmBasis+ -> [a]+ -> Double+rhythmicityPolyG1 f = rhythmicityPolyGE (Either.Right f)+{-# INLINE rhythmicityPolyG1 #-}++rhythmicityPolyG12+ :: (Ord a) => (Double -> Double -> Double)+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> Int -- ^ If the argument is less or equal to 4, then 'Marker4s' is used, if it is greater than 4, then 'PolyMarkers' is used.+ -> PolyChoices+ -> PolyRhythmBasis+ -> [a]+ -> Double+rhythmicityPolyG12 f = rhythmicityPolyGE (Either.Left f)+{-# INLINE rhythmicityPolyG12 #-}++{-| General function to estimate the inner rhythmicity of the 'Ord'ered list of values. For many cases its arguments can be+guessed or approximated by some reasonable values. Nevertheless, it is a highly experimental one.+-}+rhythmicityPolyGE0+  :: (Ord a) => Either.Either (Double -> Double -> Double) (Int -> Double -> Double -> Double)+  -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+  -> Int -- ^ If the argument is less or equal to 4, then 'Marker4s' is used, if it is greater than 4, then 'PolyMarkers' is used.+  -> PolyChoices+  -> PolyRhythmBasis+  -> [a]+  -> Double+rhythmicityPolyGE0 f x0 r choices rhythm = similarityPolyGE0 f 'a' x0 . zip [0..] . getPolyChRhData 'a' r choices rhythm+{-# INLINE rhythmicityPolyGE0 #-}++rhythmicityPolyG01+ :: (Ord a) => (Int -> Double -> Double -> Double)+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> Int -- ^ If the argument is less or equal to 4, then 'Marker4s' is used, if it is greater than 4, then 'PolyMarkers' is used.+ -> PolyChoices+ -> PolyRhythmBasis+ -> [a]+ -> Double+rhythmicityPolyG01 f = rhythmicityPolyGE0 (Either.Right f)+{-# INLINE rhythmicityPolyG01 #-}++rhythmicityPolyG02+ :: (Ord a) => (Double -> Double -> Double)+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> Int -- ^ If the argument is less or equal to 4, then 'Marker4s' is used, if it is greater than 4, then 'PolyMarkers' is used.+ -> PolyChoices+ -> PolyRhythmBasis+ -> [a]+ -> Double+rhythmicityPolyG02 f = rhythmicityPolyGE0 (Either.Left f)+{-# INLINE rhythmicityPolyG02 #-}++{-| General function to estimate the inner rhythmicity of the 'Ord'ered list of values. For many cases its arguments can be+guessed or approximated by some reasonable values. Nevertheless, it is a highly experimental one.+The more straightforward variant of the 'rhythmicityPoly' function.+-} rhythmicityPoly0   :: (Ord a) => Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.   -> Int -- ^ If the argument is less or equal to 4, then 'Marker4s' is used, if it is greater than 4, then 'PolyMarkers' is used.@@ -420,6 +757,61 @@  ------------------------------------------------------------------- +{-| This function tries to increase the importance of the beginning of the line and decreases the importance+of the ending of the line. It is not linear one.+-}+simpleF2 :: Double -> Double -> Double+simpleF2 k x = x / (k + 1.0)^2++simpleF3 :: Int -> Double -> Double -> Double+simpleF3 n k x+ | n <= 2 = x / (k + 1.0)^2+ | otherwise = max x (x ^ n / (k + 1.0)^2)++-------------------------------------------------------------------++rhythmicityPolyWeightedF2+  :: (Ord a) => Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+  -> Int -- ^ If the argument is less or equal to 4, then 'Marker4s' is used, if it is greater than 4, then 'PolyMarkers' is used.+  -> PolyChoices+  -> PolyRhythmBasis+  -> [a]+  -> Double+rhythmicityPolyWeightedF2 = rhythmicityPolyG12 (simpleF2)+{-# INLINE rhythmicityPolyWeightedF2 #-}++rhythmicityPolyWeightedF3+  :: (Ord a) => Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+  -> Int -- ^ If the argument is less or equal to 4, then 'Marker4s' is used, if it is greater than 4, then 'PolyMarkers' is used.+  -> PolyChoices+  -> PolyRhythmBasis+  -> [a]+  -> Double+rhythmicityPolyWeightedF3 = rhythmicityPolyG1 (simpleF3)+{-# INLINE rhythmicityPolyWeightedF3 #-}++rhythmicityPolyWeightedF20+  :: (Ord a) => Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+  -> Int -- ^ If the argument is less or equal to 4, then 'Marker4s' is used, if it is greater than 4, then 'PolyMarkers' is used.+  -> PolyChoices+  -> PolyRhythmBasis+  -> [a]+  -> Double+rhythmicityPolyWeightedF20 = rhythmicityPolyG02 (simpleF2)+{-# INLINE rhythmicityPolyWeightedF20 #-}++rhythmicityPolyWeightedF30+  :: (Ord a) => Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+  -> Int -- ^ If the argument is less or equal to 4, then 'Marker4s' is used, if it is greater than 4, then 'PolyMarkers' is used.+  -> PolyChoices+  -> PolyRhythmBasis+  -> [a]+  -> Double+rhythmicityPolyWeightedF30 = rhythmicityPolyG01 (simpleF3)+{-# INLINE rhythmicityPolyWeightedF30 #-}++-------------------------------------------------------------------+ {-| Data type that is used to implement some parameter language to encode in the 'String' argument information that is sufficient to transform the 'String' into 'Double' using the needed additional information provided by some other means.@@ -461,13 +853,13 @@  | x == 'c' && not (null xs) = if                                 | isDigit . head $ xs -> let x = readMaybe (take 1 ts)::Maybe Int                                                              y = readMaybe (drop 1 . take 2 $ ts)::Maybe Int-                                                             z = readMaybe (drop 2 ts)::Maybe Int +                                                             z = readMaybe (drop 2 ts)::Maybe Int                                                              ch = case (x,y,z) of                                                                    (Just x1, Just y1, Just z1) -> Just (TF.Ch x1 y1 z1)                                                                    _ -> Nothing                                                              x2 = readMaybe (take 1 ws)::Maybe Int                                                              y2 = readMaybe (drop 1 . take 2 $ ws)::Maybe Int-                                                             z2 = readMaybe (drop 2 ws)::Maybe Int +                                                             z2 = readMaybe (drop 2 ws)::Maybe Int                                                              rh = case (x2,y2,z2) of                                                                    (Just x3, Just y3, Just z3) -> Just (TF.Rhythm x3 y3 z3)                                                                    _ -> Nothing@@ -476,7 +868,7 @@                                                                  (Just ch1,Just rh1,Just n1) -> Just . P1 ch1 rh1 $ f n1                                                                  _ -> Just . P0 $ ys                                 | head xs == 't' || head xs == 'f' ->-                                                         let z = readMaybe qs::Maybe Int +                                                         let z = readMaybe qs::Maybe Int                                                              ch = case z of                                                                    Just z1 -> Just (PolyCh rs z1)                                                                    _ -> Nothing@@ -484,7 +876,7 @@                                                              m = readMaybe ms::Maybe Int in                                                                case (ch,n,m) of                                                                  (Just ch1,Just n1,Just m1) -> Just . P2 ch1 (PolyRhythm vs) n1 $ f m1-                                                                 _ -> Just . P0 $ ys +                                                                 _ -> Just . P0 $ ys                                 | otherwise -> Just . P0 $ ys  | otherwise = Just . P0 $ ys      where (ts, us) = break (== '+') xs@@ -498,4 +890,4 @@            f k              | k `rem` 4 < 0 = 5 + (k `rem` 4)              | otherwise = 1 + (k `rem` 4)-           +
Rhythmicity/TwoFourth.hs view
@@ -110,7 +110,7 @@  {-| The function that uses a simple arithmetic logics to calculate the similarity of the two equal by length (if not they are truncated to the least one) lists of 'Marker3s'. It emphasises the 'A' similarity and for most values have not so simply defined 'B'-behaviour. Uses 'similarityLogics' inside.--}           +-} similarityABC  :: Double -- ^ The positive factor (multiplier) coefficient that increases or decreases the result in case of 'A' simultaneous presence (absence).  -> Double -- ^ The addition (positive subtraction) coefficient that increases or decreases (probably) the result in case of 'B' similtaneous presence (absence).@@ -123,7 +123,7 @@ {-| The function that uses a simple arithmetic logics to calculate the similarity of the two equal by length (if not they are truncated to the least one) lists of 'Marker3s'. It emphasises the 'A' and 'B' similarities. Uses 'similarityLogics0' inside. The more straightforward variant of the 'similarityABC' function.--}           +-} similarityABC0  :: Double -- ^ The positive factor (multiplier) coefficient that increases or decreases the result in case of 'A' simultaneous presence (absence).  -> Double -- ^ The addition coefficient that increases the result in case of 'B' similtaneous presence.@@ -172,7 +172,7 @@  | m1 == A || m2 == A = x0 / k1  | m1 == B || m2 == B = abs (x0 - k2)  | otherwise = x0-{-# INLINE similarityF1 #-} +{-# INLINE similarityF1 #-}  {-| The more straightforward variant of the 'similarityF1' function. -} similarityF0@@ -207,7 +207,7 @@  {-| General function to estimate the inner rhythmicity of the 'Ord'ered list of values. For many cases its arguments can be guessed or approximated by some reasonable values. Nevertheless, it is a highly experimental one.-The more straightforward variant of the 'rhythmicityABC' function. +The more straightforward variant of the 'rhythmicityABC' function. -} rhythmicityABC0   :: (Ord a) => Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.
phonetic-languages-rhythmicity.cabal view
@@ -2,7 +2,7 @@ -- For further documentation, see http://haskell.org/cabal/users-guide/  name:                phonetic-languages-rhythmicity-version:             0.6.0.1+version:             0.7.0.0 synopsis:            Allows to estimate the rhythmicity properties for the text description:         Allows to estimate (somewhat to say, evaluate) the rhythmicity properties for the text. Inspired by the ancient Greek and Latin poetry.