diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2021-08-27 14:37:24 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2021-08-27 14:37:24 +0200 |
commit | c8b49eed4cf92e7d2dd01dce779ef84ccae733eb (patch) | |
tree | 753547fc766a616e9c47aa78b32f047e73e7a7ef /src/lib/modifiers/vocalize.ml | |
parent | 65d5990607e9542aa847ec7cb684afd3ffdedb8f (diff) |
Splitted modifiers in own library
Diffstat (limited to 'src/lib/modifiers/vocalize.ml')
-rw-r--r-- | src/lib/modifiers/vocalize.ml | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/modifiers/vocalize.ml b/src/lib/modifiers/vocalize.ml new file mode 100644 index 0000000..86a0502 --- /dev/null +++ b/src/lib/modifiers/vocalize.ml @@ -0,0 +1,20 @@ +(** Transform the S into Z if the S is the opening consonant and + there is no ending consonant before *) +let process + : 'a Sig.modifier + = fun (type el) m init -> + let module T = (val m:Sounds.T with type t = el) in + let (((v1, v2), c) , ending) = init in + + match c with + | None -> init + | Some op -> + (* The voyel may be none in case of ending word. In such case, we shall + not trnasform the S into Z *) + let is_voyel = T.is_voyel v1 && T.is_voyel v2 in + match is_voyel, op.Sig.opening, op.Sig.ending with + | true, hd::[], None when T.code hd = T.SZ -> + let c = Some { op with opening = [T.z ()] } in + (((v1, v2), c) , ending) + | _ -> init + |