-- |
-- Module : Main
-- Copyright : (c) OleksandrZhabenko 2020-2021
-- 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.
-- The program tries to be more accurate in cases of the lines consisting entirely of the words
-- which are unique in phonetic meaning alongside the line. Another hypothesis is for the seventh command line
-- argument equal to \"y0\" that the distribution
-- of the placement of the actual poetic text in Ukrainian is not one of the standard distributions.
-- It can probably have approximately a form of and is different for different authors:
--
-- > -- -- --
-- > / \_/ \_/ \
--
-- 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
args0 <- getArgs
let !args = filter (/= "+W") args0
!gzS = mconcat . take 1 $ args
!printInput = mconcat . drop 1 . take 2 $ args
!whitelines = any (== "+W") args0 -- Usually, if specified -- the third argument
contents <- B.getContents
innerProc whitelines gzS printInput contents