phonetic-languages-examples 0.5.0.0 → 0.6.0.0
raw patch · 4 files changed
+62/−29 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +7/−0
- GetInfo/Main.hs +53/−27
- README.md +1/−1
- phonetic-languages-examples.cabal +1/−1
CHANGELOG.md view
@@ -58,3 +58,10 @@ ## 0.5.0.0 -- 2020-11-13 * Fifth version. Added file README.md with the persistent link to the instruction (in Ukrainian) how to use the programs of the package.++## 0.6.0.0 -- 2020-11-16++* Sixth version. Added the possibility to select the lines for analysis by propertiesTextG and to print the analyzed text with line numbers. To print it with+line numbers use the command line argument @n. Afterwards, running again, specify the needed line numbers by the first one number and the last one number+separated with colon (':'). You can specify multiple times. The order would have been the same as you have specified.+
GetInfo/Main.hs view
@@ -6,15 +6,7 @@ -- 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. Since the 0.4.0.0 version--- 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 (since the 0.12.0.0 version) 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:------ > -- -- ----- > / \_/ \_/ \+-- then for the whole poem prints the hypothesis evaluation information. -- -- To enable parallel computations (potentially, they can speed up the work), please, run the @propertiesText@ executable with -- @+RTS -threaded -RTS@ command line options with possibly @-N@ option inside.@@ -33,6 +25,7 @@ import Control.Exception import Control.Parallel.Strategies import Data.Maybe (fromMaybe)+import Data.List (sort) import Text.Read (readMaybe) import qualified Data.Vector as VB import Languages.UniquenessPeriods.Vector.General.DebugG hiding (newLineEnding)@@ -54,29 +47,54 @@ main :: IO () main = do- args <- getArgs- let !coeffs = readCF . concat . take 1 $ args -- The first command line argument. If not sure, just enter \"1_\".+ args0 <- getArgs+ let args = filter (\xs -> all (/= ':') xs && all (/= '@') xs) args0+ !coeffs = readCF . concat . take 1 $ args -- The first command line argument. If not sure, just enter \"1_\".+ !lInes = filter (any (== ':')) args0+ !numbersJustPrint = filter (== "@n") args0 if isPair coeffs then do- let !file = concat . drop 1 . take 2 $ args -- The second command line arguments except those ones that are RTS arguments- !gzS = concat . take 1 . drop 2 $ args -- The third command line argument that controls the choice of the number of intervals- !printLine = 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 print the current line within the information- !toOneLine = 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 convert the text into one single line before applying to it the processment (it can be more conceptually consistent in such a case)- !choice = concat . drop 5 . take 6 $ args -- The sixth command line argument that controls what properties are used.- generalProc coeffs file gzS printLine toOneLine choice+ let !file = concat . drop 1 . take 2 $ args -- The second command line argument except those ones that are RTS arguments+ if null numbersJustPrint then do+ let !gzS = concat . take 1 . drop 2 $ args -- The third command line argument that controls the choice of the number of intervals+ !printLine = 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 print the current line within the information+ !toOneLine = 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 convert the text into one single line before applying to it the processment (it can be more conceptually consistent in such a case)+ !choice = concat . drop 5 . take 6 $ args -- The sixth command line argument that controls what properties are used.+ generalProc lInes coeffs file gzS printLine toOneLine choice+ else do+ contents <- readFile file+ fLinesIO contents else do let !file = concat . take 1 $ args- !gzS = concat . take 1 . drop 1 $ args- !printLine = fromMaybe 0 (readMaybe (concat . take 1 . drop 2 $ args)::(Maybe Int))- !toOneLine = fromMaybe 0 (readMaybe (concat . take 1 . drop 3 $ args)::(Maybe Int))- !choice = concat . drop 4 . take 5 $ args- generalProc coeffs file gzS printLine toOneLine choice+ if null numbersJustPrint then do+ let !gzS = concat . take 1 . drop 1 $ args+ !printLine = fromMaybe 0 (readMaybe (concat . take 1 . drop 2 $ args)::(Maybe Int))+ !toOneLine = fromMaybe 0 (readMaybe (concat . take 1 . drop 3 $ args)::(Maybe Int))+ !choice = concat . drop 4 . take 5 $ args+ generalProc lInes coeffs file gzS printLine toOneLine choice+ else do+ contents <- readFile file+ fLinesIO contents -generalProc :: Coeffs2 -> FilePath -> String -> Int -> Int -> String -> IO ()-generalProc coeffs file gzS printLine toOneLine choice = do- contents <- readFile file- let !flines = fLines toOneLine contents- getData3 coeffs (getIntervalsN gzS flines) printLine choice flines+generalProc :: [String] -> Coeffs2 -> FilePath -> String -> Int -> Int -> String -> IO ()+generalProc lInes coeffs file gzS printLine toOneLine choice+ | null lInes = do+ contents <- readFile file+ let !flines = fLines toOneLine contents+ getData3 coeffs (getIntervalsN gzS flines) printLine choice flines+ | otherwise = do+ contents <- readFile file+ let flines = fLines toOneLine . unlines . linesFromArgsG lInes . map VB.toList . fLines 0 $ contents+ getData3 coeffs (getIntervalsN gzS flines) printLine choice flines +linesFromArgs1 :: Int -> String -> [String] -> [String]+linesFromArgs1 n xs yss =+ let (!ys,!zs) = (\(x,z) -> (x, drop 1 z)) . break (== ':') $ xs+ !ts = sort . map (min n . abs) $ [fromMaybe 1 (readMaybe ys::Maybe Int), fromMaybe n (readMaybe zs::Maybe Int)] in+ drop (head ts) . take (last ts) $ yss++linesFromArgsG :: [String] -> [String] -> [String]+linesFromArgsG xss yss = let n = length yss in concatMap (\ts -> linesFromArgs1 n ts yss) xss+ getIntervalsN :: String -> [VB.Vector Char] -> Int getIntervalsN xs ys | xs == "s" = sturgesH (length ys)@@ -125,3 +143,11 @@ 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++fLinesIO :: String -> IO ()+fLinesIO 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 VB.mapM_ putStrLn . VB.map (\(i,x) -> show (i + 1) ++ "\t" ++ x) . VB.indexed . VB.fromList . g preText $ wss
README.md view
@@ -1,5 +1,5 @@ The short (possibly) instruction how to use the programs of the package phonetic-languages-examples in Ukrainian is here: -https://web.archive.org/web/20201113133020/https://oleksandrzhabenko.github.io/uk/%D0%9A%D0%BE%D1%80%D0%BE%D1%82%D0%BA%D0%B0_%D1%96%D0%BD%D1%81%D1%82%D1%80%D1%83%D0%BA%D1%86%D1%96%D1%8F_%D1%89%D0%BE%D0%B4%D0%BE_%D0%BA%D0%BE%D1%80%D0%B8%D1%81%D1%82%D1%83%D0%B2%D0%B0%D0%BD%D0%BD%D1%8F_%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B0%D0%BC%D0%B8_%D0%BF%D0%B0%D0%BA%D0%B5%D1%82%D1%83_phonetic-languages-examples.pdf+https://web.archive.org/web/20201116195336/https://oleksandrzhabenko.github.io/uk/%D0%9A%D0%BE%D1%80%D0%BE%D1%82%D0%BA%D0%B0_%D1%96%D0%BD%D1%81%D1%82%D1%80%D1%83%D0%BA%D1%86%D1%96%D1%8F_%D1%89%D0%BE%D0%B4%D0%BE_%D0%BA%D0%BE%D1%80%D0%B8%D1%81%D1%82%D1%83%D0%B2%D0%B0%D0%BD%D0%BD%D1%8F_%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B0%D0%BC%D0%B8_%D0%BF%D0%B0%D0%BA%D0%B5%D1%82%D1%83_phonetic-languages-examples-0.6.0.0.pdf
phonetic-languages-examples.cabal view
@@ -2,7 +2,7 @@ -- further documentation, see http://haskell.org/cabal/users-guide/ name: phonetic-languages-examples-version: 0.5.0.0+version: 0.6.0.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