packages feed

phonetic-languages-examples-0.1.0.0: Languages/UniquenessPeriods/Vector/FuncRepRelatedG.hs

-- |
-- Module      :  Languages.UniquenessPeriods.Vector.FuncRepRelatedG
-- Copyright   :  (c) OleksandrZhabenko 2020
-- License     :  MIT
-- Stability   :  Experimental
-- Maintainer  :  olexandr543@yahoo.com
--
-- Functions to choose from the 'FuncRep' variants.

module Languages.UniquenessPeriods.Vector.FuncRepRelatedG where

import qualified Data.Vector as VB
import Languages.UniquenessPeriods.Vector.DataG
import String.Languages.UniquenessPeriods.VectorG
import Languages.UniquenessPeriods.Vector.PropertiesFuncRepG

-- | Allows to choose the variant of the computations in case of usual processment.
chooseMax :: String -> FuncRep (VB.Vector Char) (UniquenessGeneral2 Char) [Float]
chooseMax xs
  | xs == "y0" = procDiverse2F
  | xs == "0y" = procRhythmicity23F
  | xs == "y" = procBothF
  | otherwise = procBothInvF

-- | Allows to choose the variant of the computations in case of minimum lookup. Uses @-neg@ variants.
chooseMin :: String -> FuncRep (VB.Vector Char) (UniquenessGeneral2 Char) [Float]
chooseMin xs
  | xs == "y0" = procDiverse2Fneg
  | xs == "0y" = procRhythmicity23Fneg
  | xs == "y" = procBothFneg
  | otherwise = procBothInvFneg

-- | Allows to choose precision in the Numeric.showFFloat function being given a choice parameter.
precChoice :: String -> Maybe Int
precChoice xs
  | xs == "y0" || xs == "y" || xs == "0y" = Just 0
  | otherwise = Just 4