packages feed

rhythmic-sequences 0.2.1.0 → 0.2.2.0

raw patch · 4 files changed

+40/−15 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -36,3 +36,8 @@ * Second version revised B. Changed the defaults for the new functions. Added the possibility to   parse the '-' sign into the negative second parameter  in HashCorrections. +## 0.2.2.0 -- 2023-03-17++* Second version revised C. Some performance improvements for splitF function. Documentation +improvements.+
README.md view
@@ -12,8 +12,8 @@ It is the way to evaluate the rhythmic properties accordingly to the basic ideas there  and to avoid the issues with the previous realization. -P.S.: the author would like to devote this project to support the Fund GASTROSTARS.-If you would like to share some financial support, please, contact the fund+P.S.: the author would like to devote this project to support the Foundation GASTROSTARS.+If you would like to share some financial support, please, contact the foundation using the URL:  https://gastrostars.nl/hou-mij-op-de-hoogte
rhythmic-sequences.cabal view
@@ -2,7 +2,7 @@ name:               rhythmic-sequences  -- The package version.-version:            0.2.1.0+version:            0.2.2.0  -- A short (one-line) description of the package. synopsis:
src/Rhythmicity/MarkerSeqs.hs view
@@ -82,19 +82,18 @@  -- | Split the list into lists of @n@ elements where @n@ is the first parameter. splitF :: Int -> [a] -> [[a]]-splitF n ys =-   let q = length ys `quot` n-       rs = take (q * n) ys in f' n rs-        where f' n ks@(_:_) = let (ts,ws) = splitAt n ks in ts : f' n ws-              f' _ _ = []+splitF n ys =  f' n q ys+   where q = length ys `quot` n+         f' n q ks@(_:_) = let (ts,ws) = splitAt n ks in ts : f' n (q - 1) ws+         f' _ 0 _ = []   -- | Function to get basic data for hash-based evaluation of the rhythmicity of the list data. Is -- used internally in the 'countHashesG'. -- Provided here mostly for testing purposes. getHashes2 -  :: Ord a => Int8 -- ^ The period of the groups (the length of the lists into which the general sequence is splitted at first).-  -> [Int8] -- ^ The list must be sorted in the descending order, the elements must be greater than -1 and less than the first argument here and there must not be repetitions in the list.  -  -> [a] +  :: Ord a => Int8 -- ^ A period of the groups (the length of the lists into which the general sequence is splitted at first).+  -> [Int8] -- ^ The list must be sorted in the descending order, the elements must be greater or equal to 0 and less than the first argument of 'getHashes2' here; besides, there must not be repetitions (any duplicates) in the list so all the elements must be pairwise not equal.  +  -> [a] -- ^ A list of 'Ord' data values that is evaluated for its rhythmic properties.   -> [[Integer]] getHashes2 selmarkNum ks xs = map (map toNum . filter (not . null) . map (idList ks) .  -- before this mapping the smallest element can potentially have 'orD' equal to 0 or greater than 0. The greatest element has 'orD' equal to @selmarkNum - 1@ (@= periodLength - 1@).  g [selmarkNum-1,selmarkNum-2..] . sort . @@ -146,25 +145,46 @@ hashList (H xs _) = xs `mappend` cycle [0] {-# INLINE hashList #-} --- | If you would like to specify just your own values then specify the 'String' \"0...\" where+-- | If you would like to specify just your own values then specify the 'String' \"a...\" where+-- \'a\' here means the minus sign \'-\' or some not equal to 1 or 2 digit,  -- instead of dots specify some digits that are the beginning of the ['Int8'] list in+-- 'HashCorrections'. If \'a\' is \'-\', then the next not equal to \'a\' symbol should be+-- some digit not equal to 1 or 2 if you want to specify your own list of @[Int8]@ for  -- 'HashCorrections'.+-- -- Caution:  --  -- > readHashCorrections . show $ xs /= xs -- -- > show . readHashCorrections $ xs /= xs ----- in general case. The default value is @H [0,0..] 0@.+-- in general case. The default value is @H [0,0..] 0@. This one corresponds to usage of the+-- 'hashBalancingLF2' without any corrections (equi-sensitive to all the parts of the line except +-- probably the last syllables if the number of syllables is not wholely divisible without remainder+-- to the groupLength parameter in the 'countHashesG' function).+--  readHashCorrections :: String -> HashCorrections readHashCorrections xs = if length ys > 1 then let (ts,us) = splitAt 1 ys in H (map (\x -> read [x]::Int8) us) (if sgn then (-(read ts::Int8)) else (read ts::Int8)) else H [0,0..] 0    where ys = filter (\x -> isDigit x) xs          sgn = any (== '-') xs  -- | This is used to provide the second and the third arguments to 'countHashesG' function. The--- default value is @(4,[4,3])@ that should be related to disyllables metrical feet.+-- default value is @(4,[3,2])@. This means that the line is divided into groups of 4-syllables +-- then there are searched for rhythmic repetitions of the positions of the most maximum values+-- and the less maximum values. This scheme should is related to disyllables metrical feet for SaaW +-- (syllables-as-a-whole) mode of operation for PhLADiPreLiO (see: +-- https://oleksandrzhabenko.github.io/uk/rhythmicity/PhLADiPreLiO.Eng.21.html#SaaW).+-- For more information on the metrical feet you can see e. g. +--+-- > @article{kagerfeet,+-- >   title={Feet and metrical stress},+-- >   author={Kager, Rene},+-- >   journal={This page intentionally left blank},+-- >   pages={195}+-- > }+-- grouppingR :: String -> (Int8, [Int8])-grouppingR xs = if length ys > 1 then let (ts,us) = splitAt 1 ys in (read ts::Int8, map (\x -> read [x]::Int8) us) else (4,[4,3])+grouppingR xs = if length ys > 1 then let (ts,us) = splitAt 1 ys in (read ts::Int8, map (\x -> read [x]::Int8) us) else (4,[3,2])    where ys = take 8 . filter (\x -> isDigit x) $ xs  -- | General implementation of  the hash-based algorithm to evaluate the level of rhythmicity