packages feed

phonetic-languages-simplified-generalized-examples-array 0.3.0.0 → 0.4.0.0

raw patch · 4 files changed

+64/−3 lines, 4 filesdep +mmsyn3dep +processPVP ok

version bump matches the API change (PVP)

Dependencies added: mmsyn3, process

API changes (from Hackage documentation)

+ EspeakNG_IPA: espeakNG_IPA :: String -> String -> IO String
+ EspeakNG_IPA: espeakNG_IPA_ :: String -> String -> IO ()

Files

ChangeLog.md view
@@ -29,3 +29,9 @@  * Third version. Changed the code related to the breaking update of the phonetic-languages-phonetics-basics package. Now the GWritingSystemPRPLX and syllable segmentation have extended possibilities.++## 0.4.0.0 -- 2021-07-06++* Fourth version. Added a new module EspeakNG_IPA to use the espeak and IPA functionality. +For this, added mmsyn3 and process as new dependencies.+
+ EspeakNG_IPA.hs view
@@ -0,0 +1,50 @@+-- |+-- Module      :  EspeakNG_IPA+-- Copyright   :  (c) OleksandrZhabenko 2021+-- License     :  MIT+-- Stability   :  Experimental+-- Maintainer  :  olexandr543@yahoo.com+--+-- Is intended to use internally \"espeak-ng\" or \"espeak\" executable to produce the IPA phonemes output+-- of the given 'String'.+-- The prerequisite is installed espeak-ng or espeak executable in the path that is in the PATH+-- environment variable. ++module EspeakNG_IPA where++import System.Process (readProcessWithExitCode)+import EndOfExe (showE)+import System.Exit (ExitCode(..))+import Data.Maybe (fromJust)++{-| Given a language 'String' supported by the espeak-ng or espeak (which one is installed properly) and the+needed text returns the IPA representation. Is just some wrapper around the espeak functionality. -}+espeakNG_IPA :: String -> String -> IO String+espeakNG_IPA lang xs =+ case showE "espeak-ng" of+   Just path -> readProcessWithExitCode path ("-xq":"--ipa":"-l":[lang]) xs >>=+     \(hcode,hout,herr) -> case hcode of+        ExitSuccess -> return (unwords . lines $ hout)+        _ -> error ("EspeakNG_IPA.espeakNG_IPA: " ++ show herr)+   _ -> case showE "espeak" of+          Just path2 -> readProcessWithExitCode path2 ("-xq":"--ipa":"-l":[lang]) xs >>=+            \(hcode,hout,herr) -> case hcode of+               ExitSuccess -> return (unwords . lines $ hout)+               _ -> error ("EspeakNG_IPA.espeakNG_IPA: " ++ show herr)+          _ -> error ("EspeakNG_IPA.espeakNG_IPA: No espeak or espeak-ng executable is installed in the PATH directories. ")++{-| Given a language 'String' supported by the espeak-ng or espeak (which one is installed properly) and the+needed text prints the IPA representation. Is just some wrapper around the espeak functionality. -}  +espeakNG_IPA_ :: String -> String -> IO ()+espeakNG_IPA_ lang xs =+   case showE "espeak-ng" of+   Just path -> readProcessWithExitCode path ("-xq":"--ipa":"-l":[lang]) xs >>=+     \(hcode,hout,herr) -> case hcode of+        ExitSuccess -> putStrLn (unwords . lines $ hout)+        _ -> error ("EspeakNG_IPA.espeakNG_IPA_: " ++ show herr)+   _ -> case showE "espeak" of+          Just path2 -> readProcessWithExitCode path2 ("-xq":"--ipa":"-l":[lang]) xs >>=+            \(hcode,hout,herr) -> case hcode of+               ExitSuccess -> putStrLn (unwords . lines $ hout)+               _ -> error ("EspeakNG_IPA.espeakNG_IPA_: " ++ show herr)+          _ -> error ("EspeakNG_IPA.espeakNG_IPA_: No espeak or espeak-ng executable is installed in the PATH directories. ")
README.md view
@@ -64,3 +64,8 @@ and some other ones, just as the algorithms provided here.  This, to the mind of the author, is a ground for using the library and its functionality in such cases.++ Using the Espeak and IPA functionality+ ======================================++You can use the EspeakNG_IPA module for this since the 0.4.0.0 version.
phonetic-languages-simplified-generalized-examples-array.cabal view
@@ -3,7 +3,7 @@ -- http://haskell.org/cabal/users-guide/  name:                phonetic-languages-simplified-generalized-examples-array-version:             0.3.0.0+version:             0.4.0.0 synopsis:            Helps to create texts with the given phonetic properties (e. g. poetic). description:         Is rewritten from the modules of the @phonetic-languages-simplified-examples-array@ package. Can be used not only for Ukrainian, but also for other languages.  homepage:            https://hackage.haskell.org/package/phonetic-languages-simplified-generalized-examples-array@@ -18,9 +18,9 @@ cabal-version:       >=1.10  library-  exposed-modules:     Phonetic.Languages.General.Lines, Phonetic.Languages.General.Parsing, Phonetic.Languages.General.Simple, Phonetic.Languages.General.GetTextualInfo, Phonetic.Languages.Simplified.Array.General.FuncRep2RelatedG2, Phonetic.Languages.General.Simple.Parsing, Phonetic.Languages.General.Lines.Parsing, Phonetic.Languages.General.GetInfo.Parsing+  exposed-modules:     Phonetic.Languages.General.Lines, Phonetic.Languages.General.Parsing, Phonetic.Languages.General.Simple, Phonetic.Languages.General.GetTextualInfo, Phonetic.Languages.Simplified.Array.General.FuncRep2RelatedG2, Phonetic.Languages.General.Simple.Parsing, Phonetic.Languages.General.Lines.Parsing, Phonetic.Languages.General.GetInfo.Parsing, EspeakNG_IPA   -- other-modules:   other-extensions:    BangPatterns, FlexibleContexts-  build-depends:       base >=4.8 && <4.15, phonetic-languages-simplified-generalized-examples-common >=0.2 && <1, subG >=0.4.2 && <1, phonetic-languages-simplified-generalized-properties-array >=0.2 && <1, phonetic-languages-simplified-base >=0.2 && <1, phonetic-languages-permutations-array >=0.1 && <1, phonetic-languages-filters-array >=0.1 && <1, phonetic-languages-phonetics-basics >=0.7 && <1, phonetic-languages-constraints-array >=0.1 && <1, parallel >=3.2.0.6 && <4, phonetic-languages-plus >=0.2 && <1, mmsyn2-array >=0.1.3 && <1, heaps >=0.3.6.1 && <1+  build-depends:       base >=4.8 && <4.15, phonetic-languages-simplified-generalized-examples-common >=0.2 && <1, subG >=0.4.2 && <1, phonetic-languages-simplified-generalized-properties-array >=0.2 && <1, phonetic-languages-simplified-base >=0.2 && <1, phonetic-languages-permutations-array >=0.1 && <1, phonetic-languages-filters-array >=0.1 && <1, phonetic-languages-phonetics-basics >=0.7 && <1, phonetic-languages-constraints-array >=0.1 && <1, parallel >=3.2.0.6 && <4, phonetic-languages-plus >=0.2 && <1, mmsyn2-array >=0.1.3 && <1, heaps >=0.3.6.1 && <1, mmsyn3 >=0.1.5 && <1, process >= 1.6.2 && <2   -- hs-source-dirs:   default-language:    Haskell2010