uniqueness-periods-vector-examples 0.8.0.3 → 0.9.0.0
raw patch · 4 files changed
+23/−21 lines, 4 files
Files
- ChangeLog.md +6/−0
- Lines/Main.hs +9/−14
- Proportion/Main.hs +6/−5
- uniqueness-periods-vector-examples.cabal +2/−2
ChangeLog.md view
@@ -99,3 +99,9 @@ ## 0.8.0.3 -- 2020-10-05 * Eigth version revised C. Fixed issues with README.md file inaccuracies and for double import of the mconcat function.++## 0.9.0.0 -- 2020-10-06++* Ninth version. Added the sixth command line argument except those ones in RTS for the processText executable to control whether if the executable is+working in comparative mode printing two analyses at a time then to evaluate them in parallel or sequentially. The default one is in parallel, but if you+would like to use possibly less resources then you can evaluate them in sequence. Some minor code improvements.
Lines/Main.hs view
@@ -5,8 +5,8 @@ -- Stability : Experimental -- Maintainer : olexandr543@yahoo.com ----- Inspired by: https://functional-art.org/2020/papers/Poetry-OleksandrZhabenko.pdf from the https://functional-art.org/2020/performances ; --- Allows to rewrite the given text (usually a poetical one). +-- Inspired by: https://functional-art.org/2020/papers/Poetry-OleksandrZhabenko.pdf from the https://functional-art.org/2020/performances ;+-- Allows to rewrite the given text (usually a poetical one). module Main where @@ -21,6 +21,7 @@ import Languages.Phonetic.Ukrainian.PrepareText import Languages.UniquenessPeriods.Vector.Data import Languages.UniquenessPeriods.Vector.Auxiliary+import Data.Lists.FLines (newLineEnding) main :: IO () main = do@@ -29,8 +30,8 @@ contents <- readFile file let flines = prepareText contents lasts = map (\ts -> if null . words $ ts then [] else last . words $ ts) flines- zs = lastFrom3 . headU2 . fst . get22 . uniqNProperties2GN " 01-" (PA [] (concat . take 1 $ lasts)) 1 1 (V.singleton (oneProperty)) (uniquenessPeriodsVector3 " 01-" . - aux0 . convertToProperUkrainian) (justOneValue2Property . diverse2) . unwords . init . words . concat . take 1 $ flines + zs = lastFrom3 . headU2 . fst . get22 . uniqNProperties2GN " 01-" (PA [] (concat . take 1 $ lasts)) 1 1 (V.singleton (oneProperty)) (uniquenessPeriodsVector3 " 01-" .+ aux0 . convertToProperUkrainian) (justOneValue2Property . diverse2) . unwords . init . words . concat . take 1 $ flines toFile (file ++ "new.txt") (zs:(noDoubleWords . circle2 (concat . take 1 $ lasts) . drop 1 $ flines)) circle2 :: String -> [String] -> [String]@@ -38,21 +39,15 @@ | null xss = [] | otherwise = let (zss,tss) = splitAt 1 xss in do let rs = words . concat $ zss- ws = lastFrom3 . headU2 . fst . get22 . - uniqNProperties2GN " 01-" (PA xs (if null rs then [] else last rs)) 1 1 (V.singleton (oneProperty)) (uniquenessPeriodsVector3 " 01-" . - aux0 . convertToProperUkrainian) (justOneValue2Property . diverse2) . unwords $ + ws = lastFrom3 . headU2 . fst . get22 .+ uniqNProperties2GN " 01-" (PA xs (if null rs then [] else last rs)) 1 1 (V.singleton (oneProperty)) (uniquenessPeriodsVector3 " 01-" .+ aux0 . convertToProperUkrainian) (justOneValue2Property . diverse2) . unwords $ if null rs then [] else init rs in ws:circle2 (if null rs then [] else last rs) tss headU2 :: [UniquenessG1 a b] -> UniquenessG1 a b-headU2 zs +headU2 zs | null zs = ([],V.empty,[]) | otherwise = head zs noDoubleWords :: [String] -> [String] noDoubleWords xss = map (unwords . drop 1 . words) xss---- | Auxiliary printing function to define the line ending needed to be printed by 'printUniquenessG1List' function in some cases. -newLineEnding :: String-newLineEnding - | nativeNewline == LF = "\n"- | otherwise = "\r\n"
Proportion/Main.hs view
@@ -72,14 +72,15 @@ !toOneLine = fromMaybe 0 (readMaybe (concat . take 1 . drop 3 $ args)::(Maybe Int)) -- The fourth command line argument except those ones that are RTS arguments. Set to 1 if you would like to convert the text into one single line before applying to it the processment (it can be more conceptually consistent in such a case) !compareMode = fromMaybe 0 (readMaybe (concat . take 1 . drop 4 $ args)::(Maybe Int)) -- The fifth command line argument except those ones that are RTS arguments. Set to 1 if you would like to print the original version and the concatenated one's (into one line) analyses. !gzS = concat . take 1 . drop 1 $ args+ !twoInParallel = fromMaybe 1 (readMaybe (concat . take 1 . drop 5 $ args)::(Maybe Int)) -- The sixth command line argument that controls whether if the fifth command line argument is set to \"1\" then the evaluation is done in parallel or not (set to \"1\" --- the default one --- if you would like to evaluate in parallel, otherwise --- just usual sequential evaluation). contents <- readFile file if compareMode == 0 then do let !flines = fLines toOneLine contents innerProc printLine flines gzS- else let !flines1 = fLines 1 contents in do- innerProc printLine flines1 gzS- let !flines2 = fLines 0 contents- innerProc printLine flines2 gzS+ else let tau !k = (let !flines1 = fLines k contents in innerProc printLine flines1 gzS) in+ case twoInParallel of+ 1 -> ($|) (mapM_ id) rpar (map tau [1, 0])+ _ -> mapM_ tau [1, 0] innerProc :: Int -> [String] -> String -> IO () innerProc printLine flInes gzS = do@@ -107,7 +108,7 @@ sturgesH :: Int -> Int sturgesH n | compare n 0 == GT = ceiling (logBase 2 (int2Float n))- | otherwise = error $ "sterdgess: undefined for the argument " ++ show n ++ newLineEnding+ | otherwise = error $ "sturgesH: undefined for the argument " ++ show n ++ newLineEnding {-# INLINE sturgesH #-} -- | According to @В. П. Левинський@ (V. P. Levynskyi) from @Опря А. Т. Статистика (модульний варіант з програмованою формою контролю знань).
uniqueness-periods-vector-examples.cabal view
@@ -3,7 +3,7 @@ -- http://haskell.org/cabal/users-guide/ name: uniqueness-periods-vector-examples-version: 0.8.0.3+version: 0.9.0.0 synopsis: Usage examples for the uniqueness-periods-vector series of packages description: Usage examples 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@@ -29,7 +29,7 @@ main-is: Main.hs -- other-modules: -- other-extensions:- build-depends: base >=4.7 && <4.15, mmsyn6ukr >=0.8.1 && <1, vector >=0.11 && <0.14, uniqueness-periods-vector >=0.3 && <1, uniqueness-periods-vector-general >=0.4.4 && < 1, uniqueness-periods-vector-common >=0.4 && <1, uniqueness-periods-vector-properties >=0.3.1 && <1, print-info >=0.1.3 && <1, phonetic-languages-ukrainian >=0.2.2 && <1+ build-depends: base >=4.7 && <4.15, mmsyn6ukr >=0.8.1 && <1, vector >=0.11 && <0.14, uniqueness-periods-vector >=0.3 && <1, uniqueness-periods-vector-general >=0.4.4 && < 1, uniqueness-periods-vector-common >=0.4 && <1, uniqueness-periods-vector-properties >=0.3.1 && <1, print-info >=0.1.3 && <1, phonetic-languages-ukrainian >=0.2.2 && <1, lists-flines >=0.1.1 && <1 hs-source-dirs: Lines default-language: Haskell2010