dobutokO-poetry 0.5.0.0 → 0.6.0.0
raw patch · 3 files changed
+34/−1 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ DobutokO.Poetry: uniqInMaxPoeticalNLine :: Int -> Vector ([Int] -> Int) -> Vector Uniqueness -> IO (Vector Uniqueness)
+ DobutokO.Poetry: uniqNPoetical2GNLine :: Int -> Int -> Vector ([Int] -> Int) -> (String -> [Int]) -> String -> IO ()
+ DobutokO.Poetry: uniqNPoeticalNLine :: Int -> Int -> Vector ([Int] -> Int) -> Vector Uniqueness -> IO ()
Files
- ChangeLog.md +5/−0
- DobutokO/Poetry.hs +28/−0
- dobutokO-poetry.cabal +1/−1
ChangeLog.md view
@@ -31,3 +31,8 @@ * Fifth version. Fixed issues with inappropriate message information in some functions. Added new norms and possibility to use non-negative lists and to split them to make possible a technique of multiple metrics united in one function. Added generalized variant of the 'uniquenessPeriods' and some additional functions to work with String data in Ukrainian. Some minor code improvements.++## 0.6.0.0 -- 2020-07-25++* Sixth version. Added three new functions to the DobutokO.Poetry module: uniqInMaxPoeticalNLine, uniqNPoeticalNLine and uniqNPoetical2GNLine. They are +similar to the respective functions without 'Line' ending in their name but prints their output on the same line.
DobutokO/Poetry.hs view
@@ -47,6 +47,10 @@ -- ** Additional functions , uniquenessVariants2GN , uniqMaxPoetical2GN+ -- * On one line output+ , uniqInMaxPoeticalNLine+ , uniqNPoeticalNLine+ , uniqNPoetical2GNLine ) where import Data.Char (isPunctuation)@@ -141,6 +145,13 @@ putStrLn (filter (not . isPunctuation) . lastFrom3 $ uniq) >> print (twoFrom3 uniq) >> putStrLn "" return . V.filter (/= uniq) $ v +-- | Generalized variant of the 'uniqInMaxPoetical' with usage of the several norms and all the information is printed on the same line. +uniqInMaxPoeticalNLine :: Int -> V.Vector ([Int] -> Int) -> V.Vector Uniqueness -> IO (V.Vector Uniqueness)+uniqInMaxPoeticalNLine k vN v = do+ let !uniq = uniqMaxPoeticalGNV k vN v+ putStr (filter (not . isPunctuation) . lastFrom3 $ uniq) >> putStr " " + return . V.filter (/= uniq) $ v + -- | A variant of the 'uniqNPoeticalG' function with the @n@ equal to 10. uniq10PoeticalG :: ([Int] -> Int) -> String -> IO () uniq10PoeticalG = uniqNPoeticalG 10@@ -171,6 +182,13 @@ | compare (V.length v) n == LT = V.mapM_ (\x -> putStrLn (filter (not . isPunctuation) . lastFrom3 $ x) >> print (twoFrom3 x) >> putStrLn "" ) v | otherwise = (uniqInMaxPoeticalN k vN v >>= uniqNPoeticalN (n - 1) k vN) +-- | Generalized variant of the 'uniqNPoetical' with usage of several norms but prints it output on the one line. +uniqNPoeticalNLine :: Int -> Int -> V.Vector ([Int] -> Int) -> V.Vector Uniqueness -> IO ()+uniqNPoeticalNLine n k vN v + | n == 0 = putStrLn ""+ | compare (V.length v) n == LT = V.mapM_ (\x -> putStr (filter (not . isPunctuation) . lastFrom3 $ x) >> putStr " " ) v >> putStrLn ""+ | otherwise = (uniqInMaxPoeticalNLine k vN v >>= uniqNPoeticalNLine (n - 1) k vN) + -- | The result of the recursive @n :: Int@ times application of the 'uniqInMaxPoetical' function. The norm given defines the way, in which the elements -- are considered the \"maximum\" ones. uniqNPoeticalV :: Int -> V.Vector ([Int],Int,Int,Int,String) -> IO (V.Vector ([Int],Int,Int,Int,String))@@ -281,6 +299,16 @@ if compare (V.length v) n == LT then V.mapM_ (\x -> putStrLn ((filter (not . isPunctuation) . lastFrom3 $ x)) >> print (twoFrom3 x) >> putStrLn "" ) v else (uniqInMaxPoeticalN k vN v >>= uniqNPoeticalN (n - 1) k vN) ++-- | Generalized variant of the 'uniqNPoeticalG' with usage of the several norms, but prints its output on the same line. +uniqNPoetical2GNLine :: Int -> Int -> V.Vector ([Int] -> Int) -> (String -> [Int]) -> String -> IO ()+uniqNPoetical2GNLine n k vN g xs + | n == 0 = putStrLn ""+ | otherwise = do + let v = uniquenessVariants2GN vN g xs+ if compare (V.length v) n == LT + then V.mapM_ (\x -> putStr ((filter (not . isPunctuation) . lastFrom3 $ x)) >> putStr " " ) v >> putStrLn ""+ else (uniqInMaxPoeticalNLine k vN v >>= uniqNPoeticalNLine (n - 1) k vN) -- | Generalized variant of the 'uniqNPoeticalVG' with usage of the several norms. uniqNPoetical2VGN :: Int -> Int -> V.Vector ([Int] -> Int) -> (String -> [Int]) -> String -> IO (V.Vector Uniqueness)
dobutokO-poetry.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: dobutokO-poetry-version: 0.5.0.0+version: 0.6.0.0 synopsis: Helps to order the 7 or less Ukrainian words to obtain somewhat suitable for poetry or music text description: Helps to order the 7 or less Ukrainian words (or their concatenations) to obtain somewhat suitable for poetry or music text. Can be also used as a research instrument with generalized functions.