summaryrefslogtreecommitdiff
path: root/src/lib/modifiers/e.ml
blob: bd4a94000b8fb494a3368c0bed3a5eeaa0ba171c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(** Transform the ending e.

    For example "ie$" into "i"

*)
let ending_e
  : 'a Sig.modifier
  = fun init ->
    let ((v, c) , ending) = init in

    if v = Sounds.diphtongue Sounds.semi_voyel_y Sounds.schwa then
      ((Sounds.i, c), ending)
    else if v = Sounds.schwa then (
      match c, ending with
      (* If there is no consonant, and just a final e, remove it *)
      | None, None -> ((Sounds.none, c), ending)
      | _ -> init
    ) else
      init

(** Transform the e into eu or E *)
let process
  : 'a Sig.modifier
  = fun init ->
    let ((v, c) , ending) = init in

    match ending with
    | None when v = Sounds.schwa ->
      (* If there is no more consononant in the syllabe, change the e
         into eu, like in sera *)
      ((Sounds.eu `Closed, c) , ending)
    | Some _ when v = Sounds.schwa ->
      (* If there is an ending consonant, change the e into E like essai *)
      ((Sounds.e `Opened, c) , ending)
    | _ -> ((v, c) , ending)