diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2021-09-04 10:43:01 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2021-09-04 10:43:01 +0200 |
commit | 0ba049daed6e4b5d01f83d236f3178747bf849cb (patch) | |
tree | 72eeedcaa5fbe9736e2842879d62d0bf412a149f /src/lib/process.ml | |
parent | 0b2e63791a073000b70b4463db5d8bce88ab4d23 (diff) |
Transform the letter e into eu or E
Diffstat (limited to 'src/lib/process.ml')
-rw-r--r-- | src/lib/process.ml | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/lib/process.ml b/src/lib/process.ml index 463701c..f85853f 100644 --- a/src/lib/process.ml +++ b/src/lib/process.ml @@ -1,6 +1,6 @@ open StdLabels -type voyel = Sounds.t Modifiers.Sig.voyel +type voyel = Sounds.t type group = voyel * Sounds.t Modifiers.Sig.consonants option type modifier = Sounds.t Modifiers.Sig.modifier @@ -19,13 +19,6 @@ let apply_modifiers ~init:e ~f:(fun e f -> f e) -let change_voyel - = fun init -> - let (((v1, v2), _) , ending) = init in - match ending with - | None -> v2 - | Some _ -> v1 - let rec _rebuild ~(m:modifier list) acc ending_consonant : group list -> Sounds.t list = function | [] -> acc @@ -37,7 +30,6 @@ let rec _rebuild ~(m:modifier list) acc ending_consonant : group list -> Sounds. apply_modifiers (hd, ending_consonant) modifier in - let voyel = change_voyel ((voyel, consonants), ending_consonant) in (* Add the last consonant and the voyel *) let acc = match ending_consonant with @@ -49,8 +41,17 @@ let rec _rebuild ~(m:modifier list) acc ending_consonant : group list -> Sounds. | Some s -> voyel :: s::acc in + (* Apply the modifiers to the previous syllabus. + + Only transform the e into eu / E if there is previous syllabus with + voyel. *) + let modifiers = if voyel = Sounds.none then + [] + else + [Modifiers.e] in + match consonants with - | None -> _rebuild ~m:[] acc None tl + | None -> _rebuild ~m:modifiers acc None tl | Some {ending; opening; following} -> let acc = match following with @@ -58,8 +59,8 @@ let rec _rebuild ~(m:modifier list) acc ending_consonant : group list -> Sounds. | Some s -> s::acc in match opening with - | [] ->_rebuild ~m:[] acc ending tl - | opening -> _rebuild ~m:[] (opening @ acc) ending tl + | [] ->_rebuild ~m:modifiers acc ending tl + | opening -> _rebuild ~m:modifiers (opening @ acc) ending tl (** Rebuild the list in the normal order @@ -78,6 +79,6 @@ let rebuild = fun ending elems -> let elems' = match ending with | None -> elems - | Some _ -> ((Sounds.none, Sounds.none), ending)::elems in + | Some _ -> (Sounds.none, ending)::elems in _rebuild ~m:[Modifiers.mute_consonant] [] None elems' |