phladiprelio-ukrainian-simple 0.3.1.0 → 0.3.2.0
raw patch · 3 files changed
+27/−17 lines, 3 filesdep ~rhythmic-sequences
Dependency ranges changed: rhythmic-sequences
Files
- CHANGELOG.md +7/−0
- app/Main.hs +18/−15
- phladiprelio-ukrainian-simple.cabal +2/−2
CHANGELOG.md view
@@ -41,3 +41,10 @@ * Third version revised B. Added the "-t 2" command line options with weaker and permissive test for irregularities that influences prosody. +## 0.3.2.0 -- 2023-03-29++* Third version revised C. Added the possibility to specify custom hash step. Added the possibility+to run test for average values - with "-t 3" command line options that can give more information+on potentially irregular or unstable line options. Updated the dependency boundaries of +rhythmic-sequences.+
app/Main.hs view
@@ -26,18 +26,18 @@ import Phladiprelio.Ukrainian.ReadDurations import Data.Ord (comparing) -generalF :: FilePath -> Int -> HashCorrections -> (Int8,[Int8]) -> Int -> Bool -> String -> IO [()]-generalF file numTest hc (grps,mxms) k descending rs = do+generalF :: FilePath -> Int -> HashCorrections -> (Int8,[Int8]) -> Int -> Bool -> Int -> String -> IO [()]+generalF file numTest hc (grps,mxms) k descending hashStep rs = do syllableDurationsDs <- readSyllableDurations file let syllN = countSyll rs universalSet = map unwords . permutations . words $ rs- f syllableDurationsDs grps mxms = sum . countHashesG hc grps mxms . mconcat . + f syllableDurationsDs grps mxms = sum . countHashes2G hashStep hc grps mxms . mconcat . (if null file then case k of { 1 -> syllableDurationsD; 2 -> syllableDurationsD2; 3 -> syllableDurationsD3; 4 -> syllableDurationsD4} else if length syllableDurationsDs >= k then syllableDurationsDs !! (k - 1) else syllableDurationsD2) . createSyllablesUkrS- if numTest `elem` [0,2] then do+ if numTest `elem` [0,2,3] then do putStrLn "Feet Val Stat Proxim" mapM (\(q,qs) -> let m = stat1 syllN (q,qs) in let max1 = maximumBy (comparing (f syllableDurationsDs q qs)) universalSet in let mx = f syllableDurationsDs q qs max1 in putStrLn (show (fromEnum q) `mappend` " | " `mappend` show mx `mappend` " " `mappend` show m `mappend` " -> " `mappend` show (100 * fromIntegral mx / fromIntegral m) `mappend` "%")) .- zip [2..7] $ ([1]:(if numTest == 0 then [[2,1],[3,2],[4,3,2],[5,4,3],[6,5,4,3,2]] else [[2],[3],[4,3],[5,4],[6,5,4]]))+ zip [2..7] $ ([1]:(case numTest of { 0 -> [[2,1],[3,2],[4,3,2],[5,4,3],[6,5,4,3,2]]; 2 -> [[2],[3],[4,3],[5,4],[6,5,4]]; 3 -> [[1],[2,1],[3,2,1],[3,2],[4,3,2]]})) else mapM (\(x,y) -> putStrLn (show x `mappend` (' ':y))) . (let h1 = if descending then (\(u,w) -> ((-1) * u, w)) else id in sortOn h1) . map (\xss -> (f syllableDurationsDs grps mxms xss, xss)) $ universalSet countSyll :: String -> Int@@ -55,23 +55,26 @@ hc = readHashCorrections . concat . getB "+c" $ argsB grpp = grouppingR . concat . getB "+r" $ argsB numTest = fromMaybe 1 (readMaybe (concat . getB "-t" $ argsB)::Maybe Int)+ hashStep = fromMaybe 20 (readMaybe (concat . getB "+k" $ argsB)::Maybe Int) helpMessage = oneA "-h" argsA descending = oneA "+n" argsA str1 = unwords . take 7 . words . mconcat . prepareText . unwords $ arg2s if helpMessage then do- putStrLn "Synopsis:"- putStrLn "phladiprelioUkr [+c <HashCorrections encoded>] [+n] [+d <FilePath to file with durations>] [+r <groupping info>] [-t <number of the test or its absense if 1 is here>] [+s <syllable durations function number>] <Ukrainian textual line>"+ putStrLn "SYNOPSIS:" putStrLn ""- putStrLn "+n — if specified then the order of sorting and printing is descending (the reverse one to the default otherwise). "- putStrLn "+s — the next is the digit from 1 to 4 included. The default one is 2. Influences the result in the case of +d parameter is not given. "- putStrLn "+d — see: https://web.archive.org/web/20220610171812/https://raw.githubusercontent.com/OleksandrZhabenko/phonetic-languages-data/main/0.20.0.0/56.csv as a format for the file."- putStrLn "+r — afterwards are several unique digits not greater than 8 in the descending order — the first one is the length of the group of syllables to be considered as a period, the rest — positions of the maximums and minimums. Example: \"543\" means that the line is splitted into groups of 5 syllables starting from the beginning, then the positions of the most maximum (4 = 5 - 1) and the next (smaller) maximum (3 = 4 - 1). If there are no duplicated values then the lowest possible value here is 0, that corresponds to the lowest minimum. If there are duplicates then the lowest value here is the number of the groups of duplicates, e. g. in the sequence 1,6,3,3,4,4,5 that is one group there are two groups of duplicates — with 3 and 4 — and, therefore, the corresponding data after +r should be 7...2. The values less than the lowest minimum are neglected."- putStrLn "+c — see explanation at the link: https://hackage.haskell.org/package/rhythmic-sequences-0.2.3.1/docs/src/Rhythmicity.MarkerSeqs.html#HashCorrections"- putStrLn "-t — and afterwards the digit showing the test for \'smoothness\' (to be more accurate - absense or presense of some irregularities that influences the prosody) to be run - if 0 - more extended and strict, if 2 - less strict, more permissive, otherwise - no tests at all (if no digit is here then it is likely that the first word can be used instead and it will be removed from the input)."- else generalF fileDu numTest hc grpp sylD descending str1 >> return ()+ putStrLn "phladiprelioUkr [+c <HashCorrections encoded>] [+n] [+d <FilePath to file with durations>] [+k <number - hash step>] [+r <groupping info>] [-t <number of the test or its absense if 1 is here>] [+s <syllable durations function number>] <Ukrainian textual line>"+ putStrLn ""+ putStrLn "+n \t— if specified then the order of sorting and printing is descending (the reverse one to the default otherwise). "+ putStrLn "+s \t— the next is the digit from 1 to 4 included. The default one is 2. Influences the result in the case of +d parameter is not given. "+ putStrLn "+d \t— see: https://web.archive.org/web/20220610171812/https://raw.githubusercontent.com/OleksandrZhabenko/phonetic-languages-data/main/0.20.0.0/56.csv as a format for the file."+ putStrLn "+r \t— afterwards are several unique digits not greater than 8 in the descending order — the first one is the length of the group of syllables to be considered as a period, the rest — positions of the maximums and minimums. Example: \"543\" means that the line is splitted into groups of 5 syllables starting from the beginning, then the positions of the most maximum (4 = 5 - 1) and the next (smaller) maximum (3 = 4 - 1). If there are no duplicated values then the lowest possible value here is 0, that corresponds to the lowest minimum. If there are duplicates then the lowest value here is the number of the groups of duplicates, e. g. in the sequence 1,6,3,3,4,4,5 that is one group there are two groups of duplicates — with 3 and 4 — and, therefore, the corresponding data after +r should be 7...2. The values less than the lowest minimum are neglected."+ putStrLn "+c \t— see explanation at the link: https://hackage.haskell.org/package/rhythmic-sequences-0.2.3.1/docs/src/Rhythmicity.MarkerSeqs.html#HashCorrections"+ putStrLn "-t \t— and afterwards the digit showing the test for \'smoothness\' (to be more accurate - absense or presense of some irregularities that influences the prosody) to be run - if 0 - more extended and strict, if 2 - less strict, more permissive, if 3 - the test for some values expected to be not the maximum nor the minimum ones in the line with no repetitions (the most common case), this option for its greatest values tends to give either more \'irregular\' lines (more jumping-like or wavy combinations) than other ones or more \'regular\' ones - it depends on the distribution of not included into account maximums and minimums; the lines with the minimum values here can be of different kinds but they are not \'stable\', otherwise - no tests at all (if no digit is here then it is likely that the first word can be used instead and it will be removed from the input)."+ 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."+ else generalF fileDu numTest hc grpp sylD descending hashStep str1 >> return () bSpecs :: CLSpecifications-bSpecs = zip ["+c","+d","+r","+s","-t"] . cycle $ [1]+bSpecs = zip ["+c","+d","+k","+r","+s","-t"] . cycle $ [1] aSpecs :: CLSpecifications aSpecs = [("-h",0),("+n",0)]
phladiprelio-ukrainian-simple.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: phladiprelio-ukrainian-simple-version: 0.3.1.0+version: 0.3.2.0 -- A short (one-line) description of the package. synopsis: A PhLADiPreLiO implementation for Ukrainian that uses hashes@@ -29,7 +29,7 @@ -- LANGUAGE extensions used by modules in this package. -- other-extensions:- build-depends: base >=4.13 && <5, rhythmic-sequences ==0.2.3.1, ukrainian-phonetics-basic-array ==0.7.0.0, phonetic-languages-ukrainian-array ==0.10.0.0, phladiprelio-ukrainian-shared ==0.1.0.0, cli-arguments ==0.7.0.0+ build-depends: base >=4.13 && <5, rhythmic-sequences ==0.3.0.0, ukrainian-phonetics-basic-array ==0.7.0.0, phonetic-languages-ukrainian-array ==0.10.0.0, phladiprelio-ukrainian-shared ==0.1.0.0, cli-arguments ==0.7.0.0 hs-source-dirs: app default-language: Haskell2010