diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2021-08-27 17:20:59 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2021-08-27 17:20:59 +0200 |
commit | 26faec7a69051f639b50c8e8741f0823c6be52a2 (patch) | |
tree | a610d0306bf3e0c84f7993be7c290965fcab1900 /src/lib/modifiers | |
parent | c8b49eed4cf92e7d2dd01dce779ef84ccae733eb (diff) |
Managed diphtongues
Diffstat (limited to 'src/lib/modifiers')
-rw-r--r-- | src/lib/modifiers/nasal.ml | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/lib/modifiers/nasal.ml b/src/lib/modifiers/nasal.ml index da24863..b9874c9 100644 --- a/src/lib/modifiers/nasal.ml +++ b/src/lib/modifiers/nasal.ml @@ -9,15 +9,28 @@ let process let module T = (val m:Sounds.T with type t = el) in let (((v1, v2), c) , ending) = init in let ending = Option.bind ending (fun x -> x) in - match ending with - | None -> init - | Some ending -> - match T.is_nasal ending with - | false -> init - | true -> - (* Remove the ending consonant, and transform the voyel into - the nasal form *) - ( ( (T.nasal v1, T.nasal v2) - , c ) - , None ) + let opening = Option.map (fun v -> v.Sig.opening) c in + let is_voyel = T.is_voyel v1 && T.is_voyel v2 in + match ending, is_voyel, opening with + | Some ending, _, _ when T.is_nasal ending -> + (* Remove the ending consonant, and transform the voyel into + the nasal form *) + ( ( (T.nasal v1, T.nasal v2) + , c ) + , None ) + | None, false, Some (opening::tl) when T.is_nasal opening -> + (* If there is no voyel here, transform the opening consonant as an + ending consonant for the next syllabus *) + let c = Option.map + (fun c -> + { c with + Sig.opening = tl + ; Sig.ending = (Some (Some opening)) + }) c in + ( ( (T.nasal v1, T.nasal v2) + , c ) + , None ) + | _ -> + (* Return the element unchanged *) + init |