string-interpreter 0.1.0.0 → 0.2.0.0
raw patch · 3 files changed
+22/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- Interpreter/StringConversion.hs +15/−2
- string-interpreter.cabal +3/−3
ChangeLog.md view
@@ -3,3 +3,7 @@ ## 0.1.0.0 -- 2021-08-16 * First version. Released on an unsuspecting world.++## 0.2.0.0 -- 2021-08-16++* Second version. Added a possibility to specify also splitting of the word.
Interpreter/StringConversion.hs view
@@ -20,6 +20,19 @@ convStringInterpreter :: String -> String -> String convStringInterpreter contrs xs | null contrs = xs+ | null . words $ xs = xs+ | case filter (\y -> isDigit y || y == '/') contrs of { a:'/':bs -> a /= '/' && a /= '0' ; ~rrr -> False } =+ let ys = filter (\y -> isDigit y || y == '/') contrs in+ case ys of+ ~a:'/':bs -> let wordsN = words xs+ wordN = min (fromMaybe 1 (readMaybe [a]::Maybe Int)) (length wordsN)+ pos = fromMaybe 0 (readMaybe bs::Maybe Int)+ (ts,us) = splitAt pos (wordsN !! (wordN - 1))+ twoWords = ts `mappend` (' ':us)+ (wss,tss) = splitAt (wordN - 1) wordsN+ kss = drop 1 tss in+ if null wss then twoWords `mappend` (' ':unwords kss)+ else unwords wss `mappend` (' ':twoWords) `mappend` (' ':unwords kss) | length (nub . filter (\t -> t >= '1' && [t] <= show (length . words $ xs)) $ contrs) < 2 = xs | otherwise = let cntrs = nub . filter (\t -> t >= '1' && [t] <= show (length . words $ xs)) $ contrs tss = words xs in@@ -30,8 +43,8 @@ (kss,lss) = splitAt number yss in if length tss < pos + number - 1 then xs else if null zss then concat kss `mappend` " " `mappend` intercalate " " lss- else intercalate " " zss `mappend` " " `mappend` concat kss `mappend` " " `mappend` intercalate " " lss+ else unwords zss `mappend` " " `mappend` concat kss `mappend` " " `mappend` unwords lss _ -> let idxs = map (\x -> fromJust (readMaybe [x]::Maybe Int)) $ cntrs wordsN = map (\i -> tss !! (i - 1)) idxs restWords = tss \\ wordsN- in intercalate " " restWords `mappend` " " `mappend` concat wordsN+ in unwords restWords `mappend` " " `mappend` concat wordsN
string-interpreter.cabal view
@@ -2,9 +2,9 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: string-interpreter-version: 0.1.0.0-synopsis: A library that has commonly used function for the phonetic-languages implementations-description: Provides a way to use recersive interactive mode.+version: 0.2.0.0+synopsis: Is used in the recursive mode for phonetic languages approach.+description: A library that has commonly used function for the phonetic-languages implementations. homepage: https://hackage.haskell.org/package/string-interpreter license: MIT license-file: LICENSE