packages feed

phonetic-languages-rhythmicity 0.3.0.0 → 0.3.1.0

raw patch · 3 files changed

+80/−7 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Rhythmicity.TwoFourth: rhythmicityABC0 :: Ord a => Double -> Double -> Double -> Choices -> RhythmBasis -> [a] -> Double
+ Rhythmicity.TwoFourth: similarityABC0 :: Double -> Double -> Double -> [[Marker3s]] -> Double
+ Rhythmicity.TwoFourth: similarityF0 :: Marker3s -> Marker3s -> Double -> Double -> Double -> Double
+ Rhythmicity.TwoFourth: similarityF1 :: Marker3s -> Marker3s -> Double -> Double -> Double -> Double
+ Rhythmicity.TwoFourth: similarityLogics0 :: Double -> Double -> Double -> [Marker3s] -> [Marker3s] -> Double

Files

CHANGELOG.md view
@@ -25,3 +25,7 @@  * Third version. Added a new module Rhythmicity.TwoFourth with a different approach to the rhythmicity evaluation. It is highly experimental.++## 0.3.1.0 -- 2021-07-20++* Third version revised A. Added new functions to the module Rhythmicity.TwoFourth. Some code optimizations.
Rhythmicity/TwoFourth.hs view
@@ -99,6 +99,19 @@ similarityABC _ _ z _ = z  {-| 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.+ -> Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+ -> [[Marker3s]]+ -> Double  -- ^ In case of positive previous 'Double' arguments this is a positive value. The greater one corresponds to (probably) more rhythmic list.+similarityABC0 k1 k2 z (xs:ys:xss) = similarityABC0 k1 k2 (z * similarityLogics0 1 k1 k2 xs ys) (ys:xss)+similarityABC0 _ _ z _ = z++{-| 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. -} similarityLogics@@ -108,13 +121,54 @@   -> [Marker3s]   -> [Marker3s]   -> Double  -- ^ In case of positive previous 'Double' arguments this is a positive value. The greater one corresponds to (probably) more rhythmic list.-similarityLogics x0 k1 k2 (x:xs) (y:ys) = similarityLogics ((if x == y && x == A then (* k1)-  else if x == y && x == B then (+ k2)-    else if x /= y && (x == A || y == A) then (\r -> r / k1)-      else if x /= y && (x == B || y == B) then (\r -> abs (r - k2))-        else id) x0) k1 k2 xs ys-similarityLogics x0 _ _ _ _ = x0        +similarityLogics x0 k1 k2 (x:xs) (y:ys) = similarityLogics (similarityF1 x y x0 k1 k2) k1 k2 xs ys+similarityLogics x0 _ _ _ _ = x0 +{-| The more straightforward variant of the 'similarityLogics' function. -}+similarityLogics0+  :: Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+  -> 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.+  -> [Marker3s]+  -> [Marker3s]+  -> Double  -- ^ In case of positive previous 'Double' arguments this is a positive value. The greater one corresponds to (probably) more rhythmic list.+similarityLogics0 x0 k1 k2 (x:xs) (y:ys) = similarityLogics0 (similarityF0 x y x0 k1 k2) k1 k2 xs ys+similarityLogics0 x0 _ _ _ _ = x0++similarityF1+ :: Marker3s+ -> Marker3s+ -> Double -- ^ The initial value.+ -> 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).+ -> Double+similarityF1 m1 m2 x0 k1 k2+ | m1 == m2 = case m1 of+     A -> x0 * k1+     B -> x0 + k2+     _ -> x0+ | m1 == A || m2 == A = x0 / k1+ | m1 == B || m2 == B = abs (x0 - k2)+ | otherwise = x0+{-# INLINE similarityF1 #-} ++{-| The more straightforward variant of the 'similarityF1' function. -}+similarityF0+ :: Marker3s+ -> Marker3s+ -> Double -- ^ The initial value.+ -> 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 the result in case of 'B' similtaneous presence.+ -> Double+similarityF0 m1 m2 x0 k1 k2+ | m1 == m2 = case m1 of+     A -> x0 * k1+     B -> x0 + k2+     _ -> x0+ | m1 == A || m2 == A = x0 / k1+ | otherwise = x0+{-# INLINE similarityF0 #-}+ {-| 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. -}@@ -128,3 +182,18 @@   -> Double -- ^ In case of positive previous 'Double' arguments this is a positive value. The greater one corresponds to (probably) more rhythmic list. rhythmicityABC x0 k1 k2 choices rhythm = similarityABC k1 k2 x0 . getChRhData choices rhythm {-# INLINE rhythmicityABC #-}++{-| 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. +-}+rhythmicityABC0+  :: (Ord a) => Double -- ^ The initial value starting from which it counts. Usually, equals to 1.0.+  -> 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.+  -> Choices+  -> RhythmBasis+  -> [a]+  -> Double -- ^ In case of positive previous 'Double' arguments this is a positive value. The greater one corresponds to (probably) more rhythmic list.+rhythmicityABC0 x0 k1 k2 choices rhythm = similarityABC0 k1 k2 x0 . getChRhData choices rhythm+{-# INLINE rhythmicityABC0 #-}
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.3.0.0+version:             0.3.1.0 synopsis:            Allows to estimate the rhythmicity properties for the text (usually, the Ukrainian poetic one) description:         Allows to estimate (somewhat to say, evaluate) the rhythmicity properties for the text (usually, the Ukrainian poetic one, but it can be extrapolated to other ones). Inspired by the ancient Greek and Latin poetry.