1
0
forked from GitHub/gf-rgl

Complete AdjectiveTur (#12)

* remove unnecessary flags from GrammarTur.gf

* Implement the linearization for UseA2

* Minor formatting fixes

* Manually specify the preposition "ile" for married_A2

* Implement the linearization for ComplA2

* Implement the linearization for ReflA2 ("kendi ile evli")

* Fix ReflA2 adjective case to Nom

* Add a TODO comment

* Add a linearization for AdAP

* Implement the linearization for UseA2

* Minor formatting fixes

* Manually specify the preposition "ile" for married_A2

* Implement the linearization for ComplA2

* Implement the linearization for ReflA2 ("kendi ile evli")

* Fix ReflA2 adjective case to Nom

* Add a TODO comment

* Add a linearization for AdAP

* Fix AdAP

* Add linearization for at_most_AdN

* Add linearization for at_least_AdN

* added dummies for the missing modules in Turkish

* Add the linearization for as_CAdv

* Add rudimentary linearization for UsePN

* Add the linearization for CAdvAP

* Add preliminary linearization for EmbedVP

* Add linearization stub for SentAP

* Fix code-formatting and indentation in HarmonyTur

* Patterns for front and back vowels

* Add an oper for attaching the -mA suffix

* Formatting fixes in ParadigmsTur

* Attempt to implement attachMe

* Almost-working linearization for SentAP

* Update TODO for SentAP

* Move the addition of suffix si to the linearization of EmbedVP

* Import PhraseTur in GrammarTur

* Fix the duplication of PhraseTur in GrammarTur

* Start working on PhraseTur

* Fix formatting of makeH4Table

* Formatting

* Begin implementing the gerund inflection `makeVerb`

* Attach Number and Case data to the Gerund constructor of param VForm

* Get rid of hacky appending of "si" in EmbedVP
This commit is contained in:
Ayberk Tosun
2017-09-30 06:29:03 -05:00
committed by Krasimir Angelov
parent 432a6295cc
commit 76d6749797
15 changed files with 726 additions and 542 deletions

View File

@@ -1,4 +1,5 @@
concrete AdjectiveTur of Adjective = CatTur ** open ResTur, Prelude in { concrete AdjectiveTur of Adjective =
CatTur ** open ResTur, ParadigmsTur, Prelude in {
lin lin
@@ -18,4 +19,38 @@ concrete AdjectiveTur of Adjective = CatTur ** open ResTur, Prelude in {
s = \\n, c => adv.s ++ ap.s ! n ! c s = \\n, c => adv.s ++ ap.s ! n ! c
} ; } ;
AdAP ada ap = {
s = \\n, c => ada.s ++ ap.s ! n ! c
} ;
UseA2 a = {s = a.s} ;
ComplA2 a np = {
s = \\n, c => np.s ! a.c.c ++ a.c.s ++ a.s ! n ! c
} ;
-- TODO: Whether this is correct or not requires further examination.
ReflA2 a = {
s =
let
kendi : N = mkN "kendi"
in
\\n, c => kendi.s ! n ! c ++ a.c.s ++ a.s ! n ! Nom
} ;
-- Some examples of using CAdvAP:
-- Lang> gt -number=2 -depth=1 (CAdvAP ? ? ?) | l -lang=LangTur
-- > Paris kadar kötü
-- > o kadar kötü
CAdvAP cadv ap np = {
s = \\n, c => np.s ! Nom ++ cadv.s ++ ap.s ! n ! c
} ;
-- TODO: Instead of `++ BIND ++ "si"`, sc.s should be treated as a noun
-- and it should be inflected to `gen Sg {n = Sg; p = P3}`.
SentAP ap sc = {
s =
\\n, c => sc.s ++ (ap.s ! n ! c)
} ;
} }

View File

@@ -1,8 +1,4 @@
concrete ConjunctionEng of Conjunction = concrete ConjunctionTur of Conjunction =
CatTur ** open ResTur, Coordination, Prelude in { CatTur ** open ResTur, Coordination, Prelude in {
lin }
-- ConjNP : Conj -> ListNP -> NP
-- ConjNP conj ss =
}

View File

@@ -4,12 +4,19 @@ concrete GrammarTur of Grammar =
NounTur, NounTur,
VerbTur, VerbTur,
AdjectiveTur, AdjectiveTur,
AdverbTur,
NumeralTur, NumeralTur,
StructuralTur,
SentenceTur, SentenceTur,
AdverbTur QuestionTur,
RelativeTur,
ConjunctionTur,
TextX,
StructuralTur,
PhraseTur,
IdiomTur,
TenseX
** { ** {
flags startcat = Phr ; unlexer = text ; lexer = text ; flags startcat = Phr ;
} ; } ;

View File

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

5
src/turkish/IdiomTur.gf Normal file
View File

@@ -0,0 +1,5 @@
concrete IdiomTur of Idiom = CatTur ** open Prelude, ResTur in {
}

View File

@@ -245,7 +245,7 @@ concrete LexiconTur of Lexicon = CatTur **
wide_A = mkA "geniş" ; wide_A = mkA "geniş" ;
yellow_A = mkA "sarı" ; yellow_A = mkA "sarı" ;
young_A = mkA "genç" ; young_A = mkA "genç" ;
married_A2 = mkA2 (mkA "evli") with_Prep ; married_A2 = mkA2 (mkA "evli") (mkPrep "ile" Nom) ;
--Verbs --Verbs
add_V3 = mkV3 (mkV "eklemek") ; add_V3 = mkV3 (mkV "eklemek") ;
answer_V2S = mkV2S (mkV "yanıtlamak") ; answer_V2S = mkV2S (mkV "yanıtlamak") ;

View File

