phonetic-languages-plus 0.6.0.0 → 0.7.1.0
raw patch · 13 files changed
Files
- ChangeLog.md +8/−0
- Data/Statistics/RulesIntervals.hs +0/−41
- Data/Statistics/RulesIntervalsPlus.hs +0/−32
- Distribution/Main.hs +0/−46
- Distribution/Processment.hs +0/−136
- LICENSE +1/−1
- Languages/UniquenessPeriods/Vector/AuxiliaryG.hs +0/−31
- Main.hs +41/−0
- Phladiprelio/AuxiliaryG.hs +34/−0
- Phladiprelio/Distribution.hs +130/−0
- Phladiprelio/RulesIntervals.hs +46/−0
- Phladiprelio/RulesIntervalsPlus.hs +35/−0
- phonetic-languages-plus.cabal +9/−9
ChangeLog.md view
@@ -51,3 +51,11 @@ * Sixth version. Added multiple properties mode. +## 0.7.0.0 -- 2023-02-02++* Seventh version. Switched to NoImplicitPrelude extension. Removed bytestring as a dependency. Updated the dependencies boundaries. Changed the names of the modules. Some minor code changes.++## 0.7.1.0 -- 2023-02-02++* Seventh version revised A. Actually removed bytestring as a dependency.+
− Data/Statistics/RulesIntervals.hs
@@ -1,41 +0,0 @@--- |--- Module : Data.Statistics.RulesIntervals--- Copyright : (c) OleksandrZhabenko 2020--- License : MIT--- Stability : Experimental--- Maintainer : olexandr543@yahoo.com------ Additional statistic rules to choose the number of the intervals.--{-# LANGUAGE BangPatterns #-}--module Data.Statistics.RulesIntervals where--import Data.Lists.FLines (newLineEnding)-import GHC.Real (ceiling)-import GHC.Float (int2Float)-import Data.Maybe (fromMaybe)-import Text.Read (readMaybe)--sturgesH :: Int -> Int-sturgesH n- | compare n 0 == GT = ceiling (logBase 2 (int2Float n))- | otherwise = error $ "sturgesH: undefined for the argument " ++ show n ++ newLineEnding-{-# INLINE sturgesH #-}---- | According to @В. П. Левинський@ (V. P. Levynskyi) from @Опря А. Т. Статистика (модульний варіант з програмованою формою контролю знань).--- Навч. посіб. --- К.: Центр учбової літератури, 2012. --- 448 с. ISBN 978-611-01-0266-7@) page 60. Always return odd values.-levynskyiMod :: Int -> Int-levynskyiMod n- | compare n 100 == LT = g n- | compare n 200 == LT = 11- | compare n 300 == LT = 13- | compare n 400 == LT = 15- | compare n 500 == LT = 17- | otherwise = let !k = sturgesH n in if even k then k + 7 else k + 8- where g n- | compare n 60 == GT = 9- | compare n 40 == GT = 7- | compare n 20 == GT = 5- | otherwise = 3-{-# INLINABLE levynskyiMod #-}
− Data/Statistics/RulesIntervalsPlus.hs
@@ -1,32 +0,0 @@--- |--- Module : Data.Statistics.RulesIntervalsPlus--- Copyright : (c) OleksandrZhabenko 2020--- License : MIT--- Stability : Experimental--- Maintainer : olexandr543@yahoo.com------ Additional statistic rules to choose the number of the intervals.--{-# LANGUAGE BangPatterns #-}--module Data.Statistics.RulesIntervalsPlus where--import Data.Statistics.RulesIntervals-import Data.Maybe (fromMaybe)-import Text.Read (readMaybe)--getIntervalsNS :: Bool -> String -> [String] -> Int-getIntervalsNS lstW xs yss- | xs == "s" = sturgesH z- | xs == "l" = levynskyiMod z- | otherwise = fromMaybe 9 (readMaybe xs::(Maybe Int))- where k = if lstW then 2 else 1- z = length . filter ((> k) . length . words) $ yss-{-# INLINE getIntervalsNS #-}--getIntervalsN :: String -> [a] -> Int-getIntervalsN xs yss- | xs == "s" = sturgesH (length yss)- | xs == "l" = levynskyiMod (length yss)- | otherwise = fromMaybe 9 (readMaybe xs::(Maybe Int))-{-# INLINE getIntervalsN #-}
− Distribution/Main.hs
@@ -1,46 +0,0 @@--- |--- Module : Main--- Copyright : (c) OleksandrZhabenko 2020-2022--- License : MIT--- Stability : Experimental--- Maintainer : olexandr543@yahoo.com------ Analyzes a poetic text in Ukrainian, for every line prints statistic data and--- then for the whole poem prints the hypothesis evaluation information.--- Is used in pair with some other programs, e. g. with propertiesText from uniqueness-periods-vector-exampls package--- or with a new phonetic-languages-ukrainian series.--- ------ To enable parallel computations (potentially, they can speed up the work), please, run the @distributionText@ executable with--- @+RTS -threaded -RTS@ command line options with possibly @-N@ option inside.-----{-# OPTIONS_GHC -threaded -rtsopts #-}--{-# LANGUAGE CPP, BangPatterns #-}--module Main where--import qualified Data.ByteString.Char8 as B-import System.Environment-import Distribution.Processment-#ifdef __GLASGOW_HASKELL__-#if __GLASGOW_HASKELL__==708-/* code that applies only to GHC 7.8.* */-mconcat = concat-#endif-#endif--main :: IO ()-main = do- args00 <- getArgs- let !multiprop = any (== "+m") args00 -- If 'True' then uses multiple properties mode.- !pairwisePermutations = any (== "+p") args00- !whitelines = any (== "+W") args00 -- Usually, if specified -- the third argument- !args0 = filter (\xs -> xs /= "+p" && xs /= "+m" && xs /= "+W") args00- !gzS = mconcat . take 1 $ args0- !printInput = mconcat . drop 1 . take 2 $ args0- contents <- B.getContents- if printInput == "1" then B.putStr contents else B.putStr B.empty- innerProcG pairwisePermutations whitelines gzS multiprop contents-
− Distribution/Processment.hs
@@ -1,136 +0,0 @@--- |--- Module : Distribution.Processment--- Copyright : (c) OleksandrZhabenko 2020-2022--- License : MIT--- Stability : Experimental--- Maintainer : olexandr543@yahoo.com------ Analyzes a poetic text in Ukrainian, for every line prints statistic data and--- then for the whole poem prints the hypothesis evaluation information.--- Is used in pair with some other programs, e. g. with propertiesTextG3 from phonetic-languages-simplified-examples-array package--- or with a new phonetic-languages-ukrainian series.--- The module contains library functions for the program.--- ------ To enable parallel computations (potentially, they can speed up the work), please, run the @distributionText@ executable with--- @+RTS -threaded -RTS@ command line options with possibly @-N@ option inside.-----{-# OPTIONS_GHC -threaded -rtsopts #-}--{-# LANGUAGE CPP, BangPatterns #-}--module Distribution.Processment where--#ifdef __GLASGOW_HASKELL__-#if __GLASGOW_HASKELL__>=710-/* code that applies only to GHC 7.10.* and higher versions */-import GHC.Base (mconcat)-#endif-#endif-import Control.Parallel.Strategies-import Data.Maybe (fromMaybe,isJust,fromJust)-import Text.Read (readMaybe)-import Numeric (showFFloat)-import Data.List (sort)-import Numeric.Stats-import Data.Char (isDigit)-import qualified Data.ByteString.Char8 as B-import Data.Lists.FLines hiding (mconcat)-import Data.Statistics.RulesIntervals-import Data.Statistics.RulesIntervalsPlus-#ifdef __GLASGOW_HASKELL__-#if __GLASGOW_HASKELL__==708-/* code that applies only to GHC 7.8.* */-mconcat = concat-#endif-#endif---- | Sum data type to control whether the functions work with multiple properties or with just one.-data ControlStatsIntervals = U ([Double],[(Int,Int)]) | M [(Int,Int)] deriving (Eq,Show)--isU :: ControlStatsIntervals -> Bool-isU (U _) = True-isU _ = False--isM :: ControlStatsIntervals -> Bool-isM (M _) = True-isM _ = False--data31F (U (x,y)) = Just x-data31F (M _) = Nothing--wordsCnt0_data32F (U (x,y)) = y-wordsCnt0_data32F (M y) = y--maybeDII :: (Int -> Bool) -> ControlStatsIntervals -> Maybe [(Double,(Int,Int))]-maybeDII p (U (xs,ys)) = Just . filter (\(_,(y,_)) -> p y) . zip xs $ ys-maybeDII _ _ = Nothing--numberProps :: B.ByteString -> Int-numberProps contents = maximum . map (subtract 1 . length . filter (B.all isDigit) . B.words) . B.lines $ contents- -innerProcG :: Bool -> Bool -> String -> Bool -> B.ByteString -> IO ()-innerProcG pairwisePermutations whitelines gzS multiprop contents - | multiprop = mapM_ (\i -> processContentsMultiprop i contents >>= \csi -> innerProc pairwisePermutations whitelines gzS csi contents) [1..numberProps contents]- | otherwise = processContents whitelines contents >>= \csi -> innerProc pairwisePermutations whitelines gzS csi contents--innerProc :: Bool -> Bool -> String -> ControlStatsIntervals -> B.ByteString -> IO ()-innerProc pairwisePermutations whitelines gzS csi contents = do- if all ((< 2) . fst) . wordsCnt0_data32F $ csi- then putStrLn (replicate 102 '-') >> putStrLn "1.000+-0.000\tALL!" >> putStrLn (replicate 102 '=') -- Well, this means that all the text consists of the lines that have no variativity from the program perspective and, therefore, they cannot be analyzed effectively by it. Nevertheless, you can accurately exclude them from the consideration. A rather rare occurrence.- else do- let !gz- | isU csi = getIntervalsN gzS (fromJust . data31F $ csi) -- Obtained from the first command line argument except those ones that are for RTS- | otherwise = getIntervalsN gzS . wordsCnt0_data32F $ csi- !mndsp- | isU csi = Just . meanWithDispD2 . map fst . fromJust . maybeDII (>1) $ csi -- Since the 0.6.0.0 version switched to the sample unbiased dispersion with (n - 1) in the denominator.- | otherwise = Nothing- !pairs = sort . filter ((/= 0) . snd) . wordsCnt0_data32F $ csi- g !m !n = (length . takeWhile (\(_,v) -> v == n) . dropWhile (\(_,v) -> v /= n) . takeWhile (\(u,_) -> u == m) .- dropWhile (\(u,_) -> u /= m) $ pairs) `using` rdeepseq- h !y !x = mconcat [mconcat . map (\m1 -> mconcat [mconcat . map (\n1 -> (if y then show (g m1 n1)- else if g m1 n1 == 0 then "." else show (g m1 n1)) ++ "\t") $ [1..gz],newLineEnding]) $- [2..(if pairwisePermutations then 10 else 7)],replicate 102 x]- putStrLn . generalInfo1 pairwisePermutations gz pairs mndsp . length . wordsCnt0_data32F $ csi- putStrLn (h False '~')- putStrLn (h True '=')--processContents :: Bool -> B.ByteString -> IO ControlStatsIntervals-processContents whitelines contents = do- let !anlines = B.lines contents- !anStrs- | whitelines = filter (not . null) . map (drop 6 . take 9 . B.words) $ anlines- | otherwise = map (drop 6 . take 9 . B.words) anlines- !ratioStrs = map (B.unpack . head) anStrs- !wordsNStrs = map (B.unpack . (!! 1)) anStrs- !intervalNStrs = map (B.unpack . last) anStrs- !ratios = map (\xs -> fromMaybe 1.0 (readMaybe xs::Maybe Double)) ratioStrs- !wordsNs = map (\xs -> fromMaybe 0 (readMaybe xs::Maybe Int)) wordsNStrs- !intervalNs = map (\xs -> fromMaybe 0 (readMaybe xs::Maybe Int)) intervalNStrs- return . U $ (ratios,zip wordsNs intervalNs)--processContentsMultiprop :: Int -> B.ByteString -> IO ControlStatsIntervals-processContentsMultiprop propN contents = do- let !anwords = map B.words . B.lines $ contents- !wordsNStrs = map (B.unpack . head) anwords- !intervalNStrs = map (B.unpack . B.concat . drop propN . take (propN + 1)) anwords- !wordsNs = drop 1 . filter (> 0) . map (\xs -> fromMaybe 0 (readMaybe xs::Maybe Int)) $ wordsNStrs- !intervalNs = filter (> 0) . map (\xs -> fromMaybe 0 (readMaybe xs::Maybe Int)) $ intervalNStrs- return . M . zip wordsNs $ intervalNs--generalInfo1 :: Bool -> Int -> [(Int,Int)] -> Maybe (Double,Double) -> Int -> String-generalInfo1 pairwisePermutations gz pairs mndsp ll =- let !ks = map (\r -> length . takeWhile (== r) . dropWhile (/= r) . sort . map snd $ pairs) [1..gz]- !s = sum ks- stringMD- | isJust mndsp = let (mean1,disp) = fromJust mndsp in mconcat [showFFloat (Just 4) mean1 "+-", showFFloat (Just 4) (sqrt disp) "\t"]- | otherwise = "" in- mconcat [replicate 102 '-', newLineEnding, mconcat . map (\r -> show r ++ "\t") $ [1..gz], newLineEnding,- mconcat . map (\r -> show r ++ "\t") $ ks,- newLineEnding, mconcat . map (\r -> showFFloat (Just 2) (fromIntegral (r * 100) / fromIntegral s) "%\t") $ ks,- newLineEnding, stringMD, show (length . filter ((<= 1) . fst) $ pairs), '\t':show ll, newLineEnding,- mconcat . map (\r -> show r ++ "\t") $ [2..(if pairwisePermutations then 10 else 7)], newLineEnding, mconcat .- map (\r -> (show . length . takeWhile (== r) . dropWhile (/= r) . map fst $ pairs) ++ "\t") $- [2..(if pairwisePermutations then 10 else 7)], newLineEnding, replicate 102 '*']-{-# INLINE generalInfo1 #-}
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2020 OleksandrZhabenko+Copyright (c) 2020-2023 Oleksandr Zhabenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
− Languages/UniquenessPeriods/Vector/AuxiliaryG.hs
@@ -1,31 +0,0 @@--- |--- Module : Languages.UniquenessPeriods.Vector.AuxiliaryG--- Copyright : (c) OleksandrZhabenko 2020--- License : MIT--- Stability : Experimental--- Maintainer : olexandr543@yahoo.com------ Is from the @dobutokO-poetry-general@ package. Is included here --- to minimize dependencies of the package. --- Similar functionality is provided by the packages MissingH, extra, ghc --- and other packages, but they have a lot of dependencies, so here there are --- less dependencies module and package.--module Languages.UniquenessPeriods.Vector.AuxiliaryG (- -- * Help functions- lastFrom3- , firstFrom3- , secondFrom3-) where--lastFrom3 :: (a,b,c) -> c-lastFrom3 (_,_,z) = z-{-# INLINE lastFrom3 #-}--firstFrom3 :: (a, b, c) -> a-firstFrom3 (x, _, _) = x-{-# INLINE firstFrom3 #-}--secondFrom3 :: (a, b, c) -> b-secondFrom3 (_, y, _) = y-{-# INLINE secondFrom3 #-}
+ Main.hs view
@@ -0,0 +1,41 @@+-- |+-- Module : Main+-- Copyright : (c) Oleksandr Zhabenko 2020-2023+-- License : MIT+-- Stability : Experimental+-- Maintainer : olexandr543@yahoo.com+--+-- Analyzes a text, for every line prints statistic data and+-- then for the whole text prints the hypothesis evaluation information.+-- Is used in pair with some other programs, e. g. with propertiesTextG3 and propertiesTextG4.+-- +--+-- To enable parallel computations (potentially, they can speed up the work), please, run the @distributionTextG@ executable with+-- @+RTS -threaded -RTS@ command line options with possibly @-N@ option inside.+--++{-# OPTIONS_GHC -threaded -rtsopts #-}++{-# LANGUAGE BangPatterns, NoImplicitPrelude #-}++module Main where++import GHC.Base+import System.Environment+import System.IO+import Phladiprelio.Distribution+import GHC.List++main :: IO ()+main = do+ args00 <- getArgs+ let !multiprop = any (== "+m") args00 -- If 'True' then uses multiple properties mode.+ !pairwisePermutations = any (== "+p") args00+ !whitelines = any (== "+W") args00 -- Usually, if specified -- the third argument+ !args0 = filter (\xs -> xs /= "+p" && xs /= "+m" && xs /= "+W") args00+ !gzS = mconcat . take 1 $ args0+ !printInput = mconcat . drop 1 . take 2 $ args0+ contents <- getContents+ if printInput == "1" then putStr contents else putStr empty+ innerProcG pairwisePermutations whitelines gzS multiprop contents+
+ Phladiprelio/AuxiliaryG.hs view
@@ -0,0 +1,34 @@+-- |+-- Module : Phladiprelio.AuxiliaryG+-- License : MIT+-- Stability : Experimental+-- Maintainer : oleksandr.zhabenko@yahoo.com+--+-- Is from the @dobutokO-poetry-general@ package. Is included here +-- to minimize dependencies of the package. +-- Similar functionality is provided by the packages MissingH, extra, ghc +-- and other packages, but they have a lot of dependencies, so here there are +-- less dependencies module and package.++{-# LANGUAGE NoImplicitPrelude #-}++module Phladiprelio.AuxiliaryG (+ -- * Help functions+ lastFrom3+ , firstFrom3+ , secondFrom3+) where++import GHC.Base++lastFrom3 :: (a,b,c) -> c+lastFrom3 (_,_,z) = z+{-# INLINE lastFrom3 #-}++firstFrom3 :: (a, b, c) -> a+firstFrom3 (x, _, _) = x+{-# INLINE firstFrom3 #-}++secondFrom3 :: (a, b, c) -> b+secondFrom3 (_, y, _) = y+{-# INLINE secondFrom3 #-}
+ Phladiprelio/Distribution.hs view
@@ -0,0 +1,130 @@+-- |+-- Module : Phladiprelio.Distribution+-- Copyright : (c) Oleksandr Zhabenko 2020-2023+-- License : MIT+-- Stability : Experimental+-- Maintainer : oleksandr.zhabenko@yahoo.com+--+-- Analyzes a poetic text in Ukrainian, for every line prints statistic data and+-- then for the whole poem prints the hypothesis evaluation information.+-- Is used in pair with some other programs, e. g. with propertiesTextG3 from phonetic-languages-simplified-examples-array package+-- or with a new phonetic-languages-ukrainian series.+-- The module contains library functions for the program.+-- +--+-- To enable parallel computations (potentially, they can speed up the work), please, run the @distributionText@ executable with+-- @+RTS -threaded -RTS@ command line options with possibly @-N@ option inside.+--++{-# OPTIONS_GHC -threaded -rtsopts #-}++{-# LANGUAGE BangPatterns, NoImplicitPrelude #-}++module Phladiprelio.Distribution where++import GHC.Base+import GHC.Real+import GHC.Float+import Data.Tuple+import System.IO+import GHC.Num ((+),subtract,(*)) +import Control.Parallel.Strategies+import Data.Maybe (fromMaybe,isJust,fromJust)+import Text.Read (readMaybe)+import Numeric (showFFloat)+import Data.List+import Numeric.Stats+import Data.Char (isDigit)+import Data.Lists.FLines hiding (mconcat)+import Phladiprelio.RulesIntervals+import Phladiprelio.RulesIntervalsPlus+import Text.Show (Show(..),show)++-- | Sum data type to control whether the functions work with multiple properties or with just one.+data ControlStatsIntervals = U ([Double],[(Int,Int)]) | M [(Int,Int)] deriving (Eq,Show)++isU :: ControlStatsIntervals -> Bool+isU (U _) = True+isU _ = False++isM :: ControlStatsIntervals -> Bool+isM (M _) = True+isM _ = False++data31F (U (x,y)) = Just x+data31F (M _) = Nothing++wordsCnt0_data32F (U (x,y)) = y+wordsCnt0_data32F (M y) = y++maybeDII :: (Int -> Bool) -> ControlStatsIntervals -> Maybe [(Double,(Int,Int))]+maybeDII p (U (xs,ys)) = Just . filter (\(_,(y,_)) -> p y) . zip xs $ ys+maybeDII _ _ = Nothing++numberProps :: String -> Int+numberProps contents = maximum . map (subtract 1 . length . filter (all isDigit) . words) . lines $ contents+ +innerProcG :: Bool -> Bool -> String -> Bool -> String -> IO ()+innerProcG pairwisePermutations whitelines gzS multiprop contents + | multiprop = mapM (\i -> processContentsMultiprop i contents >>= \csi -> innerProc pairwisePermutations whitelines gzS csi contents) [1..numberProps contents] >> return ()+ | otherwise = processContents whitelines contents >>= \csi -> innerProc pairwisePermutations whitelines gzS csi contents++innerProc :: Bool -> Bool -> String -> ControlStatsIntervals -> String -> IO ()+innerProc pairwisePermutations whitelines gzS csi contents = do+ if all ((< 2) . fst) . wordsCnt0_data32F $ csi+ then putStrLn (replicate 80 '-') >> putStrLn "1.000+-0.000\tALL!" >> putStrLn (replicate 80 '=') -- Well, this means that all the text consists of the lines that have no variativity from the program perspective and, therefore, they cannot be analyzed effectively by it. Nevertheless, you can accurately exclude them from the consideration. A rather rare occurrence.+ else do+ let !gz+ | isU csi = getIntervalsN gzS (fromJust . data31F $ csi) -- Obtained from the first command line argument except those ones that are for RTS+ | otherwise = getIntervalsN gzS . wordsCnt0_data32F $ csi+ !mndsp+ | isU csi = Just . meanWithDispD2 . map fst . fromJust . maybeDII (>1) $ csi -- Since the 0.6.0.0 version switched to the sample unbiased dispersion with (n - 1) in the denominator.+ | otherwise = Nothing+ !pairs = sort . filter ((/= 0) . snd) . wordsCnt0_data32F $ csi+ g !m !n = (length . takeWhile (\(_,v) -> v == n) . dropWhile (\(_,v) -> v /= n) . takeWhile (\(u,_) -> u == m) .+ dropWhile (\(u,_) -> u /= m) $ pairs) `using` rdeepseq+ h !y !x = mconcat [mconcat . map (\m1 -> mconcat [mconcat . map (\n1 -> (if y then show (g m1 n1)+ else if g m1 n1 == 0 then "." else show (g m1 n1)) ++ "\t") $ [1..gz],newLineEnding]) $+ [2..(if pairwisePermutations then 10 else 7)],replicate 80 x]+ putStrLn . generalInfo1 pairwisePermutations gz pairs mndsp . length . wordsCnt0_data32F $ csi+ putStrLn (h False '~')+ putStrLn (h True '=')++processContents :: Bool -> String -> IO ControlStatsIntervals+processContents whitelines contents = do+ let !anlines = lines contents+ !anStrs+ | whitelines = filter (not . null) . map (drop 6 . take 9 . words) $ anlines+ | otherwise = map (drop 6 . take 9 . words) anlines+ !ratioStrs = map head anStrs+ !wordsNStrs = map (!! 1) anStrs+ !intervalNStrs = map last anStrs+ !ratios = map (\xs -> fromMaybe 1.0 (readMaybe xs::Maybe Double)) ratioStrs+ !wordsNs = map (\xs -> fromMaybe 0 (readMaybe xs::Maybe Int)) wordsNStrs+ !intervalNs = map (\xs -> fromMaybe 0 (readMaybe xs::Maybe Int)) intervalNStrs+ return . U $ (ratios,zip wordsNs intervalNs)++processContentsMultiprop :: Int -> String -> IO ControlStatsIntervals+processContentsMultiprop propN contents = do+ let !anwords = map words . lines $ contents+ !wordsNStrs = map head anwords+ !intervalNStrs = map (concat . drop propN . take (propN + 1)) anwords+ !wordsNs = drop 1 . filter (> 0) . map (\xs -> fromMaybe 0 (readMaybe xs::Maybe Int)) $ wordsNStrs+ !intervalNs = filter (> 0) . map (\xs -> fromMaybe 0 (readMaybe xs::Maybe Int)) $ intervalNStrs+ return . M . zip wordsNs $ intervalNs++generalInfo1 :: Bool -> Int -> [(Int,Int)] -> Maybe (Double,Double) -> Int -> String+generalInfo1 pairwisePermutations gz pairs mndsp ll =+ let !ks = map (\r -> length . takeWhile (== r) . dropWhile (/= r) . sort . map snd $ pairs) [1..gz]+ !s = sum ks+ stringMD+ | isJust mndsp = let (mean1,disp) = fromJust mndsp in mconcat [showFFloat (Just 4) mean1 "+-", showFFloat (Just 4) (sqrt disp) "\t"]+ | otherwise = "" in+ mconcat [replicate 80 '-', newLineEnding, mconcat . map (\r -> show r ++ "\t") $ [1..gz], newLineEnding,+ mconcat . map (\r -> show r ++ "\t") $ ks,+ newLineEnding, mconcat . map (\r -> showFFloat (Just 2) (fromIntegral (r * 100) / fromIntegral s) "%\t") $ ks,+ newLineEnding, stringMD, show (length . filter ((<= 1) . fst) $ pairs), '\t':show ll, newLineEnding,+ mconcat . map (\r -> show r ++ "\t") $ [2..(if pairwisePermutations then 10 else 7)], newLineEnding, mconcat .+ map (\r -> (show . length . takeWhile (== r) . dropWhile (/= r) . map fst $ pairs) ++ "\t") $+ [2..(if pairwisePermutations then 10 else 7)], newLineEnding, replicate 80 '*']+{-# INLINE generalInfo1 #-}
+ Phladiprelio/RulesIntervals.hs view
@@ -0,0 +1,46 @@+-- |+-- Module : Phladiprelio.RulesIntervals+-- Copyright : (c) Oleksandr Zhabenko 2020-2023+-- License : MIT+-- Stability : Experimental+-- Maintainer : oleksandr.zhabenko@yahoo.com+--+-- Additional statistic rules to choose the number of the intervals.++{-# LANGUAGE BangPatterns, NoImplicitPrelude #-}++module Phladiprelio.RulesIntervals where++import GHC.Base+import GHC.Num ((+))+import GHC.Float (logBase)+import Data.Lists.FLines (newLineEnding)+import GHC.Real (ceiling, even)+import GHC.Float (int2Float)+import Data.Maybe (fromMaybe)+import Data.List (filter, words)+import Text.Read (readMaybe)+import Text.Show (show)++sturgesH :: Int -> Int+sturgesH n+ | compare n 0 == GT = ceiling (logBase 2 (int2Float n))+ | otherwise = error $ "Phladiprelio.RulesIntervals.sturgesH: undefined for the argument " ++ show n ++ newLineEnding+{-# INLINE sturgesH #-}++-- | According to @В. П. Левинський@ (V. P. Levynskyi) from @Опря А. Т. Статистика (модульний варіант з програмованою формою контролю знань).+-- Навч. посіб. --- К.: Центр учбової літератури, 2012. --- 448 с. ISBN 978-611-01-0266-7@) page 60. Always return odd values.+levynskyiMod :: Int -> Int+levynskyiMod n+ | compare n 100 == LT = g n+ | compare n 200 == LT = 11+ | compare n 300 == LT = 13+ | compare n 400 == LT = 15+ | compare n 500 == LT = 17+ | otherwise = let !k = sturgesH n in if even k then k + 7 else k + 8+ where g n+ | compare n 60 == GT = 9+ | compare n 40 == GT = 7+ | compare n 20 == GT = 5+ | otherwise = 3+{-# INLINABLE levynskyiMod #-}
+ Phladiprelio/RulesIntervalsPlus.hs view
@@ -0,0 +1,35 @@+-- |+-- Module : Phladiprelio.RulesIntervalsPlus+-- Copyright : (c) Oleksandr Zhabenko 2020-2023+-- License : MIT+-- Stability : Experimental+-- Maintainer : oleksandr.zhabenko@yahoo.com+--+-- Additional statistic rules to choose the number of the intervals.++{-# LANGUAGE BangPatterns, NoImplicitPrelude #-}++module Phladiprelio.RulesIntervalsPlus where++import GHC.Base+import GHC.List (length, filter)+import Phladiprelio.RulesIntervals+import Data.Maybe (fromMaybe)+import Text.Read (readMaybe)+import Data.List (words)++getIntervalsNS :: Bool -> String -> [String] -> Int+getIntervalsNS lstW xs yss+ | xs == "s" = sturgesH z+ | xs == "l" = levynskyiMod z+ | otherwise = fromMaybe 9 (readMaybe xs::(Maybe Int))+ where k = if lstW then 2 else 1+ z = length . filter ((> k) . length . words) $ yss+{-# INLINE getIntervalsNS #-}++getIntervalsN :: String -> [a] -> Int+getIntervalsN xs yss+ | xs == "s" = sturgesH (length yss)+ | xs == "l" = levynskyiMod (length yss)+ | otherwise = fromMaybe 9 (readMaybe xs::(Maybe Int))+{-# INLINE getIntervalsN #-}
phonetic-languages-plus.cabal view
@@ -3,14 +3,14 @@ -- http://haskell.org/cabal/users-guide/ name: phonetic-languages-plus-version: 0.6.0.0+version: 0.7.1.0 synopsis: Some common shared between different packages functions. description: Among them are the uniqueness-periods-vector series. homepage: https://hackage.haskell.org/package/phonetic-languages-plus license: MIT license-file: LICENSE author: OleksandrZhabenko-maintainer: olexandr543@yahoo.com+maintainer: oleksandr.zhabenko@yahoo.com copyright: Oleksandr Zhabenko category: Language, Math, Game build-type: Simple@@ -18,18 +18,18 @@ cabal-version: >=1.10 library- exposed-modules: Languages.UniquenessPeriods.Vector.AuxiliaryG, Data.Statistics.RulesIntervals, Data.Statistics.RulesIntervalsPlus, Distribution.Processment+ exposed-modules: Phladiprelio.AuxiliaryG, Phladiprelio.RulesIntervals, Phladiprelio.RulesIntervalsPlus, Phladiprelio.Distribution -- other-modules:- other-extensions: CPP, BangPatterns- build-depends: base >=4.8 && <5, bytestring >= 0.10 && <1, lists-flines >=0.1.2 && <1, uniqueness-periods-vector-stats ==0.3.0.0, parallel >=3.2.0.6 && <4+ other-extensions: BangPatterns, NoImplicitPrelude+ build-depends: base >=4.13 && <5, lists-flines ==0.1.3.0, uniqueness-periods-vector-stats ==0.4.0.0, parallel >=3.2.2.0 && <4 -- hs-source-dirs: default-language: Haskell2010 executable distributionTextG main-is: Main.hs- other-modules: Data.Statistics.RulesIntervals, Data.Statistics.RulesIntervalsPlus, Distribution.Processment- other-extensions: CPP, BangPatterns- build-depends: base >=4.8 && <5, bytestring >= 0.10 && <1, lists-flines >=0.1.2 && <1, uniqueness-periods-vector-stats ==0.3.0.0, parallel >=3.2.0.6 && <4+ other-modules: Phladiprelio.AuxiliaryG, Phladiprelio.RulesIntervals, Phladiprelio.RulesIntervalsPlus, Phladiprelio.Distribution+ other-extensions: BangPatterns, NoImplicitPrelude+ build-depends: base >=4.13 && <5, lists-flines ==0.1.3.0, uniqueness-periods-vector-stats ==0.4.0.0, parallel >=3.2.2.0 && <4 ghc-options: -threaded -rtsopts- hs-source-dirs: ., Distribution+ -- hs-source-dirs: ., Distribution default-language: Haskell2010