uniqueness-periods-vector-examples 0.2.0.0 → 0.3.0.0
raw patch · 3 files changed
+58/−1 lines, 3 filesnew-component:exe:uniqVec03
Files
- ChangeLog.md +5/−0
- Proportion/Main.hs +44/−0
- uniqueness-periods-vector-examples.cabal +9/−1
ChangeLog.md view
@@ -15,3 +15,8 @@ ## 0.2.0.0 -- 2020-09-13 * Second version. Changed the dependency boundaries of the uniqueness-periods-vector-general package. Added a new executable uniqVec02. ++## 0.3.0.0 -- 2020-09-15++* Third version. Added a new executable uniqVec03. It tests a hypothesis that for many Ukrainian poems (for example, by Oleksandr Oles) the actual +diverse2 output lies close between midpoint between the minimum and maximum possible for that line values.
+ Proportion/Main.hs view
@@ -0,0 +1,44 @@+-- |+-- Module : Main+-- Copyright : (c) OleksandrZhabenko 2020+-- License : MIT+-- Stability : Experimental+-- Maintainer : olexandr543@yahoo.com+--+-- Analyzez a poetic text in Ukrainian for every line prints statistic data and +-- then for the whole poem prints the hypothesis evaluation information. ++module Main where++import qualified Data.Vector as V+import String.Languages.UniquenessPeriods.Vector+import Languages.UniquenessPeriods.Vector.General.Debug+import Languages.UniquenessPeriods.Vector.Properties+import Melodics.Ukrainian+import System.Environment+import Languages.Phonetic.Ukrainian.PrepareText+import Languages.UniquenessPeriods.Vector.Data+import Languages.UniquenessPeriods.Vector.Auxiliary+import Languages.UniquenessPeriods.Vector.StrictV+import Numeric+import Data.Char ++main :: IO ()+main = do+ args <- getArgs+ let file = concat . take 1 $ args+ contents <- readFile file+ let flines = filter (not . null . filter isAlpha) . prepareText $ contents+ data3 <- mapM (\ts -> do+ let maxE = (\k -> if k == 0 then 1 else k) . (\rs -> if null rs then 0 else head rs) . firstFrom3 . maximumElBy 1 (V.singleton (oneProperty)) $ UL2 ([],uniquenessVariants2GN " 01-" (V.singleton (oneProperty)) (uniquenessPeriodsVector3 " 01-" . + aux0 . convertToProperUkrainian) (justOneValue2Property . diverse2) $ ts)+ minE = (\k -> if k == 0 then 1 else k) .abs . (\rs -> if null rs then 0 else head rs) . firstFrom3 . maximumElBy 1 (V.singleton (oneProperty)) $ UL2 ([],uniquenessVariants2GN " 01-" (V.singleton (oneProperty)) (uniquenessPeriodsVector3 " 01-" . + aux0 . convertToProperUkrainian) (justOneValue2Property . negate . diverse2) $ ts)+ data2 = (\k -> if k == 0 then 1 else k) .diverse2 . uniquenessPeriodsVector3 " 01-" . aux0 . convertToProperUkrainian $ ts + putStrLn $ show (maxE::Int) ++ " " ++ show (data2::Int) ++ " " ++ show (minE::Int) ++ " " ++ + showFFloat (Just 3) (fromIntegral maxE / fromIntegral data2) " " ++ showFFloat (Just 3) (fromIntegral data2 / fromIntegral minE) " " ++ + showFFloat (Just 3) (2.0 * fromIntegral data2 / fromIntegral (minE + maxE)) " " ++ show (length . words $ ts)+ return (2.0 * fromIntegral data2 / fromIntegral (minE + maxE))) $ flines+ let mean1 = sum data3 / fromIntegral (length data3)+ putStrLn $ showFFloat (Just 3) mean1 " +- " ++ showFFloat (Just 3) (sqrt ((sum (map (**2) data3) / fromIntegral (length data3)) - mean1 ** 2)) ""+
uniqueness-periods-vector-examples.cabal view
@@ -3,7 +3,7 @@ -- http://haskell.org/cabal/users-guide/ name: uniqueness-periods-vector-examples-version: 0.2.0.0+version: 0.3.0.0 synopsis: Examples of usage for the uniqueness-periods-vector series of packages description: Examples of usage for the uniqueness-periods-vector series of packages. Several executables are planned to demonstrate the libraries work. homepage: https://hackage.haskell.org/package/uniqueness-periods-vector-examples@@ -31,4 +31,12 @@ -- other-extensions: build-depends: base >=4.7 && <4.15, mmsyn6ukr >=0.8 && <1, vector >=0.11 && <0.14, uniqueness-periods-vector >=0.3 && <1, uniqueness-periods-vector-general >=0.4.2 && < 1, uniqueness-periods-vector-common >=0.3 && <1, uniqueness-periods-vector-properties >=0.3.1 && <1, print-info >=0.1.3 && <1, phonetic-languages-ukrainian >=0.2 && <1 hs-source-dirs: Lines+ default-language: Haskell2010++executable uniqVec03+ main-is: Main.hs+ -- other-modules:+ -- other-extensions:+ build-depends: base >=4.7 && <4.15, mmsyn6ukr >=0.8 && <1, vector >=0.11 && <0.14, uniqueness-periods-vector >=0.3 && <1, uniqueness-periods-vector-general >=0.4.2 && < 1, uniqueness-periods-vector-common >=0.3 && <1, uniqueness-periods-vector-properties >=0.3.1 && <1, print-info >=0.1.3 && <1, phonetic-languages-ukrainian >=0.2 && <1+ hs-source-dirs: Proportion default-language: Haskell2010