Turkish: fixed vowel harmony

This commit is contained in:
krasimir
2009-05-07 14:55:38 +00:00
parent 95d8fd3be4
commit a83a68573d
2 changed files with 94 additions and 81 deletions

View File

@@ -12,61 +12,55 @@ oper
base+"mek" => base
}
in { s = table {
VPres Sg P1 => harmony4 (harmony4 base "iyor") "im" ;
VPres Sg P2 => harmony4 (harmony4 base "iyor") "sin" ;
VPres Sg P3 => harmony4 base "iyor" ;
VPres Pl P1 => harmony4 (harmony4 base "iyor") "iz" ;
VPres Pl P2 => harmony4 (harmony4 (harmony4 base "iyor") "sin") "iz" ;
VPres Pl P3 => harmony4 (harmony4 base "iyor") "ler" ;
VPast Sg P1 => harmony4 base "dim" ;
VPast Sg P2 => harmony4 base "din" ;
VPast Sg P3 => harmony4 base "di" ;
VPast Pl P1 => harmony4 base "dik" ;
VPast Pl P2 => harmony4 (harmony4 base "din") "iz" ;
VPast Pl P3 => harmony4 base "diler" ;
VFuture Sg P1 => harmony4 (harmony2 base "ecek") "im" ;
VFuture Sg P2 => harmony4 (harmony2 base "ecek") "sin" ;
VFuture Sg P3 => harmony2 base "ecek" ;
VFuture Pl P1 => harmony4 (harmony2 base "ecek") "iz" ;
VFuture Pl P2 => harmony4 (harmony2 base "ecek") "siniz" ;
VFuture Pl P3 => harmony4 (harmony2 base "ecek") "ler" ;
VAorist Sg P1 => harmony4 base "im" ;
VAorist Sg P2 => harmony4 base "sin" ;
VPres Sg P1 => harmony4 (harmony4 base "iyor" "yiyor") "im" "yim" ;
VPres Sg P2 => harmony4 (harmony4 base "iyor" "yiyor") "sin" "sin" ;
VPres Sg P3 => harmony4 base "iyor" "yiyor" ;
VPres Pl P1 => harmony4 (harmony4 base "iyor" "yiyor") "iz" "yiz" ;
VPres Pl P2 => harmony4 (harmony4 (harmony4 base "iyor" "yiyor") "sin" "sin") "iz" "yiz" ;
VPres Pl P3 => harmony2 (harmony4 base "iyor" "yiyor") "ler" "ler" ;
VPast Sg P1 => harmony4 base "dim" "dim" ;
VPast Sg P2 => harmony4 base "din" "din" ;
VPast Sg P3 => harmony4 base "di" "di" ;
VPast Pl P1 => harmony4 base "dik" "dik" ;
VPast Pl P2 => harmony4 (harmony4 base "din" "din") "iz" "yiz" ;
VPast Pl P3 => harmony4 base "diler" "diler" ;
VFuture Sg P1 => harmony4 (harmony2 base "ecek" "yecek") "im" "yim" ;
VFuture Sg P2 => harmony4 (harmony2 base "ecek" "yecek") "sin" "sin" ;
VFuture Sg P3 => harmony2 base "ecek" "yecek";
VFuture Pl P1 => harmony4 (harmony2 base "ecek" "yecek") "iz" "yiz" ;
VFuture Pl P2 => harmony4 (harmony2 base "ecek" "yecek") "siniz" "siniz" ;
VFuture Pl P3 => harmony2 (harmony2 base "ecek" "yecek") "ler" "ler" ;
VAorist Sg P1 => harmony4 base "im" "yim" ;
VAorist Sg P2 => harmony4 base "sin" "sin" ;
VAorist Sg P3 => base ;
VAorist Pl P1 => harmony4 base "iz" ;
VAorist Pl P2 => harmony4 (harmony4 base "sin") "iz" ;
VAorist Pl P3 => harmony4 base "ler" ;
VAorist Pl P1 => harmony4 base "iz" "yiz" ;
VAorist Pl P2 => harmony4 (harmony4 base "sin" "sin") "iz" "yiz" ;
VAorist Pl P3 => harmony2 base "ler" "ler" ;
VImperative => base ;
VInfinitive => inf
}
} ;
add_number : Number -> Str -> Str = \n,base ->
case n of {
Sg => base ;
Pl => harmony2 base "ler"
} ;
regN : Str -> Noun = \base -> {
s = \\n => table {
Nom => add_number n base ;
Acc => harmony4 (add_number n base) "i" ;
Dat => harmony2 (add_number n base) "e" ;
Gen => harmony4 (add_number n base) "in" ;
Loc => harmony2 (add_number n base) "de" ;
Ablat => harmony2 (add_number n base) "den" ;
Acc => harmony4 (add_number n base) "i" "yi" ;
Dat => harmony2 (add_number n base) "e" "ye" ;
Gen => harmony4 (add_number n base) "in" "nin" ;
Loc => harmony2 (add_number n base) "de" "de" ;
Ablat => harmony2 (add_number n base) "den" "den" ;
Abess p => case p of {
Pos => harmony4 (add_number n base) "li" ;
Neg => harmony4 (add_number n base) "siz"
Pos => harmony4 (add_number n base) "li" "li" ;
Neg => harmony4 (add_number n base) "siz" "siz"
}
} ;
gen = \\n => table {
{n=Sg; p=P1} => harmony4 (add_number n base) "im" ;
{n=Sg; p=P2} => harmony4 (add_number n base) "in" ;
{n=Sg; p=P3} => harmony4 (add_number n base) "i" ;
{n=Pl; p=P1} => harmony4 (add_number n base) "imiz" ;
{n=Pl; p=P2} => harmony4 (add_number n base) "iniz" ;
{n=Pl; p=P3} => harmony4 (add_number n base) "i"
{n=Sg; p=P1} => harmony4 (add_number n base) "im" "yim" ;
{n=Sg; p=P2} => harmony4 (add_number n base) "in" "yin" ;
{n=Sg; p=P3} => harmony4 (add_number n base) "i" "yi" ;
{n=Pl; p=P1} => harmony4 (add_number n base) "imiz" "yimiz" ;
{n=Pl; p=P2} => harmony4 (add_number n base) "iniz" "yiniz" ;
{n=Pl; p=P3} => harmony4 (add_number n base) "i" "yi"
}
} ;
}

