phonetic-languages-rhythmicity 0.1.1.0 → 0.1.2.0
raw patch · 3 files changed
+18/−13 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Languages.Rhythmicity: posMaxIn3 :: Ord a => a -> a -> a -> Int
+ Languages.Rhythmicity: posMaxIn3 :: Ord a => a -> a -> a -> Int16
Files
- CHANGELOG.md +3/−0
- Languages/Rhythmicity.hs +14/−12
- phonetic-languages-rhythmicity.cabal +1/−1
CHANGELOG.md view
@@ -12,3 +12,6 @@ * First version revised B. Some code improvements. +## 0.1.2.0 -- 2020-10-20++* First version revised C. Some code improvements.
Languages/Rhythmicity.hs view
@@ -12,21 +12,23 @@ module Languages.Rhythmicity where +import GHC.Int+ maxPosition2 :: (RealFrac a) => [a] -> a maxPosition2 xs | null xs = 0.0- | otherwise = if mx2 == 0.0 then 2.0 * abs (maxP21 xs 0.0) else abs (maxP21 xs 0.0 / mx2)- where maxP21 (x:y:ys) !acc1 = maxP21 ys (if x < y then acc1 + 1.0 else acc1 - 1.0)- maxP21 _ !acc1 = acc1- maxP22 (x:y:ys) !acc1 = maxP22 (y:ys) (if x < y then acc1 + 1.0 else acc1 - 1.0)- maxP22 _ !acc1 = acc1- !mx2 = maxP22 xs 0.0+ | otherwise = if mx2 == 0.0 then 2.0 * abs (maxP21 xs 0) else abs (maxP21 xs 0 / mx2)+ where maxP21 (x:y:ys) !acc1 = maxP21 ys (if x < y then (acc1 + 1)::Int16 else (acc1 - 1)::Int16)+ maxP21 _ !acc1 = fromIntegral acc1+ maxP22 (x:y:ys) !acc1 = maxP22 (y:ys) (if x < y then (acc1 + 1)::Int16 else (acc1 - 1)::Int16)+ maxP22 _ !acc1 = fromIntegral acc1+ !mx2 = maxP22 xs (0::Int16) posMaxIn3 :: (Ord a) => a -> a -> a- -> Int+ -> Int16 posMaxIn3 x y z | x < y = if y < z then 3 else 2 | x < z = 3@@ -35,8 +37,8 @@ maxPosition3 :: RealFrac a => [a] -> a maxPosition3 xs | null xs = 0.0- | length xs `rem` 3 == 0 = 3.0 * fromIntegral (go (h xs) ((0, 0, 0)::(Int,Int,Int)))- | otherwise = fromIntegral (go xs ((0, 0, 0)::(Int,Int,Int)))+ | length xs `rem` 3 == 0 = 3.0 * fromIntegral (go (h xs) ((0, 0, 0)::(Int16,Int16,Int16)))+ | otherwise = fromIntegral (go xs ((0, 0, 0)::(Int16,Int16,Int16))) where h (x:y:z:ys) = posMaxIn3 x y z:h ys h _ = [] go [] (!acc21,!acc22,!acc23)@@ -45,9 +47,9 @@ | otherwise = acc23 go (x:zs) (!acc21,!acc22,!acc23) = go zs (h1 x (acc21,acc22,acc23)) h1 !x (!t,!u,!w)- | x == 1 = (t + 1, u, w)- | x == 2 = (t, u + 1, w)- | otherwise = (t,u,w + 1)+ | x == 1 = (t + (1::Int16), u, w)+ | x == 2 = (t, u + (1::Int16), w)+ | otherwise = (t,u,w + (1::Int16)) evalRhythmicity23 :: (RealFrac a, Floating a) => [a] -> a evalRhythmicity23 xs = maxPosition2 xs * maxPosition2 xs + maxPosition3 xs * maxPosition3 xs
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.1.1.0+version: 0.1.2.0 synopsis: Allows to estimate the rhythmicity metrices for the text (usually, the Ukrainian poetic one) description: Allows to estimate (somewhat to say, evaluate) the rhythmicity metrices for the text (usually, the Ukrainian poetic one, but it can be extrapolated to other ones). Inspired by the ancient Greek and Latin poetry.