@@ -17,6 +17,9 @@ concrete NounTur of Noun = CatTur ** open ResTur, SuffixTur, HarmonyTur, Prelude
UsePron p = p ; UsePron p = p ;
-- TODO: look further into how correct this is.
UsePN pn = { s = \\c => pn.s ! Sg ! c; a = {n = Sg; p = P1}} ;
PossPron p = {s = []; useGen = YesGen p.a} ; PossPron p = {s = []; useGen = YesGen p.a} ;
DetQuant quant num = { DetQuant quant num = {

View File

@@ -9,503 +9,552 @@ resource ParadigmsTur = open
HarmonyTur HarmonyTur
in { in {
flags flags
coding=utf8 ; optimize=noexpand ; coding=utf8 ; optimize=noexpand ;
oper oper
-- Paradigms for verb -- Paradigms for verb
mkV : overload { mkV : overload {
--make regular verbs, one form is enough -- make regular verbs, one form is enough
mkV : (esmek : Str) -> V ; mkV : (esmek : Str) -> V ;
-- make verbs of which aorist form is irregular -- make verbs of which aorist form is irregular
mkV : (gelmek : Str) -> AoristType -> V ; mkV : (gelmek : Str) -> AoristType -> V ;
-- make verbs which do not obey softnening rule -- make verbs which do not obey softnening rule
mkV : (gitmek, gidmek : Str) -> V ; mkV : (gitmek, gidmek : Str) -> V ;
-- make verbs which progressive 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"
-- two forms are enough but third form is needed to differentiate from the other overloads -- conversion like "yemek" -> "yiyorum" and "demek" -> "diyorum"
mkV : (yemek, yemek, yimek : Str) -> V ; -- two forms are enough but third form is needed to differentiate from the
-- make verbs that is usually formed by a noun and a auxiallary verb -- other overloads
-- contiguity indicates whether they are written concatenated or separated mkV : (yemek, yemek, yimek : Str) -> V ;
mkV : (seyr : Str) -> (etmek : V) -> (con : Contiguity) -> V ; -- make verbs that is usually formed by a noun and a auxiallary verb
-- same as above, defined to make separated form default -- contiguity indicates whether they are written concatenated or separated
mkV : (nefret : Str) -> (etmek : V) -> V ; mkV : (seyr : Str) -> (etmek : V) -> (con : Contiguity) -> V ;
} ; -- same as above, defined to make separated form default
mkV : (nefret : Str) -> (etmek : V) -> V ;
} ;
mkV2 : overload {
-- make V2, use default case and preposition which are accusative case
-- and no preposition
mkV2 : (sormak : V) -> V2 ;
-- make V2, set case explicitly
mkV2 : (korkmak : V) -> Prep -> V2 ;
} ;
mkV2 : overload { mkV3 : overload {
-- make V2, use default case and preposition which are accusative case and no preposition -- make V3, use default cases and prepositions which are accusative and
mkV2 : (sormak : V) -> V2 ; -- dative cases and no preposition.
-- make V2, set case explicitly mkV3 : (satmak : V) -> V2 ;
mkV2 : (korkmak : V) -> Prep -> V2 ; -- make V3, set cases and prepositions explicitly.
} ; mkV3 : (konusmak : V) -> Prep -> Prep -> V3 ;
} ;
mkV3 : overload { mkV2S : V -> V2S = \verb -> lin V2S (verb ** {c = no_Prep}) ;
-- make V3, use default cases and prepositions which are accusative and dative cases and no preposition.
mkV3 : (satmak : V) -> V2 ;
-- make V3, set cases and prepositions explicitly.
mkV3 : (konusmak : V) -> Prep -> Prep -> V3 ;
} ;
mkV2S : V -> V2S = \verb -> lin V2S (verb ** {c = no_Prep}) ; -- worst-case function
-- bases of all forms are required.
makeVerb : (mek,inf,base,presBase,pastBase,aoristBase : Str)
-> (futureBase : Softness => Str )
-> Harmony
-> V ;
-- worst-case function -- make a regular verb
-- bases of all forms are required. -- supply infinitive, softened infinitive, future infinitive forms and
makeVerb : (inf,base,presBase,pastBase,aoristBase : Str) -> ( futureBase : Softness => Str ) -> Harmony -> V ; -- aorist type
regVerb : (inf, softInf, futInf : Str) -> AoristType -> V ;
-- make a regular verb -- make a regular verb, only infinitive form is needed
-- supply infinitive, softened infinitive, future infinitive forms and aorist type regV : (inf : Str) -> V ;
regVerb : (inf, softInf, futInf : Str) -> AoristType -> V ;
-- make a regular verb, only infinitive form is needed -- make a verb, aorist type must be specified
regV : (inf : Str) -> V ; -- see AoristType for list of verbs that has irregular aorist suffix
irregV_aor : (inf : Str) -> AoristType -> V ;
-- make a verb, aorist type must be specified -- make a verb from a str (usually a noun) and a auxiallary verb, also
-- see AoristType for list of verbs that has irregular aorist suffix -- specify contiguity (i.e whether they will be concatenated or separated)
irregV_aor : (inf : Str) -> AoristType -> V ; auxillaryVerb : Str -> Verb -> Contiguity -> V ;
-- make a verb from a str (usually a noun) and a auxiallary verb, also specify contiguity (i.e whether they will be concatenated or separated) mkV2 = overload {
auxillaryVerb : Str -> Verb -> Contiguity -> V ; -- sormak
mkV2 : V -> V2 = \verb -> verb ** lin V2 {c = no_Prep} ;
-- (bir şeyden) korkmak
mkV2 : V -> Prep -> V2 = \verb,c -> verb ** lin V2 {c = c} ;
} ;
mkV2 = overload { mkV3 = overload {
-- sormak -- (birine bir şeyi) satmak
mkV2 : V -> V2 = \verb -> verb ** lin V2 {c = no_Prep} ; mkV3 : V -> V3 = \verb -> verb ** lin V3 {c1 = no_Prep; c2 = no_Prep} ;
-- (bir şeyden) korkmak -- (biri ile bir şeyi) konuşmak
mkV2 : V -> Prep -> V2 = \verb,c -> verb ** lin V2 {c = c} ; mkV3 : V -> Prep -> Prep -> V3 =
} ; \verb,c1,c2 -> verb ** lin V3 {c1 = c1; c2 = c2} ;
} ;
-- Paradigms for noun
mkV3 = overload {
-- (birine bir şeyi) satmak
mkV3 : V -> V3 = \verb -> verb ** lin V3 {c1 = no_Prep; c2 = no_Prep} ;
-- (biri ile bir şeyi) konuşmak
mkV3 : V -> Prep -> Prep -> V3 =
\verb,c1,c2 -> verb ** lin V3 {c1 = c1; c2 = c2} ;
} ;
-- Paradigms for noun -- overload all noun paradigms to mkN
mkN : overload {
-- regular noun, only nominative case is needed
mkN : (araba : Str) -> N ;
-- handles three type of irregularities which never overlap
-- 1.Doubling consonant hak -> hakka
-- 2.Dropping vowel burun -> burnu
-- 3.Improper softening bisiklet -> bisikleti
mkN : (burun, burn : Str) -> N ;
-- in addition to irregularities above, handles vowel harmony irregularities
mkN : (divaniharp, divaniharb : Str) -> (ih_har : HarVowP) -> N ;
-- links two noun to form a compound noun
mkN : (fotograf, makine : N) -> Contiguity -> N ;
-- same as above, make concatenated form default
mkN : (zeytin, yag : N) -> N ;
} ;
-- overload all noun paradigms to mkN mkN2 : Str -> N2 ;
mkN : overload {
-- regular noun, only nominative case is needed
mkN : (araba : Str) -> N ;
-- handles three type of irregularities which never overlap
-- 1.Doubling consonant hak -> hakka
-- 2.Dropping vowel burun -> burnu
-- 3.Improper softening bisiklet -> bisikleti
mkN : (burun, burn : Str) -> N ;
-- in addition to irregularities above, handles vowel harmony irregularities
mkN : (divaniharp, divaniharb : Str) -> (ih_har : HarVowP) -> N ;
-- links two noun to form a compound noun
mkN : (fotograf, makine : N) -> Contiguity -> N ;
-- same as above, make concatenated form default
mkN : (zeytin, yag : N) -> N ;
} ;
mkN2 : Str -> N2 ;
mkN3 : Str -> N3 ; mkN3 : Str -> N3 ;
-- worst case function -- worst case function
-- parameters: all singular cases of base, base of genitive table, plural form of base and harmony of base -- parameters: all singular cases of base, base of genitive table, plural
mkNoun : (nom,acc,dat,gen,loc,abl,abessPos,abessNeg,gens,plural : Str) -> Harmony -> N ; -- form of base and harmony of base
--this function is for nouns that has different harmony than their vowels imply mkNoun : (nom,acc,dat,gen,loc,abl,abessPos,abessNeg,gens,plural : Str)
irregN_h : (burun, burn : Str) -> HarVowP -> N ; -> Harmony
-- this function handles all irregularities in nouns, because all irregularities require two forms of noun -> N ;
irregN : HarVowP -> (burun, burn : Str) -> N ;
-- paradigm for regular noun
regN : Str -> N ;
-- paradigm for proper noun
regPN : Str -> Noun ;
-- worst case function for proper nouns
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 : N) -> Species -> Contiguity -> N ;
-- Paradigms for adjactives -- This function is for nouns that has different harmony than their vowels imply
mkA : overload { irregN_h : (burun, burn : Str) -> HarVowP -> N ;
-- güzel
mkA : Str -> A ;
-- ak
mkA : Str -> Str -> A ;
-- kahve rengi
mkA : N -> N -> A ;
-- pürdikkat
mkA : Str -> Str -> HarVowP -> A ;
} ;
mkA2 : overload { -- This function handles all irregularities in nouns, because all
-- (biri) ile evli -- irregularities require two forms of noun
mkA2 : A -> Prep -> A2 ; irregN : HarVowP -> (burun, burn : Str) -> N ;
} ;
-- Paradigms for numerals -- Paradigm for regular noun
mkNum : overload { regN : Str -> N ;
-- a regular numeral, obeys softening and hardening rules. e.g. "bir" "birinci"
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)
mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} ;
} ;
regNum : Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} ; -- Paradigm for proper noun
makeNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} ; regPN : Str -> Noun ;
mkDig : overload { -- Worst case function for proper nouns
mkDig : Str -> {s : CardOrd => Number => Case => Str ; n : Number} ; makePN : Str -> Str -> Noun ;
mkDig : Str -> Str -> Number -> {s : CardOrd => Number => Case => Str ; n : Number} ;
} ;
regDigit : Str -> {s : CardOrd => Number => Case => Str ; n : Number} ; -- digits can be seen as proper noun, but we need an additional harmony argument
makeDigit : Str -> Str -> Number -> {s : CardOrd => Number => Case => Str ; n : Number} ; -- 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 : N) -> Species -> Contiguity -> N ;
-- Paradigms for adjactives
mkA : overload {
-- güzel
mkA : Str -> A ;
-- ak
mkA : Str -> Str -> A ;
-- kahve rengi
mkA : N -> N -> A ;
-- pürdikkat
mkA : Str -> Str -> HarVowP -> A ;
} ;
mkA2 : overload {
-- (biri) ile evli
mkA2 : A -> Prep -> A2 ;
} ;
-- Paradigms for numerals
mkNum : overload {
-- a regular numeral, obeys softening and hardening rules.
-- e.g. "bir" "birinci"
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)
mkNum : Str -> Str -> Str -> Str
-> {s : DForm => CardOrd => Number => Case => Str} ;
} ;
regNum : Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} ;
makeNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} ;
mkDig : overload {
mkDig : Str -> {s : CardOrd => Number => Case => Str ; n : Number} ;
mkDig : Str -> Str -> Number -> {s : CardOrd => Number => Case => Str ; n : Number} ;
} ;
regDigit : Str -> {s : CardOrd => Number => Case => Str ; n : Number} ;
makeDigit : Str -> Str -> Number -> {s : CardOrd => Number => Case => Str ; n : Number} ;
--Implementation of verb paradigms --Implementation of verb paradigms
mkV = overload { mkV = overload {
--esmek --esmek
mkV : Str -> V = regV ; mkV : Str -> V = regV ;
--gelmek --gelmek
mkV : Str -> AoristType -> V = irregV_aor ; mkV : Str -> AoristType -> V = irregV_aor ;
--gitmek --gitmek
mkV : Str -> Str -> V = \inf,softInf -> regVerb inf softInf softInf (getAoristType (tk 3 inf)) ; mkV : Str -> Str -> V =
--yemek \inf,softInf -> regVerb inf softInf softInf (getAoristType (tk 3 inf)) ;
mkV : Str -> Str -> Str -> V = \inf,softInf,futInf -> regVerb inf softInf futInf (getAoristType (tk 3 inf)) ; --yemek
--seyretmek mkV : Str -> Str -> Str -> V =
mkV : Str -> V -> Contiguity -> V = auxillaryVerb ; \inf,softInf,futInf -> regVerb inf softInf futInf (getAoristType (tk 3 inf)) ;
--nefret etmek --seyretmek
mkV : Str -> V -> V = \base,v -> auxillaryVerb base v Sep ; mkV : Str -> V -> Contiguity -> V = auxillaryVerb ;
} ; --nefret etmek
mkV : Str -> V -> V = \base,v -> auxillaryVerb base v Sep ;
} ;
auxillaryVerb prefix verb con = case con of { auxillaryVerb prefix verb con =
Sep => lin V {s = \\t => prefix ++ verb.s ! t} ; case con of {
Con => lin V {s = \\t => prefix + verb.s ! t} Sep => lin V {s = \\t => prefix ++ verb.s ! t} ;
} ; Con => lin V {s = \\t => prefix + verb.s ! t}
} ;
regV inf = regVerb inf inf inf (getAoristType (tk 3 inf)) ;
regV inf = regVerb inf inf inf (getAoristType (tk 3 inf)) ;
irregV_aor inf aorT = regVerb inf inf inf aorT ;
irregV_aor inf aorT = regVerb inf inf inf aorT ;
regVerb inf softInf futInf aoristType =
let base = (tk 3 inf) ;
softBase = (tk 3 softInf) ;
futBase = (tk 3 futInf) ;
har = getHarmony base ;
softness = getSoftness base ;
futureBase = addSuffix futBase har futureSuffix ;
softFutureBase = addSuffix futBase har softFutureSuffix ;
pastBase = addSuffix base har pastSuffix ;
futureTable = table {
Soft => softFutureBase ;
Hard => futureBase
} ;
aoristBase = case aoristType of {
SgSylConReg => addSuffix softBase har aoristErSuffix ;
_ => addSuffix softBase har aoristIrSuffix
} ;
progBase = case (getHarConP base) of {
SVow => addSuffix (tk 1 base) (getHarmony (tk 1 base)) presentSuffix ;
_ => addSuffix softBase har presentSuffix
} ;
in makeVerb inf base progBase pastBase aoristBase futureTable har;
makeVerb inf base progBase pastBase aoristBase futureTable har = regVerb inf softInf futInf aoristType =
let let base = (tk 3 inf) ;
futht = getHarVowP (futureTable ! Hard) ; softBase = (tk 3 softInf) ;
pastHar = {vow = har.vow ; con = SVow} ; futBase = (tk 3 futInf) ;
futHar = {vow = futht ; con = (SCon Soft)} ; har = getHarmony base ;
aorHar = {vow = getHarVowP aoristBase ; con = (SCon Soft)} ; softness = getSoftness base ;
in lin V { futureBase = addSuffix futBase har futureSuffix ;
s = table { softFutureBase = addSuffix futBase har softFutureSuffix ;
VProg agr => addSuffix progBase progHar (verbSuffixes ! agr) ; pastBase = addSuffix base har pastSuffix ;
VPast agr => addSuffix pastBase pastHar (verbSuffixes ! agr) ; futureTable =
VFuture agr => addSuffix futureTable futHar (verbSuffixes ! agr) ; table {
VAorist agr => addSuffix aoristBase aorHar (verbSuffixes ! agr) ; Soft => softFutureBase ;
VImperative => base ; Hard => futureBase
VInfinitive => inf } ;
} aoristBase =
} ; case aoristType of {
SgSylConReg => addSuffix softBase har aoristErSuffix ;
-- Implementation of noun paradigms _ => addSuffix softBase har aoristIrSuffix
mkNoun sn sa sd sg sl sabl sgabPos sgabNeg sgs pln har = } ;
let plHar = getHarmony pln ; progBase =
in case (getHarConP base) of {
lin N { SVow => addSuffix (tk 1 base) (getHarmony (tk 1 base)) presentSuffix ;
s = table { _ => addSuffix softBase har presentSuffix
Sg => table {
Nom => sn ;
Acc => sa ;
Dat => sd ;
Gen => sg ;
Loc => sl ;
Ablat => sabl ;
Abess Pos => sgabPos ;
Abess Neg => sgabNeg
} ;
Pl => table {
Abess Pos => addSuffix sgabPos plHar plSuffix;
Abess Neg => addSuffix sgabNeg plHar plSuffix;
c => addSuffix pln plHar (caseSuffixes ! c)
}
} ;
gen = table {
Sg => table {
--Genitive suffix for P3 is always -ları, always selecting plural form of base and harmony is a trick to implement this
{n=Pl; p=P3} => addSuffix pln plHar genPlP3Suffix ;
s => addSuffix sgs har (genSuffixes ! s)
} ;
Pl => \\s => addSuffix pln plHar (genSuffixes ! s)
} ; } ;
harmony = har in makeVerb (init inf) inf base progBase pastBase aoristBase futureTable har;
} ;
irregN_h sn sg har = irregN har sn sg ; makeVerb mek inf base progBase pastBase aoristBase futureTable har =
let
irregN ht sn sg = futht = getHarVowP (futureTable ! Hard) ;
let pastHar = {vow = har.vow ; con = SVow} ;
pln = add_number Pl sn ht ; futHar = {vow = futht ; con = (SCon Soft)} ;
har = mkHar ht (SCon (getSoftness sn)) ; aorHar = {vow = getHarVowP aoristBase ; con = (SCon Soft)} ;
irHar = mkHar ht (getHarConP sg) ; in
in lin V {
mkNoun sn s =
(addSuffix sg irHar accSuffix) table {
(addSuffix sg irHar datSuffix) VProg agr => addSuffix progBase progHar (verbSuffixes ! agr) ;
(addSuffix sg har genSuffix) VPast agr => addSuffix pastBase pastHar (verbSuffixes ! agr) ;
(addSuffix sn har locSuffix) VFuture agr => addSuffix futureTable futHar (verbSuffixes ! agr) ;
(addSuffix sn har ablatSuffix) VAorist agr => addSuffix aoristBase aorHar (verbSuffixes ! agr) ;
(addSuffix sn har abessPosSuffix) VImperative => base ;
(addSuffix sn har abessNegSuffix) VInfinitive => inf ;
sg Gerund _ Acc =>
pln case aorHar.vow of {
har ; Ih_Har => mek + "si" ;
I_Har => mek + "sı" ;
regN sn = U_Har => "TODO" ;
let har = getHarmony sn ; Uh_Har => "TODO"
pln = add_number Pl sn har.vow ;
bt = getBaseTable sn
in
mkNoun sn
(addSuffix bt har accSuffix)
(addSuffix bt har datSuffix)
(addSuffix bt har genSuffix)
(addSuffix bt har locSuffix)
(addSuffix bt har ablatSuffix)
(addSuffix bt har abessPosSuffix)
(addSuffix bt har abessNegSuffix)
(bt ! Soft)
pln
har ;
regPN sn = makePN sn sn ;
makeHarPN sn sy har =
let bn = sn + "'" ;
by = sy + "'" ;
pln = add_number Pl bn har.vow ;
in
mkNoun sn
(addSuffix by har accSuffix)
(addSuffix by har datSuffix)
(addSuffix by har genSuffix)
(addSuffix bn har locSuffix)
(addSuffix bn har ablatSuffix)
(addSuffix bn har abessPosSuffix)
(addSuffix bn har abessNegSuffix)
by
pln
har ;
makePN sn sy = makeHarPN sn sy (getHarmony sn) ;
linkNoun n1 n2 lt ct =
let n1sn = n1.s ! Sg ! Nom ;--tere
n2sn = n2.s ! Sg ! Nom ;--yağ
n2pn = n2.s ! Pl ! Nom ;--yağlar
n2sb = n2.gen ! Sg ! {n = Sg; p = P3} ;--yağı
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 => <n1sn + n2sn, n1sn + n2sb, n1sn + n2pn, n1sn + n2pb, n1sn + n2AbessPos, n1sn + n2AbessNeg> ;
Sep => <n1sn ++ n2sn, n1sn ++ n2sb, n1sn ++ n2pn, n1sn ++ n2pb, n1sn ++ n2AbessPos, n1sn ++ n2AbessNeg>
} ; } ;
sb = con.p1 ;--tereyağ Gerund _ _ => mek
sn = con.p2 ;--tereyağı }
pb = con.p3 ;--tereyağlar } ;
pn = con.p4 ;--tereyağları
sgAbessPos = con.p5 ; -- Implementation of noun paradigms
sgAbessNeg = con.p6 ; mkNoun sn sa sd sg sl sabl sgabPos sgabNeg sgs pln har =
sgHar = getHarmony sn ; let plHar = getHarmony pln ;
plHar = getHarmony pn in
in lin N { lin N {
s = table { s = table {
Sg => table { Sg => table {
Nom => sn ; --tereyağı Nom => sn ;
Acc => addSuffix sn sgHar accSuffixN ; --tereyağını Acc => sa ;
Dat => addSuffix sn sgHar datSuffixN ; --tereyağına Dat => sd ;
Gen => addSuffix sn sgHar genSuffix ; --tereyağının Gen => sg ;
Loc => addSuffix sn sgHar locSuffixN ; --tereyağında Loc => sl ;
Ablat => addSuffix sn sgHar ablatSuffixN ; --tereyağından Ablat => sabl ;
Abess Pos => sgAbessPos ; --tereyağlı Abess Pos => sgabPos ;
Abess Neg => sgAbessNeg --tereyağsız Abess Neg => sgabNeg
} ; } ;
Pl => table { Pl => table {
Nom => pn ;--tereyağları Abess Pos => addSuffix sgabPos plHar plSuffix;
Acc => addSuffix pn plHar accSuffixN ; --tereyağlarını Abess Neg => addSuffix sgabNeg plHar plSuffix;
Dat => addSuffix pn plHar datSuffixN ; --tereyağlarına c => addSuffix pln plHar (caseSuffixes ! c)
Gen => addSuffix pn plHar genSuffix ; --tereyağlarının }
Loc => addSuffix pn plHar locSuffixN ; --tereyağlarında } ;
Ablat => addSuffix pn plHar ablatSuffixN ; --tereyağlarından gen = table {
Abess Pos => addSuffix sgAbessPos plHar abessPosSuffix ; --tereyağlılar Sg => table {
Abess Neg => addSuffix sgAbessNeg plHar abessNegSuffix --tereyağsızlar -- Genitive suffix for P3 is always -ları, always selecting plural form of
} -- base and harmony is a trick to implement this
} ; {n=Pl; p=P3} => addSuffix pln plHar genPlP3Suffix ;
gen = case ct of { s => addSuffix sgs har (genSuffixes ! s)
Con => \\num,agr => n1sn + n2.gen ! num ! agr ; } ;
Sep => \\num,agr => n1sn ++ n2.gen ! num ! agr Pl => \\s => addSuffix pln plHar (genSuffixes ! s)
} ; } ;
harmony = sgHar harmony = har
} ;
irregN_h sn sg har = irregN har sn sg ;
irregN ht sn sg =
let
pln = add_number Pl sn ht ;
har = mkHar ht (SCon (getSoftness sn)) ;
irHar = mkHar ht (getHarConP sg) ;
in
mkNoun sn
(addSuffix sg irHar accSuffix)
(addSuffix sg irHar datSuffix)
(addSuffix sg har genSuffix)
(addSuffix sn har locSuffix)
(addSuffix sn har ablatSuffix)
(addSuffix sn har abessPosSuffix)
(addSuffix sn har abessNegSuffix)
sg
pln
har ;
regN sn =
let har = getHarmony sn ;
pln = add_number Pl sn har.vow ;
bt = getBaseTable sn
in
mkNoun sn
(addSuffix bt har accSuffix)
(addSuffix bt har datSuffix)
(addSuffix bt har genSuffix)
(addSuffix bt har locSuffix)
(addSuffix bt har ablatSuffix)
(addSuffix bt har abessPosSuffix)
(addSuffix bt har abessNegSuffix)
(bt ! Soft)
pln
har ;
regPN sn = makePN sn sn ;
makeHarPN sn sy har =
let bn = sn + "'" ;
by = sy + "'" ;
pln = add_number Pl bn har.vow ;
in
mkNoun sn
(addSuffix by har accSuffix)
(addSuffix by har datSuffix)
(addSuffix by har genSuffix)
(addSuffix bn har locSuffix)
(addSuffix bn har ablatSuffix)
(addSuffix bn har abessPosSuffix)
(addSuffix bn har abessNegSuffix)
by
pln
har ;
makePN sn sy = makeHarPN sn sy (getHarmony sn) ;
linkNoun n1 n2 lt ct =
let n1sn = n1.s ! Sg ! Nom ;--tere
n2sn = n2.s ! Sg ! Nom ;--yağ
n2pn = n2.s ! Pl ! Nom ;--yağlar
n2sb = n2.gen ! Sg ! {n = Sg; p = P3} ;--yağı
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 => <n1sn + n2sn, n1sn + n2sb, n1sn + n2pn, n1sn + n2pb, n1sn + n2AbessPos, n1sn + n2AbessNeg> ;
Sep => <n1sn ++ n2sn, n1sn ++ n2sb, n1sn ++ n2pn, n1sn ++ n2pb, n1sn ++ n2AbessPos, n1sn ++ n2AbessNeg>
} ;
sb = con.p1 ;--tereyağ
sn = con.p2 ;--tereyağı
pb = con.p3 ;--tereyağlar
pn = con.p4 ;--tereyağları
sgAbessPos = con.p5 ;
sgAbessNeg = con.p6 ;
sgHar = getHarmony sn ;
plHar = getHarmony pn
in lin N {
s = table {
Sg => table {
Nom => sn ; --tereyağı
Acc => addSuffix sn sgHar accSuffixN ; --tereyağını
Dat => addSuffix sn sgHar datSuffixN ; --tereyağına
Gen => addSuffix sn sgHar genSuffix ; --tereyağının
Loc => addSuffix sn sgHar locSuffixN ; --tereyağında
Ablat => addSuffix sn sgHar ablatSuffixN ; --tereyağından
Abess Pos => sgAbessPos ; --tereyağlı
Abess Neg => sgAbessNeg --tereyağsız
} ;
Pl => table {
Nom => pn ;--tereyağları
Acc => addSuffix pn plHar accSuffixN ; --tereyağlarını
Dat => addSuffix pn plHar datSuffixN ; --tereyağlarına
Gen => addSuffix pn plHar genSuffix ; --tereyağlarının
Loc => addSuffix pn plHar locSuffixN ; --tereyağlarında
Ablat => addSuffix pn plHar ablatSuffixN ; --tereyağlarından
Abess Pos => addSuffix sgAbessPos plHar abessPosSuffix ; --tereyağlılar
Abess Neg => addSuffix sgAbessNeg plHar abessNegSuffix --tereyağsızlar
}
} ;
gen = case ct of {
Con => \\num,agr => n1sn + n2.gen ! num ! agr ;
Sep => \\num,agr => n1sn ++ n2.gen ! num ! agr
} ;
harmony = sgHar
} ;
mkN = overload {
mkN : (araba : Str) -> N =
regN ;
mkN : (burun, burn : Str) -> N =
\sn,sg -> irregN (getComplexHarmony sn sg) sn sg ;
mkN : (divaniharp, divaniharb : Str) -> (ih_har : HarVowP) -> N =
irregN_h ;
mkN : (fotograf, makine : N) -> Contiguity -> Noun =
\n1,n2,c -> linkNoun n1 n2 Indef c ;
mkN : (zeytin, yag : N) -> N =
\n1,n2 -> linkNoun n1 n2 Indef Con ;
} ; } ;
mkN = overload {
mkN : (araba : Str) -> N = regN ;
mkN : (burun, burn : Str) -> N = \sn,sg -> irregN (getComplexHarmony sn sg) sn sg ;
mkN : (divaniharp, divaniharb : Str) -> (ih_har : HarVowP) -> N = irregN_h ;
mkN : (fotograf, makine : N) -> Contiguity -> Noun = \n1,n2,c -> linkNoun n1 n2 Indef c ;
mkN : (zeytin, yag : N) -> N = \n1,n2 -> linkNoun n1 n2 Indef Con ;
} ;
mkN2 base = (mkN base) ** lin N2 {c = lin Prep {s=[]; c=Gen}} ; mkN2 base = (mkN base) ** lin N2 {c = lin Prep {s=[]; c=Gen}} ;
mkN3 base = (mkN base) ** lin N3 {c1,c2 = lin Prep {s=[]; c=Gen}} ; mkN3 base = (mkN base) ** lin N3 {c1,c2 = lin Prep {s=[]; c=Gen}} ;
-- Implementation of adjactive paradigms -- Implementation of adjactive paradigms
mkA = overload { mkA = overload {
-- güzel -- güzel
mkA : Str -> A = \base -> (mkN base) ** lin A { adv = addSuffix base (getHarmony base) adjAdvSuffix} ; mkA : Str -> A =
-- ak \base ->
mkA : Str -> Str -> A = \base,soft -> (irregN (getComplexHarmony base soft) base soft) ** lin A { adv = addSuffix base (getHarmony base) adjAdvSuffix} ; (mkN base) ** lin A { adv = addSuffix base (getHarmony base) adjAdvSuffix} ;
-- kahve rengi -- ak
mkA : (zeytin, yag : N) -> A = \n1,n2 -> let n = linkNoun n1 n2 Indef Con in n ** lin A {adv = addSuffix (n.s ! Sg ! Nom) (getHarmony (n.s ! Sg ! Nom)) adjAdvSuffix} ; mkA : Str -> Str -> A =
-- pürdikkat \base,soft ->
mkA : (base, base1 : Str) -> (ih_har : HarVowP) -> A = \base,base1,ih_har -> (irregN_h base base ih_har) ** lin A {adv = addSuffix base (mkHar ih_har (getHarConP base)) adjAdvSuffix}; (irregN (getComplexHarmony base soft) base soft) ** lin A { adv = addSuffix base (getHarmony base) adjAdvSuffix} ;
} ; -- kahve rengi
mkA : (zeytin, yag : N) -> A = \n1,n2 -> let n = linkNoun n1 n2 Indef Con in n ** lin A {adv = addSuffix (n.s ! Sg ! Nom) (getHarmony (n.s ! Sg ! Nom)) adjAdvSuffix} ;
-- pürdikkat
mkA : (base, base1 : Str) -> (ih_har : HarVowP) -> A = \base,base1,ih_har -> (irregN_h base base ih_har) ** lin A {adv = addSuffix base (mkHar ih_har (getHarConP base)) adjAdvSuffix};
} ;
mkA2 =
overload {
mkA2 : A -> Prep -> A2 = \base,c -> base ** lin A2 {c = c} ;
} ;
mkA2 = overload { -- Implementation of numeral paradigms
mkA2 : A -> Prep -> A2 = \base,c -> base ** lin A2 {c = c} ; mkNum = overload {
} ; mkNum : Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} =
regNum ;
mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} =
makeNum ;
} ;
-- Implementation of numeral paradigms regNum two twenty =
mkNum = overload { makeNum two
mkNum : Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} = regNum ; twenty
mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Number => Case => Str} = makeNum ; (addSuffix (getBaseTable two) (getHarmony two) ordNumSuffix)
} ; (addSuffix (getBaseTable twenty) (getHarmony twenty) ordNumSuffix) ;
regNum two twenty = makeNum two twenty second twentieth =
makeNum two {
twenty s = table {
(addSuffix (getBaseTable two) (getHarmony two) ordNumSuffix) unit => table {
(addSuffix (getBaseTable twenty) (getHarmony twenty) ordNumSuffix) ; NCard => (regN two).s ;
NOrd => (regN second).s
} ;
ten => table {
NCard => (regN twenty).s ;
NOrd => (regN twentieth).s
}
}
} ;
makeNum two twenty second twentieth = mkDig = overload {
--all digits except 1 (plural)
mkDig : Str -> {s : CardOrd => Number => Case => Str ; n : Number} = regDigit ;
--for 1 (singular)
mkDig : Str -> Str -> Number -> {s : CardOrd => Number => Case => Str ; n : Number} = makeDigit ;
} ;
regDigit card = makeDigit card (card + ".") Pl ;
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 {
unit => table { NCard => (makeHarPN card card harCard).s ;
NCard => (regN two).s ; NOrd => (makeHarPN ordi ordi harOrd).s
NOrd => (regN second).s } ;
} ; n = num
ten => table {
NCard => (regN twenty).s ;
NOrd => (regN twentieth).s
}
}
} ; } ;
mkDig = overload { -- Helper functions and parameters
--all digits except 1 (plural) -- finds which aorist type will be used with a base, see aorist type parameter for more info
mkDig : Str -> {s : CardOrd => Number => Case => Str ; n : Number} = regDigit ; getAoristType : Str -> AoristType =
--for 1 (singular) \base -> case base of {
mkDig : Str -> Str -> Number -> {s : CardOrd => Number => Case => Str ; n : Number} = makeDigit ; #consonant* +
} ; #vowel +
#consonant +
#consonant* => SgSylConReg ;
_ => PlSyl
} ;
regDigit card = makeDigit card (card + ".") Pl ; -- construct a table contatining soft and hard forms of a base
getBaseTable : Str -> Softness => Str =
\base -> table {
Soft => softenBase base ;
Hard => base
} ;
makeDigit card ordi num = -- following two functions are to help deciding har type of nouns like vakit, hasut
let getComplexHarmony : Str -> Str -> HarVowP =
digitStr = case card of { \sn,sg -> case <(getHarVowP sn), (getHarVowP sg)> of {
"0" => "sıfır" ; <(I_Har | U_Har) , Ih_Har> => I_Har ;
"1" => "bir" ; <(I_Har | U_Har) , Uh_Har> => U_Har ;
"2" => "iki" ; <(Ih_Har | Uh_Har), I_Har> => Ih_Har ;
"3" => "üç" ; <(Ih_Har | Uh_Har), U_Har> => Uh_Har ;
"4" => "dört" ; <_,h> => h
"5" => "beş" ; } ;
"6" => "altı" ;
"7" => "yedi" ;
"8" => "sekiz" ;
"9" => "dokuz"
} ;
harCard = getHarmony digitStr ;
harOrd = getHarmony (addSuffix digitStr harCard ordNumSuffix)
in
{
s = table {
NCard => (makeHarPN card card harCard).s ;
NOrd => (makeHarPN ordi ordi harOrd).s
} ;
n = num
} ;
-- Helper functions and parameters add_number : Number -> Str -> HarVowP -> Str =
-- finds which aorist type will be used with a base, see aorist type parameter for more info \n,base,harVow ->
getAoristType : Str -> AoristType = case n of {
\base -> case base of { Sg => base ;
#consonant* + Pl => addSuffix base (mkHar harVow SVow) plSuffix
#vowel + } ;
#consonant +
#consonant* => SgSylConReg ;
_ => PlSyl
} ;
-- construct a table contatining soft and hard forms of a base ablat_Case : Prep = mkPrep [] Ablat;
getBaseTable : Str -> Softness => Str = dat_Case : Prep = mkPrep [] Dat;
\base -> table { acc_Case : Prep = mkPrep [] Dat;
Soft => softenBase base ;
Hard => base
} ;
-- following two functions are to help deciding har type of nouns like vakit, hasut mkQuant : Str -> Quant = \s -> lin Quant {s=s; useGen = NoGen} ;
getComplexHarmony : Str -> Str -> HarVowP =
\sn,sg -> case <(getHarVowP sn), (getHarVowP sg)> of {
<(I_Har | U_Har) , Ih_Har> => I_Har ;
<(I_Har | U_Har) , Uh_Har> => U_Har ;
<(Ih_Har | Uh_Har), I_Har> => Ih_Har ;
<(Ih_Har | Uh_Har), U_Har> => Uh_Har ;
<_,h> => h
} ;
add_number : Number -> Str -> HarVowP -> Str = param
\n,base,harVow -> AoristType =
case n of { PlSyl -- more than one syllable, takes -ir
Sg => base ; | SgSylConIrreg -- one syllable ending with consonant, but takes -ir
Pl => addSuffix base (mkHar harVow SVow) plSuffix -- (here is the list: al-, bil-, bul-, dur-, gel-, gör-,
} ; -- kal-, ol-, öl-, var-, ver-, vur-, san- )
| SgSylConReg ; -- one syllable ending with consonant, takes -er
ablat_Case : Prep = mkPrep [] Ablat;
dat_Case : Prep = mkPrep [] Dat;
acc_Case : Prep = mkPrep [] Dat;
mkQuant : Str -> Quant = \s -> lin Quant {s=s; useGen = NoGen} ;
param
AoristType = PlSyl -- more than one syllable, takes -ir
| SgSylConIrreg -- one syllable ending with consonant, but takes -ir (here is the list: al-, bil-, bul-, dur-, gel-, gör-, kal-, ol-, öl-, var-, ver-, vur-, san- )
| SgSylConReg ; -- one syllable ending with consonant, takes -er
} }

