1
0
forked from GitHub/gf-rgl

implement ProgrVP

This commit is contained in:
Krasimir Angelov
2024-07-24 19:57:23 +02:00
parent 4bb96aa295
commit d3ecaadef0
11 changed files with 152 additions and 86 deletions

View File

@@ -13,9 +13,9 @@ concrete CatTur of Cat = CommonX - [CAdv,AdN] ** open ResTur, HarmonyTur, Prelud
CN = {s : Number => Case => Str; gen : Number => Agr => Str; h : Harmony} ; CN = {s : Number => Case => Str; gen : Number => Agr => Str; h : Harmony} ;
NP = {s : Case => Str ; h : Harmony; a : Agr} ; NP = {s : Case => Str ; h : Harmony; a : Agr} ;
VP = {s : VForm => Str; compl : Str} ; VP = {s : Aspect => VForm => Str; compl : Str} ;
VPSlash = Verb ** {compl : Str; c : Prep} ; VPSlash = Verb ** {compl : Str; c : Prep} ;
Comp = {s : VForm => Str; compl : Str} ; Comp = {s : Aspect => VForm => Str; compl : Str} ;
Pron = ResTur.Pron ; Pron = ResTur.Pron ;
Det = {s : Str; n : Number; useGen : UseGen} ; Det = {s : Str; n : Number; useGen : UseGen} ;
@@ -59,6 +59,6 @@ concrete CatTur of Cat = CommonX - [CAdv,AdN] ** open ResTur, HarmonyTur, Prelud
linref linref
V2 = \v -> v.s ++ v.c.s ; V2 = \v -> v.s ++ v.c.s ;
VP = \vp -> vp.compl ++ vp.s ! VInf Pos ; VP = \vp -> vp.compl ++ vp.s ! Perf ! VInf Pos ;
} }

View File

@@ -97,37 +97,39 @@ lin
oper oper
inflVerb : Verb -> Str = \v -> inflVerb : Verb -> Str = \v ->
(heading2 ("Şimdiki zaman") ++ (heading2 ("Şimdiki zaman") ++
finite Pres ++ finite Perf Pres ++
finite Imperf Pres ++
heading2 ("Geçmiş zaman") ++ --# notpresent heading2 ("Geçmiş zaman") ++ --# notpresent
finite Past ++ --# notpresent finite Perf Past ++ --# notpresent
finite Imperf Past ++ --# notpresent
heading2 ("Gelecek zaman") ++ --# notpresent heading2 ("Gelecek zaman") ++ --# notpresent
finite Fut ++ --# notpresent finite Perf Fut ++ --# notpresent
heading2 ("Emir kipi") ++ heading2 ("Emir kipi") ++
frameTable ( frameTable (
tr (th "tekil" ++ tr (th "tekil" ++
th "çoğul") ++ th "çoğul") ++
tr (td (tbl ! VImp Pos Sg) ++ tr (td (tbl ! Perf ! VImp Pos Sg) ++
td (tbl ! VImp Pos Pl)) td (tbl ! Perf ! VImp Pos Pl))
) ++ ) ++
heading2 ("Eylemlik") ++ heading2 ("Eylemlik") ++
paragraph (tbl ! VInf Pos)) paragraph (tbl ! Perf ! VInf Pos))
where { where {
tbl : VForm => Str = mkVerbForms v ; tbl : Aspect => VForm => Str = mkVerbForms v ;
finite : Tense -> Str = \t -> finite : Aspect -> Tense -> Str = \asp,t ->
frameTable ( frameTable (
tr (th "" ++ tr (th "" ++
th "tekil" ++ th "tekil" ++
th "çoğul") ++ th "çoğul") ++
tr (th "1." ++ tr (th "1." ++
td (tbl ! VFin t Pos {n=Sg; p=P1}) ++ td (tbl ! asp ! VFin t Pos {n=Sg; p=P1}) ++
td (tbl ! VFin t Pos {n=Pl; p=P1})) ++ td (tbl ! asp ! VFin t Pos {n=Pl; p=P1})) ++
tr (th "2." ++ tr (th "2." ++
td (tbl ! VFin t Pos {n=Sg; p=P2}) ++ td (tbl ! asp ! VFin t Pos {n=Sg; p=P2}) ++
td (tbl ! VFin t Pos {n=Pl; p=P2})) ++ td (tbl ! asp ! VFin t Pos {n=Pl; p=P2})) ++
tr (th "3." ++ tr (th "3." ++
td (tbl ! VFin t Pos {n=Sg; p=P3}) ++ td (tbl ! asp ! VFin t Pos {n=Sg; p=P3}) ++
td (tbl ! VFin t Pos {n=Pl; p=P3})) td (tbl ! asp ! VFin t Pos {n=Pl; p=P3}))
) ; ) ;
} ; } ;
} }

