1
0
forked from GitHub/gf-core

nounAdjVerbNumerals

This commit is contained in:
e1560697
2010-03-22 08:44:21 +00:00
parent 2a7fbf43e1
commit dec065a578
13 changed files with 48408 additions and 260 deletions

View File

@@ -1,3 +1,5 @@
--# -path=.:../abstract:../common:../../prelude
concrete CatTur of Cat = CommonX ** open ResTur, Prelude in { concrete CatTur of Cat = CommonX ** open ResTur, Prelude in {
flags optimize=all_subs ; flags optimize=all_subs ;
@@ -10,22 +12,22 @@ concrete CatTur of Cat = CommonX ** open ResTur, Prelude in {
Pron = ResTur.Pron ; Pron = ResTur.Pron ;
Det = {s : Str; n : Number} ; Det = {s : Str; n : Number} ;
Num = {s : Str; n : Number} ; Num = {s : Number => Case => Str; n : Number} ;
Card = {s : Str} ; Card = {s : Number => Case => Str} ;
Ord = {s : Str} ; Ord = {s : Number => Case => Str} ;
Quant = {s : Str} ; Quant = {s : Str} ;
Prep = {s : Str} ; Prep = {s : Str} ;
Numeral = {s : CardOrd => Str ; n : Number} ; Numeral = {s : CardOrd => Number => Case => Str ; n : Number} ;
Digits = {s : CardOrd => Str ; n : Number; tail : DTail} ; Digits = {s : CardOrd => Number => Case => Str ; n : Number; tail : DTail} ;
-- Open lexical classes, e.g. Lexicon -- Open lexical classes, e.g. Lexicon
V, VS, VQ, VA = Verb ; V, VS, VQ, VA = Verb ;
V2, V2Q, V2V, V2A, V2S = Verb ** {c : Case; p : Prep} ; V2, V2Q, V2V, V2A, V2S = Verb ** {c : Case; p : Prep} ;
V3 = Verb ** {c1 : Case; p1 : Prep; c2 : Case; p2 : Prep} ; V3 = Verb ** {c1 : Case; p1 : Prep; c2 : Case; p2 : Prep} ;
A = Noun ; A = Adjective ;
A2 = Noun ** {c : Case; p : Prep} ; A2 = Adjective ** {c : Case; p : Prep} ;
N = Noun ; N = Noun ;
N2 = Noun ** {c : Case} ; N2 = Noun ** {c : Case} ;

23868
lib/src/turkish/DictTur.gf Normal file

File diff suppressed because it is too large Load Diff

23866
lib/src/turkish/DictTurAbs.gf Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,105 @@
--# -path=.:../abstract:../common:../../prelude
-- (c) 2010 Server Çimen under LGPL
resource HarmonyTur = ParamX ** open Prelude, Predef in {
flags
coding=utf8 ;
--Harmony
param
-- Consonant are divided into 2 groups: Voiceless vs Voiced or Hard vs Soft.
-- This parameter type is used for consonant harmony, namely hardening and softening rules.
Softness = Soft | Hard ;
-- Parameter type for consonant harmony:
-- Suffixes should have three forms at the worst case for consonant harmony, these forms are
-- used when stem ends with:
-- 1) soft consonant
-- 2) hard consonant
-- 3) vowel
HarConP = SCon Softness | SVow ;
-- Parameter type for vowel harmony:
-- Suffixes should have 4 forms, because of two dimensional vowel harmony
HarVowP = I_Har | U_Har | Ih_Har | Uh_Har ;
oper
-- Some pattern macros used by some opers (especially those related to harmonies) in ResTur.gf and ParadigmsTur.gf
--Capital forms of vowels are also added, otherwise harmony of proper nouns like "Of" can not be determined
vowel : pattern Str = #("a"|"e"|"ı"|"i"|"u"|"ü"|"o"|"ö"|"î"|"â"|"û"|"A"|"E"|"I"|"İ"|"U"|"Ü"|"O"|"Ö"|"Î"|"Â"|"Û") ;
consonant : pattern Str = #("b"|"v"|"d"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h") ;
--Extended consonant are used when proccessing words that contain non-letter characters like "stand-by"
extConson : pattern Str = #("b"|"v"|"d"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h"|"'"|"-") ;
--The following are the hard (voiced) consonant in Turkish Alphabet (Order is determined by "Fıstıı Şahap" :) )
hardCons : pattern Str = #("f"|"s"|"t"|"k"|"ç"|"ş"|"h"|"p") ;
-- Type definition and constructor of Harmony.
Harmony = {
vow : HarVowP ;
con : HarConP
} ;
mkHar : HarVowP -> HarConP -> Harmony;
mkHar v c = { vow = v ; con = c } ;
getHarmony : Str -> Harmony ;
getHarmony base = {
vow = getHarVowP base ;
con = getHarConP base ;
} ;
getHarVowP : Str -> HarVowP
= \base -> case base of {
_ + ("ı"|"a"|"â"|"I"|"A"|"Â") + #extConson* => I_Har ;
_ + ("i"|"e"|"î"|"İ"|"E"|"Î") + #extConson* => Ih_Har ;
_ + ("u"|"o"|"û"|"U"|"O"|"Û") + #extConson* => U_Har ;
_ + ("ü"|"ö"|"Ü"|"Ö") + #extConson* => Uh_Har ;
_ => Ih_Har --this is for yiyor ("y" is base in that case)
} ;
-- Param base : a word, of which softness is to be determined
-- Returns whether Soft or Hard form of suffix will be used when adding a suffix to base
getSoftness : Str -> Softness = \base -> case dp 1 base of {
#hardCons => Hard ;
_ => Soft
} ;
-- Param larC : the consonant form of suffix of which softness is to be determined
-- Returns whether Soft or Hard form of base will be used when adding a suffix to parameter
getBeginType : Str -> Softness = \larC -> case take 1 larC of {
#vowel => Soft ;
_ => Hard
} ;
-- Param base : a word
-- Returns which SuffixForm will be used when adding a suffix to base
getHarConP : Str -> HarConP =
\base -> case dp 1 base of {
#vowel => SVow ;
_ => SCon (getSoftness base)
} ;
-- returns softened form of a base
softenBase : Str -> Str = \base ->
let root = tk 1 base in
case base of {
_+ "p" => root + "b" ;
_+ "ç" => root + "c" ;
_+ "t" => root + "d" ;
_+ #consonant + "k" => root + "g" ;
_+ #vowel + ("k"|"g") => root + "ğ" ;
_ => base
} ;
-- harmony of progresive form of a verb is always the same, therefore it is constructed here to avoid unnecessary computation
progHar : Harmony
= {
vow = U_Har ;
con = SCon Soft ;
} ;
}

View File

@@ -0,0 +1,31 @@
--# -path=.:../abstract:../common:../../prelude
-- (c) 2009 Server Çimen under LGPL
concrete IrregTur of IrregTurAbs = CatTur ** open ParadigmsTur, ResTur in {
flags
optimize=values ;
coding=utf8 ;
lin
eat_V = mkV "yemek" "yemek" "yimek" ;
fear_V = mkV "korkmak" ;
fight_V = mkV "dövüşmek" ; --suça karşı / suçla savaşmak
find_V = mkV "bulmak" SgSylConIrreg ;
hate_V = mkV "nefret" et_Aux ;
hit_V = mkV "vurmak" SgSylConIrreg ;
know_V = mkV "bilmek" SgSylConIrreg ;
leave_V = mkV "ayrılmak";
like_V = mkV "hoşlanmak";
see_V = mkV "görmek" SgSylConIrreg ;
oper
et_Aux : Verb = mkV "etmek" "edmek" ;
et_Hard_Aux : Verb = mkV "etmek" ;
soyle_Aux : Verb = mkV "söylemek" ;
ol_Aux : Verb = mkV "olmak" SgSylConIrreg ;
koy_Aux : Verb = mkV "koymak" ;
gec_Aux : Verb = mkV "geçmek" ;
against_Prep : Prep = mkPrep "karşı" ;
}

