mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-20 08:32:50 -06:00
Proper reflexive and medial verbs support together with completelly reworked case system.
This commit is contained in:
@@ -18,7 +18,8 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
-- This is the worst-case $Case$ needed for pronouns.
|
||||
|
||||
param
|
||||
Case = Nom | Acc | Dat;
|
||||
Role = RSubj | RObj Case ;
|
||||
Case = Acc | Dat;
|
||||
|
||||
NForm =
|
||||
NF Number Species
|
||||
@@ -54,6 +55,12 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
| VImperative Number
|
||||
| VGerund
|
||||
;
|
||||
|
||||
VType =
|
||||
VNormal
|
||||
| VMedial Case
|
||||
| VPhrasal Case
|
||||
;
|
||||
|
||||
-- The order of sentence is needed already in $VP$.
|
||||
|
||||
@@ -112,39 +119,39 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
GPl => Pl
|
||||
} ;
|
||||
|
||||
aform : GenNum -> Species -> Case -> AForm = \gn,spec,c ->
|
||||
aform : GenNum -> Species -> Role -> AForm = \gn,spec,role ->
|
||||
case gn of {
|
||||
GSg g => case <g,spec,c> of {
|
||||
<Masc,Def,Nom> => ASgMascDefNom ;
|
||||
_ => ASg g spec
|
||||
GSg g => case <g,spec,role> of {
|
||||
<Masc,Def,RSubj> => ASgMascDefNom ;
|
||||
_ => ASg g spec
|
||||
} ;
|
||||
GPl => APl spec
|
||||
} ;
|
||||
|
||||
dgenderSpecies : DGender -> Species -> Case -> DGenderSpecies =
|
||||
\g,spec,c -> case <g,spec> of {
|
||||
<DMasc,Indef> => DMascIndef ;
|
||||
<DMasc,Def> => case c of {
|
||||
Nom => DMascDefNom ;
|
||||
_ => DMascDef
|
||||
} ;
|
||||
<DMascPersonal,Indef> => DMascPersonalIndef ;
|
||||
<DMascPersonal,Def> => case c of {
|
||||
Nom => DMascPersonalDefNom ;
|
||||
_ => DMascPersonalDef
|
||||
} ;
|
||||
<DFem ,Indef> => DFemIndef ;
|
||||
<DFem ,Def> => DFemDef ;
|
||||
<DNeut,Indef> => DNeutIndef ;
|
||||
<DNeut,Def> => DNeutDef
|
||||
} ;
|
||||
dgenderSpecies : DGender -> Species -> Role -> DGenderSpecies =
|
||||
\g,spec,role -> case <g,spec> of {
|
||||
<DMasc,Indef> => DMascIndef ;
|
||||
<DMasc,Def> => case role of {
|
||||
RSubj => DMascDefNom ;
|
||||
_ => DMascDef
|
||||
} ;
|
||||
<DMascPersonal,Indef> => DMascPersonalIndef ;
|
||||
<DMascPersonal,Def> => case role of {
|
||||
RSubj => DMascPersonalDefNom ;
|
||||
_ => DMascPersonalDef
|
||||
} ;
|
||||
<DFem ,Indef> => DFemIndef ;
|
||||
<DFem ,Def> => DFemDef ;
|
||||
<DNeut,Indef> => DNeutIndef ;
|
||||
<DNeut,Def> => DNeutDef
|
||||
} ;
|
||||
|
||||
nform2aform : NForm -> DGender -> AForm
|
||||
= \nf,g -> case nf of {
|
||||
NF n spec => aform (gennum g n) spec Acc ;
|
||||
NFSgDefNom => aform (gennum g Sg) Def Nom ;
|
||||
NF n spec => aform (gennum g n) spec (RObj Acc) ;
|
||||
NFSgDefNom => aform (gennum g Sg) Def RSubj ;
|
||||
NFPlCount => APl Indef ;
|
||||
NFVocative => aform (gennum g Sg) Indef Acc
|
||||
NFVocative => aform (gennum g Sg) Indef (RObj Acc)
|
||||
} ;
|
||||
|
||||
indefNForm : NForm -> NForm
|
||||
@@ -159,96 +166,174 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
-- For $Verb$.
|
||||
|
||||
Verb : Type = {
|
||||
s : VForm => Str ;
|
||||
s : VForm => Str ;
|
||||
vtype : VType
|
||||
} ;
|
||||
|
||||
VP : Type = {
|
||||
s : Tense => Anteriority => Polarity => Agr => Str ;
|
||||
s : Tense => Anteriority => Polarity => Agr => Bool => Str ;
|
||||
imp : Polarity => Number => Str ;
|
||||
s2 : Agr => Str
|
||||
s2 : Agr => Str ;
|
||||
subjRole : Role
|
||||
} ;
|
||||
|
||||
predV : Verb -> VP =
|
||||
\verb ->
|
||||
let pol : Polarity -> Str -> Str = \p,vf -> case p of { Pos => vf ; Neg => "íå" ++ vf }
|
||||
in { s = \\t,a,p,agr => let present = verb.s ! (VPres (numGenNum agr.gn) agr.p) ;
|
||||
aorist = verb.s ! (VAorist (numGenNum agr.gn) agr.p) ;
|
||||
perfect = verb.s ! (VPerfect (aform agr.gn Indef Acc)) ;
|
||||
vf = case <t,a> of {
|
||||
<Pres,Simul> => present ;
|
||||
<Pres,Anter> => auxBe.s ! (VPres (numGenNum agr.gn) agr.p) ++ perfect ;
|
||||
<Past,Simul> => aorist ;
|
||||
<Past,Anter> => auxBe.s ! (VAorist (numGenNum agr.gn) agr.p) ++ perfect ;
|
||||
<Fut, Simul> => "ùå" ++ present ;
|
||||
<Fut, Anter> => "ùå" ++ auxBe.s ! (VPres (numGenNum agr.gn) agr.p) ++ perfect ;
|
||||
<Cond,Simul> => auxWould.s ! (VAorist (numGenNum agr.gn) agr.p) ++ perfect ;
|
||||
<Cond,Anter> => auxWould.s ! (VAorist (numGenNum agr.gn) agr.p) ++ auxBe.s ! (VPerfect (aform agr.gn Indef Acc)) ++ perfect
|
||||
{ s = \\t,a,p,agr,q => let
|
||||
clitic = case verb.vtype of {
|
||||
VNormal => {s=[]; agr=agr} ;
|
||||
VMedial c => {s=reflClitics ! c; agr=agr} ;
|
||||
VPhrasal c => {s=personalClitics ! c ! agr.gn ! agr.p; agr={gn=GSg Neut; p=P3}}
|
||||
} ;
|
||||
|
||||
present = verb.s ! (VPres (numGenNum clitic.agr.gn) clitic.agr.p) ;
|
||||
aorist = verb.s ! (VAorist (numGenNum clitic.agr.gn) clitic.agr.p) ;
|
||||
perfect = verb.s ! (VPerfect (aform clitic.agr.gn Indef (RObj Acc))) ;
|
||||
|
||||
auxPres = auxBe clitic.s ! VPres (numGenNum clitic.agr.gn) clitic.agr.p ;
|
||||
auxAorist = auxBe clitic.s ! VAorist (numGenNum clitic.agr.gn) clitic.agr.p ;
|
||||
auxPerfect = auxBe clitic.s ! VPerfect (aform clitic.agr.gn Indef (RObj Acc)) ;
|
||||
auxCondS = auxWould clitic.s ! VAorist (numGenNum clitic.agr.gn) clitic.agr.p ;
|
||||
auxCondA = auxCondS ++
|
||||
auxBe [] ! VPerfect (aform clitic.agr.gn Indef (RObj Acc)) ;
|
||||
|
||||
verbs : {aux:Str; main:Str}
|
||||
= case <t,a> of {
|
||||
<Pres,Simul> => {aux=clitic.s; main=present} ;
|
||||
<Pres,Anter> => {aux=auxPres; main=perfect} ;
|
||||
<Past,Simul> => {aux=clitic.s; main=aorist} ;
|
||||
<Past,Anter> => {aux=auxAorist; main=perfect} ;
|
||||
<Fut, Simul> => {aux=clitic.s; main=present} ;
|
||||
<Fut, Anter> => {aux=auxPres; main=perfect} ;
|
||||
<Cond,Simul> => {aux=auxCondS; main=perfect} ;
|
||||
<Cond,Anter> => {aux=auxCondA; main=perfect}
|
||||
} ;
|
||||
in pol p vf ;
|
||||
imp = \\p,n => pol p (verb.s ! VImperative n) ;
|
||||
s2 = \\_ => []
|
||||
|
||||
li = case q of {True => "ëè"; False => []} ;
|
||||
aux = case p of {
|
||||
Pos => case t of {
|
||||
Fut => {s1="ùå"++verbs.aux; s2=li} ;
|
||||
_ => case q of {True => {s1=[]; s2="ëè"++verbs.aux};
|
||||
False => {s1=verbs.aux; s2=[]}}
|
||||
} ;
|
||||
Neg => case t of {
|
||||
Fut => {s1="íå"++"ùå"++verbs.aux; s2=li} ;
|
||||
_ => case q of {True => {s1="íå"++verbs.aux; s2="ëè"};
|
||||
False => {s1="íå"++verbs.aux; s2=[]}}
|
||||
}
|
||||
}
|
||||
|
||||
in aux.s1 ++ verbs.main ++ aux.s2;
|
||||
imp = \\p,n => let ne = case p of {Pos => []; Neg => "íå"} ;
|
||||
in ne ++ verb.s ! VImperative n ;
|
||||
s2 = \\_ => [] ;
|
||||
subjRole = case verb.vtype of {
|
||||
VNormal => RSubj ;
|
||||
VMedial _ => RSubj ;
|
||||
VPhrasal c => RObj c
|
||||
}
|
||||
} ;
|
||||
|
||||
insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
|
||||
s = vp.s ;
|
||||
s = vp.s ;
|
||||
imp = vp.imp ;
|
||||
s2 = \\a => vp.s2 ! a ++ obj ! a
|
||||
s2 = \\a => vp.s2 ! a ++ obj ! a ;
|
||||
subjRole = vp.subjRole
|
||||
} ;
|
||||
|
||||
auxBe : Verb = {
|
||||
s = table {
|
||||
VPres Sg P1 => "ñúì" ;
|
||||
VPres Sg P2 => "ñè" ;
|
||||
VPres Sg P3 => "å" ;
|
||||
VPres Pl P1 => "ñìå" ;
|
||||
VPres Pl P2 => "ñòå" ;
|
||||
VPres Pl P3 => "ñà" ;
|
||||
VAorist Sg P1 => "áÿõ" ;
|
||||
VAorist Sg _ => "áåøå" ;
|
||||
VAorist Pl P1 => "áÿõìå" ;
|
||||
VAorist Pl P2 => "áÿõòå" ;
|
||||
VAorist Pl P3 => "áÿõà" ;
|
||||
VImperfect Sg P1 => "áÿõ" ;
|
||||
VImperfect Sg _ => "áåøå" ;
|
||||
VImperfect Pl P1 => "áÿõìå" ;
|
||||
VImperfect Pl P2 => "áÿõòå" ;
|
||||
VImperfect Pl P3 => "áÿõà" ;
|
||||
VPerfect aform => (regAdjective "áèë").s ! aform ;
|
||||
VPluPerfect aform => (regAdjective "áèë").s ! aform ;
|
||||
VPassive aform => (regAdjective "áúäåí").s ! aform ;
|
||||
VPresPart aform => (regAdjective "áúäåù").s ! aform ;
|
||||
VImperative Sg => "áúäè" ;
|
||||
VImperative Pl => "áúäåòå" ;
|
||||
VGerund => "áèäåéêè"
|
||||
}
|
||||
auxBe : Str -> VForm => Str = \se ->
|
||||
table {
|
||||
VPres Sg P1 => "ñúì" ++ se ;
|
||||
VPres Sg P2 => "ñè" ++ se ;
|
||||
VPres Sg P3 => se ++ "å" ;
|
||||
VPres Pl P1 => "ñìå" ++ se ;
|
||||
VPres Pl P2 => "ñòå" ++ se ;
|
||||
VPres Pl P3 => "ñà" ++ se ;
|
||||
VAorist Sg P1 => "áÿõ" ++ se ;
|
||||
VAorist Sg P2 => "áåøå" ++ se ;
|
||||
VAorist Sg P3 => se ++ "áåøå" ;
|
||||
VAorist Pl P1 => "áÿõìå" ++ se ;
|
||||
VAorist Pl P2 => "áÿõòå" ++ se ;
|
||||
VAorist Pl P3 => "áÿõà" ++ se ;
|
||||
VImperfect Sg P1 => "áÿõ" ++ se ;
|
||||
VImperfect Sg _ => "áåøå" ++ se ;
|
||||
VImperfect Pl P1 => "áÿõìå" ++ se ;
|
||||
VImperfect Pl P2 => "áÿõòå" ++ se ;
|
||||
VImperfect Pl P3 => "áÿõà" ++ se ;
|
||||
VPerfect aform => (regAdjective "áèë").s ! aform ++ se ;
|
||||
VPluPerfect aform => (regAdjective "áèë").s ! aform ++ se ;
|
||||
VPassive aform => (regAdjective "áúäåí").s ! aform ++ se ;
|
||||
VPresPart aform => (regAdjective "áúäåù").s ! aform ++ se ;
|
||||
VImperative Sg => "áúäè" ++ se ;
|
||||
VImperative Pl => "áúäåòå" ++ se ;
|
||||
VGerund => "áèäåéêè" ++ se
|
||||
} ;
|
||||
|
||||
auxWould : Verb = {
|
||||
s = table {
|
||||
VPres Sg P1 => "áúäà" ;
|
||||
VPres Sg P2 => "áúäåø" ;
|
||||
VPres Sg P3 => "áúäå" ;
|
||||
VPres Pl P1 => "áúäåì" ;
|
||||
VPres Pl P2 => "áúäåòå" ;
|
||||
VPres Pl P3 => "áúäàò" ;
|
||||
VAorist Sg P1 => "áèõ" ;
|
||||
VAorist Sg _ => "áè" ;
|
||||
VAorist Pl P1 => "áèõìå" ;
|
||||
VAorist Pl P2 => "áèõòå" ;
|
||||
VAorist Pl P3 => "áèõà" ;
|
||||
VImperfect Sg P1 => "áúäåõ" ;
|
||||
VImperfect Sg _ => "áúäåøå" ;
|
||||
VImperfect Pl P1 => "áúäåõìå" ;
|
||||
VImperfect Pl P2 => "áúäåõòå" ;
|
||||
VImperfect Pl P3 => "áúäåõà" ;
|
||||
VPerfect aform => (regAdjective "áèë").s ! aform ;
|
||||
VPluPerfect aform => (regAdjective "áúäåë").s ! aform ;
|
||||
VPassive aform => (regAdjective "áúäåí").s ! aform ;
|
||||
VPresPart aform => (regAdjective "áúäåù").s ! aform ;
|
||||
VImperative Sg => "áúäè" ;
|
||||
VImperative Pl => "áúäåòå" ;
|
||||
VGerund => "áúäåéêè"
|
||||
}
|
||||
auxWould : Str -> VForm => Str = \se ->
|
||||
table {
|
||||
VPres Sg P1 => "áúäà" ++ se ;
|
||||
VPres Sg P2 => "áúäåø" ++ se ;
|
||||
VPres Sg P3 => se ++ "áúäå" ;
|
||||
VPres Pl P1 => "áúäåì" ++ se ;
|
||||
VPres Pl P2 => "áúäåòå" ++ se ;
|
||||
VPres Pl P3 => "áúäàò" ++ se ;
|
||||
VAorist Sg P1 => "áèõ" ++ se ;
|
||||
VAorist Sg _ => "áè" ++ se ;
|
||||
VAorist Pl P1 => "áèõìå" ++ se ;
|
||||
VAorist Pl P2 => "áèõòå" ++ se ;
|
||||
VAorist Pl P3 => "áèõà" ++ se ;
|
||||
VImperfect Sg P1 => "áúäåõ" ++ se ;
|
||||
VImperfect Sg _ => "áúäåøå" ++ se ;
|
||||
VImperfect Pl P1 => "áúäåõìå" ++ se ;
|
||||
VImperfect Pl P2 => "áúäåõòå" ++ se ;
|
||||
VImperfect Pl P3 => "áúäåõà" ++ se ;
|
||||
VPerfect aform => (regAdjective "áèë").s ! aform ++ se ;
|
||||
VPluPerfect aform => (regAdjective "áúäåë").s ! aform ++ se ;
|
||||
VPassive aform => (regAdjective "áúäåí").s ! aform ++ se ;
|
||||
VPresPart aform => (regAdjective "áúäåù").s ! aform ++ se ;
|
||||
VImperative Sg => "áúäè" ++ se ;
|
||||
VImperative Pl => "áúäåòå" ++ se ;
|
||||
VGerund => "áúäåéêè" ++ se
|
||||
} ;
|
||||
|
||||
verbBe : Verb = {s=auxBe []; vtype=VNormal} ;
|
||||
|
||||
reflClitics : Case => Str = table {Acc => "ñå"; Dat => "ñè"} ;
|
||||
|
||||
personalClitics : Case => GenNum => Person => Str =
|
||||
table {
|
||||
Acc => table {
|
||||
GSg g => table {
|
||||
P1 => "ìå" ;
|
||||
P2 => "òå" ;
|
||||
P3 => case g of {
|
||||
Masc => "ãî" ;
|
||||
Fem => "ÿ" ;
|
||||
Neut => "ãî"
|
||||
}
|
||||
} ;
|
||||
GPl => table {
|
||||
P1 => "íè" ;
|
||||
P2 => "âè" ;
|
||||
P3 => "ãè"
|
||||
}
|
||||
} ;
|
||||
Dat => table {
|
||||
GSg g => table {
|
||||
P1 => "ìè" ;
|
||||
P2 => "òè" ;
|
||||
P3 => case g of {
|
||||
Masc => "ìó" ;
|
||||
Fem => "é" ;
|
||||
Neut => "ìó"
|
||||
}
|
||||
} ;
|
||||
GPl => table {
|
||||
P1 => "íè" ;
|
||||
P2 => "âè" ;
|
||||
P3 => "èì"
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
ia2e : Str -> Str = -- to be used when the next syllable has vowel different from "à","ú","î" or "ó"
|
||||
@@ -345,7 +430,8 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
_ => chete + "éêè"
|
||||
}
|
||||
} ;
|
||||
} ;
|
||||
vtype = VNormal
|
||||
} ;
|
||||
|
||||
-- For $Sentence$.
|
||||
|
||||
@@ -357,12 +443,13 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
\subj,agr,vp -> {
|
||||
s = \\t,a,b,o =>
|
||||
let
|
||||
verb = vp.s ! t ! a ! b ! agr ;
|
||||
verb = vp.s ! t ! a ! b ! agr ! False ;
|
||||
verbq = vp.s ! t ! a ! b ! agr ! True ;
|
||||
compl = vp.s2 ! agr
|
||||
in case o of {
|
||||
Main => subj ++ verb ++ compl ;
|
||||
Inv => verb ++ subj ++ compl ;
|
||||
Quest => subj ++ verb ++ "ëè" ++ compl
|
||||
Inv => verb ++ compl ++ subj ;
|
||||
Quest => subj ++ verbq ++ compl
|
||||
}
|
||||
} ;
|
||||
|
||||
@@ -421,22 +508,22 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
DNeutDef => addDef dve
|
||||
} ;
|
||||
|
||||
mkIP : Str -> Str -> GenNum -> {s : Case => Str ; gn : GenNum} =
|
||||
mkIP : Str -> Str -> GenNum -> {s : Role => Str ; gn : GenNum} =
|
||||
\koi,kogo,gn -> {
|
||||
s = table {
|
||||
Nom => koi ;
|
||||
Acc => kogo ;
|
||||
Dat => "íà" ++ kogo
|
||||
RSubj => koi ;
|
||||
RObj Acc => kogo ;
|
||||
RObj Dat => "íà" ++ kogo
|
||||
} ;
|
||||
gn = gn
|
||||
} ;
|
||||
|
||||
mkPron : (az,men,mi,moj,moia,moiat,moia_,moiata,moe,moeto,moi,moite : Str) -> GenNum -> Person -> {s : Case => Str; gen : AForm => Str; a : Agr} =
|
||||
mkPron : (az,men,mi,moj,moia,moiat,moia_,moiata,moe,moeto,moi,moite : Str) -> GenNum -> Person -> {s : Role => Str; gen : AForm => Str; a : Agr} =
|
||||
\az,men,mi,moj,moia,moiat,moia_,moiata,moe,moeto,moi,moite,gn,p -> {
|
||||
s = table {
|
||||
Nom => az ;
|
||||
Acc => men ;
|
||||
Dat => mi
|
||||
RSubj => az ;
|
||||
RObj Acc => men ;
|
||||
RObj Dat => mi
|
||||
} ;
|
||||
gen = (mkAdjective moj moia moiat moia_ moiata moe moeto moi moite).s ;
|
||||
a = {
|
||||
@@ -444,17 +531,18 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
p = p
|
||||
}
|
||||
} ;
|
||||
|
||||
Preposition : Type = {s : Str; c : Case};
|
||||
|
||||
mkQuestion :
|
||||
{s : Str} -> Clause ->
|
||||
{s1,s2 : Str} -> Clause ->
|
||||
{s : Tense => Anteriority => Polarity => QForm => Str} = \wh,cl ->
|
||||
{
|
||||
s = \\t,a,p =>
|
||||
let cls = cl.s ! t ! a ! p ;
|
||||
why = wh.s
|
||||
in table {
|
||||
QDir => why ++ cls ! Inv ;
|
||||
QIndir => why ++ cls ! Main
|
||||
QDir => wh.s1 ++ cls ! Inv ;
|
||||
QIndir => wh.s2 ++ cls ! Main
|
||||
}
|
||||
} ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user