uniqueness-periods-vector-examples 0.7.1.0 → 0.7.2.0
raw patch · 3 files changed
+33/−16 lines, 3 files
Files
- ChangeLog.md +5/−0
- Proportion/Main.hs +27/−15
- uniqueness-periods-vector-examples.cabal +1/−1
ChangeLog.md view
@@ -70,3 +70,8 @@ ## 0.7.1.0 -- 2020-09-28 * Seventh version revised A. Fixed issue with ambiguous importing for GHC-7.8* series in the uniqVec03 executable Main.hs module.++## 0.7.2.0 -- 2020-10-02++* Seventh version revised B. Added additional information so that also is displayed the percentages of intervals in the uniqVec03 executable. Parallelization+(and mostly performance) optimizations for uniqVec03 executable.
Proportion/Main.hs view
@@ -66,38 +66,50 @@ !toOneLine = fromMaybe 0 (readMaybe (concat . take 1 . drop 3 $ args)::(Maybe Int)) -- The fourth command line arguments except those ones that are RTS arguments. Seti 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) contents <- readFile file let !flines = fLines toOneLine contents- data3 <- getData3 printLine gz flines- let !(data31,wordsCnt0_data32) = unzip data3- !data4 = filter (/= 0) data31+ (!data31,!wordsCnt0_data32) = unzip . getData3 printLine gz $ flines+ !data4 = filter (/= 0) . map fst $ data31 if null data4 then putStrLn (replicate 102 '-') >> putStrLn "1.000+-0.000\tALL!" >> putStrLn (replicate 102 '=') -- Well, this means that all the text consists of the unique (in phonetic meaning) words alongside every line. A rather rare occurrence. else do let (!mean1,!disp) = meanWithDisp data4 !pairs = sort . filter ((/= 0) . snd) $ wordsCnt0_data32 g !m !n = (length . takeWhile (\(_,v) -> v == n) . dropWhile (\(_,v) -> v /= n) . takeWhile (\(u,_) -> u == m) . dropWhile (\(u,_) -> u /= m) $ pairs) `using` rseq- putStrLn . mconcat $ [replicate 102 '-', newLineEnding, mconcat . map (\r -> show r ++ "\t") $ [1..gz], newLineEnding, mconcat . map (\r -> (show . length . takeWhile (== r) . dropWhile (/= r) . sort . map snd $ pairs) ++ "\t") $ [1..gz], newLineEnding, mconcat $ [showFFloat (Just 4) mean1 "+-", showFFloat (Just 4) (sqrt disp) "\t", show (length . filter (== 0) $ data31), '\t':show (length data31)], newLineEnding, mconcat . map (\r -> show r ++ "\t") $ [2..7], newLineEnding, mconcat . map (\r -> (show . length . takeWhile (== r) . dropWhile (/= r) . map fst $ pairs) ++ "\t") $ [2..7], newLineEnding, replicate 102 '*']- mapM_ (\m1 -> mapM_ (\n1 -> putStr $ (if g m1 n1 == 0 then "." else show (g m1 n1)) ++ "\t") [1..gz] >> putStrLn "") [2..7]- putStrLn (replicate 102 '~')- mapM_ (\m1 -> mapM_ (\n1 -> putStr $ show (g m1 n1) ++ "\t") [1..gz] >> putStrLn "") [2..7]- putStrLn (replicate 102 '=')+ 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..7],replicate 102 x]+ mapM_ putStrLn . map snd $ data31+ putStrLn . generalInfo1 gz pairs (mean1, disp) $ data31+ putStrLn (h False '~')+ putStrLn (h True '=') -getData3 :: Int -> Int -> [String] -> IO [(Float,(Int,Int))]-getData3 printLine gz = mapM (\ts -> do+getData3 :: Int -> Int -> [String] -> [((Float,String),(Int,Int))]+getData3 printLine gz = parMap rseq (\ts -> let (!maxE,!minE,!data2) = runEval ((parTuple3 rpar rseq rseq) ((\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), (\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), (\k -> if k == 0 then 1 else k) . diverse2 . uniquenessPeriodsVector3 " 01-" . aux0 . convertToProperUkrainian $ ts))- !ratio = if maxE == 1 then 0.0 else 2.0 * fromIntegral data2 / fromIntegral (minE + maxE) (!wordsN,!intervalN) | maxE == 1 = (0, 0) | otherwise = runEval ((parTuple2 rpar rpar) (length . words $ ts, intervalNRealFrac (int2Float minE) (int2Float maxE) gz (int2Float data2)))- putStrLn . mconcat $ [show $ (minE::Int), '\t':show (data2::Int), '\t':show (maxE::Int), '\t':showFFloat (Just 4) (fromIntegral data2 / fromIntegral minE) "\t",- showFFloat (Just 4) (fromIntegral maxE / fromIntegral data2) "\t", showFFloat (Just 4) ratio "\t", '\t':show (wordsN::Int), '\t':show (intervalN::Int),- if printLine == 1 then '\t':ts else ""]- return (ratio,(wordsN,intervalN)))+ (!ratio,!printedLine) = (if maxE == 1 then 0.0 else 2.0 * fromIntegral data2 / fromIntegral (minE + maxE), mconcat [show $ (minE::Int),+ '\t':show (data2::Int), '\t':show (maxE::Int), '\t':showFFloat (Just 4) (fromIntegral data2 / fromIntegral minE) "\t",+ showFFloat (Just 4) (fromIntegral maxE / fromIntegral data2) "\t", showFFloat (Just 4) ratio "\t", '\t':show (wordsN::Int),+ '\t':show (intervalN::Int), if printLine == 1 then '\t':ts else ""]) in ((ratio,printedLine),(wordsN,intervalN))) {-# INLINABLE getData3 #-} fLines :: Int -> String -> [String] fLines !toOneLine = filter (any (\x -> isUkrainian x && isAlpha x)) . prepareText . (\z -> if toOneLine == 1 then unwords . words $ z else z) {-# INLINE fLines #-}++generalInfo1 :: Int -> [(Int,Int)] -> (Float,Float) -> [(Float,String)] -> String+generalInfo1 gz pairs (mean1, disp) data31 =+ let !ks = map (\r -> length . takeWhile (== r) . dropWhile (/= r) . sort . map snd $ pairs) [1..gz]+ !s = sum ks 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,+ mconcat [showFFloat (Just 4) mean1 "+-", showFFloat (Just 4) (sqrt disp) "\t", show (length . filter (== 0) . map fst $ data31),+ '\t':show (length data31)], newLineEnding, mconcat . map (\r -> show r ++ "\t") $ [2..7], newLineEnding, mconcat .+ map (\r -> (show . length . takeWhile (== r) . dropWhile (/= r) . map fst $ pairs) ++ "\t") $ [2..7], newLineEnding, replicate 102 '*']+{-# INLINE generalInfo1 #-}+++
uniqueness-periods-vector-examples.cabal view
@@ -3,7 +3,7 @@ -- http://haskell.org/cabal/users-guide/ name: uniqueness-periods-vector-examples-version: 0.7.1.0+version: 0.7.2.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