View File

@@ -65,14 +65,9 @@ resource ResTur = ParamX ** open Prelude, Predef in {
} ;
oper
harmony4 : Str -> Str -> Str
= \base0,suffix0 ->
let buffer : Str =
case dp 1 base0 + take 1 suffix0 of {
("ı"|"a"|"i"|"e"|"u"|"o"|"ü"|"ö")+("ı"|"a"|"i"|"e"|"u"|"o"|"ü"|"ö") => "y" ;
_ => ""
} ;
h : Str =
harmony4 : Str -> Str -> Str -> Str
= \base0,suffixC,suffixV ->
let h : Str =
case base0 of {
_+c@("ı"|"a"|"i"|"e"|"u"|"o"|"ü"|"ö")+
("b"|"v"|"d"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h")* =>
@@ -82,31 +77,34 @@ resource ResTur = ParamX ** open Prelude, Predef in {
("u"|"o") => "u" ;
("ü"|"ö") => "ü"
} ;
_ => error ("harmony4")
_ => error "harmony4"
} ;
base : Str =
case dp 1 base0 + take 1 suffix0 of {
case dp 1 base0 + take 1 suffixC of {
("k")+("ı"|"a"|"i"|"e"|"u"|"o"|"ü"|"ö") => tk 1 base0 + "ğ" ;
_ => base0
} ;
suffix : Str =
case suffix0 of {
s1@(("b"|"v"|"d"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h")*)
+ ("ı"|"i"|"u"|"ü")
+s2 => s1+h+s2 ;
s => s
}
in base + buffer + suffix ;
suffix : Str =
case dp 1 base0 of {
("ı"|"a"|"i"|"e"|"u"|"o"|"ü"|"ö") => case suffixV of {
s1@("b"|"v"|"d"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h")
+ ("ı"|"i"|"u"|"ü")
+s2 => s1+h+s2 ;
_ => error "harmony4"
} ;
_ => case suffixC of {
s1@(("b"|"v"|"d"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h")*)
+ ("ı"|"i"|"u"|"ü")
+s2 => s1+h+s2 ;
s => error "harmony4"
}
}
in base + suffix ;
harmony2 : Str -> Str -> Str
= \base,suffix0 ->
let buffer : Str =
case dp 1 base + take 1 suffix0 of {
("ı"|"a"|"i"|"e"|"u"|"o"|"ü"|"ö")+("ı"|"a"|"i"|"e"|"u"|"o"|"ü"|"ö") => "n" ;
_ => ""
} ;
h : Str =
case base of {
harmony2 : Str -> Str -> Str -> Str
= \base0,suffixC,suffixV ->
let h : Str =
case base0 of {
_+c@("ı"|"a"|"i"|"e"|"u"|"o"|"ü"|"ö")+
("b"|"v"|"d"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h")* =>
case c of {
@@ -115,17 +113,38 @@ resource ResTur = ParamX ** open Prelude, Predef in {
} ;
_ => error "harmony2"
} ;
suffix1 : Str =
case suffix0 of {
s1@(("b"|"v"|"d"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h")*)
+ ("a"|"e")
+s2 => s1+h+s2 ;
s => s
} ;
suffix : Str =
case dp 1 base + take 1 suffix1 of {
("ç"|"p"|"ş"|"k"|"f")+("d") => "t"+drop 1 suffix1 ;
_ => suffix1
base : Str =
case dp 1 base0 + take 1 suffixC of {
("k")+("ı"|"a"|"i"|"e"|"u"|"o"|"ü"|"ö") => tk 1 base0 + "ğ" ;
_ => base0
} ;
in base + buffer + suffix ;
suffix : Str =
case dp 1 base0 of {
("ı"|"a"|"i"|"e"|"u"|"o"|"ü"|"ö") => case suffixV of {
s1@("b"|"v"|"d"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h")
+ ("a"|"e")
+s2 => s1+h+s2 ;
_ => error "harmony2"
} ;
("p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h") => case suffixC of {
s1@(("b"|"v"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h")*)
+ ("a"|"e")
+s2 => s1+h+s2 ;
("da"|"de")+s => "t"+h+s ;
_ => error "harmony2"
} ;
_ => case suffixC of {
s1@(("b"|"v"|"d"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h")*)
+ ("a"|"e")
+s2 => s1+h+s2 ;
_ => error "harmony2"
}
}
in base + suffix ;
add_number : Number -> Str -> Str = \n,base ->
case n of {
Sg => base ;
Pl => harmony2 base "ler" "ler"
} ;
}