summaryrefslogtreecommitdiff
path: root/src/lib/modifiers/nasal.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2021-08-27 14:37:24 +0200
committerSébastien Dailly <sebastien@chimrod.com>2021-08-27 14:37:24 +0200
commitc8b49eed4cf92e7d2dd01dce779ef84ccae733eb (patch)
tree753547fc766a616e9c47aa78b32f047e73e7a7ef /src/lib/modifiers/nasal.ml
parent65d5990607e9542aa847ec7cb684afd3ffdedb8f (diff)
Splitted modifiers in own library
Diffstat (limited to 'src/lib/modifiers/nasal.ml')
-rw-r--r--src/lib/modifiers/nasal.ml23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/modifiers/nasal.ml b/src/lib/modifiers/nasal.ml
new file mode 100644
index 0000000..da24863
--- /dev/null
+++ b/src/lib/modifiers/nasal.ml
@@ -0,0 +1,23 @@
+(** The Nasal modifier transform a voyel followed by N and a consonant
+ into a nasal voyel.
+
+ Does this min that nasal voyel are not a distinct element, but just a
+ merge from two distinct elements ? *)
+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
+ 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 )
+