-- | -- 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