diff options
Diffstat (limited to 'src/lib/sounds/sounds.ml')
-rw-r--r-- | src/lib/sounds/sounds.ml | 107 |
1 files changed, 58 insertions, 49 deletions
diff --git a/src/lib/sounds/sounds.ml b/src/lib/sounds/sounds.ml index 088485a..a8c9ce9 100644 --- a/src/lib/sounds/sounds.ml +++ b/src/lib/sounds/sounds.ml @@ -180,7 +180,8 @@ let m = let l = { none with - code = Consonant_L } + code = Consonant_L + ; mutable_ = false } let r = { none with @@ -238,51 +239,59 @@ let muted f = { none with code = Muted f } -let rec repr - : type a. (module Sig.REPR with type t = a) -> t -> a - = fun m letter -> - let module Repr = (val m:Sig.REPR with type t = a) in - match letter.code, letter.nasal with - - | None, _ -> Repr.none - | Voyel_A, false -> Repr.a - | Voyel_A, true -> Repr.a_nasal - | Voyel_AI, false -> Repr.e_opened - | Voyel_AI, true -> Repr.i_nasal - | E_Closed, _ -> Repr.e_closed - | E_Opened, true | Voyel_E, true -> Repr.a_nasal - | Voyel_E , _ -> Repr.schwa - | E_Opened, _ -> Repr.e_opened - | Voyel_I, false -> Repr.i - | Voyel_I, true -> Repr.i_nasal - | Voyel_O, true -> Repr.o_nasal - | Voyel_O, false -> Repr.o - | 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 - - | Consonant_P, _ -> Repr.p - | Consonant_B, _ -> Repr.b - | Consonant_T, _ -> Repr.t - | Consonant_D, _ -> Repr.d - | Consonant_K, _ -> Repr.k - | Consonant_G, _ -> Repr.g - | Consonant_F, _ -> Repr.f - | Consonant_V, _ -> Repr.v - | SZ, _ - | Consonant_S, _ -> Repr.s - | Consonant_Z, _ -> Repr.z - - | Consonant_X, _ -> Repr.ch - | Consonant_J, _ -> Repr.j - - | Consonant_M, _ -> Repr.m - | Consonant_N, _ -> Repr.n - | Consonant_L, _ -> Repr.l - | Consonant_R, _ -> Repr.r - | Diphtonge (l1, l2), _ -> Repr.diphtongue (repr m l1) (repr m l2) - | Muted t, _ -> Repr.muted (repr m t) +let repr + : (module Sig.REPR) -> t list -> string + = fun m letters -> + let module Repr = (val m:Sig.REPR) in + + let rec _repr letter = + + match letter.code, letter.nasal with + + | None, _ -> Repr.none + | Voyel_A, false -> Repr.a + | Voyel_A, true -> Repr.a_nasal + | Voyel_AI, false -> Repr.e_opened + | Voyel_AI, true -> Repr.i_nasal + | E_Closed, _ -> Repr.e_closed + | E_Opened, true | Voyel_E, true -> Repr.a_nasal + | Voyel_E , false -> Repr.schwa + | E_Opened, false -> Repr.e_opened + | Voyel_I, false -> Repr.i + | Voyel_I, true -> Repr.i_nasal + | Voyel_O, true -> Repr.o_nasal + | Voyel_O, false -> Repr.o + | 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 + + | Consonant_P, _ -> Repr.p + | Consonant_B, _ -> Repr.b + | Consonant_T, _ -> Repr.t + | Consonant_D, _ -> Repr.d + | Consonant_K, _ -> Repr.k + | Consonant_G, _ -> Repr.g + | Consonant_F, _ -> Repr.f + | Consonant_V, _ -> Repr.v + | SZ, _ + | Consonant_S, _ -> Repr.s + | Consonant_Z, _ -> Repr.z + + | Consonant_X, _ -> Repr.ch + | Consonant_J, _ -> Repr.j + + | Consonant_M, _ -> Repr.m + | Consonant_N, _ -> Repr.n + | Consonant_L, _ -> Repr.l + | Consonant_R, _ -> Repr.r + | Diphtonge (l1, l2), _ -> Repr.diphtongue (_repr l1) (_repr l2) + | Muted t, _ -> Repr.muted (_repr t) + + in + + List.map _repr letters + |> Repr.fold |