30
src/turkish/PhraseTur.gf Normal file
View File

@@ -0,0 +1,30 @@
concrete PhraseTur of Phrase = CatTur ** open Prelude, ResTur in {
lin
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
-- The following are utterly untested.
-- Currently, they should be treated as just implementation stubs.
UttQS qs = {s = qs.s} ;
UttImpSg pol imp = {s = imp.s} ;
UttImpPl pol imp = {s = imp.s} ;
UttImpPol pol imp = {s = imp.s} ;
UttIP ip = {s = ip.s} ;
UttIAdv iadv = iadv ;
UttCard n = {s = n.s ! Sg ! Nom} ;
UttInterj i = i ;
-- The following have been somewhat tested and seem to be working fine
-- to some extent.
UttNP np = {s = np.s ! Nom} ;
UttVP vp = {s = vp.s ! VInfinitive} ;
UttAP ap = {s = ap.s ! Sg ! Nom} ;
UttCN n = {s = n.s ! Sg ! Nom} ;
UttS s = s ;
UttAdv adv = adv ;
NoPConj = {s = []} ;
PConjConj conj = {s = conj.s} ;
NoVoc = {s = []} ;
VocNP np = {s = np.s ! Nom} ;
}

View File

@@ -0,0 +1,4 @@
concrete QuestionTur of Question = CatTur ** open ResTur, Prelude in {
}

