summaryrefslogtreecommitdiff
path: root/src/lib/prononciation.mly
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2021-08-24 15:04:25 +0200
committerSébastien Dailly <sebastien@chimrod.com>2021-08-24 15:04:25 +0200
commitdf92da631e9a10a099a72ba846f90adf99d180df (patch)
treec56cffa7045795c0cc494512c28fc34a63f800bc /src/lib/prononciation.mly
parent546afdcf2148087f3a90b69c23ea756550f64433 (diff)
Added pre-processing
Diffstat (limited to 'src/lib/prononciation.mly')
-rw-r--r--src/lib/prononciation.mly72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/lib/prononciation.mly b/src/lib/prononciation.mly
new file mode 100644
index 0000000..f865abd
--- /dev/null
+++ b/src/lib/prononciation.mly
@@ -0,0 +1,72 @@
+%{
+
+ (** This module transform the words into a semi-prononciation elements.
+
+ The letters should be quite close with the associate phonem, but some
+ modification can occur.
+
+ *)
+
+ open Tokens
+%}
+
+%start<Tokens.token list> main
+%%
+
+initial_voyel:
+ | A { A }
+ | E { E }
+ | I { I }
+ | O { O }
+ | U { U }
+ | E_ACUTE { E_ACUTE }
+
+voyel:
+ | initial_voyel { $1 }
+
+
+letters:
+ | { [] }
+ | letters voyel { $2 :: $1 }
+ | letters Space { Space :: $1 }
+ | letters Sep { Sep :: $1 }
+
+ | letters B { B :: $1 }
+ | letters C %prec Low { K :: $1 }
+ | letters C H { X :: $1 }
+ | letters C I { I :: S :: $1 }
+ | letters C E { E :: S :: $1 }
+ | letters C U I { I :: K :: $1 }
+ | letters C U E { E :: K :: $1 }
+ | letters D { D :: $1 }
+ | letters F { F :: $1 }
+ | letters G %prec Low { G :: $1 }
+ | letters G I { I :: J :: $1 }
+ | letters G E { E :: J :: $1 }
+ | letters G U I { I :: G :: $1 }
+ | letters G U E { E :: G :: $1 }
+
+ | letters J { J :: $1 }
+ | letters K { K :: $1 }
+ | letters L { L :: $1 }
+ | letters M { M :: $1 }
+ | letters N { N :: $1 }
+ | letters P { P :: $1 }
+ | letters P H { F :: $1 }
+
+ | letters Q U { K :: $1 }
+
+ | letters R { R :: $1 }
+ | letters S S { S :: $1 }
+ | letters S { SZ :: $1 }
+ | letters T { T :: $1 }
+
+ | letters V { V :: $1 }
+ | letters W { V :: $1 }
+ | letters X { S :: K :: $1 }
+ | letters Y { I :: $1 }
+
+ | letters Z { Z :: $1 }
+
+main:
+ letters EOL { EOL::$1 }