View File

@@ -0,0 +1,17 @@
--# -path=.:../abstract:../common:../../prelude
-- (c) 2009 Server Çimen under LGPL
abstract IrregTurAbs = Cat ** {
fun
eat_V : V ;
fear_V : V ;
fight_V : V ;
find_V : V ;
hate_V : V ;
hit_V : V ;
know_V : V ;
leave_V : V ;
like_V : V ;
see_V : V ;
}

View File

@@ -1,4 +1,5 @@
--# -path=.:prelude --# -path=.:../abstract:../common:../../prelude
concrete LexiconTur of Lexicon = CatTur ** concrete LexiconTur of Lexicon = CatTur **
open ResTur, ParadigmsTur, Prelude, StructuralTur, IrregTur in { open ResTur, ParadigmsTur, Prelude, StructuralTur, IrregTur in {
@@ -198,53 +199,53 @@ concrete LexiconTur of Lexicon = CatTur **
john_PN = regPN "John" ; john_PN = regPN "John" ;
paris_PN = regPN "Paris" ; paris_PN = regPN "Paris" ;
--Adjectives --Adjectives
bad_A = mkN "kötü" ; bad_A = mkA "kötü" ;
beautiful_A = mkN "güzel" ; beautiful_A = mkA "güzel" ;
big_A = mkN "büyük" ; big_A = mkA "büyük" ;
black_A = mkN "kara" ; black_A = mkA "kara" ;
blue_A = mkN "mavi" ; blue_A = mkA "mavi" ;
broad_A = mkN "geniş" ; broad_A = mkA "geniş" ;
brown_A = mkN (mkN "kahve") (mkN "renk") ; brown_A = mkA (mkN "kahve") (mkN "renk") ;
clean_A = mkN "temiz" ; clean_A = mkA "temiz" ;
clever_A = mkN "zeki" ; clever_A = mkA "zeki" ;
cold_A = mkN "soğuk" ; cold_A = mkA "soğuk" ;
correct_A = mkN "doğru" ; correct_A = mkA "doğru" ;
dirty_A = mkN "kirli" ; dirty_A = mkA "kirli" ;
dry_A = mkN "kuru" ; dry_A = mkA "kuru" ;
dull_A = mkN "sıkıcı" ; dull_A = mkA "sıkıcı" ;
empty_A = mkN "boş" ; empty_A = mkA "boş" ;
full_A = mkN "dolu" ; full_A = mkA "dolu" ;
good_A = mkN "iyi" ; good_A = mkA "iyi" ;
green_A = mkN "yeşil" ; green_A = mkA "yeşil" ;
heavy_A = mkN "ağır" ; heavy_A = mkA "ağır" ;
hot_A = mkN "sıcak" ; hot_A = mkA "sıcak" ;
important_A = mkN "önemli" ; important_A = mkA "önemli" ;
long_A = mkN "uzun" ; long_A = mkA "uzun" ;
narrow_A = mkN "dar" ; narrow_A = mkA "dar" ;
near_A = mkN "yakın" ; near_A = mkA "yakın" ;
new_A = mkN "yeni" ; new_A = mkA "yeni" ;
old_A = mkN "eski" ; old_A = mkA "eski" ;
ready_A = mkN "hazır" ; ready_A = mkA "hazır" ;
red_A = mkN "kırmızı" ; red_A = mkA "kırmızı" ;
rotten_A = mkN "çürük" ; rotten_A = mkA "çürük" ;
round_A = mkN "yuvarlak" ; round_A = mkA "yuvarlak" ;
sharp_A = mkN "keskin" ; sharp_A = mkA "keskin" ;
short_A = mkN "kısa" ; short_A = mkA "kısa" ;
small_A = mkN "küçük" ; small_A = mkA "küçük" ;
smooth_A = mkN "pürüzsüz" ; smooth_A = mkA "pürüzsüz" ;
straight_A = mkN "düz" ; straight_A = mkA "düz" ;
stupid_A = mkN "aptal" ; stupid_A = mkA "aptal" ;
thick_A = mkN "kalın" ; thick_A = mkA "kalın" ;
thin_A = mkN "ince" ; thin_A = mkA "ince" ;
ugly_A = mkN "çirkin" ; ugly_A = mkA "çirkin" ;
uncertain_A = mkN "kuşkulu" ; uncertain_A = mkA "kuşkulu" ;
warm_A = mkN "ılık" ; warm_A = mkA "ılık" ;
wet_A = mkN "ıslak" ; wet_A = mkA "ıslak" ;
white_A = mkN "ak" "ak" ; white_A = mkA "ak" "ak" ;
wide_A = mkN "geniş" ; wide_A = mkA "geniş" ;
yellow_A = mkN "sarı" ; yellow_A = mkA "sarı" ;
young_A = mkN "genç" ; young_A = mkA "genç" ;
married_A2 = mkA2 (mkN "evli") with_Prep ; married_A2 = mkA2 (mkA "evli") with_Prep ;
--Verbs --Verbs
add_V3 = mkV3 (mkV "eklemek") ; add_V3 = mkV3 (mkV "eklemek") ;
answer_V2S = mkV2 (mkV "yanıtlamak") ; answer_V2S = mkV2 (mkV "yanıtlamak") ;

View File

@@ -1,3 +1,5 @@
--# -path=.:../abstract:../common:../../prelude
concrete NounTur of Noun = CatTur ** open ResTur, Prelude in { concrete NounTur of Noun = CatTur ** open ResTur, Prelude in {
flags optimize=all_subs ; flags optimize=all_subs ;
@@ -11,20 +13,20 @@ concrete NounTur of Noun = CatTur ** open ResTur, Prelude in {
UsePron p = p ; UsePron p = p ;
DetQuant quant num = { DetQuant quant num = {
s = quant.s ++ num.s ; s = quant.s ++ num.s ! Sg ! Nom ;
n = num.n n = num.n
} ; } ;
NumSg = {s = []; n = Sg} ; NumSg = {s = \\num,c => []; n = Sg} ;
NumPl = {s = []; n = Pl} ; NumPl = {s = \\num,c => []; n = Pl} ;
NumCard n = n ** {n = Sg} ; NumCard n = n ** {n = Sg} ;
NumNumeral numeral = {s = numeral.s ! NCard} ; NumNumeral numeral = {s = numeral.s ! NCard} ;
OrdDigits dig = {s = dig.s ! NOrd} ; OrdDigits dig = {s = \\c => dig.s ! NOrd ! c} ;
OrdNumeral num = {s = num.s ! NOrd} ; OrdNumeral num = {s = \\c => num.s ! NOrd ! c} ;
OrdSuperl a = {s = "daha" ++ a.s ! Sg ! Nom} ; OrdSuperl a = {s = \\n,c => "en" ++ a.s ! n ! c} ;
DefArt = { DefArt = {
s = [] s = []

View File

@@ -6,11 +6,11 @@ flags
coding = utf8 ; coding = utf8 ;
lincat lincat
Digit = {s : DForm => CardOrd => Str} ; Digit = {s : DForm => CardOrd => Number => Case => Str} ;
Sub10 = {s : DForm => CardOrd => Str ; n : Number ; blank : Str} ; -- the field blank is used to get rid of metavariables at parsing Sub10 = {s : DForm => CardOrd => Number => Case => Str ; n : Number ; blank : Str} ; -- the field blank is used to get rid of metavariables at parsing
Sub100 = {s : CardOrd => Str ; n : Number ; blank : Str} ; Sub100 = {s : CardOrd => Number => Case => Str ; n : Number ; blank : Str} ;
Sub1000 = {s : CardOrd => Str ; n : Number ; blank : Str} ; Sub1000 = {s : CardOrd => Number => Case => Str ; n : Number ; blank : Str} ;
Sub1000000 = {s : CardOrd => Str ; n : Number} ; Sub1000000 = {s : CardOrd => Number => Case => Str ; n : Number} ;
lin num x = x ; lin num x = x ;
@@ -25,35 +25,35 @@ lin n9 = mkNum "dokuz" "doksan" ;
lin pot01 = mkNum "bir" "on" "birinci" "onuncu" ** {n = Sg; blank = []} ; lin pot01 = mkNum "bir" "on" "birinci" "onuncu" ** {n = Sg; blank = []} ;
lin pot0 d = d ** {n = Pl; blank = []} ; lin pot0 d = d ** {n = Pl; blank = []} ;
lin pot110 = {s = pot01.s ! ten; n = Pl; blank = []} ; lin pot110 = {s = pot01.s ! ten; n = Pl; blank = []} ;
lin pot111 = {s = \\t => "on" ++ pot01.s ! unit ! t; n = Pl; blank = []} ; lin pot111 = {s = \\t,num,c => "on" ++ pot01.s ! unit ! t ! num ! c; n = Pl; blank = []} ;
lin pot1to19 d = {s = \\t => "on" ++ d.s ! unit ! t; n = Pl; blank = []} ; lin pot1to19 d = {s = \\t,num,c => "on" ++ d.s ! unit ! t ! num ! c; n = Pl; blank = []} ;
lin pot0as1 n = {s = \\t => n.s ! unit ! t; n = n.n ; blank = n.blank} ; lin pot0as1 n = {s = \\t => n.s ! unit ! t; n = n.n ; blank = n.blank} ;
lin pot1 d = {s = d.s ! ten; n = Pl ; blank = []} ; lin pot1 d = {s = d.s ! ten; n = Pl ; blank = []} ;
lin pot1plus d e = {s = \\t => d.s ! ten ! NCard ++ e.s ! unit ! t; n = Pl; blank = e.blank} ; lin pot1plus d e = {s = \\t,num,c => d.s ! ten ! NCard ! Sg ! Nom ++ e.s ! unit ! t ! num ! c; n = Pl; blank = e.blank} ;
lin pot1as2 n = n ; lin pot1as2 n = n ;
lin pot2 d = {s = \\t => case d.n of { lin pot2 d = {s = \\t,num,c => case d.n of {
Sg => d.blank ; Sg => d.blank ;
Pl => d.s ! unit ! NCard Pl => d.s ! unit ! NCard ! Sg ! Nom
} ++ (mkNum "yüz" "yüz").s ! unit ! t; n = Pl; blank = d.blank} ; } ++ (mkNum "yüz" "yüz").s ! unit ! t ! num ! c; n = Pl; blank = d.blank} ;
lin pot2plus d e = {s = \\t => case d.n of { lin pot2plus d e = {s = \\t,num,c => case d.n of {
Sg => d.blank ; Sg => d.blank ;
Pl => d.s ! unit ! NCard Pl => d.s ! unit ! NCard ! Sg ! Nom
} ++ "yüz" ++ e.s ! t ; n = Pl; blank = d.blank} ; } ++ "yüz" ++ e.s ! t ! num ! c; n = Pl; blank = d.blank} ;
lin pot2as3 n = n ; lin pot2as3 n = n ;
lin pot3 n = {s = \\t => case n.n of { lin pot3 n = {s = \\t,num,c => case n.n of {
Sg => n.blank ; Sg => n.blank ;
Pl => n.s ! NCard Pl => n.s ! NCard ! Sg ! Nom
} ++ (mkNum "bin" "bin").s ! unit ! t; n = Pl} ; } ++ (mkNum "bin" "bin").s ! unit ! t ! num ! c; n = Pl} ;
lin pot3plus n m = {s = \\t => case n.n of { lin pot3plus n m = {s = \\t,num,c => case n.n of {
Sg => n.blank ; Sg => n.blank ;
Pl => n.s ! NCard Pl => n.s ! NCard ! Sg !Nom
} ++ "bin" ++ m.s ! t; n = Pl} ; } ++ "bin" ++ m.s ! t ! num ! c; n = Pl} ;
lincat lincat
Dig = {s : CardOrd => Str ; n : Number} ; Dig = {s : CardOrd => Number => Case => Str ; n : Number} ;
lin lin
IDig d = d ** {tail = T1}; IDig d = d ** {tail = T1};
IIDig d ds = IIDig d ds =
{ s = \\t => d.s ! NCard ++ commaIf ds.tail ++ ds.s ! t; n = Pl; tail = inc ds.tail} ; { s = \\t,num,c => d.s ! NCard ! Sg ! Nom ++ commaIf ds.tail ++ ds.s ! t ! num ! c; n = Pl; tail = inc ds.tail} ;
D_0 = mkDig "0" ; D_0 = mkDig "0" ;
D_1 = mkDig "1" "1." Sg; D_1 = mkDig "1" "1." Sg;

View File

@@ -5,7 +5,8 @@ resource ParadigmsTur = open
Predef, Predef,
Prelude, Prelude,
ResTur, ResTur,
SuffixTur SuffixTur,
HarmonyTur
in { in {
flags flags
@@ -21,8 +22,8 @@ oper
mkV : (gelmek : Str) -> AoristType -> Verb ; mkV : (gelmek : Str) -> AoristType -> Verb ;
-- make verbs which do not obey softnening rule -- make verbs which do not obey softnening rule
mkV : (gitmek, gidmek : Str) -> Verb ; mkV : (gitmek, gidmek : Str) -> Verb ;
-- make verbs which present and future forms has "e" to "i" conversion like "yemek" -> "yiyorum" and "demek" -> "diyorum" -- make verbs which progressive and future forms has "e" to "i" conversion like "yemek" -> "yiyorum" and "demek" -> "diyorum"
-- two forms are enough but three form is needed to differentiate from the other overloads -- two forms are enough but third form is needed to differentiate from the other overloads
mkV : (yemek, yemek, yimek : Str) -> Verb ; mkV : (yemek, yemek, yimek : Str) -> Verb ;
-- make verbs that is usually formed by a noun and a auxiallary verb -- make verbs that is usually formed by a noun and a auxiallary verb
-- contiguity indicates whether they are written concatenated or separated -- contiguity indicates whether they are written concatenated or separated
@@ -52,7 +53,7 @@ oper
-- worst-case function -- worst-case function
-- bases of all forms are required. -- bases of all forms are required.
makeVerb : (inf,base,presBase,pastBase,futureBase,aoristBase : Str) -> Verb ; makeVerb : (inf,base,presBase,pastBase,aoristBase : Str) -> ( futureBase : Softness => Str ) -> Harmony -> Verb ;
-- make a regular verb -- make a regular verb
-- supply infinitive, softened infinitive, future infinitive forms and aorist type -- supply infinitive, softened infinitive, future infinitive forms and aorist type
@@ -122,35 +123,50 @@ oper
regPN : Str -> Noun ; regPN : Str -> Noun ;
-- worst case function for proper nouns -- worst case function for proper nouns
makePN : Str -> Str -> Noun ; makePN : Str -> Str -> Noun ;
-- digits can be seen as proper noun, but we need an additional harmony argument since harmony information can not be extracted from digit string.
makeHarPN : Str -> Str -> Harmony -> Noun ;
-- Link two nouns, e.g. zeytin (olive) + yağ (oil) -> zeytinyağı (olive oil)
linkNoun : (tere,yag : Noun) -> Species -> Contiguity -> Noun ;
-- Paradigms for adjactives (mkA is same as mkN) -- Paradigms for adjactives
mkA2 : overload { mkA : overload {
-- (biri) ile evli -- güzel
mkA2 : Noun -> Case -> Prep -> Noun ** {c : Case; p : Prep} ; mkA : Str -> Adjective ;
-- makes default case accusative -- ak
mkA2 : Noun -> Prep -> Noun ** {c : Case; p : Prep} ; mkA : Str -> Str -> Adjective ;
-- kahve rengi
mkA : Noun -> Noun -> Adjective ;
-- pürdikkat
mkA : Str -> Str -> HarVowP -> Adjective ;
} ; } ;
mkAdj2 : Noun -> Case -> Prep -> Noun ** {c : Case; p : Prep} ; mkA2 : overload {
-- (biri) ile evli
mkA2 : Adjective -> Case -> Prep -> Adjective ** {c : Case; p : Prep} ;
-- makes default case accusative
mkA2 : Adjective -> Prep -> Adjective ** {c : Case; p : Prep} ;
} ;
mkAdj2 : Adjective -> Case -> Prep -> Adjective ** {c : Case; p : Prep} ;
-- Paradigms for numerals -- Paradigms for numerals
mkNum : overload { mkNum : overload {
-- a regular numeral, obeys softening and hardening rules. e.g. "bir" "birinci" -- a regular numeral, obeys softening and hardening rules. e.g. "bir" "birinci"
mkNum : Str -> Str -> {s : DForm => CardOrd => Str} ; mkNum : Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} ;
-- an irregular numeral of which two form is needed. e.g. "kırk" "kırkıncı" "kırk" "kırkıncı" (does not soften) -- an irregular numeral of which two form is needed. e.g. "kırk" "kırkıncı" "kırk" "kırkıncı" (does not soften)
mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} ; mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} ;
} ; } ;
regNum : Str -> Str -> {s : DForm => CardOrd => Str} ; regNum : Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} ;
makeNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} ; makeNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} ;
mkDig : overload { mkDig : overload {
mkDig : Str -> {s : CardOrd => Str ; n : Number} ; mkDig : Str -> {s : CardOrd => Number => Case => Str ; n : Number} ;
mkDig : Str -> Str -> Number -> {s : CardOrd => Str ; n : Number} ; mkDig : Str -> Str -> Number -> {s : CardOrd => Number => Case => Str ; n : Number} ;
} ; } ;
regDigit : Str -> {s : CardOrd => Str ; n : Number} ; regDigit : Str -> {s : CardOrd => Number => Case => Str ; n : Number} ;
makeDigit : Str -> Str -> Number -> {s : CardOrd => Str ; n : Number} ; makeDigit : Str -> Str -> Number -> {s : CardOrd => Number => Case => Str ; n : Number} ;
--Implementation of verb paradigms --Implementation of verb paradigms
@@ -188,36 +204,34 @@ oper
har = getHarmony base ; har = getHarmony base ;
softness = getSoftness base ; softness = getSoftness base ;
futureBase = addSuffix futBase har futureSuffix ; futureBase = addSuffix futBase har futureSuffix ;
softFutureBase = addSuffix futBase har softFutureSuffix ;
pastBase = addSuffix base har pastSuffix ; pastBase = addSuffix base har pastSuffix ;
futureTable = table {
Soft => softFutureBase ;
Hard => futureBase
} ;
aoristBase = case aoristType of { aoristBase = case aoristType of {
SgSylConReg => addSuffix softBase har aoristErSuffix ; SgSylConReg => addSuffix softBase har aoristErSuffix ;
_ => addSuffix softBase har aoristIrSuffix _ => addSuffix softBase har aoristIrSuffix
} ; } ;
presBase = case (getHarConP base) of { progBase = case (getHarConP base) of {
SVow => addSuffix (tk 1 base) (getHarmony (tk 1 base)) presentSuffix ; SVow => addSuffix (tk 1 base) (getHarmony (tk 1 base)) presentSuffix ;
_ => addSuffix softBase har presentSuffix _ => addSuffix softBase har presentSuffix
} ; } ;
in makeVerb inf base presBase pastBase futureBase aoristBase ; in makeVerb inf base progBase pastBase aoristBase futureTable har;
makeVerb inf base presBase pastBase futureBase aoristBase = makeVerb inf base progBase pastBase aoristBase futureTable har =
let fbt = table { let
Soft => softenBase futureBase ; futht = getHarVowP (futureTable ! Hard) ;
Hard => futureBase pastHar = {vow = har.vow ; con = SVow} ;
} ; futHar = {vow = futht ; con = (SCon Soft)} ;
preht = getHarVowP presBase ; aorHar = {vow = getHarVowP aoristBase ; con = (SCon Soft)} ;
pasht = getHarVowP pastBase ;
futht = getHarVowP futureBase ;
aorht = getHarVowP aoristBase ;
preHar = (mkHar preht (SCon Soft));
pastHar = (mkHar pasht SVow);
futHar = (mkHar futht (SCon Soft));
aorHar = (mkHar aorht (SCon Soft));
in { in {
s = table { s = table {
VPres agr => addSuffix presBase preHar (verbSuffixes ! agr) ; VProg agr => addSuffix progBase progHar (verbSuffixes ! agr) ;
VPast agr => addSuffix pastBase pastHar (verbSuffixes ! agr) ; VPast agr => addSuffix pastBase pastHar (verbSuffixes ! agr) ;
VFuture agr => addSuffix fbt futHar (verbSuffixes ! agr) ; VFuture agr => addSuffix futureTable futHar (verbSuffixes ! agr) ;
VAorist agr => addSuffix aoristBase aorHar (verbSuffixes ! agr) ; VAorist agr => addSuffix aoristBase aorHar (verbSuffixes ! agr) ;
VImperative => base ; VImperative => base ;
VInfinitive => inf VInfinitive => inf
@@ -241,7 +255,11 @@ oper
Abess Pos => sgabPos ; Abess Pos => sgabPos ;
Abess Neg => sgabNeg Abess Neg => sgabNeg
} ; } ;
Pl => \\s => addSuffix pln plHar (caseSuffixes ! s) Pl => table {
Abess Pos => addSuffix sgabPos plHar plSuffix;
Abess Neg => addSuffix sgabNeg plHar plSuffix;
c => addSuffix pln plHar (caseSuffixes ! c)
}
} ; } ;
gen = table { gen = table {
Sg => table { Sg => table {
@@ -250,7 +268,8 @@ oper
s => addSuffix sgs har (genSuffixes ! s) s => addSuffix sgs har (genSuffixes ! s)
} ; } ;
Pl => \\s => addSuffix pln plHar (genSuffixes ! s) Pl => \\s => addSuffix pln plHar (genSuffixes ! s)
} } ;
harmony = har
} ; } ;
irregN_h sn sg har = irregN har sn sg ; irregN_h sn sg har = irregN har sn sg ;
@@ -278,10 +297,7 @@ oper
regN sn = regN sn =
let har = getHarmony sn ; let har = getHarmony sn ;
pln = add_number Pl sn har.vow ; pln = add_number Pl sn har.vow ;
bt = table { bt = getBaseTable sn
Soft => softenBase sn ;
Hard => sn
} ;
in in
mkNoun sn mkNoun sn
(addSuffix bt har accSuffix) (addSuffix bt har accSuffix)
@@ -289,29 +305,17 @@ oper
(addSuffix bt har genSuffix) (addSuffix bt har genSuffix)
(addSuffix bt har locSuffix) (addSuffix bt har locSuffix)
(addSuffix bt har ablatSuffix) (addSuffix bt har ablatSuffix)
(addSuffix bt har abessPosSuffix) (addSuffix bt har abessPosSuffix)
(addSuffix bt har abessNegSuffix) (addSuffix bt har abessNegSuffix)
(bt ! Soft) (bt ! Soft)
pln pln
har ; har ;
{-
--this function will be needed when nouns are fully implemented
regNounSTableOnly : Str -> Harmony -> Case => Str;
regNounSTableOnly sn har =
table {
t => (addSuffix sn har (caseSuffixes ! t))
} ;
-}
regPN sn = makePN sn sn ; regPN sn = makePN sn sn ;
makeHarPN sn sy har =
makePN sn sy = let bn = sn + "'" ;
let har = getHarmony sn ;
bn = sn + "'" ;
by = sy + "'" ; by = sy + "'" ;
pln = add_number Pl bn har.vow ; pln = add_number Pl bn har.vow ;
in in
@@ -327,8 +331,9 @@ oper
pln pln
har ; har ;
-- Link two nouns, e.g. zeytin (olive) + yağ (oil) -> zeytinyağı (olive oil) makePN sn sy = makeHarPN sn sy (getHarmony sn) ;
linkNoun : (tere,yag : Noun) -> Species -> Contiguity -> Noun ;
linkNoun n1 n2 lt ct = linkNoun n1 n2 lt ct =
let n1sn = n1.s ! Sg ! Nom ;--tere let n1sn = n1.s ! Sg ! Nom ;--tere
@@ -336,16 +341,20 @@ oper
n2pn = n2.s ! Pl ! Nom ;--yağlar n2pn = n2.s ! Pl ! Nom ;--yağlar
n2sb = n2.gen ! Sg ! {n = Sg; p = P3} ;--yağı n2sb = n2.gen ! Sg ! {n = Sg; p = P3} ;--yağı
n2pb = n2.gen ! Pl ! {n = Sg; p = P3} ;--yağları n2pb = n2.gen ! Pl ! {n = Sg; p = P3} ;--yağları
n2AbessPos = n2. s ! Sg ! Abess Pos ;
n2AbessNeg = n2. s ! Sg ! Abess Neg ;
con = case ct of { con = case ct of {
Con => <n1sn + n2sn, n1sn + n2sb, n1sn + n2pn, n1sn + n2pb> ; Con => <n1sn + n2sn, n1sn + n2sb, n1sn + n2pn, n1sn + n2pb, n1sn + n2AbessPos, n1sn + n2AbessNeg> ;
Sep => <n1sn ++ n2sn, n1sn ++ n2sb, n1sn ++ n2pn, n1sn ++ n2pb> Sep => <n1sn ++ n2sn, n1sn ++ n2sb, n1sn ++ n2pn, n1sn ++ n2pb, n1sn ++ n2AbessPos, n1sn ++ n2AbessNeg>
} ; } ;
sb = con.p1 ;--tereyağ sb = con.p1 ;--tereyağ
sn = con.p2 ;--tereyağı sn = con.p2 ;--tereyağı
pb = con.p3 ;--tereyağlar pb = con.p3 ;--tereyağlar
pn = con.p4 ;--tereyağları pn = con.p4 ;--tereyağları
sgAbessPos = con.p5 ;
sgAbessNeg = con.p6 ;
sgHar = getHarmony sn ; sgHar = getHarmony sn ;
plHar = getHarmony pn ; plHar = getHarmony pn
in { in {
s = table { s = table {
Sg => table { Sg => table {
@@ -355,8 +364,8 @@ oper
Gen => addSuffix sn sgHar genSuffix ; --tereyağının Gen => addSuffix sn sgHar genSuffix ; --tereyağının
Loc => addSuffix sn sgHar locSuffixN ; --tereyağında Loc => addSuffix sn sgHar locSuffixN ; --tereyağında
Ablat => addSuffix sn sgHar ablatSuffixN ; --tereyağından Ablat => addSuffix sn sgHar ablatSuffixN ; --tereyağından
Abess Pos => addSuffix sb sgHar abessPosSuffix ; --tereyağlı Abess Pos => sgAbessPos ; --tereyağlı
Abess Neg => addSuffix sb sgHar abessNegSuffix --tereyağsız Abess Neg => sgAbessNeg --tereyağsız
} ; } ;
Pl => table { Pl => table {
Nom => pn ;--tereyağları Nom => pn ;--tereyağları
@@ -365,14 +374,15 @@ oper
Gen => addSuffix pn plHar genSuffix ; --tereyağlarının Gen => addSuffix pn plHar genSuffix ; --tereyağlarının
Loc => addSuffix pn plHar locSuffixN ; --tereyağlarında Loc => addSuffix pn plHar locSuffixN ; --tereyağlarında
Ablat => addSuffix pn plHar ablatSuffixN ; --tereyağlarından Ablat => addSuffix pn plHar ablatSuffixN ; --tereyağlarından
Abess Pos => addSuffix pb plHar abessPosSuffix ; --tereyağlarlı Abess Pos => addSuffix sgAbessPos plHar abessPosSuffix ; --tereyağlılar
Abess Neg => addSuffix pb plHar abessNegSuffix --tereyağlarsız Abess Neg => addSuffix sgAbessNeg plHar abessNegSuffix --tereyağsızlar
} }
} ; } ;
gen = case ct of { gen = case ct of {
Con => \\num,agr => n1sn + n2.gen ! num ! agr ; Con => \\num,agr => n1sn + n2.gen ! num ! agr ;
Sep => \\num,agr => n1sn ++ n2.gen ! num ! agr Sep => \\num,agr => n1sn ++ n2.gen ! num ! agr
} } ;
harmony = sgHar
} ; } ;
mkN = overload { mkN = overload {
@@ -391,17 +401,29 @@ oper
-- Implementation of adjactive paradigms -- Implementation of adjactive paradigms
mkA = overload {
-- güzel
mkA : Str -> Adjective = \base -> (mkN base) ** { adv = addSuffix base (getHarmony base) adjAdvSuffix } ;
-- ak
mkA : Str -> Str -> Adjective = \base,soft -> (irregN (getComplexHarmony base soft) base soft ) ** { adv = addSuffix base (getHarmony base) adjAdvSuffix } ;
-- kahve rengi
mkA : (zeytin, yag : Noun) -> Adjective = \n1,n2 -> let n = linkNoun n1 n2 Indef Con in n ** {adv = addSuffix (n.s ! Sg ! Nom) (getHarmony (n.s ! Sg ! Nom)) adjAdvSuffix } ;
-- pürdikkat
mkA : (base, base1 : Str) -> (ih_har : HarVowP) -> Adjective = \base,base1,ih_har -> (irregN_h base base ih_har) ** { adv = addSuffix base (mkHar ih_har (getHarConP base)) adjAdvSuffix };
} ;
mkA2 = overload { mkA2 = overload {
mkA2 : Noun -> Case -> Prep -> Noun ** {c : Case; p : Prep} = mkAdj2 ; mkA2 : Adjective -> Case -> Prep -> Adjective ** {c : Case; p : Prep} = mkAdj2 ;
mkA2 : Noun -> Prep -> Noun ** {c : Case; p : Prep} = \n,p -> mkAdj2 n Acc p ; mkA2 : Adjective -> Prep -> Adjective ** {c : Case; p : Prep} = \n,p -> mkAdj2 n Acc p ;
} ; } ;
mkAdj2 base c prep = base ** {c = c; p = prep} ; mkAdj2 base c prep = base ** {c = c; p = prep} ;
-- Implementation of numeral paradigms -- Implementation of numeral paradigms
mkNum = overload { mkNum = overload {
mkNum : Str -> Str -> {s : DForm => CardOrd => Str} = regNum ; mkNum : Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} = regNum ;
mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} = makeNum ; mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} = makeNum ;
} ; } ;
regNum two twenty = regNum two twenty =
@@ -414,30 +436,46 @@ oper
{ {
s = table { s = table {
unit => table { unit => table {
NCard => two ; NCard => (regN two).s ;
NOrd => second NOrd => (regN second).s
} ; } ;
ten => table { ten => table {
NCard => twenty ; NCard => (regN twenty).s ;
NOrd => twentieth NOrd => (regN twentieth).s
} }
} }
} ; } ;
mkDig = overload { mkDig = overload {
--all digits except 1 (plural) --all digits except 1 (plural)
mkDig : Str -> {s : CardOrd => Str ; n : Number} = regDigit ; mkDig : Str -> {s : CardOrd => Number => Case => Str ; n : Number} = regDigit ;
--for 1 (singular) --for 1 (singular)
mkDig : Str -> Str -> Number -> {s : CardOrd => Str ; n : Number} = makeDigit ; mkDig : Str -> Str -> Number -> {s : CardOrd => Number => Case => Str ; n : Number} = makeDigit ;
} ; } ;
regDigit card = makeDigit card (card + ".") Pl ; regDigit card = makeDigit card (card + ".") Pl ;
makeDigit card ordi num = makeDigit card ordi num =
let
digitStr = case card of {
"0" => "sıfır" ;
"1" => "bir" ;
"2" => "iki" ;
"3" => "üç" ;
"4" => "dört" ;
"5" => "beş" ;
"6" => "altı" ;
"7" => "yedi" ;
"8" => "sekiz" ;
"9" => "dokuz"
} ;
harCard = getHarmony digitStr ;
harOrd = getHarmony (addSuffix digitStr harCard ordNumSuffix)
in
{ {
s = table { s = table {
NCard => card ; NCard => (makeHarPN card card harCard).s ;
NOrd => ordi NOrd => (makeHarPN ordi ordi harOrd).s
} ; } ;
n = num n = num
} ; } ;
@@ -453,18 +491,6 @@ oper
_ => PlSyl _ => PlSyl
} ; } ;
-- returns softened form of a base
softenBase : Str -> Str = \base ->
let root = tk 1 base in
case base of {
_+ "p" => root + "b" ;
_+ "ç" => root + "c" ;
_+ "t" => root + "d" ;
_+ #consonant + "k" => root + "g" ;
_+ #vowel + "k" => root + "ğ" ;
_+ #vowel + "g" => root + "ğ" ;
_ => base
} ;
-- construct a table contatining soft and hard forms of a base -- construct a table contatining soft and hard forms of a base
getBaseTable : Str -> Softness => Str = getBaseTable : Str -> Softness => Str =