View File

@@ -0,0 +1,4 @@
concrete RelativeTur of Relative = CatTur ** open ResTur in {
}

View File

@@ -14,7 +14,11 @@ resource ResTur = ParamX ** open Prelude, Predef, HarmonyTur in {
oper oper
Agr = {n : Number ; p : Person} ; Agr = {n : Number ; p : Person} ;
Noun = {s : Number => Case => Str; gen : Number => Agr => Str; harmony : Harmony} ; 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 ;
@@ -32,6 +36,7 @@ resource ResTur = ParamX ** open Prelude, Predef, HarmonyTur in {
| VAorist Agr | VAorist Agr
| VImperative | VImperative
| VInfinitive | VInfinitive
| Gerund Number Case
; ;
UseGen = NoGen | YesGen Agr | UseIndef ; UseGen = NoGen | YesGen Agr | UseIndef ;
@@ -70,4 +75,14 @@ resource ResTur = ParamX ** open Prelude, Predef, HarmonyTur in {
mkClause : Str -> Agr -> Verb -> {s : Str} = mkClause : Str -> Agr -> Verb -> {s : Str} =
\np, a, v -> ss (np ++ v.s ! VProg a) ; \np, a, v -> ss (np ++ v.s ! VProg a) ;
attachMe : Verb -> {s : Str} =
\v ->
let
s : Str = v.s ! VImperative
in
case s of {
(_ + #vowel + _ )* + (_ + #frontVowel + _) => ss (s ++ "me") ;
(_ + #vowel + _)* + (_ + #backVowel + _) => ss (s ++ "ma")
} ;
} }

View File

@@ -4,4 +4,7 @@ concrete SentenceTur of Sentence = CatTur ** open Prelude, ResTur in {
PredVP np vp = mkClause (np.s ! Nom) np.a vp ; PredVP np vp = mkClause (np.s ! Nom) np.a vp ;
-- TODO: Check how correct this is.
EmbedVP vp = {s = (vp.s ! Gerund Sg Acc)} ;
} }

View File

@@ -87,4 +87,10 @@ concrete StructuralTur of Structural = CatTur **
but_PConj = ss "ama" ; but_PConj = ss "ama" ;
at_most_AdN = ss "en fazla" ;
at_least_AdN = ss "en az" ;
as_CAdv = {s = "kadar"; p = "kadar"} ;
} }

