{-# LANGUAGE TypeSynonymInstances #-}
{-# OPTIONS_HADDOCK show-extensions #-}
-- |
-- Module      :  Languages.Phonetic.Ukrainian.Syllable.Double.ArrInt8
-- Copyright   :  (c) OleksandrZhabenko 2021-2022
-- License     :  MIT
-- Stability   :  Experimental
-- Maintainer  :  olexandr543@yahoo.com
--
-- This module works with syllable segmentation in Ukrainian. Uses 'Double' whenever possible.
-- Is inspired by the DobutokO.Sound.DIS5G6G module from @dobutokO2@ package.
-- See: 'https://hackage.haskell.org/package/dobutokO2-0.43.0.0/docs/DobutokO-Sound-DIS5G6G.html'.
-- The initial 'Double' data are gotten from there.

module Languages.Phonetic.Ukrainian.Syllable.Double.ArrInt8 where

import CaseBi.Arr
import Melodics.Ukrainian.ArrInt8 (Sound8)
import GHC.Int
import Data.Foldable (foldl')

s0DuratD1 :: Sound8 -> Double
s0DuratD1 :: Sound8 -> Double
s0DuratD1 = Double -> [(Sound8, Double)] -> Sound8 -> Double
forall a b. Ord a => b -> [(a, b)] -> a -> b
getBFstLSorted' Double
0.051020 [(Sound8
1,Double
0.138231),(Sound8
2,Double
9.3605e-2),(Sound8
3,Double
0.116463),(Sound8
4,Double
0.10907),(Sound8
5,Double
9.9955e-2),(Sound8
6,Double
9.415e-2),(Sound8
7,Double
2.0227e-2),(Sound8
8,Double
5.5601e-2),(Sound8
9,Double
5.5601e-2),(Sound8
10,Double
7.0658e-2),(Sound8
11,Double
7.0658e-2),(Sound8
15,Double
5.7143e-2),(Sound8
16,Double
5.7143e-2),(Sound8
17,Double
7.2063e-2),(Sound8
18,Double
7.2063e-2),(Sound8
19,Double
6.2948e-2),(Sound8
20,Double
6.2948e-2),(Sound8
21,Double
7.6825e-2),(Sound8
22,Double
7.6825e-2),(Sound8
23,Double
4.8934e-2),(Sound8
24,Double
4.8934e-2),(Sound8
25,Double
5.6054e-2),(Sound8
26,Double
5.6054e-2),(Sound8
27,Double
5.7143e-2),(Sound8
28,Double
6.4036e-2),(Sound8
29,Double
6.4036e-2),(Sound8
30,Double
7.737e-2),(Sound8
31,Double
7.737e-2),(Sound8
32,Double
7.424e-2),(Sound8
33,Double
7.424e-2),(Sound8
34,Double
4.9206e-2),(Sound8
35,Double
4.9206e-2),(Sound8
36,Double
8.2268e-2),(Sound8
37,Double
8.2268e-2),(Sound8
38,Double
5.3061e-2),(Sound8
39,Double
5.7596e-2),(Sound8
40,Double
5.7596e-2),(Sound8
41,Double
6.6077e-2),(Sound8
42,Double
6.6077e-2),(Sound8
43,Double
6.2268e-2),(Sound8
44,Double
6.2268e-2),(Sound8
45,Double
4.5351e-2),(Sound8
46,Double
4.5351e-2),(Sound8
47,Double
0.13483),(Sound8
48,Double
0.13483),(Sound8
49,Double
7.4603e-2),(Sound8
50,Double
0.110658),(Sound8
51,Double
0.110658),(Sound8
52,Double
7.7188e-2),(Sound8
53,Double
7.7188e-2),(Sound8
54,Double
7.4558e-2),(Sound8
66,Double
8.9342e-2)]

-- |
s0DuratD2 :: Sound8 -> Double
s0DuratD2 :: Sound8 -> Double
s0DuratD2 = Double -> [(Sound8, Double)] -> Sound8 -> Double
forall a b. Ord a => b -> [(a, b)] -> a -> b
getBFstLSorted' Double
0.06408817 [(Sound8
1,Double
0.27161466),(Sound8
2,Double
0.27192511),(Sound8
3,Double
0.28539351),(Sound8
4,Double
0.25250039),(Sound8
5,Double
0.2050935),(Sound8
6,Double
0.20026538),(Sound8
7,Double
2.218624e-2),(Sound8
8,Double
7.729654e-2),(Sound8
9,Double
7.729654e-2),(Sound8
10,Double
8.048113e-2),(Sound8
11,Double
8.048113e-2),(Sound8
15,Double
0.10977617),(Sound8
16,Double
0.10977617),(Sound8
17,Double
6.58655e-2),(Sound8
18,Double
6.58655e-2),(Sound8
19,Double
7.751571e-2),(Sound8
20,Double
7.751571e-2),(Sound8
21,Double
5.392745e-2),(Sound8
22,Double
5.392745e-2),(Sound8
23,Double
8.900757e-2),(Sound8
24,Double
8.900757e-2),(Sound8
25,Double
6.099951e-2),(Sound8
26,Double
6.099951e-2),(Sound8
27,Double
8.226452e-2),(Sound8
28,Double
0.11159399),(Sound8
29,Double
0.11159399),(Sound8
30,Double
0.14303837),(Sound8
31,Double
0.14303837),(Sound8
32,Double
5.639178e-2),(Sound8
33,Double
5.639178e-2),(Sound8
34,Double
6.354637e-2),(Sound8
35,Double
6.354637e-2),(Sound8
36,Double
8.404524e-2),(Sound8
37,Double
8.404524e-2),(Sound8
38,Double
5.616409e-2),(Sound8
39,Double
0.12541547),(Sound8
40,Double
0.12541547),(Sound8
41,Double
0.12838476),(Sound8
42,Double
0.12838476),(Sound8
43,Double
0.15776219),(Sound8
44,Double
0.15776219),(Sound8
45,Double
4.91782e-2),(Sound8
46,Double
4.91782e-2),(Sound8
47,Double
9.603085e-2),(Sound8
48,Double
9.603085e-2),(Sound8
49,Double
5.294375e-2),(Sound8
50,Double
5.047358e-2),(Sound8
51,Double
5.047358e-2),(Sound8
52,Double
7.905155e-2),(Sound8
53,Double
7.905155e-2),(Sound8
54,Double
7.512999e-2),(Sound8
66,Double
7.835033e-2)]

s0DuratD3 :: Sound8 -> Double
s0DuratD3 :: Sound8 -> Double
s0DuratD3 = Double -> [(Sound8, Double)] -> Sound8 -> Double
forall a b. Ord a => b -> [(a, b)] -> a -> b
getBFstLSorted' Double
0.05779993 [(Sound8
1,Double
0.25872483),(Sound8
2,Double
0.22876537),(Sound8
3,Double
0.25423777),(Sound8
4,Double
0.20243791),(Sound8
5,Double
0.19849003),(Sound8
6,Double
0.19777405),(Sound8
7,Double
1.943042e-2),(Sound8
8,Double
8.453724e-2),(Sound8
9,Double
8.453724e-2),(Sound8
10,Double
9.996042e-2),(Sound8
11,Double
9.996042e-2),(Sound8
15,Double
0.13787716),(Sound8
16,Double
0.13787716),(Sound8
17,Double
7.437409e-2),(Sound8
18,Double
7.437409e-2),(Sound8
19,Double
7.985903e-2),(Sound8
20,Double
7.985903e-2),(Sound8
21,Double
0.10289067),(Sound8
22,Double
0.10289067),(Sound8
23,Double
0.10039843),(Sound8
24,Double
0.10039843),(Sound8
25,Double
6.643842e-2),(Sound8
26,Double
6.643842e-2),(Sound8
27,Double
0.10975353),(Sound8
28,Double
0.1090645),(Sound8
29,Double
0.1090645),(Sound8
30,Double
0.14576594),(Sound8
31,Double
0.14576594),(Sound8
32,Double
6.084464e-2),(Sound8
33,Double
6.084464e-2),(Sound8
34,Double
5.937718e-2),(Sound8
35,Double
5.937718e-2),(Sound8
36,Double
7.798724e-2),(Sound8
37,Double
7.798724e-2),(Sound8
38,Double
5.901357e-2),(Sound8
39,Double
0.11906522),(Sound8
40,Double
0.11906522),(Sound8
41,Double
0.13985258),(Sound8
42,Double
0.13985258),(Sound8
43,Double
0.15880087),(Sound8
44,Double
0.15880087),(Sound8
45,Double
5.893304e-2),(Sound8
46,Double
5.893304e-2),(Sound8
47,Double
0.10765654),(Sound8
48,Double
0.10765654),(Sound8
49,Double
6.247632e-2),(Sound8
50,Double
6.03912e-2),(Sound8
51,Double
6.03912e-2),(Sound8
52,Double
0.13526622),(Sound8
53,Double
0.13526622),(Sound8
54,Double
8.190674e-2),(Sound8
66,Double
7.8444e-2)]

s0DuratD4 :: Sound8 -> Double
s0DuratD4 :: Sound8 -> Double
s0DuratD4 = Double -> [(Sound8, Double)] -> Sound8 -> Double
forall a b. Ord a => b -> [(a, b)] -> a -> b
getBFstLSorted' Double
0.14160713 [(Sound8
1,Double
0.20859653),(Sound8
2,Double
0.21194045),(Sound8
3,Double
0.2089092),(Sound8
4,Double
0.19826109),(Sound8
5,Double
0.20249813),(Sound8
6,Double
0.20167924),(Sound8
7,Double
1.957491e-2),(Sound8
8,Double
8.508446e-2),(Sound8
9,Double
8.508446e-2),(Sound8
10,Double
0.17053331),(Sound8
11,Double
0.17053331),(Sound8
15,Double
7.768941e-2),(Sound8
16,Double
7.768941e-2),(Sound8
17,Double
0.12987485),(Sound8
18,Double
0.12987485),(Sound8
19,Double
0.14343568),(Sound8
20,Double
0.14343568),(Sound8
21,Double
0.22822145),(Sound8
22,Double
0.22822145),(Sound8
23,Double
0.16712392),(Sound8
24,Double
0.16712392),(Sound8
25,Double
8.566847e-2),(Sound8
26,Double
8.566847e-2),(Sound8
27,Double
6.241711e-2),(Sound8
28,Double
0.16563571),(Sound8
29,Double
0.16563571),(Sound8
30,Double
0.2694089),(Sound8
31,Double
0.2694089),(Sound8
32,Double
0.13174949),(Sound8
33,Double
0.13174949),(Sound8
34,Double
5.978079e-2),(Sound8
35,Double
5.978079e-2),(Sound8
36,Double
9.572877e-2),(Sound8
37,Double
9.572877e-2),(Sound8
38,Double
5.705798e-2),(Sound8
39,Double
0.21173804),(Sound8
40,Double
0.21173804),(Sound8
41,Double
0.24441358),(Sound8
42,Double
0.24441358),(Sound8
43,Double
0.19044721),(Sound8
44,Double
0.19044721),(Sound8
45,Double
0.10747824),(Sound8
46,Double
0.10747824),(Sound8
47,Double
5.737927e-2),(Sound8
48,Double
5.737927e-2),(Sound8
49,Double
0.10201693),(Sound8
50,Double
0.18138075),(Sound8
51,Double
0.18138075),(Sound8
52,Double
0.26765448),(Sound8
53,Double
0.26765448),(Sound8
54,Double
0.12159184),(Sound8
66,Double
7.663289e-2)]

class (Eq a) => SyllableDurations4 a where
  sDuratsD :: a -> Double
  sDuratsD2 :: a -> Double
  sDuratsD3 :: a -> Double
  sDuratsD4 :: a -> Double
  syllableDurationsGDc :: (a -> Double) -> [[[a]]] -> [[Double]]
  syllableDurationsGDc a -> Double
g = ([[a]] -> [Double]) -> [[[a]]] -> [[Double]]
forall a b. (a -> b) -> [a] -> [b]
map (([a] -> Double) -> [[a]] -> [Double]
forall a b. (a -> b) -> [a] -> [b]
map ((a -> Double) -> [a] -> Double
forall (t :: * -> *) a t.
(Foldable t, Num a) =>
(t -> a) -> t t -> a
k a -> Double
g))
    where k :: (t -> a) -> t t -> a
k t -> a
f = (a -> t -> a) -> a -> t t -> a
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' (\a
y t
x -> t -> a
f t
x a -> a -> a
forall a. Num a => a -> a -> a
+ a
y) a
0
  {-# INLINABLE syllableDurationsGDc #-}

instance SyllableDurations4 Sound8 where
  sDuratsD :: Sound8 -> Double
sDuratsD = Sound8 -> Double
s0DuratD1
  sDuratsD2 :: Sound8 -> Double
sDuratsD2 = Sound8 -> Double
s0DuratD2
  sDuratsD3 :: Sound8 -> Double
sDuratsD3 = Sound8 -> Double
s0DuratD3
  sDuratsD4 :: Sound8 -> Double
sDuratsD4 = Sound8 -> Double
s0DuratD4

-- | General variant of the 'syllableDurationsD' function.
syllableDurationsGD :: (Sound8 -> Double) -> [[[Sound8]]] -> [[Double]]
syllableDurationsGD :: (Sound8 -> Double) -> [[[Sound8]]] -> [[Double]]
syllableDurationsGD Sound8 -> Double
g = (Sound8 -> Double) -> [[[Sound8]]] -> [[Double]]
forall a.
SyllableDurations4 a =>
(a -> Double) -> [[[a]]] -> [[Double]]
syllableDurationsGDc Sound8 -> Double
g

syllableDurationsD :: [[[Sound8]]] -> [[Double]]
syllableDurationsD :: [[[Sound8]]] -> [[Double]]
syllableDurationsD = (Sound8 -> Double) -> [[[Sound8]]] -> [[Double]]
forall a.
SyllableDurations4 a =>
(a -> Double) -> [[[a]]] -> [[Double]]
syllableDurationsGDc Sound8 -> Double
s0DuratD1

syllableDurationsD2 :: [[[Sound8]]] -> [[Double]]
syllableDurationsD2 :: [[[Sound8]]] -> [[Double]]
syllableDurationsD2 = (Sound8 -> Double) -> [[[Sound8]]] -> [[Double]]
forall a.
SyllableDurations4 a =>
(a -> Double) -> [[[a]]] -> [[Double]]
syllableDurationsGDc Sound8 -> Double
s0DuratD2

syllableDurationsD3 :: [[[Sound8]]] -> [[Double]]
syllableDurationsD3 :: [[[Sound8]]] -> [[Double]]
syllableDurationsD3 = (Sound8 -> Double) -> [[[Sound8]]] -> [[Double]]
forall a.
SyllableDurations4 a =>
(a -> Double) -> [[[a]]] -> [[Double]]
syllableDurationsGDc Sound8 -> Double
s0DuratD3

syllableDurationsD4 :: [[[Sound8]]] -> [[Double]]
syllableDurationsD4 :: [[[Sound8]]] -> [[Double]]
syllableDurationsD4 = (Sound8 -> Double) -> [[[Sound8]]] -> [[Double]]
forall a.
SyllableDurations4 a =>
(a -> Double) -> [[[a]]] -> [[Double]]
syllableDurationsGDc Sound8 -> Double
s0DuratD4