diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2021-09-03 11:44:55 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2021-09-03 11:44:55 +0200 |
commit | ad45e1b397ba995dc0222057a8dc1d0c38970c4f (patch) | |
tree | 311e8b38215503ae05a78573c8a92500d7ca01f4 /src/lib/sounds | |
parent | 6af889039d232381b13f1f07a694abcfaff2535e (diff) |
Update model
Diffstat (limited to 'src/lib/sounds')
-rw-r--r-- | src/lib/sounds/sounds.ml | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/src/lib/sounds/sounds.ml b/src/lib/sounds/sounds.ml index 9892ace..276e8a1 100644 --- a/src/lib/sounds/sounds.ml +++ b/src/lib/sounds/sounds.ml @@ -82,11 +82,15 @@ module T = struct | SZ (* This is a possible Z if followed by a voyel *) | Voyel_A | Voyel_E + | Schwa + | E_Opened + | E_Closed | Voyel_I | Voyel_O | Voyel_U (* OU like in Ouvrir *) | Voyel_Y (* U like in Unique *) | Voyel_AI + | Voyel_EU | SemiVoyel_W | SemiVoyel_Y | Consonant_P @@ -107,10 +111,10 @@ module T = struct | Consonant_L | Consonant_R | Diphtonge of t * t + | Muted of t and t = { code : code - ; repr : string ; mutable_: bool (* Can the sound be muted ? *) ; kind : kind ; nasal : bool @@ -125,6 +129,12 @@ module Repr = struct let a = "a" and a_nasal = "@" + and e_opened = "E" + and e_closed = "e" + and schwa = "°" + + and eu = "9" + and o = "o" and o_nasal = "§" @@ -173,8 +183,7 @@ module S = struct let none = - { repr = "" - ; mutable_ = true + { mutable_ = true ; kind = None ; nasal = false ; code = None } @@ -186,7 +195,6 @@ module S = struct let diphtongue v1 v2 = { voyel with code = Diphtonge (v1, v2) - ; repr = "[" ^ (v1.repr) ^ (v2.repr) ^ "]" } let code t = t.code @@ -194,108 +202,94 @@ module S = struct let a = { voyel with code = Voyel_A - ; repr = Repr.a } let voyel_ai = { voyel with code = Voyel_AI - ; repr = "E" } let e = function - | `Closed -> { voyel with repr = "e" ; code = Voyel_E } - | `Opened -> { voyel with repr = "E" ; code = Voyel_E } + | `Closed -> { voyel with code = E_Closed } + | `Opened -> { voyel with code = E_Opened } let eu = - { voyel with repr = "9" } + { voyel with + code = Voyel_EU + } let schwa () = { voyel with - code = Voyel_E - ; repr = "°" } + code = Schwa } let o = { voyel with - repr = Repr.o - ; code = Voyel_O } + code = Voyel_O } let i = { voyel with - repr = Repr.i - ; code = Voyel_I } + code = Voyel_I } let voyel_y = { voyel with - repr = Repr.y - ; code = Voyel_Y } + code = Voyel_Y } let voyel_u = { voyel with - repr = Repr.u - ; code = Voyel_U } + code = Voyel_U } let p = { none with code = Consonant_P - ; repr = Repr.p ; mutable_ = false } let b = { none with code = Consonant_B - ; repr = Repr.b ; mutable_ = false } let t = { none with code = Consonant_T - ; repr = Repr.t } let d = { none with - code = Consonant_D - ; repr = Repr.d } + code = Consonant_D } let k = { none with code = Consonant_K - ; repr = Repr.k ; mutable_ = false } let g = { none with - code = Consonant_G - ; repr = Repr.g } + code = Consonant_G } let f = { none with code = Consonant_F - ; repr = Repr.f } + ; mutable_ = false + } let v = { none with - code = Consonant_V - ; repr = Repr.v } + code = Consonant_V } let s = { none with - code = Consonant_S - ; repr = Repr.s } + code = Consonant_S } let ch = { none with code = Consonant_X - ; repr = Repr.ch ; mutable_ = false } let j = { none with code = Consonant_J - ; repr = Repr.j ; mutable_ = false } let sz = @@ -303,52 +297,46 @@ module S = struct let z = { none with - code = Consonant_Z - ; repr = Repr.z } + code = Consonant_Z } let n = { none with code = Consonant_N - ; repr = Repr.n ; nasal = true } let m = { none with code = Consonant_M - ; repr = Repr.m ; nasal = true } let l = { none with - code = Consonant_L - ; repr = Repr.l } + code = Consonant_L } let r = { none with - code = Consonant_R - ; repr = Repr.r } + code = Consonant_R } let semi_voyel_w = { none with kind = SemiVoyel - ; repr = Repr.semi_voyel_w ; code = SemiVoyel_W} let semi_voyel_y = { none with kind = SemiVoyel - ; repr = Repr.semi_voyel_y ; code = SemiVoyel_Y} let nasal t = match t.code with - | Voyel_E -> Some { t with repr = Repr.a_nasal ; nasal = true } - | Voyel_A -> Some { t with repr = Repr.a_nasal ; nasal = true } - | Voyel_AI -> Some { t with repr = Repr.i_nasal ; nasal = true } - | Voyel_O -> Some { t with repr = Repr.o_nasal ; nasal = true } - | Voyel_I -> Some { t with repr = Repr.i_nasal ; nasal = true } - | Voyel_Y -> Some { t with repr = Repr.y_nasal ; nasal = true } + | Voyel_E | E_Opened | Schwa -> + Some { t with nasal = true } + | Voyel_A -> Some { t with nasal = true } + | Voyel_AI -> Some { t with nasal = true } + | Voyel_O -> Some { t with nasal = true } + | Voyel_I -> Some { t with nasal = true } + | Voyel_Y -> Some { t with nasal = true } | Diphtonge (s1, s2) -> begin match s1.code, s2.code with | (SemiVoyel_W, Voyel_I) -> @@ -357,24 +345,29 @@ module S = struct Some ( diphtongue semi_voyel_w - { i with repr = Repr.i_nasal ; nasal = true } ) + { i with nasal = true } ) | (Voyel_I, Voyel_E) -> (* The only case we could have the nasalisation of such diphtongue, is the case I E, N -> wich is transformed into I, E N *) Some ( diphtongue i - { t with repr = Repr.i_nasal ; nasal = true } ) + { t with nasal = true } ) | _ -> None end | _ -> None let muted f = + (* f is alway pronounend in endding consonant. Know exeception are : + - cerf + - clef + - nerf + - serf *) match f.mutable_ with | false -> f | true -> { none with - repr = "(" ^ f.repr ^ ")" } + code = Muted f } let rec repr : t -> Repr.t @@ -388,6 +381,10 @@ module S = struct | Voyel_AI, false -> "E" | Voyel_AI, true -> Repr.i_nasal | Voyel_E, _ -> "" + | E_Closed, _ -> Repr.e_closed + | E_Opened, true | Schwa, true -> Repr.a_nasal + | Schwa, _ -> Repr.schwa + | E_Opened, _ -> Repr.e_opened | Voyel_I, false -> Repr.i | Voyel_I, true -> Repr.i_nasal | Voyel_O, true -> Repr.o_nasal @@ -395,6 +392,7 @@ module S = struct | Voyel_U, _ -> Repr.u | Voyel_Y, false -> Repr.y | Voyel_Y, true -> Repr.y_nasal + | Voyel_EU, _ -> Repr.eu | SemiVoyel_W, _ -> Repr.semi_voyel_w | SemiVoyel_Y, _ -> Repr.semi_voyel_y @@ -420,6 +418,8 @@ module S = struct | Consonant_R, _ -> Repr.r | Diphtonge (l1, l2), _ -> "[" ^ (repr l1) ^ (repr l2) ^ "]" + | Muted t, _ -> + "(" ^ (repr t) ^ ")" end include S |