-- | -- Module : Phonetic.Languages.Simplified.Array.General.FuncRep2RelatedG2 -- Copyright : (c) OleksandrZhabenko 2020-2021 -- License : MIT -- Stability : Experimental -- Maintainer : olexandr543@yahoo.com -- -- Functions to choose from the 'FuncRep2' variants for the general phonetic languages approach. {-# LANGUAGE BangPatterns #-} module Phonetic.Languages.Simplified.Array.General.FuncRep2RelatedG2 where import CaseBi.Arr (getBFstL') import Phonetic.Languages.Simplified.DataG.Base import Phonetic.Languages.Array.General.PropertiesFuncRepG2 import Phonetic.Languages.Array.General.PropertiesSyllablesG2 import Data.Monoid (mappend) import Data.Phonetic.Languages.Base import Data.Phonetic.Languages.Syllables -- | Allows to choose the variant of the computations in case of usual processment. The coefficient 1.3 (anyway, it must -- be greater than 1.0) )is an empirical and approximate, you can use your own if you like. chooseMax :: (Ord c) => GWritingSystemPRPLX -- ^ Data used to obtain the phonetic language representation of the text. -> [(Char,Char)] -- ^ The pairs of the 'Char' that corresponds to the similar phonetic languages consonant phenomenon -- (e. g. allophones). Must be sorted in the ascending order to be used correctly. -> CharPhoneticClassification -- ^ The 'Array' 'Int' 'PRS' must be sorted in the ascending order to be used in the module correctly. -> SegmentRulesG -> String -- ^ Corresponds to the \'0\' symbol delimiter in the @ukrainian-phonetics-basic-array@ package. -> String -- ^ Corresponds to the \'1\' and \'-\' symbol delimiters in the @ukrainian-phonetics-basic-array@ package. -> (Double -> c) -> (Double -> String -> ([[[PRS]]] -> [[Double]])) -- ^ The function that is needed in the 'procRhythmicity23F' function. -- Specifies a way how the syllables represented in the phonetic language approach transforms into their durations and -- depends on two parameters. -> Coeffs2 -> [([[[PRS]]] -> [[Double]])] -- ^ A list of 4 different functions that specifies the syllables durations, analogues of the -- syllableDurationsD functions from the @ukrainian-phonetics-basics-array@ package. The last one must be probably the most -- exact one and, therefore, the default one. -> String -- ^ Is intended to be one of the following strings: \"02y\", \"02z\", \"03y\", \"03z\", \"04y\", \"04z\", -- \"0y\", \"0z\", \"y\", \"y0\", \"y2\", \"y3\", \"y4\", \"yy\", \"yy2\", \"yy3\", \"z\", \"z2\", \"z3\", \"z4\", -- \"zz\", \"zz2\", \"zz3\", \"zz4\" or some other one (that is the default one). Since the 0.5.0.0 version -- you can use also \"w\" and \"x\"-based lines of properties. Specifies the applied properties -- to get the result. The \"z\"-line uses \'F\' functions. -> FuncRep2 String Double c chooseMax = chooseMaxG 1.3 {-# INLINE chooseMax #-} -- | Allows to choose the variant of the computations in case of usual processment. chooseMaxG :: (Ord c) => Double -- ^ Must be greater than 1.0 though it is not checked. -> GWritingSystemPRPLX -- ^ Data used to obtain the phonetic language representation of the text. -> [(Char,Char)] -- ^ The pairs of the 'Char' that corresponds to the similar phonetic languages consonant phenomenon -- (e. g. allophones). Must be sorted in the ascending order to be used correctly. -> CharPhoneticClassification -- ^ The 'Array' 'Int' 'PRS' must be sorted in the ascending order to be used in the module correctly. -> SegmentRulesG -> String -- ^ Corresponds to the \'0\' symbol delimiter in the @ukrainian-phonetics-basic-array@ package. -> String -- ^ Corresponds to the \'1\' and \'-\' symbol delimiters in the @ukrainian-phonetics-basic-array@ package. -> (Double -> c) -> (Double -> String -> ([[[PRS]]] -> [[Double]])) -- ^ The function that is needed in the 'procRhythmicity23F' function. -- Specifies a way how the syllables represented in the phonetic language approach transforms into their durations and -- depends on two parameters. -> Coeffs2 -> [([[[PRS]]] -> [[Double]])] -- ^ A list of 4 different functions that specifies the syllables durations, analogues of the -- syllableDurationsD functions from the @ukrainian-phonetics-basics-array@ package. The last one must be probably the most -- exact one and, therefore, the default one. -> String -- ^ Is intended to be one of the following strings: \"02y\", \"02z\", \"03y\", \"03z\", \"04y\", \"04z\", -- \"0y\", \"0z\", \"y\", \"y0\", \"y2\", \"y3\", \"y4\", \"yy\", \"yy2\", \"yy3\", \"z\", \"z2\", \"z3\", \"z4\", -- \"zz\", \"zz2\", \"zz3\", \"zz4\" or some other one (that is the default one). Since the 0.5.0.0 version -- you can use also \"w\" and \"x\"-based lines of properties. Specifies the applied properties -- to get the result. The \"z\"-line uses \'F\' functions. -> FuncRep2 String Double c chooseMaxG k wrs ks arr gs us vs g h coeffs xs choice = getBFstL' (procB2InvF wrs ks arr gs us vs g (xs !! 3) coeffs) [("02y",procRhythmicity23F k g h "02y" coeffs wrs ks arr gs us vs), ("02z",procRhythmicity23F k g h "02z" coeffs wrs ks arr gs us vs), ("03y",procRhythmicity23F k g h "03y" coeffs wrs ks arr gs us vs), ("03z",procRhythmicity23F k g h "03z" coeffs wrs ks arr gs us vs), ("04y",procRhythmicity23F k g h "04y" coeffs wrs ks arr gs us vs), ("04z",procRhythmicity23F k g h "04z" coeffs wrs ks arr gs us vs), ("0y",procRhythmicity23F k g h "0y" coeffs wrs ks arr gs us vs), ("0z",procRhythmicity23F k g h "0z" coeffs wrs ks arr gs us vs), ("w01",procRhythmicity23F k g h "w01" coeffs wrs ks arr gs us vs), ("w02",procRhythmicity23F k g h "w02" coeffs wrs ks arr gs us vs), ("w03",procRhythmicity23F k g h "w03" coeffs wrs ks arr gs us vs), ("w04",procRhythmicity23F k g h "w04" coeffs wrs ks arr gs us vs), ("w11",procRhythmicity23F k g h "w11" coeffs wrs ks arr gs us vs), ("w12",procRhythmicity23F k g h "w12" coeffs wrs ks arr gs us vs), ("w13",procRhythmicity23F k g h "w13" coeffs wrs ks arr gs us vs), ("w14",procRhythmicity23F k g h "w14" coeffs wrs ks arr gs us vs), ("w21",procRhythmicity23F k g h "w21" coeffs wrs ks arr gs us vs), ("w22",procRhythmicity23F k g h "w22" coeffs wrs ks arr gs us vs), ("w23",procRhythmicity23F k g h "w23" coeffs wrs ks arr gs us vs), ("w24",procRhythmicity23F k g h "w24" coeffs wrs ks arr gs us vs), ("w31",procRhythmicity23F k g h "w31" coeffs wrs ks arr gs us vs), ("w32",procRhythmicity23F k g h "w32" coeffs wrs ks arr gs us vs), ("w33",procRhythmicity23F k g h "w33" coeffs wrs ks arr gs us vs), ("w34",procRhythmicity23F k g h "w34" coeffs wrs ks arr gs us vs), ("x01",procRhythmicity23F k g h "x01" coeffs wrs ks arr gs us vs), ("x02",procRhythmicity23F k g h "x02" coeffs wrs ks arr gs us vs), ("x03",procRhythmicity23F k g h "x03" coeffs wrs ks arr gs us vs), ("x04",procRhythmicity23F k g h "x04" coeffs wrs ks arr gs us vs), ("x11",procRhythmicity23F k g h "x11" coeffs wrs ks arr gs us vs), ("x12",procRhythmicity23F k g h "x12" coeffs wrs ks arr gs us vs), ("x13",procRhythmicity23F k g h "x13" coeffs wrs ks arr gs us vs), ("x14",procRhythmicity23F k g h "x14" coeffs wrs ks arr gs us vs), ("x21",procRhythmicity23F k g h "x21" coeffs wrs ks arr gs us vs), ("x22",procRhythmicity23F k g h "x22" coeffs wrs ks arr gs us vs), ("x23",procRhythmicity23F k g h "x23" coeffs wrs ks arr gs us vs), ("x24",procRhythmicity23F k g h "x24" coeffs wrs ks arr gs us vs), ("x31",procRhythmicity23F k g h "x31" coeffs wrs ks arr gs us vs), ("x32",procRhythmicity23F k g h "x32" coeffs wrs ks arr gs us vs), ("x33",procRhythmicity23F k g h "x33" coeffs wrs ks arr gs us vs), ("x34",procRhythmicity23F k g h "x34" coeffs wrs ks arr gs us vs), ("y",procB2F wrs ks arr gs us vs g (xs !! 0) coeffs), ("y0",procDiverse2F wrs (' ':us `mappend` vs) g), ("y2",procB2F wrs ks arr gs us vs g (xs !! 1) coeffs), ("y3",procB2F wrs ks arr gs us vs g (xs !! 2) coeffs), ("y4",procB2F wrs ks arr gs us vs g (xs !! 3) coeffs), ("yy",procB2InvF wrs ks arr gs us vs g (xs !! 0) coeffs), ("yy2",procB2InvF wrs ks arr gs us vs g (xs !! 1) coeffs), ("yy3",procB2InvF wrs ks arr gs us vs g (xs !! 2) coeffs), ("z",procB2FF wrs ks arr gs us vs k g (xs !! 0) coeffs), ("z2",procB2FF wrs ks arr gs us vs k g (xs !! 1) coeffs), ("z3",procB2FF wrs ks arr gs us vs k g (xs !! 2) coeffs), ("z4",procB2FF wrs ks arr gs us vs k g (xs !! 3) coeffs), ("zz",procB2InvFF wrs ks arr gs us vs k g (xs !! 0) coeffs), ("zz2",procB2InvFF wrs ks arr gs us vs k g (xs !! 1) coeffs), ("zz3",procB2InvFF wrs ks arr gs us vs k g (xs !! 2) coeffs), ("zz4", procB2InvFF wrs ks arr gs us vs k g (xs !! 3) coeffs)] choice -- | Allows to choose precision in the Numeric.showFDouble function being given a choice parameter. precChoice :: String -- ^ Is intended to be one of the following strings: \"02y\", \"02z\", \"03y\", \"03z\", \"04y\", \"04z\", -- \"0y\", \"0z\", \"y\", \"y0\", \"y2\", \"y3\", \"y4\", \"yy\", \"yy2\", \"yy3\", \"z\", \"z2\", \"z3\", \"z4\", -- \"zz\", \"zz2\", \"zz3\", \"zz4\" or some other one (that is the default one). Since the 0.5.0.0 version -- you can use also \"w\" and \"x\"-based lines of properties. Specifies the applied properties -- to get the result. The \"z\"-line uses \'F\' functions. -> Maybe Int precChoice = getBFstL' (Just 4) [("02y",Just 0),("02z",Just 0),("03y",Just 0),("03z",Just 0),("04y",Just 0), ("04z",Just 0),("0y",Just 0),("0z",Just 0),("y",Just 0),("y0",Just 0),("y2",Just 0),("y3",Just 0), ("y4",Just 0), ("z",Just 0),("z0",Just 0),("z2",Just 0),("z3",Just 0), ("z4",Just 0)]