summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandrZhabenko <>2020-09-15 18:54:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2020-09-15 18:54:00 (GMT)
commitdcff87275b3800cd8d11ba6c29d09557ae2b62e3 (patch)
tree0f4fa656252e38c476ba2949cadbd6ddceafc9f0
parent1485cece113d68066e4e9a63237945f0b39a8fc1 (diff)
version 0.3.0.00.3.0.0
-rw-r--r--ChangeLog.md5
-rw-r--r--Proportion/Main.hs44
-rw-r--r--uniqueness-periods-vector-examples.cabal10
3 files changed, 58 insertions, 1 deletions
diff --git a/ChangeLog.md b/ChangeLog.md
index 2424e90..1d0767b 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -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.
diff --git a/Proportion/Main.hs b/Proportion/Main.hs
new file mode 100644
index 0000000..bf7613f
--- /dev/null
+++ b/Proportion/Main.hs
@@ -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)) ""
+
diff --git a/uniqueness-periods-vector-examples.cabal b/uniqueness-periods-vector-examples.cabal
index bfa76eb..cb655cc 100644
--- a/uniqueness-periods-vector-examples.cabal
+++ b/uniqueness-periods-vector-examples.cabal
@@ -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
@@ -32,3 +32,11 @@ executable uniqVec02
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