View File

@@ -1,6 +1,6 @@
--# -path=.:../abstract:../common:../../prelude --# -path=.:../abstract:../common:../../prelude
resource ResTur = ParamX ** open Prelude, Predef in { resource ResTur = ParamX ** open Prelude, Predef, HarmonyTur in {
--2 For $Noun$ --2 For $Noun$
@@ -14,17 +14,19 @@ resource ResTur = ParamX ** open Prelude, Predef in {
oper oper
Agr = {n : Number ; p : Person} ; Agr = {n : Number ; p : Person} ;
Noun = {s : Number => Case => Str; gen : Number => Agr => Str} ; Noun = {s : Number => Case => Str; gen : Number => Agr => Str; harmony : Harmony} ;
Pron = {s : Case => Str; a : Agr} ; Pron = {s : Case => Str; a : Agr} ;
agrP3 : Number -> Agr ; agrP3 : Number -> Agr ;
agrP3 n = {n = n; p = P3} ; agrP3 n = {n = n; p = P3} ;
-- For $Adjective$
oper
Adjective = Noun ** { adv : Str } ;
-- For $Verb$. -- For $Verb$.
param param
VForm = VForm =
VPres Agr VProg Agr
| VPast Agr | VPast Agr
| VFuture Agr | VFuture Agr
| VAorist Agr | VAorist Agr
@@ -60,85 +62,7 @@ resource ResTur = ParamX ** open Prelude, Predef in {
a = {n=n; p=p} ; a = {n=n; p=p} ;
} ; } ;
--Harmony
param
-- Consonant are divided into 2 groups: Voiced vs Unvoiced or Hard vs Soft.
-- This parameter type is used for consonant harmony, namely hardening and softening rules.
Softness = Soft | Hard ;
-- Parameter type for consonant harmony:
-- Suffixes should have three forms at the worst case for consonant harmony, these forms are
-- used when stem ends with:
-- 1) soft consonant
-- 2) hard consonant
-- 3) vowel
HarConP = SCon Softness | SVow ;
-- Parameter type for vowel harmony:
-- Suffixes should have 4 forms, because of two dimensional vowel harmony
HarVowP = I_Har | U_Har | Ih_Har | Uh_Har ;
oper
-- Some pattern macros used by some opers (especially those related to harmonies) in ResTur.gf and ParadigmsTur.gf
--Capital forms of vowels are also added, otherwise harmony of proper nouns like "Of" can not be determined
vowel : pattern Str = #("a"|"e"|"ı"|"i"|"u"|"ü"|"o"|"ö"|"î"|"â"|"û"|"A"|"E"|"I"|"İ"|"U"|"Ü"|"O"|"Ö"|"Î"|"Â"|"Û") ;
consonant : pattern Str = #("b"|"v"|"d"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h") ;
--Extended consonant are used when proccessing words that contain non-letter characters like "stand-by"
extConson : pattern Str = #("b"|"v"|"d"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h"|" "|"'"|"-") ;
--The following are the hard (voiced) consonant in Turkish Alphabet (Order is determined by "Fıstıı Şahap" :) )
hardCons : pattern Str = #("f"|"s"|"t"|"k"|"ç"|"ş"|"h"|"p") ;
-- Type definition and constructor of Harmony.
Harmony = {
vow : HarVowP ;
con : HarConP
} ;
mkHar : HarVowP -> HarConP -> Harmony;
mkHar v c = { vow = v ; con = c } ;
getHarmony : Str -> Harmony ;
getHarmony base = {
vow = getHarVowP base ;
con = getHarConP base ;
} ;
getHarVowP : Str -> HarVowP
= \base -> case base of {
_+c@#vowel+
#extConson* =>
case c of {
("ı"|"a"|"â"|"I"|"A"|"Â") => I_Har ;
("i"|"e"|"î"|"İ"|"E"|"Î") => Ih_Har ;
("u"|"o"|"û"|"U"|"O"|"Û") => U_Har ;
("ü"|"ö"|"Ü"|"Ö") => Uh_Har
} ;
_ => Ih_Har --this is for yiyor ("y" is base in that case)
} ;
-- Param base : a word, of which softness is to be determined
-- Returns whether Soft or Hard form of suffix will be used when adding a suffix to base
getSoftness : Str -> Softness = \base -> case dp 1 base of {
#hardCons => Hard ;
_ => Soft
} ;
-- Param larC : the consonant form of suffix of which softness is to be determined
-- Returns whether Soft or Hard form of base will be used when adding a suffix to parameter
getBeginType : Str -> Softness = \larC -> case take 1 larC of {
#vowel => Soft ;
_ => Hard
} ;
-- Param base : a word
-- Returns which SuffixForm will be used when adding a suffix to base
getHarConP : Str -> HarConP =
\base -> case dp 1 base of {
#vowel => SVow ;
_ => SCon (getSoftness base)
} ;
--Prep --Prep
no_Prep = mkPrep [] ; no_Prep = mkPrep [] ;