View File

@@ -7,7 +7,7 @@ concrete ExtendTur of Extend = CatTur ** open ResTur, SuffixTur, Predef in {
a = {n=num.n; p=P3} ; a = {n=num.n; p=P3} ;
} ; } ;
UttVPShort vp = {s = vp.s ! VInf Pos} ; UttVPShort vp = {s = vp.s ! Perf ! VInf Pos} ;
TPastSimple = {s = []} ** {t = Past} ; --# notpresent TPastSimple = {s = []} ** {t = Past} ; --# notpresent

View File

@@ -1,4 +1,4 @@
concrete IdiomTur of Idiom = CatTur ** open Prelude, ResTur in { concrete IdiomTur of Idiom = CatTur ** open Prelude, ResTur, SuffixTur in {
lin lin
ImpersCl _ = variants {} ; ImpersCl _ = variants {} ;
@@ -8,7 +8,10 @@ lin
CleftNP _ _ = variants {} ; CleftNP _ _ = variants {} ;
CleftAdv _ _ = variants {} ; CleftAdv _ _ = variants {} ;
ImpPl1 _ = variants {} ; ImpPl1 _ = variants {} ;
ProgrVP _ = variants {} ;
ProgrVP vp = vp ** {
s = \\asp,vform => vp.s ! Imperf ! vform
} ;
} }

View File

@@ -195,7 +195,7 @@ concrete NounTur of Noun = CatTur ** open ResTur, SuffixTur, HarmonyTur, ParamX,
PPartNP np v2 = { PPartNP np v2 = {
s = \\c => np.s ! c s = \\c => np.s ! c
++ mkVerbForms v2 ! VFin Past Pos np.a --# notpresent ++ mkVerbForms v2 ! Perf ! VFin Past Pos np.a --# notpresent
; ;
h = np.h ; h = np.h ;
a = np.a a = np.a

View File

@@ -252,10 +252,10 @@ resource ParadigmsTur = open
VBase Soft => softBase ; VBase Soft => softBase ;
VProg => progBase ; VProg => progBase ;
VFuture => futBase ; VFuture => futBase ;
VPass => case last base of { VPass => case last softBase of {
#vowel => base + "n" ; #vowel => softBase + "n" ;
"l" => base + suffixStr h passiveInSuffix ; "l" => softBase + suffixStr h passiveInSuffix ;
_ => base + suffixStr h passiveIlSuffix _ => softBase + suffixStr h passiveIlSuffix
} }
} ; } ;
aoristType = aoristType ; aoristType = aoristType ;

View File

