phladiprelio-ukrainian-simple 0.15.1.0 → 0.15.2.0
raw patch · 4 files changed
+38/−31 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Phladiprelio.Ukrainian.IO: outputWithFile :: (Eq a1, Num a1, Foldable t1, Foldable t2) => t1 a2 -> t2 a3 -> [PhladiprelioUkr] -> FilePath -> [[[[Sound8]]] -> [[Double]]] -> Int -> a1 -> Int -> FilePath -> Int -> IO ()
+ Phladiprelio.Ukrainian.IO: outputWithFile :: (Eq a1, Num a1) => String -> [Double] -> [PhladiprelioUkr] -> FilePath -> [[[[Sound8]]] -> [[Double]]] -> Int -> a1 -> Int -> FilePath -> Int -> IO ()
Files
- CHANGELOG.md +4/−0
- Main.hs +27/−25
- Phladiprelio/Ukrainian/IO.hs +6/−5
- phladiprelio-ukrainian-simple.cabal +1/−1
CHANGELOG.md view
@@ -204,3 +204,7 @@ * Fifteenth version revised A. Added selective help for -h command line option with general context and without it (see README.md file). Some code refactoring. Added new functions to simplify understanding and testing. +## 0.15.2.0 -- 2023-12-30++* Fifteenth version revised B. Changed the function to count syllables in test and other cases modes. Now it includes the "\_{set of digits}" groups as syllables. Some code deduplication in help function. Some minor documentation improvements.+
Main.hs view
@@ -172,28 +172,30 @@ | xs == "k" = putStrLn "+k \t— and then the number greater than 2 (better, greater than 12, the default value if not specified is 20). The greater value leads to greater numbers. The number less than some infimum here leads to wiping of some information from the result and, therefore, probably is not the desired behaviour. For most cases the default value is just enough sensible, but you can give it a try for other values.\n" | xs == "x" = putStrLn "+x \t— If specified with the further natural number then means that instead of maximum 7 words or their concatenations that can be analysed together as a line there will be taken the specified number here or 9 if the number is greater than 8. More words leads to more computations, therefore, please, use with this caution in mind. It can be useful mostly for the cases with the additional constraints specified (+a ... -a or +b ... -b groups, see above).\n" | xs == "m" = putStrLn "+m \t— If present followed with two arguments — the name of the file to be used for reading data for multiline processment and the second one — the number of line to be processed. The numeration of the lines in the file for the phladiprelioUkr program here starts from 1 (so, it is: 1, 2, 3, 4,.. etc). The program then uses instead of text the specified line from the file specified here and prints information about its previous and next lines (if available).\n"- | xs == "m2" || xs == "m3" = putStrLn "+m2 \t— If present, it means that the line with the corresponding number specified here will be taken from the same file specified as +m <file>. For example, the entry +m <file> 1 +m2 4 means that 1 line will be taken from the file <file> for the similarity analysis and it will be compared not with contents of +l2 ... -l2, but with the 4th line from the same file. \nThe abbreviation for +m <file> <num1> +m2 <num2> is +m3 <file> <num1> <num2>, which has the same meaning but a slightly shorter entry. \nIf <num1> == <num2>, then there is at least one of all the options with a property value of 0. \nYou can also use the \"music\" mode, which allows you to write better lyrics and music. To do this, you can add a record of the form _{set of digits} or ={set of digits} to a word or between syllables after the needed to be referred to, and this set of digits will be converted to a positive double-precision number by the program so that the first digit in the record is a whole number and the rest is a fraction (mantissa). \nIf you have added _{set of digits} then this number will be multiplied by the duration of the syllable to which this insertion refers, and the resulting number will be placed among the others in the place where this entry is inserted. \nIf you have added ={a set of digits} then this number will also be multiplied by the duration of the syllable to which this insertion refers, and the resulting number will be placed instead the duration that it was multiplied by. This allows to make syllables longer or shorter to follow language or creative intentions and rules (e. g. in French there have been noticed that the duration of the last syllable in the word, especially in the sentence or phrase is prolonged to some extent, so you can use '=12' or '=13' or '=14' here). Not as for the _{set of digits} group, you can place it only after the syllable and only once to change the duration of the syllable. If you use this option, the following _{set of digits} will be referred to the new changed duration here, so that \"так\"=2_05_1 will mean that you will use instead of the usual duration of the syllable \"так\" the twice as much duration, and then half of this twice as much (therefore, equal to duration of the syllable without altering) and then again the twice as much duration etc. The insertion of =1, =10, =100, =1000 etc will not change anything at all, except for the time of computations (you probably do not need this). \nThese two additional possibilities allows you to change rhythmic structures, and interpret this insert as a musical pause or, conversely, a musical phrase inserted to change the rhythm. What syllable does this insertion refer to? If it's at the beginning of a line, it refers to the first syllable in the line (which comes after the insertion). If it comes after a syllable, it refers to that syllable. There can be several such inserts, their number is not limited by the program itself (in the program code), but a significant number of inserts can significantly increase the duration of the calculation. \n\nWhen the results of the program are displayed on the screen, these inserts will also be displayed in the appropriate places. \n\nIf you specify _1, _10, _100, _1000, etc. as such an insertion, the program will assume that this insertion duration is equal to the duration of the syllable to which it refers. If the set of digits is preceded by a 0, the insertion has a shorter duration, if the 1 in the first 4 examples above is followed by digits other than 0, or if another digit is used instead of 1 or 0, the insertion has a longer duration. For example, _05 means exactly half the duration of the syllable, and _2 means double the duration.\n\nFor the \"music\" mode the number of syllables printed for the line does not include the inserts. So the property value can be greater than this number."- | xs == "+n" = mapM helpPrint ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","n"] >> return ()- | xs == "+l" = mapM helpPrint ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","l"] >> return ()- | xs == "+w" = mapM helpPrint ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","w"] >> return ()- | xs == "+s" = mapM helpPrint ["0","1","OR","2","OR","4","OR","5","OR","6","s"] >> return ()- | xs == "+d" = mapM helpPrint ["0","1","OR","2","OR","4","OR","5","OR","6","d"] >> return ()- | xs == "-p" = mapM helpPrint ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","p"] >> return ()- | xs == "+f" = mapM helpPrint ["0","1","OR","3","OR","4","OR","5","OR","6","f"] >> return ()- | xs == "+dc" = mapM helpPrint ["0","1","OR","3","OR","4","OR","5","OR","6","dc"] >> return ()- | xs == "+a" = mapM helpPrint ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","a"] >> return ()- | xs == "+b" = mapM helpPrint ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","b"] >> return ()- | xs == "+l2" = mapM helpPrint ["0","4","l2"] >> return ()- | xs == "+q" = mapM helpPrint ["0","4","OR","5","OR","6","q"] >> return ()- | xs == "+ul" = mapM helpPrint ["0","3","ul"] >> return ()- | xs == "+r" = mapM helpPrint ["0","1","r"] >> return ()- | xs == "+c" = mapM helpPrint ["0","1","OR","2","c"] >> return ()- | xs == "-t" = mapM helpPrint ["0","2","t"] >> return ()- | xs == "-C" = mapM helpPrint ["0","2","C"] >> return ()- | xs == "+k" = mapM helpPrint ["0","1","OR","2","k"] >> return ()- | xs == "+x" = mapM helpPrint ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","x"] >> return ()- | xs == "+m" = mapM helpPrint ["0","5","m"] >> return ()- | xs == "+m2" = mapM helpPrint ["0","5","m2"] >> return ()- | xs == "+m3" = mapM helpPrint ["0","6","m3"] >> return ()- | otherwise = mapM helpPrint ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","n","l","w","s","d","p","f","dc","a","b","l2","q","ul","r","c","t","C","k","x","m","m2"] >> return ()-+ | xs == "m2" || xs == "m3" = putStrLn "+m2 \t— If present, it means that the line with the corresponding number specified here will be taken from the same file specified as +m <file>. For example, the entry +m <file> 1 +m2 4 means that 1 line will be taken from the file <file> for the similarity analysis and it will be compared not with contents of +l2 ... -l2, but with the 4th line from the same file. \nThe abbreviation for +m <file> <num1> +m2 <num2> is +m3 <file> <num1> <num2>, which has the same meaning but a slightly shorter entry. \nIf <num1> == <num2>, then there is at least one of all the options with a property value of 0. \nYou can also use the \"music\" mode, which allows you to write better lyrics and music. To do this, you can add a record of the form _{set of digits} or ={set of digits} to a word or between syllables after the needed to be referred to, and this set of digits will be converted to a positive double-precision number by the program so that the first digit in the record is a whole number and the rest is a fraction (mantissa). \nIf you have added _{set of digits} then this number will be multiplied by the duration of the syllable to which this insertion refers, and the resulting number will be placed among the others in the place where this entry is inserted. \nIf you have added ={a set of digits} then this number will also be multiplied by the duration of the syllable to which this insertion refers, and the resulting number will be placed instead the duration that it was multiplied by. This allows to make syllables longer or shorter to follow language or creative intentions and rules (e. g. in French there have been noticed that the duration of the last syllable in the word, especially in the sentence or phrase is prolonged to some extent, so you can use '=12' or '=13' or '=14' here). Not as for the _{set of digits} group, you can place it only after the syllable and only once to change the duration of the syllable. If you use this option, the following _{set of digits} will be referred to the new changed duration here, so that \"так\"=2_05_1 will mean that you will use instead of the usual duration of the syllable \"так\" the twice as much duration, and then half of this twice as much (therefore, equal to duration of the syllable without altering) and then again the twice as much duration etc. The insertion of =1, =10, =100, =1000 etc will not change anything at all, except for the time of computations (you probably do not need this). \nThese two additional possibilities allows you to change rhythmic structures, and interpret this insert as a musical pause or, conversely, a musical phrase inserted to change the rhythm. What syllable does this insertion refer to? It refers to the previous syllable in the line. There can be several such inserts, their number is not limited by the program itself (in the program code), but a significant number of inserts can significantly increase the duration of the calculation. \n\nWhen the results of the program are displayed on the screen, these inserts will also be displayed in the appropriate places. \n\nIf you specify _1, _10, _100, _1000, etc. as such an insertion, the program will assume that this insertion duration is equal to the duration of the syllable to which it refers. If the set of digits is preceded by a 0, the insertion has a shorter duration, if the 1 in the first 4 examples above is followed by digits other than 0, or if another digit is used instead of 1 or 0, the insertion has a longer duration. For example, _05 means exactly half the duration of the syllable, and _2 means double the duration.\n\nFor the \"music\" mode the number of syllables printed for the line does include the inserts (since the version 0.15.2.0)."+ | otherwise = helpFE xs+ where helpFE xs = mapM helpPrint js >> return ()+ js + | xs == "+n" = ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","n"] + | xs == "+l" = ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","l"] + | xs == "+w" = ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","w"] + | xs == "+s" = ["0","1","OR","2","OR","4","OR","5","OR","6","s"] + | xs == "+d" = ["0","1","OR","2","OR","4","OR","5","OR","6","d"] + | xs == "-p" = ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","p"] + | xs == "+f" = ["0","1","OR","3","OR","4","OR","5","OR","6","f"] + | xs == "+dc" = ["0","1","OR","3","OR","4","OR","5","OR","6","dc"] + | xs == "+a" = ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","a"] + | xs == "+b" = ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","b"] + | xs == "+l2" = ["0","4","l2"] + | xs == "+q" = ["0","4","OR","5","OR","6","q"] + | xs == "+ul" = ["0","3","ul"] + | xs == "+r" = ["0","1","r"] + | xs == "+c" = ["0","1","OR","2","c"] + | xs == "-t" = ["0","2","t"] + | xs == "-C" = ["0","2","C"] + | xs == "+k" = ["0","1","OR","2","k"] + | xs == "+x" = ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","x"] + | xs == "+m" = ["0","5","m"] + | xs == "+m2" = ["0","5","m2"] + | xs == "+m3" = ["0","6","m3"] + | otherwise = ["0","1","OR","2","OR","3","OR","4","OR","5","OR","6","n","l","w","s","d","p","f","dc","a","b","l2","q","ul","r","c","t","C","k","x","m","m2"]
Phladiprelio/Ukrainian/IO.hs view
@@ -101,7 +101,8 @@ show (S i j xs) = showBignum 7 j `mappend` " " `mappend` xs `mappend` " " `mappend` showWithSpaces 4 i countSyll :: String -> Int-countSyll xs = fromEnum . foldr (\x y -> if isVowel1 x then y + 1 else y) 0 . convertToProperUkrainianI8 $ xs+countSyll xs = numUnderscoresSyll + (fromEnum . foldr (\x y -> if isVowel1 x then y + 1 else y) 0 . convertToProperUkrainianI8 $ xs)+ where numUnderscoresSyll = length . filter (\xs -> let (ys,ts) = splitAt 1 xs in ys == "_" && all isDigit ts && not (null ts)) . groupBy (\x y -> x=='_' && isDigit y) $ xs stat1 :: Int -> (Int8,[Int8]) -> Int stat1 n (k, ks) = fst (n `quotRemInt` fromEnum k) * length ks@@ -145,7 +146,7 @@ -- | Part of the 'generalF' for processment in case of using tests mode. testsOutput :: (Show a1, Integral a1) =>- Bool+ Bool -- ^ Whether to run tests concurrently or not. 'True' corresponds to concurrent execution that can speed up the getting results but use more resources. -> Int -> (p1 -> [a2] -> p2 -> Int8 -> [Int8] -> String -> a1) -> p1@@ -168,9 +169,9 @@ -- | Part of 'generalF' for processment with a file. outputWithFile- :: (Eq a1, Num a1, Foldable t1, Foldable t2) =>- t1 a2- -> t2 a3+ :: (Eq a1, Num a1) =>+ String -- ^ If not null than instead of rhythmicity evaluation using hashes and and feets, there is computed a diversity property for the specified 'String' here using the 'selectSounds' function. For more information, see: 'https://oleksandr-zhabenko.github.io/uk/rhythmicity/PhLADiPreLiO.Eng.21.html#types'+ -> [Double] -- ^ A list of non-negative values normed by 1.0 (the greatest of which is 1.0) that the line options are compared with. If null, then the program works as for version 0.12.1.0 without this newly-introduced argument since the version 0.13.0.0. The length of it must be a least common multiplier of the (number of syllables plus number of \'_digits\' groups) to work correctly. Is not used when the next 'FilePath' and 'String' arguments are not null. -> [PhladiprelioUkr] -> FilePath -- ^ The file to read the sound representation durations from. -> [[[[Sound8]]] -> [[Double]]]
phladiprelio-ukrainian-simple.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: phladiprelio-ukrainian-simple-version: 0.15.1.0+version: 0.15.2.0 -- A short (one-line) description of the package. synopsis: A PhLADiPreLiO implementation for Ukrainian that uses hashes and asynchronous concurrency.