summaryrefslogtreecommitdiff
path: root/src/lib/modifiers
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2021-09-05 19:41:40 +0200
committerSébastien Dailly <sebastien@chimrod.com>2021-09-05 19:41:40 +0200
commit6a34154b77ac80f89df816ba0062f382d915fb22 (patch)
tree5dab18f15fe8555d5369a9c492228f6aa4d23001 /src/lib/modifiers
parent853e281a6719125866f8b948540944c571b091c6 (diff)
Updated tests
Diffstat (limited to 'src/lib/modifiers')
-rw-r--r--src/lib/modifiers/e.ml18
-rw-r--r--src/lib/modifiers/modifiers.ml1
-rw-r--r--src/lib/modifiers/mute.ml2
-rw-r--r--src/lib/modifiers/nasal.ml2
-rw-r--r--src/lib/modifiers/sig.ml10
5 files changed, 23 insertions, 10 deletions
diff --git a/src/lib/modifiers/e.ml b/src/lib/modifiers/e.ml
index 8fd65bf..5f6e6fe 100644
--- a/src/lib/modifiers/e.ml
+++ b/src/lib/modifiers/e.ml
@@ -2,14 +2,26 @@
let process
: 'a Sig.modifier
= fun init ->
- let ((v2, c) , ending) = init in
+ let ((v, c) , ending) = init in
match ending with
- | None when v2 = Sounds.schwa ->
+ | 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 v2 = Sounds.schwa ->
+ | Some _ when v = Sounds.schwa ->
+ (* If there is an ending consonant, change the e into E like essai *)
+ ((Sounds.e `Opened, c) , ending)
+ | _ -> init
+
+(** Transform the final e into E if there is a consonant *)
+let ending_e
+ : 'a Sig.modifier
+ = fun init ->
+ let ((v, c) , ending) = init in
+
+ match ending with
+ | Some _ when v = Sounds.schwa ->
(* If there is an ending consonant, change the e into E like essai *)
((Sounds.e `Opened, c) , ending)
| _ -> init
diff --git a/src/lib/modifiers/modifiers.ml b/src/lib/modifiers/modifiers.ml
index 3a9ecd6..4e58cba 100644
--- a/src/lib/modifiers/modifiers.ml
+++ b/src/lib/modifiers/modifiers.ml
@@ -4,3 +4,4 @@ let nasal = Nasal.process
let vocalize_s = Vocalize.process
let mute_consonant = Mute.process
let e = E.process
+let ending_e = E.ending_e
diff --git a/src/lib/modifiers/mute.ml b/src/lib/modifiers/mute.ml
index b89fda7..7b58336 100644
--- a/src/lib/modifiers/mute.ml
+++ b/src/lib/modifiers/mute.ml
@@ -1,6 +1,6 @@
open StdLabels
-(** Mute the last consonant if there is no voyel in the syllabus.
+(** Mute the last consonant if there is no voyel in the syllabe.
This modifier is only applied in the first step, and not repeated anymore.
*)
diff --git a/src/lib/modifiers/nasal.ml b/src/lib/modifiers/nasal.ml
index cc29efc..43f3bd8 100644
--- a/src/lib/modifiers/nasal.ml
+++ b/src/lib/modifiers/nasal.ml
@@ -1,7 +1,7 @@
(* Remove the ending consonant, and transform the voyel into
the nasal form *)
let transform
- : Sounds.t Sig.consonants option -> Sounds.t Sig.t -> Sounds.t Sig.t
+ : Sig.consonants option -> Sounds.t Sig.t -> Sounds.t Sig.t
= fun c init ->
let ((v, _) , _) = init in
diff --git a/src/lib/modifiers/sig.ml b/src/lib/modifiers/sig.ml
index 5f82620..19c4ff7 100644
--- a/src/lib/modifiers/sig.ml
+++ b/src/lib/modifiers/sig.ml
@@ -1,11 +1,11 @@
type voyel = Sounds.t
-type 'a consonants =
- { ending : 'a option option
- ; opening : 'a list
- ; following : 'a option }
+type consonants =
+ { ending : Sounds.t option option
+ ; opening : Sounds.t list
+ ; following : Sounds.t option }
-type 'a group = voyel * 'a consonants option
+type 'a group = voyel * consonants option
type 'a t = 'a group * 'a option option