View File

@@ -278,27 +278,30 @@ resource SuffixTur = open Prelude, Predef, ResTur, HarmonyTur in {
_ => wordC.p1 _ => wordC.p1
} ; } ;
-- An auxiallary oper that fills in SuffixTable, used to avoid copy-paste -- An auxiliary 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 = makeH4Table : {p1 : Str ; p2 : Str ; p3 : Str ; p4 : Str ;}
\lirV,lirC -> -> {p1 : Str ; p2 : Str ; p3 : Str ; p4 : Str ;
table { p5 : Str ; p6 : Str ; p7 : Str ; p8 : Str }
SVow => table { -> SuffixTable =
I_Har => lirV.p1 ; \lirV,lirC ->
Ih_Har => lirV.p2 ; table {
U_Har => lirV.p3 ; SVow => table {
Uh_Har => lirV.p4 I_Har => lirV.p1 ;
} ; Ih_Har => lirV.p2 ;
SCon Soft => table { U_Har => lirV.p3 ;
I_Har => lirC.p1 ; Uh_Har => lirV.p4
Ih_Har => lirC.p2 ; } ;
U_Har => lirC.p3 ; SCon Soft => table {
Uh_Har => lirC.p4 I_Har => lirC.p1 ;
} ; Ih_Har => lirC.p2 ;
SCon Hard => table { U_Har => lirC.p3 ;
I_Har => lirC.p5 ; Uh_Har => lirC.p4
Ih_Har => lirC.p6 ; } ;
U_Har => lirC.p7 ; SCon Hard => table {
Uh_Har => lirC.p8 I_Har => lirC.p5 ;
} Ih_Har => lirC.p6 ;
} ; U_Har => lirC.p7 ;
} Uh_Har => lirC.p8
}
} ;
}