View File

@@ -1,3 +1,5 @@
--# -path=.:../abstract:../common:../../prelude
concrete StructuralTur of Structural = CatTur ** concrete StructuralTur of Structural = CatTur **
open ResTur in { open ResTur in {

View File

@@ -0,0 +1,304 @@
-- (c) 2009 Server Çimen under LGPL
{-
This module currently contains
-Type definition and paradigms for suffixes
-Some ready-to-use suffixes (plural suffix, case suffixes, genitive suffixes, tense suffixes).
-3 Suffix Tables of type Agr / Case => Suffix for case, genitive and verb suffixes
-A function for adding a suffix to a base
-}
--# -path=.:../abstract:../common:../../prelude
resource SuffixTur = open Prelude, Predef, ResTur, HarmonyTur in {
flags
coding=utf8 ;
oper
-- Considering both consonant and vowel harmonies, following table contains all
-- needed forms of a suffix
SuffixTable : Type = HarConP => HarVowP => Str ;
Suffix : Type = {
st : SuffixTable ;
-- This field indicates whether soft or hard form of the stem will be used when
-- this suffix is appended to a stem
stemT : Softness
} ;
-- Always give the "e" or "i" forms of suffixes to regSuffix* opers
-- e.g. use 'regSuffix "ler" "ler"'
-- but not 'regSuffix "lar" "lar"'
-- similarly use 'regSuffix "in" "n"'
-- but not 'regSuffix "un" "n"' or 'regSuffix "ün" "n"' or 'regSuffix "ın" "n"'
-- Parameters for regSuffix* opers
-- larC : form of suffix that will be appended to a stem that ends with a consonant
-- larV : form of suffix that will be appended to a stem that ends with a consonant
-- Constructs a one syllable suffix
regSuffix : Str -> Str -> Suffix ;
-- Constructs a two syllable suffix
regSuffix2 : Str -> Str -> Suffix ;
-- Constructs a suffix where larC is two syllable and larV is one syllable
regSuffix21 : Str -> Str -> Suffix ;
-- List of suffixes, grouped by type
-- Empty Suffix
-- This suffix is required for some suffix tables (e.g. nominative case and 3rd Sg person verbal suffix)
empSuffix : Suffix = regSuffix "" "" ;
-- Plural Suffix
plSuffix : Suffix = regSuffix "ler" "ler" ;
-- Case Suffixes
accSuffix : Suffix = regSuffix "i" "yi" ;
datSuffix : Suffix = regSuffix "e" "ye" ;
genSuffix : Suffix = regSuffix "in" "nin" ;
locSuffix : Suffix = regSuffix "de" "de" ;
ablatSuffix : Suffix = regSuffix "den" "den" ;
abessPosSuffix : Suffix = regSuffix "li" "li" ;
abessNegSuffix : Suffix = regSuffix "siz" "siz" ;
-- following 4 suffixes has other forms used after genSgP3Suffix
accSuffixN : Suffix = regSuffix "i" "ni" ;
datSuffixN : Suffix = regSuffix "e" "ne" ;
locSuffixN : Suffix = regSuffix "de" "nde" ;
ablatSuffixN : Suffix = regSuffix "den" "nden" ;
-- Genitive Suffixes
genSgP1Suffix : Suffix = regSuffix "im" "m" ;
genSgP2Suffix : Suffix = regSuffix "in" "n" ;
genSgP3Suffix : Suffix = regSuffix "i" "si" ;
genPlP1Suffix : Suffix = regSuffix21 "imiz" "miz" ;
genPlP2Suffix : Suffix = regSuffix21 "iniz" "niz" ;
-- 3rd plural person genitive suffix is actually "-ları" but can be represented as plSuffix + current form,
-- see the comment at makeNoun operation in ParadigmsTur.gf
genPlP3Suffix : Suffix = regSuffix "i" "i" ;
-- Tense Suffixes
pastSuffix : Suffix = regSuffix "di" "di" ;
inferentSuffix : Suffix = regSuffix "miş" "miş" ;
-- Vowel "o" does not obey harmony rules so assume that "iyor" is a one syllable word (see oper oneSylParser)
presentSuffix : Suffix = regSuffix "iyor" "iyor" ;
aoristIrSuffix : Suffix = regSuffix "ir" "r" ;
aoristErSuffix : Suffix = regSuffix "er" "r" ;
futureSuffix : Suffix = regSuffix2 "ecek" "yecek" ;
softFutureSuffix : Suffix = regSuffix2 "eceğ" "yeceğ" ;
-- Person Suffixes for Verbs
p1SgVerbalSuffix : Suffix = regSuffix "im" "m" ;
p2SgVerbalSuffix : Suffix = regSuffix "sin" "n" ;
-- No suffix is used for the 3rd singular person (i.e empty suffix will be used in suffix tables in ResTur.gf)
p1PlVerbalSuffix : Suffix = regSuffix "iz" "k" ;
p2PlVerbalSuffix : Suffix = regSuffix21 "siniz" "niz" ;
p3PlVerbalSuffix : Suffix = regSuffix "ler" "ler" ;
-- Ordinal suffix for numbers
ordNumSuffix : Suffix = regSuffix21 "inci" "nci" ;
-- Suffix for deriving adverb from a adjective
adjAdvSuffix : Suffix = regSuffix "ce" "ce" ;
caseSuffixes : Case => Suffix =
table {
Nom => empSuffix ;
Acc => accSuffix ;
Dat => datSuffix ;
Gen => genSuffix ;
Loc => locSuffix ;
Ablat => ablatSuffix ;
Abess Pos => abessPosSuffix ;
Abess Neg => abessNegSuffix
} ;
genSuffixes : Agr => Suffix =
table {
{n=Sg; p=P1} => genSgP1Suffix ;
{n=Sg; p=P2} => genSgP2Suffix ;
{n=Sg; p=P3} => genSgP3Suffix ;
{n=Pl; p=P1} => genPlP1Suffix ;
{n=Pl; p=P2} => genPlP2Suffix ;
{n=Pl; p=P3} => genPlP3Suffix
} ;
verbSuffixes : Agr => Suffix =
table {
{n=Sg; p=P1} => p1SgVerbalSuffix ;
{n=Sg; p=P2} => p2SgVerbalSuffix ;
{n=Sg; p=P3} => empSuffix ;
{n=Pl; p=P1} => p1PlVerbalSuffix ;
{n=Pl; p=P2} => p2PlVerbalSuffix ;
{n=Pl; p=P3} => p3PlVerbalSuffix
} ;
-- Adds a suffix to the base given as Str using Harmony.
-- If only one form of base is given then it is assumed that base does not soften
addSuffix = overload {
addSuffix : Str -> Harmony -> Suffix -> Str = addSuffixStr ;
addSuffix : (Softness => Str) -> Harmony -> Suffix -> Str = addSuffixTable ;
} ;
addSuffixStr : Str -> Harmony -> Suffix -> Str =
\base,har,suf -> base + suf.st ! har.con ! har.vow ;
addSuffixTable : (Softness => Str) -> Harmony -> Suffix -> Str =
\baseTable,har,suf -> (baseTable ! suf.stemT) + suf.st ! har.con ! har.vow ;
regSuffix larC larV =
{
st = regH4Suffix larC larV ;
stemT = getBeginType larC ;
} ;
regSuffix2 larC larV =
{
st = regH4Suffix2 larC larV ;
stemT = getBeginType larC ;
} ;
regSuffix21 larC larV =
{
st = table {
SCon z => (regH4Suffix2 larC larV) ! SCon z ;
SVow => (regH4Suffix larC larV) ! SVow
} ;
stemT = getBeginType larC ;
} ;
-- Constructs suffix table for a one syllable suffix
regH4Suffix : Str -> Str -> SuffixTable = \baseC,baseV ->
let
wordC = oneSylParser baseC ;
lirCH = hardenWord wordC ;
lirC = case wordC.p3 of {
"WXQ" => <wordC.p1, wordC.p1, wordC.p1, wordC.p1, lirCH, lirCH, lirCH, lirCH> ;
"i" => <wordC.p1 + "ı" + wordC.p2,
wordC.p1 + "i" + wordC.p2,
wordC.p1 + "u" + wordC.p2,
wordC.p1 + "ü" + wordC.p2,
lirCH + "ı" + wordC.p2,
lirCH + "i" + wordC.p2,
lirCH + "u" + wordC.p2,
lirCH + "ü" + wordC.p2> ;
_ => <wordC.p1 + "a" + wordC.p2,
wordC.p1 + "e" + wordC.p2,
wordC.p1 + "a" + wordC.p2,
wordC.p1 + "e" + wordC.p2,
lirCH + "a" + wordC.p2,
lirCH + "e" + wordC.p2,
lirCH + "a" + wordC.p2,
lirCH + "e" + wordC.p2>
} ;
wordV = oneSylParser baseV ;
lirV = case wordV.p3 of {
"WXQ" => <wordV.p1, wordV.p1, wordV.p1, wordV.p1> ;
"i" => <wordV.p1 + "ı" + wordV.p2,
wordV.p1 + "i" + wordV.p2,
wordV.p1 + "u" + wordV.p2,
wordV.p1 + "ü" + wordV.p2> ;
_ => <wordV.p1 + "a" + wordV.p2,
wordV.p1 + "e" + wordV.p2,
wordV.p1 + "a" + wordV.p2,
wordV.p1 + "e" + wordV.p2>
} ;
in makeH4Table lirV lirC ;
-- Constructs suffix table for a two syllable suffix
regH4Suffix2 : Str -> Str -> SuffixTable = \baseC,baseV ->
let
wordC = twoSylParser baseC ;
lirCH = hardenWord wordC ;
lirC = case wordC.p4 of {
"WXQ" => <wordC.p1, wordC.p1, wordC.p1, wordC.p1, lirCH, lirCH, lirCH, lirCH> ;
"i" => <wordC.p1 + "ı" + wordC.p2 + "ı" + wordC.p3,
wordC.p1 + "i" + wordC.p2 + "i" + wordC.p3,
wordC.p1 + "u" + wordC.p2 + "u" + wordC.p3,
wordC.p1 + "ü" + wordC.p2 + "ü" + wordC.p3,
lirCH + "ı" + wordC.p2 + "ı" + wordC.p3,
lirCH + "i" + wordC.p2 + "i" + wordC.p3,
lirCH + "u" + wordC.p2 + "u" + wordC.p3,
lirCH + "ü" + wordC.p2 + "ü" + wordC.p3> ;
_ => <wordC.p1 + "a" + wordC.p2 + "a" + wordC.p3,
wordC.p1 + "e" + wordC.p2 + "e" + wordC.p3,
wordC.p1 + "a" + wordC.p2 + "a" + wordC.p3,
wordC.p1 + "e" + wordC.p2 + "e" + wordC.p3,
lirCH + "a" + wordC.p2 + "a" + wordC.p3,
lirCH + "e" + wordC.p2 + "e" + wordC.p3,
lirCH + "a" + wordC.p2 + "a" + wordC.p3,
lirCH + "e" + wordC.p2 + "e" + wordC.p3>
} ;
wordV = twoSylParser baseV ;
lirV = case wordV.p4 of {
"WXQ" => <wordV.p1, wordV.p1, wordV.p1, wordV.p1> ;
"i" => <wordV.p1 + "ı" + wordV.p2 + "ı" + wordV.p3,
wordV.p1 + "i" + wordV.p2 + "i" + wordV.p3,
wordV.p1 + "u" + wordV.p2 + "u" + wordV.p3,
wordV.p1 + "ü" + wordV.p2 + "ü" + wordV.p3> ;
_ => <wordV.p1 + "a" + wordV.p2 + "a" + wordV.p3,
wordV.p1 + "e" + wordV.p2 + "e" + wordV.p3,
wordV.p1 + "a" + wordV.p2 + "a" + wordV.p3,
wordV.p1 + "e" + wordV.p2 + "e" + wordV.p3>
}
in makeH4Table lirV lirC ;
-- Parses a one syllable word and returns consonant parts and the vowel
-- NOTE: not a general purpose parser, can parse only when vowel is e or i
oneSylParser : Str -> {p1 : Str; p2 : Str; p3 : Str} =
\base -> case base of {
x@((#consonant)*) +
c@("i"|"e") +
y@((#consonant|"o")*) => <x, y, c> ; --"o" does not obey harmony rules, so it is like a consonant in this sense
_ => <base, "WXQ", "WXQ">
} ;
-- Parses a two syllable word and returns consonant parts and the vowel
-- NOTE: not a general purpose parser, can parse only when vowel is e or i
twoSylParser : Str -> {p1 : Str; p2 : Str; p3 : Str; p4 : Str} =
\base -> case base of {
x@(#consonant*) +
c@("i"|"e") +
y@(#consonant*) +
d@("i"|"e") +
z@(#consonant*)=> <x, y, z, c> ;
_ => <base, "WXQ", "WXQ", "WXQ">
} ;
-- Constructs the SCon Hard form of the suffix
hardenWord : {p1 : Str; p2 : Str} -> Str =
\wordC -> let ordC = drop 1 wordC.p1 ;
in case take 1 wordC.p1 of {
("b") => "p" + ordC ;
("c") => "ç" + ordC ;
("d") => "t" + ordC ;
("g") => "k" + ordC ;
_ => wordC.p1
} ;
-- An auxiallary oper that fills in SuffixTable, used to avoid copy-paste
makeH4Table : {p1 : Str ; p2 : Str ; p3 : Str ; p4 : Str ;} -> {p1 : Str ; p2 : Str ; p3 : Str ; p4 : Str ; p5 : Str ; p6 : Str ; p7 : Str ; p8 : Str ;} -> SuffixTable =
\lirV,lirC ->
table {
SVow => table {
I_Har => lirV.p1 ;
Ih_Har => lirV.p2 ;
U_Har => lirV.p3 ;
Uh_Har => lirV.p4
} ;
SCon Soft => table {
I_Har => lirC.p1 ;
Ih_Har => lirC.p2 ;
U_Har => lirC.p3 ;
Uh_Har => lirC.p4
} ;
SCon Hard => table {
I_Har => lirC.p5 ;
Ih_Har => lirC.p6 ;
U_Har => lirC.p7 ;
Uh_Har => lirC.p8
}
} ;
}