packages feed

phonetic-languages-examples 0.1.1.0 → 0.1.2.0

raw patch · 5 files changed

+54/−39 lines, 5 filesdep +phonetic-languages-rhythmicitydep ~phonetic-languages-propertiesdep ~ukrainian-phonetics-basicPVP ok

version bump matches the API change (PVP)

Dependencies added: phonetic-languages-rhythmicity

Dependency ranges changed: phonetic-languages-properties, ukrainian-phonetics-basic

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -7,3 +7,9 @@ ## 0.1.1.0 -- 2020-11-06  * First version revised A. Changed the dependency boundaries so that the package uses the latest versions.++## 0.1.2.0 -- 2020-11-06++* First version revised B. Fixed some issues with the text preprocessing so that avoid unconsistency between different packages. Some simplification of the code for the +propertiesTextG executable.+
GetInfo/Main.hs view
@@ -56,43 +56,34 @@       !gzS = concat . take 1 . drop 1 $ args -- The second command line argument that controls the choice of the number of intervals       !printLine = fromMaybe 0 (readMaybe (concat . take 1 . drop 2 $ args)::(Maybe Int)) -- The third command line argument except those ones that are RTS arguments. Set to 1 if you would like to print the current line within the information       !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.-      !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).-      !choice = concat . drop 6 . take 7 $ args -- The seventh command line argument that controls what properties are used.+      !choice = concat . drop 4 . take 5 $ args -- The fifth command line argument that controls what properties are used.   contents <- readFile file-  if compareMode == 0 then do-   let !flines = fLines toOneLine contents-   innerProc gzS printLine choice flines-  else let tau !k = (let !flines1 = fLines k contents in innerProc gzS printLine choice flines1) in-    case twoInParallel of-     1 -> ($|) sequence_ rpar (map tau [1, 0])-     _ -> mapM_ tau [1, 0]--innerProc :: String -> Int -> String -> VB.Vector (VB.Vector Char) -> IO ()-innerProc gzS printLine choice flInes = getData3 (getIntervalsN gzS flInes) printLine choice flInes+  let !flines = fLines toOneLine contents+  getData3 (getIntervalsN gzS flines) printLine choice flines -getIntervalsN :: String -> VB.Vector (VB.Vector Char) -> Int-getIntervalsN xs yss-  | xs == "s" = sturgesH (VB.length yss)-  | xs == "l" = levynskyiMod (VB.length yss)+getIntervalsN :: String -> [VB.Vector Char] -> Int+getIntervalsN xs ys+  | xs == "s" = sturgesH (length ys)+  | xs == "l" = levynskyiMod (length ys)   | otherwise = fromMaybe 9 (readMaybe xs::(Maybe Int)) {-# INLINE getIntervalsN #-} -getData3 :: Int -> Int -> String -> VB.Vector (VB.Vector Char) -> IO ()-getData3 gz printLine choice v4 = do- let !permsV = genPermutationsV- VB.mapM_ (\v -> bracket (do-  myThread <- forkIO (+getData3 :: Int -> Int -> String -> [VB.Vector Char] -> IO ()+getData3 gz printLine choice zs = let !permsV4 = genPermutationsV in mapM_ (process1Line gz printLine choice permsV4) zs++process1Line :: Int -> Int -> String -> VB.Vector (VB.Vector (VB.Vector Int)) -> VB.Vector Char -> IO ()+process1Line gz printLine choice !permsV5 v = bracket (do+ myThread <- forkIO (do    let !whspss = VB.fromList " 01-"        !v2 = subG whspss v        !l2 = (subtract 2) . VB.length $ v2        (!maxE,!minE,!data2)           | compare l2 0 /= LT = runEval (parTuple3 rpar rpar rpar ((\k -> if k == 0.0 then 1.0 else k) . (\ls -> if null ls then 0.0 else head ls) .               firstFrom3 . maximumElBy 1 (VB.singleton oneProperty) $-                UL2 (VB.empty,uniquenessVariants2GNB ' ' id id id (VB.unsafeIndex permsV l2) (VB.singleton oneProperty) (chooseMax choice) v2),+                UL2 (VB.empty,uniquenessVariants2GNB ' ' id id id (VB.unsafeIndex permsV5 l2) (VB.singleton oneProperty) (chooseMax choice) v2),                   (\k -> if k == 0.0 then 1.0 else k) . abs . (\ls -> if null ls then 0.0 else head ls) .                      firstFrom3 . maximumElBy 1 (VB.singleton oneProperty) $-                       UL2 (VB.empty,uniquenessVariants2GNB ' ' id id id (VB.unsafeIndex permsV l2) (VB.singleton oneProperty) (chooseMin choice) v2),+                       UL2 (VB.empty,uniquenessVariants2GNB ' ' id id id (VB.unsafeIndex permsV5 l2) (VB.singleton oneProperty) (chooseMin choice) v2),                          (\k -> if k == 0.0 then 1.0 else k) . head . getAC (chooseMax choice) $ v))           | otherwise = let !mono = (\k -> if k == 0.0 then 1.0 else k) . head . getAC (chooseMax choice) $ v in (mono,mono,mono)        (!wordsN,!intervalN)@@ -109,10 +100,12 @@          hPutStr stdout ('\t':show (wordsN::Int))          hPutStr stdout ('\t':show (intervalN::Int))          hPutStrLn stdout (if printLine == 1 then '\t':(VB.toList v) else ""))-  return myThread) (\myThread -> killThread myThread) (\_ -> hPutStr stdout "")) v4-{-# INLINABLE getData3 #-}+ return myThread) (killThread) (\_ -> putStr "") -fLines :: Int -> String -> VB.Vector (VB.Vector Char)-fLines !toOneLine = VB.map VB.fromList . VB.fromList . filter (any (\x -> isUkrainianL x && isAlpha x)) . prepareText .-  (\z -> if toOneLine == 1 then unwords . words $ z else z)-{-# INLINE fLines #-}+fLines :: Int -> String -> [VB.Vector Char]+fLines !toOneLine ys =+  let preText = filter (any (\x -> isUkrainianL x && isAlpha x)) . prepareText . (\z -> if toOneLine == 1 then unwords . words $ z else z) $ ys+      wss = map (length . subG " 01-") preText+      g (t:ts) (r:rs) = if r > 7 then filter (`notElem` "01-") t:g ts rs else t:g ts rs+      g _ _ = []+        in map VB.fromList . g preText $ wss
Lines/Main.hs view
@@ -24,11 +24,12 @@ import Languages.UniquenessPeriods.Vector.Filters (unsafeSwapVecIWithMaxI) import Text.Read (readMaybe) import Data.Maybe (fromMaybe)+import Melodics.ByteString.Ukrainian (isUkrainianL) import System.Environment import Languages.Phonetic.Ukrainian.PrepareText import Languages.UniquenessPeriods.Vector.DataG import Languages.UniquenessPeriods.Vector.AuxiliaryG-import Data.Char (isDigit)+import Data.Char (isDigit,isAlpha) import Languages.UniquenessPeriods.Vector.FuncRepRelatedG  -- | The function allows to rewrite the Ukrainian text in the file given as the first command line argument to a new file. In between, it is rewritten@@ -49,7 +50,7 @@       !file = concat . take 1 $ args       !permsV = VB.force genPermutationsV   contents <- readFile file-  let !flines = prepareText contents+  let !flines = fLines contents       !lasts = map (\ts -> if null . words $ ts then [] else last . words $ ts) flines       !l = (subtract 3) . length . words . concat . take 1 $ flines       !whspss = VB.fromList " 01-"@@ -75,6 +76,13 @@       toFile (file ++ ".new.txt") (zs:(noDoubleWords . circle2I permsV whspss (concat . take 1 $ lasts) choice [] numberI intervalNmbrs minE maxE . drop 1 $ flines))     else toFileStr (file ++ ".new.txt") ((concat . take 1 $ flines):(noDoubleWords . circle2I permsV whspss (concat . take 1 $ lasts) choice [] numberI intervalNmbrs 0.0 0.0 . drop 1 $ flines)) +fLines :: String -> [String]+fLines ys =+  let preText = filter (any (\x -> isUkrainianL x && isAlpha x)) . prepareText $ ys+      wss = map (length . subG " 01-") preText+      g (t:ts) (r:rs) = if r > 7 then filter (`notElem` "01-") t:g ts rs else t:g ts rs+      g _ _ = []+        in g preText wss  -- | Processment without rearrangements. circle2 :: VB.Vector (VB.Vector (VB.Vector Int)) -> String -> String -> [String] -> [String] -> [String]
Simple/Main.hs view
@@ -24,7 +24,8 @@ import Languages.UniquenessPeriods.Vector.StrictVG import Languages.Phonetic.Ukrainian.PrepareText import Languages.UniquenessPeriods.Vector.DataG-import Data.Char (isDigit)+import Data.Char (isDigit,isAlpha)+import Melodics.ByteString.Ukrainian (isUkrainianL) import qualified Data.List  as L (span,sort,permutations) import Languages.UniquenessPeriods.Vector.FuncRepRelatedG import Data.SubG@@ -49,7 +50,7 @@       !arg0 = fromMaybe 1 $ (readMaybe (concat . take 1 $ numericArgs)::Maybe Int)       !numberI = fromMaybe 1 $ (readMaybe (concat . drop 1 . take 2 $ numericArgs)::Maybe Int)       !choice = concat . take 1 $ textualArgs-      !xs = concat . take 1 . prepareText . unwords . drop 1 $ textualArgs+      !xs = concat . take 1 . fLines . unwords . drop 1 $ textualArgs       !l = length . words $ xs       !v = VB.fromList xs       !whspss = VB.fromList " 01-"@@ -66,3 +67,10 @@     printUniquenessG1VChar (I1 H) . fst . get22 . uniqNProperties2GN ' ' (VB.fromList " 01-") id id id perms K arg0 1 (VB.singleton (unsafeSwapVecIWithMaxI minE maxE numberI intervalNmbrs .       oneProperty)) (chooseMax choice) $ v +fLines :: String -> [String]+fLines ys =+  let preText = filter (any (\x -> isUkrainianL x && isAlpha x)) . prepareText $ ys+      wss = map (length . subG " 01-") preText+      g (t:ts) (r:rs) = if r > 7 then filter (`notElem` "01-") t:g ts rs else t:g ts rs+      g _ _ = []+        in g preText wss
phonetic-languages-examples.cabal view
@@ -2,7 +2,7 @@ -- further documentation, see http://haskell.org/cabal/users-guide/  name:                phonetic-languages-examples-version:             0.1.1.0+version:             0.1.2.0 synopsis:            A generalization of the uniqueness-periods-vector-examples functionality. description:         Is intended to use more functionality of the Data.Vector, Data.Foldable, Data.Monoid and Data.SubG modules. homepage:            https://hackage.haskell.org/package/phonetic-languages-examples@@ -20,7 +20,7 @@   exposed-modules:     Languages.UniquenessPeriods.Vector.FuncRepRelatedG   -- other-modules:   other-extensions:    BangPatterns-  build-depends:       base >=4.7 && <4.15, phonetic-languages-vector >=0.1 && <1, phonetic-languages-common >=0.1.1 && <1, phonetic-languages-properties >=0.1.1 && <1, vector >=0.11 && < 0.14+  build-depends:       base >=4.7 && <4.15, phonetic-languages-vector >=0.1 && <1, phonetic-languages-common >=0.1.1 && <1, phonetic-languages-properties >=0.1.2 && <1, vector >=0.11 && < 0.14   -- hs-source-dirs:   default-language:    Haskell2010 @@ -28,7 +28,7 @@   main-is:             Main.hs   other-modules:       Languages.UniquenessPeriods.Vector.FuncRepRelatedG   other-extensions:    BangPatterns-  build-depends:       base >=4.7 && <4.15, ukrainian-phonetics-basic >=0.1.10 && <1, vector >=0.11 && <0.14, phonetic-languages-vector >=0.1 && <1, phonetic-languages-general >=0.1 && < 1, phonetic-languages-common >=0.1.1 && <1, phonetic-languages-properties >=0.1.1 && <1, print-info >=0.1.3 && <1, phonetic-languages-ukrainian >=0.2.3 && <1, parallel >=3.2.0.6 && <4, uniqueness-periods-vector-filters >=0.3 && <1, vector >=0.11 && <0.14, phonetic-languages-plus >=0.1 && <1, subG >=0.1.1.1 && < 1+  build-depends:       base >=4.7 && <4.15, ukrainian-phonetics-basic >=0.1.11 && <1, vector >=0.11 && <0.14, phonetic-languages-vector >=0.1 && <1, phonetic-languages-general >=0.1 && < 1, phonetic-languages-common >=0.1.1 && <1, phonetic-languages-properties >=0.1.2 && <1, print-info >=0.1.3 && <1, phonetic-languages-ukrainian >=0.2.3 && <1, parallel >=3.2.0.6 && <4, uniqueness-periods-vector-filters >=0.3 && <1, vector >=0.11 && <0.14, phonetic-languages-plus >=0.1 && <1, subG >=0.1.1.1 && < 1   ghc-options:         -threaded -rtsopts   hs-source-dirs:      ., Simple   default-language:    Haskell2010@@ -37,7 +37,7 @@   main-is:             Main.hs   other-modules:       Languages.UniquenessPeriods.Vector.FuncRepRelatedG   other-extensions:    BangPatterns-  build-depends:       base >=4.7 && <4.15, ukrainian-phonetics-basic >=0.1.10 && <1, vector >=0.11 && <0.14, phonetic-languages-vector >=0.1 && <1, phonetic-languages-general >=0.1 && < 1, phonetic-languages-common >=0.1.1 && <1, phonetic-languages-properties >=0.1.1 && <1, print-info >=0.1.3 && <1, phonetic-languages-ukrainian >=0.2.3 && <1, parallel >=3.2.0.6 && <4, uniqueness-periods-vector-filters >=0.3 && <1, vector >=0.11 && <0.14, phonetic-languages-plus >=0.1 && <1, subG >= 0.1.1.1 && < 1+  build-depends:       base >=4.7 && <4.15, ukrainian-phonetics-basic >=0.1.11 && <1, vector >=0.11 && <0.14, phonetic-languages-vector >=0.1 && <1, phonetic-languages-general >=0.1 && < 1, phonetic-languages-common >=0.1.1 && <1, phonetic-languages-properties >=0.1.2 && <1, print-info >=0.1.3 && <1, phonetic-languages-ukrainian >=0.2.3 && <1, parallel >=3.2.0.6 && <4, uniqueness-periods-vector-filters >=0.3 && <1, vector >=0.11 && <0.14, phonetic-languages-plus >=0.1 && <1, subG >= 0.1.1.1 && < 1, phonetic-languages-rhythmicity >=0.1.2 && <1   ghc-options:         -threaded -rtsopts   hs-source-dirs:      ., Lines   default-language:    Haskell2010@@ -46,7 +46,7 @@   main-is:             Main.hs   other-modules:       Languages.UniquenessPeriods.Vector.FuncRepRelatedG   other-extensions:    BangPatterns-  build-depends:       base >=4.7 && <4.15, ukrainian-phonetics-basic >=0.1.10 && <1, vector >=0.11 && <0.14, phonetic-languages-vector >=0.1 && <1, phonetic-languages-general >=0.1 && < 1, phonetic-languages-common >=0.1.1 && <1, phonetic-languages-properties >=0.1.1 && <1, phonetic-languages-ukrainian >=0.2.3 && <1, uniqueness-periods-vector-filters >=0.3 && <1, uniqueness-periods-vector-stats >=0.1.2 && <1, parallel >=3.2.0.6 && <4, phonetic-languages-plus >=0.1 && <1, subG >= 0.1.1.1 && < 1+  build-depends:       base >=4.7 && <4.15, ukrainian-phonetics-basic >=0.1.11 && <1, vector >=0.11 && <0.14, phonetic-languages-vector >=0.1 && <1, phonetic-languages-general >=0.1 && < 1, phonetic-languages-common >=0.1.1 && <1, phonetic-languages-properties >=0.1.2 && <1, phonetic-languages-ukrainian >=0.2.3 && <1, uniqueness-periods-vector-filters >=0.3 && <1, uniqueness-periods-vector-stats >=0.1.2 && <1, parallel >=3.2.0.6 && <4, phonetic-languages-plus >=0.1 && <1, subG >= 0.1.1.1 && < 1, phonetic-languages-rhythmicity >=0.1.2 && <1   ghc-options:         -threaded -rtsopts   hs-source-dirs:      ., GetInfo   default-language:    Haskell2010