summaryrefslogtreecommitdiff
path: root/examples/foods/MutationsGla.gf
diff options
context:
space:
mode:
authorjohn.j.camilleri <john.j.camilleri@chalmers.se>2013-09-16 07:17:27 +0000
committerjohn.j.camilleri <john.j.camilleri@chalmers.se>2013-09-16 07:17:27 +0000
commitf5461eb3d4eb2605b546a4ed202c12bcdaa1f4e4 (patch)
tree946c9e8542b8e8271b6b529a95c0400fa6613cb4 /examples/foods/MutationsGla.gf
parent8e1c6cca407c82fc09569d80c231b8d256735989 (diff)
Remove contribs and examples
Everything has now been moved to a separate repository at https://github.com/GrammaticalFramework/gf-contrib The contents of the examples folder are build during SetupWeb
Diffstat (limited to 'examples/foods/MutationsGla.gf')
-rw-r--r--examples/foods/MutationsGla.gf53
1 files changed, 53 insertions, 0 deletions
diff --git a/examples/foods/MutationsGla.gf b/examples/foods/MutationsGla.gf
new file mode 100644
index 000000000..41eb11006
--- /dev/null
+++ b/examples/foods/MutationsGla.gf
@@ -0,0 +1,53 @@
+resource MutationsGla = open CharactersGla in {
+ param Mutation = Unmutated|Lenition1|Lenition1DNTLS|Lenition2|PrefixT|PrefixH;
+
+ --Turns a string into a mutation table
+ oper mutate : (_ : Str) -> (Mutation => Str) = \str -> table {
+ Unmutated => str ;
+ Lenition1 => lenition1 str ;
+ Lenition1DNTLS => lenition1dntls str ;
+ Lenition2 => lenition2 str ;
+ PrefixT => prefixT str ;
+ PrefixH => prefixH str
+ };
+
+ --Performs lenition 1: inserts "h" if the word begins with a lenitable character
+ oper lenition1 : Str -> Str = \str -> case str of {
+ start@("p"|"b"|"m"|"f"|"t"|"d"|"c"|"g") + rest => start + "h" + rest ;
+ start@("P"|"B"|"M"|"F"|"T"|"D"|"C"|"G") + rest => start + "h" + rest ;
+ ("s"|"S") + ("p"|"t"|"c") + _ => str ; --the sequences "sp", "st", "sc" are never mutated
+ start@("s"|"S") + rest => start + "h" + rest ;
+ _ => str
+ };
+
+ --Performs lenition 1 with dentals: same as lenition 1 but leaves "d", "t" and "s" unmutated
+ oper lenition1dntls : Str -> Str = \str -> case str of {
+ start@("p"|"b"|"m"|"f"|"c"|"g") + rest => start + "h" + rest ;
+ start@("P"|"B"|"M"|"F"|"C"|"G") + rest => start + "h" + rest ;
+ _ => str
+ };
+
+ --Performs lenition 2: same as lenition 1 with dentals but also changes "s" into "ts"
+ oper lenition2 : Str -> Str = \str -> case str of {
+ start@("p"|"b"|"m"|"f"|"c"|"g") + rest => start + "h" + rest ;
+ start@("P"|"B"|"M"|"F"|"C"|"G") + rest => start + "h" + rest ;
+ ("s"|"S") + ("p"|"t"|"c") + _ => str ; --the sequences "sp", "st", "sc" are never mutated
+ start@("s"|"S") + rest => "t-" + start + rest ;
+ _ => str
+ };
+
+ --Prefixes a "t" to words beginning with a vowel
+ oper prefixT : Str -> Str = \str -> case str of {
+ start@(#vowel) + rest => "t-" + start + rest ;
+ start@(#vowelCap) + rest => "t-" + start + rest ;
+ _ => str
+ };
+
+ --Prefixes a "h" to words beginning with a vowel
+ oper prefixH : Str -> Str = \str -> case str of {
+ start@(#vowel) + rest => "h-" + start + rest ;
+ start@(#vowelCap) + rest => "h-" + start + rest ;
+ _ => str
+ };
+
+} \ No newline at end of file