@@ -16,7 +16,7 @@ concrete PhraseTur of Phrase = CatTur ** open Prelude, ResTur in {
-- The following have been somewhat tested and seem to be working fine -- The following have been somewhat tested and seem to be working fine
-- to some extent. -- to some extent.
UttNP np = {s = np.s ! Nom} ; UttNP np = {s = np.s ! Nom} ;
UttVP vp = {s = vp.s ! VInf Pos} ; UttVP vp = {s = vp.s ! Perf ! VInf Pos} ;
UttAP ap = {s = ap.s ! Sg ! Nom} ; UttAP ap = {s = ap.s ! Sg ! Nom} ;
UttCN n = {s = n.s ! Sg ! Nom} ; UttCN n = {s = n.s ! Sg ! Nom} ;
UttS s = {s = s.s} ; UttS s = {s = s.s} ;

View File

@@ -36,6 +36,9 @@ resource ResTur = ParamX ** open Prelude, Predef, HarmonyTur, SuffixTur in {
-- For $Verb$. -- For $Verb$.
param param
Aspect =
Perf | Imperf ;
VForm = VForm =
VInf Polarity VInf Polarity
| VImp Polarity Number | VImp Polarity Number
@@ -107,26 +110,45 @@ resource ResTur = ParamX ** open Prelude, Predef, HarmonyTur, SuffixTur in {
a = {n = n; p = p} a = {n = n; p = p}
} ; } ;
mkVerbForms : Verb -> VForm => Str = mkVerbForms : Verb -> Aspect => VForm => Str =
\v -> table { \v -> \\asp =>
VInf Pos => v.s ; table {
VInf Pos => case asp of {
Perf => v.s ;
Imperf => v.stems ! VBase Soft ++ BIND ++
suffixStr v.h progrSuffix +
suffixStr progrHar infinitiveSuffix
} ;
VInf Neg => v.stems ! VBase Soft ++ BIND ++ VInf Neg => v.stems ! VBase Soft ++ BIND ++
suffixStr v.h negativeSuffix + suffixStr v.h negativeSuffix +
suffixStr v.h infinitiveSuffix ; case asp of {
VImp p n => v.stems ! VBase Soft ++ Perf => suffixStr v.h infinitiveSuffix ;
case <p,n> of { Imperf => suffixStr negHar progrSuffix +
<Pos,Sg> => [] ; suffixStr progrHar infinitiveSuffix
<Neg,Sg> => BIND ++ } ;
suffixStr v.h negativeSuffix ; VImp p n => case asp of {
<Pos,Pl> => BIND ++ Perf => v.stems ! VBase Soft ++
suffixStr v.h p2PlImperSuffix ; case <p,n> of {
<Neg,Pl> => BIND ++ <Pos,Sg> => [] ;
suffixStr v.h negativeSuffix + <Neg,Sg> => BIND ++
(let negHar = mkHar (case v.h.vow of { suffixStr v.h negativeSuffix ;
I_Har | U_Har => I_Har ; <Pos,Pl> => BIND ++
Ih_Har | Uh_Har => Ih_Har suffixStr v.h p2PlImperSuffix ;
}) SVow <Neg,Pl> => BIND ++
in suffixStr negHar p2PlImperSuffix) suffixStr v.h negativeSuffix +
suffixStr negHar p2PlImperSuffix
} ;
Imperf => v.stems ! VBase Soft ++ BIND ++
case <p,n> of {
<Pos,Sg> => suffixStr v.h progrSuffix ;
<Neg,Sg> => suffixStr v.h negativeSuffix +
suffixStr negHar progrSuffix ;
<Pos,Pl> => suffixStr v.h progrSuffix +
suffixStr progrHar p2PlImperSuffix ;
<Neg,Pl> => suffixStr v.h negativeSuffix +
suffixStr negHar progrSuffix +
suffixStr progrHar p2PlImperSuffix
}
} ; } ;
VFin t p agr => VFin t p agr =>
let presHar = mkHar (case v.h.con of { let presHar = mkHar (case v.h.con of {
@@ -137,28 +159,40 @@ resource ResTur = ParamX ** open Prelude, Predef, HarmonyTur, SuffixTur in {
SVow => v.h.vow SVow => v.h.vow
}) (SCon Soft) ; }) (SCon Soft) ;
pastHar = mkHar v.h.vow SVow ; pastHar = mkHar v.h.vow SVow ;
pastIHar= mkHar U_Har SVow ;
futSoft = (verbSuffixes ! agr).stemT ; futSoft = (verbSuffixes ! agr).stemT ;
futHar = mkHar (case v.h.vow of { futHar = mkHar (case v.h.vow of {
I_Har | U_Har => I_Har ; I_Har | U_Har => I_Har ;
Ih_Har | Uh_Har => Ih_Har Ih_Har | Uh_Har => Ih_Har
}) (SCon futSoft) ; }) (SCon futSoft) ;
negHar = mkHar (case v.h.vow of {
I_Har | U_Har => I_Har ;
Ih_Har | Uh_Har => Ih_Har
}) SVow ;
presNegHar = presNegHar =
mkHar negHar.vow (SCon Soft) mkHar negHar.vow (SCon Soft)
in case p of { in case p of {
Pos => case t of { Pos => case t of {
Pres => v.stems ! VBase Soft ++ BIND ++ Pres => case asp of {
suffixStr v.h (case v.aoristType of { Perf => v.stems ! VBase Soft ++ BIND ++
SgSylConReg => aoristErSuffix ; suffixStr v.h (case v.aoristType of {
_ => aoristIrSuffix SgSylConReg => aoristErSuffix ;
}) + _ => aoristIrSuffix
suffixStr presHar (verbSuffixes ! agr) ; }) +
Past => v.stems ! VBase Hard ++ BIND ++ suffixStr presHar (verbSuffixes ! agr) ;
suffixStr v.h pastSuffix + Imperf => v.stems ! VProg ++ BIND ++
suffixStr pastHar (verbSuffixes ! agr) ; suffixStr v.h progrSuffix +
suffixStr progrHar (verbSuffixes ! agr)
} ;
Past => case asp of {
Perf => v.stems ! VBase Hard ++ BIND ++
suffixStr v.h pastSuffix +
suffixStr pastHar (verbSuffixes ! agr) ;
Imperf => v.stems ! VProg ++ BIND ++
suffixStr v.h progrSuffix +
case agr of {
{n=Pl; p=P3} => suffixStr progrHar (verbSuffixes ! agr) +
suffixStr (mkHar Ih_Har (SCon Soft)) pastSuffix ;
_ => suffixStr progrHar pastSuffix +
suffixStr pastIHar (verbSuffixes ! agr)
}
} ;
Fut => v.stems ! VFuture ++ BIND ++ Fut => v.stems ! VFuture ++ BIND ++
suffixStr v.h (case futSoft of { suffixStr v.h (case futSoft of {
Soft => softFutureSuffix ; Soft => softFutureSuffix ;
@@ -169,17 +203,30 @@ resource ResTur = ParamX ** open Prelude, Predef, HarmonyTur, SuffixTur in {
suffixStr v.h (condCopulaSuffixes ! agr) suffixStr v.h (condCopulaSuffixes ! agr)
} ; } ;
Neg => case t of { Neg => case t of {
Pres => v.stems ! VBase Hard ++ BIND ++ Pres => case asp of {
suffixStr v.h negativeSuffix + Perf => v.stems ! VBase Hard ++ BIND ++
case agr of { suffixStr v.h negativeSuffix +
{n=Sg; p=P1} => suffixStr negHar (verbSuffixes ! agr) ; case agr of {
{n=Pl; p=P1} => suffixStr negHar p1PlAoristSuffix ; {n=Sg; p=P1} => suffixStr negHar (verbSuffixes ! agr) ;
_ => suffixStr negHar aoristIzSuffix + suffixStr presNegHar (verbSuffixes ! agr) {n=Pl; p=P1} => suffixStr negHar p1PlAoristSuffix ;
_ => suffixStr negHar aoristIzSuffix + suffixStr presNegHar (verbSuffixes ! agr)
} ;
Imperf => v.stems ! VBase Soft ++ BIND ++
tk 1 (suffixStr v.h negativeSuffix) +
suffixStr v.h progrSuffix +
suffixStr progrHar (verbSuffixes ! agr)
} ;
Past => case asp of {
Perf => v.stems ! VBase Hard ++ BIND ++
suffixStr v.h negativeSuffix +
suffixStr negHar pastSuffix +
suffixStr negHar (verbSuffixes ! agr) ;
Imperf => v.stems ! VBase Soft ++ BIND ++
tk 1 (suffixStr v.h negativeSuffix) +
suffixStr v.h progrSuffix +
suffixStr progrHar pastSuffix +
suffixStr pastIHar (verbSuffixes ! agr)
} ; } ;
Past => v.stems ! VBase Hard ++ BIND ++
suffixStr v.h negativeSuffix +
suffixStr negHar pastSuffix +
suffixStr negHar (verbSuffixes ! agr) ;
Fut => v.stems ! VBase Hard ++ BIND ++ Fut => v.stems ! VBase Hard ++ BIND ++
suffixStr v.h negativeSuffix + suffixStr v.h negativeSuffix +
suffixStr negHar (case (verbSuffixes ! agr).stemT of { suffixStr negHar (case (verbSuffixes ! agr).stemT of {
@@ -192,7 +239,14 @@ resource ResTur = ParamX ** open Prelude, Predef, HarmonyTur, SuffixTur in {
suffixStr negHar (condCopulaSuffixes ! agr) suffixStr negHar (condCopulaSuffixes ! agr)
} }
} }
} ; }
where {
negHar = mkHar (case v.h.vow of {
I_Har | U_Har => I_Har ;
Ih_Har | Uh_Har => Ih_Har
}) SVow ;
progrHar = mkHar U_Har (SCon Soft)
} ;
mkDet : Str -> Number -> UseGen -> {s : Str; n : Number; useGen : UseGen} = mkDet : Str -> Number -> UseGen -> {s : Str; n : Number; useGen : UseGen} =
\s, n, ug -> {s = s; n = n; useGen = ug} ; \s, n, ug -> {s = s; n = n; useGen = ug} ;

View File

@@ -1,7 +1,7 @@
concrete SentenceTur of Sentence = CatTur ** open Prelude, ResTur in { concrete SentenceTur of Sentence = CatTur ** open Prelude, ResTur in {
lin lin
PredVP np vp = {s = \\t,p => np.s ! Nom ++ vp.compl ++ vp.s ! VFin t p np.a} ; PredVP np vp = {s = \\t,p => np.s ! Nom ++ vp.compl ++ vp.s ! Perf ! VFin t p np.a} ;
PredSCVP sc vp = variants {} ; PredSCVP sc vp = variants {} ;
@@ -22,7 +22,7 @@ concrete SentenceTur of Sentence = CatTur ** open Prelude, ResTur in {
EmbedQS _ = variants {} ; EmbedQS _ = variants {} ;
EmbedS _ = variants {} ; EmbedS _ = variants {} ;
ImpVP vp = {s = \\p,n => vp.compl ++ vp.s ! VImp p n ImpVP vp = {s = \\p,n => vp.compl ++ vp.s ! Perf ! VImp p n
} ; } ;
AdvS _ _ = variants {} ; AdvS _ _ = variants {} ;

View File

@@ -85,7 +85,7 @@ resource SuffixTur = open Prelude, Predef, HarmonyTur in {
pastSuffix : Suffix = regSuffix "di" "di" ; pastSuffix : Suffix = regSuffix "di" "di" ;
inferentSuffix : Suffix = regSuffix "miş" "miş" ; inferentSuffix : Suffix = regSuffix "miş" "miş" ;
-- Vowel "o" does not obey harmony rules so assume that "iyor" is a one syllable word (see oper oneSylParser) -- Vowel "o" does not obey harmony rules so assume that "iyor" is a one syllable word (see oper oneSylParser)
presentSuffix : Suffix = regSuffix "iyor" "iyor" ; progrSuffix : Suffix = regSuffix "iyor" "iyor" ;
aoristIrSuffix : Suffix = regSuffix "ir" "r" ; aoristIrSuffix : Suffix = regSuffix "ir" "r" ;
aoristErSuffix : Suffix = regSuffix "er" "r" ; aoristErSuffix : Suffix = regSuffix "er" "r" ;
aoristIzSuffix : Suffix = regSuffix "iz" "z" ; aoristIzSuffix : Suffix = regSuffix "iz" "z" ;

View File

@@ -31,8 +31,10 @@ concrete VerbTur of Verb = CatTur ** open Prelude, ResTur, SuffixTur, HarmonyTur
CompCN _ = variants {} ; CompCN _ = variants {} ;
CompNP np = { CompNP np = {
s = table { s = \\asp,vform =>
VFin Pres p agr => np.s ! Nom ++ case <asp,vform> of {
<Perf,VFin Pres p agr>
=> np.s ! Nom ++
case <agr,p> of { case <agr,p> of {
<{n=Sg; p=P3},Pos> => [] ; <{n=Sg; p=P3},Pos> => [] ;
<{n=Sg; p=P3},Neg> => BIND ++ suffixStr np.h negativeSuffix ; <{n=Sg; p=P3},Neg> => BIND ++ suffixStr np.h negativeSuffix ;
@@ -44,25 +46,28 @@ concrete VerbTur of Verb = CatTur ** open Prelude, ResTur, SuffixTur, HarmonyTur
}) SVow }) SVow
in suffixStr negHar (verbSuffixes ! agr)) in suffixStr negHar (verbSuffixes ! agr))
} ; } ;
VFin Past p agr => np.s ! Nom ++ BIND ++ <Perf,VFin Past p agr>
=> np.s ! Nom ++ BIND ++
case p of { case p of {
Pos => [] ; Pos => [] ;
Neg => suffixStr np.h negativeSuffix Neg => suffixStr np.h negativeSuffix
} + } +
suffixStr np.h (alethicCopulaSuffixes ! agr) ; suffixStr np.h (alethicCopulaSuffixes ! agr) ;
vform => np.s ! Nom ++ _ => np.s ! Nom ++
mkVerbForms olmak_V ! vform mkVerbForms olmak_V ! asp ! vform
} ; } ;
compl = [] compl = []
} ; } ;
CompAP ap = { CompAP ap = {
s = table { s = \\asp,vform =>
VInf p => ap.s ! Sg ! Nom ++ case <asp,vform> of {
mkVerbForms olmak_V ! (VInf p) ; <_,VInf p> => ap.s ! Sg ! Nom ++
VImp p n => ap.s ! n ! Nom ++ mkVerbForms olmak_V ! asp ! (VInf p) ;
mkVerbForms olmak_V ! (VImp p n) ; <_,VImp p n> => ap.s ! n ! Nom ++
VFin Pres p agr => ap.s ! agr.n ! Nom ++ mkVerbForms olmak_V ! asp ! (VImp p n) ;
<Perf,VFin Pres p agr> =>
ap.s ! agr.n ! Nom ++
case <agr,p> of { case <agr,p> of {
<{n=Sg; p=P3},Pos> => [] ; <{n=Sg; p=P3},Pos> => [] ;
<{n=Sg; p=P3},Neg> => BIND ++ suffixStr ap.h negativeSuffix ; <{n=Sg; p=P3},Neg> => BIND ++ suffixStr ap.h negativeSuffix ;
@@ -76,14 +81,16 @@ concrete VerbTur of Verb = CatTur ** open Prelude, ResTur, SuffixTur, HarmonyTur
} }
in suffixStr negHar (verbSuffixes ! agr)) in suffixStr negHar (verbSuffixes ! agr))
} ; } ;
VFin Past p agr => ap.s ! agr.n ! Nom ++ BIND ++ <Perf,VFin Past p agr> =>
ap.s ! agr.n ! Nom ++ BIND ++
case p of { case p of {
Pos => [] ; Pos => [] ;
Neg => suffixStr ap.h negativeSuffix Neg => suffixStr ap.h negativeSuffix
} + } +
suffixStr ap.h (alethicCopulaSuffixes ! agr) ; suffixStr ap.h (alethicCopulaSuffixes ! agr) ;
VFin t p agr => ap.s ! agr.n ! Nom ++ <_,VFin t p agr> =>
mkVerbForms olmak_V ! (VFin t p agr) ap.s ! agr.n ! Nom ++
mkVerbForms olmak_V ! asp ! (VFin t p agr)
} ; } ;
compl = [] compl = []
} ; } ;
@@ -101,7 +108,7 @@ concrete VerbTur of Verb = CatTur ** open Prelude, ResTur, SuffixTur, HarmonyTur
} ; } ;
AdVVP adv vp = vp ** { AdVVP adv vp = vp ** {
s = \\vf => adv.s ++ vp.s ! vf ; s = \\asp,vf => adv.s ++ vp.s ! asp ! vf ;
} ; } ;
AdvVPSlash vp adv = vp ** { AdvVPSlash vp adv = vp ** {