mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-21 00:52:51 -06:00
Major refactoring -> lexical aspect; word order in VP
This commit is contained in:
@@ -44,6 +44,8 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
|
||||
--2 For $Verb$
|
||||
|
||||
Aspect = Imperf | Perf ;
|
||||
|
||||
VForm =
|
||||
VPres Number Person
|
||||
| VAorist Number Person
|
||||
@@ -186,14 +188,16 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
|
||||
oper
|
||||
-- For $Verb$.
|
||||
VTable = VForm => Str ;
|
||||
|
||||
Verb : Type = {
|
||||
s : VForm => Str ;
|
||||
vtype : VType
|
||||
s : Aspect => VTable ;
|
||||
vtype : VType
|
||||
} ;
|
||||
|
||||
VP : Type = {
|
||||
s : Tense => Anteriority => Polarity => Agr => Bool => Str ;
|
||||
imp : Polarity => Number => Str ;
|
||||
s : Tense => Anteriority => Polarity => Agr => Bool => Aspect => Str ;
|
||||
imp : Polarity => Number => Aspect => Str ;
|
||||
ad : Bool => Str ; -- sentential adverb
|
||||
s2 : Agr => Str ;
|
||||
subjRole : Role
|
||||
@@ -201,53 +205,75 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
|
||||
predV : Verb -> VP =
|
||||
\verb ->
|
||||
{ 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}}
|
||||
} ;
|
||||
{ s = \\t,a,p,agr,q,asp =>
|
||||
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))) ;
|
||||
present = verb.s ! asp ! (VPres (numGenNum clitic.agr.gn) clitic.agr.p) ;
|
||||
presentImperf = verb.s ! Imperf ! (VPres (numGenNum clitic.agr.gn) clitic.agr.p) ;
|
||||
aorist = verb.s ! asp ! (VAorist (numGenNum clitic.agr.gn) clitic.agr.p) ;
|
||||
perfect = verb.s ! asp ! (VPerfect (aform clitic.agr.gn Indef (RObj Acc))) ;
|
||||
|
||||
auxPres = auxBe ! VPres (numGenNum clitic.agr.gn) clitic.agr.p ;
|
||||
auxAorist = auxBe ! VAorist (numGenNum clitic.agr.gn) clitic.agr.p ;
|
||||
auxCond = auxWould ! VAorist (numGenNum clitic.agr.gn) clitic.agr.p ;
|
||||
|
||||
apc : Str -> Str = \s ->
|
||||
case <numGenNum clitic.agr.gn, clitic.agr.p> of {
|
||||
<Sg, P3> => clitic.s++s++auxPres ;
|
||||
_ => auxPres++s++clitic.s
|
||||
} ;
|
||||
|
||||
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}
|
||||
} ;
|
||||
|
||||
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 ;
|
||||
vf1 : Str -> {s1 : Str; s2 : Str} = \s ->
|
||||
case p of {
|
||||
Pos => case q of {True => {s1=[]; s2="ëè"++apc []};
|
||||
False => {s1=apc []; s2=[]}} ;
|
||||
Neg => {s1="íå"++apc li; s2=[]}
|
||||
} ;
|
||||
|
||||
vf2 : Str -> {s1 : Str; s2 : Str} = \s ->
|
||||
case p of {
|
||||
Pos => case q of {True => {s1=[]; s2="ëè"++s};
|
||||
False => {s1=s; s2=[]}} ;
|
||||
Neg => case verb.vtype of
|
||||
{VNormal => {s1="íå"; s2=li} ;
|
||||
_ => {s1="íå"++s++li; s2=[]}}
|
||||
} ;
|
||||
|
||||
vf3 : Str -> {s1 : Str; s2 : Str} = \s ->
|
||||
case p of {
|
||||
Pos => {s1="ùå"++s; s2=li} ;
|
||||
Neg => {s1="íÿìà"++li++"äà"++s; s2=[]}
|
||||
} ;
|
||||
|
||||
vf4 : Str -> {s1 : Str; s2 : Str} = \s ->
|
||||
case p of {
|
||||
Pos => {s1= s++li++clitic.s; s2=[]} ;
|
||||
Neg => {s1="íå"++s++li++clitic.s; s2=[]}
|
||||
} ;
|
||||
|
||||
verbs : {aux:{s1:Str; s2:Str}; main:Str}
|
||||
= case <t,a> of {
|
||||
<Pres,Simul> => {aux=vf2 clitic.s; main=presentImperf} ;
|
||||
<Pres,Anter> => {aux=vf1 clitic.s; main=perfect} ;
|
||||
<Past,Simul> => {aux=vf2 clitic.s; main=aorist} ;
|
||||
<Past,Anter> => {aux=vf4 auxAorist; main=perfect} ;
|
||||
<Fut, Simul> => {aux=vf3 clitic.s; main=present} ;
|
||||
<Fut, Anter> => {aux=vf3 (apc []); main=perfect} ;
|
||||
<Cond,_ > => {aux=vf4 auxCond ; main=perfect}
|
||||
}
|
||||
|
||||
in verbs.aux.s1 ++ verbs.main ++ verbs.aux.s2 ;
|
||||
imp = \\p,n,asp =>
|
||||
case p of {
|
||||
Pos => verb.s ! asp ! VImperative n ;
|
||||
Neg => "íå" ++ verb.s ! Imperf ! VImperative n
|
||||
} ;
|
||||
ad = \\_ => [] ;
|
||||
s2 = \\_ => [] ;
|
||||
subjRole = case verb.vtype of {
|
||||
@@ -265,62 +291,62 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
subjRole = vp.subjRole
|
||||
} ;
|
||||
|
||||
auxBe : Str -> VForm => Str = \se ->
|
||||
auxBe : VTable =
|
||||
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 "áèë" ! aform ++ se ;
|
||||
VPluPerfect aform => regAdjective "áèë" ! aform ++ se ;
|
||||
VPassive aform => regAdjective "áúäåí" ! aform ++ se ;
|
||||
VPresPart aform => regAdjective "áúäåù" ! aform ++ se ;
|
||||
VImperative Sg => "áúäè" ++ se ;
|
||||
VImperative Pl => "áúäåòå" ++ se ;
|
||||
VGerund => "áèäåéêè" ++ se
|
||||
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 "áèë" ! aform ;
|
||||
VPluPerfect aform => regAdjective "áèë" ! aform ;
|
||||
VPassive aform => regAdjective "áúäåí" ! aform ;
|
||||
VPresPart aform => regAdjective "áúäåù" ! aform ;
|
||||
VImperative Sg => "áúäè" ;
|
||||
VImperative Pl => "áúäåòå" ;
|
||||
VGerund => "áèäåéêè"
|
||||
} ;
|
||||
|
||||
auxWould : Str -> VForm => Str = \se ->
|
||||
auxWould : VTable =
|
||||
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 "áèë" ! aform ++ se ;
|
||||
VPluPerfect aform => regAdjective "áúäåë" ! aform ++ se ;
|
||||
VPassive aform => regAdjective "áúäåí" ! aform ++ se ;
|
||||
VPresPart aform => regAdjective "áúäåù" ! aform ++ se ;
|
||||
VImperative Sg => "áúäè" ++ se ;
|
||||
VImperative Pl => "áúäåòå" ++ se ;
|
||||
VGerund => "áúäåéêè" ++ se
|
||||
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 "áèë" ! aform ;
|
||||
VPluPerfect aform => regAdjective "áúäåë" ! aform ;
|
||||
VPassive aform => regAdjective "áúäåí" ! aform ;
|
||||
VPresPart aform => regAdjective "áúäåù" ! aform ;
|
||||
VImperative Sg => "áúäè" ;
|
||||
VImperative Pl => "áúäåòå" ;
|
||||
VGerund => "áúäåéêè"
|
||||
} ;
|
||||
|
||||
verbBe : Verb = {s=auxBe []; vtype=VNormal} ;
|
||||
verbBe : Verb = {s=\\_=>auxBe ; vtype=VNormal} ;
|
||||
verbWould : Verb = {s=\\_=>auxWould ; vtype=VNormal} ;
|
||||
|
||||
reflClitics : Case => Str = table {Acc => "ñå"; Dat => "ñè"} ;
|
||||
|
||||
@@ -382,23 +408,23 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
|
||||
-- For $Sentence$.
|
||||
|
||||
Clause : Type = {
|
||||
s : Tense => Anteriority => Polarity => Order => Str
|
||||
} ;
|
||||
Clause : Type = {
|
||||
s : Tense => Anteriority => Polarity => Order => Str
|
||||
} ;
|
||||
|
||||
mkClause : Str -> Agr -> VP -> Clause =
|
||||
\subj,agr,vp -> {
|
||||
s = \\t,a,b,o =>
|
||||
let
|
||||
verb : Bool => Str
|
||||
= \\q => vp.ad ! q ++ vp.s ! t ! a ! b ! agr ! q ;
|
||||
compl = vp.s2 ! agr
|
||||
in case o of {
|
||||
Main => subj ++ verb ! False ++ compl ;
|
||||
Inv => verb ! False ++ compl ++ subj ;
|
||||
Quest => subj ++ verb ! True ++ compl
|
||||
}
|
||||
} ;
|
||||
mkClause : Str -> Agr -> VP -> Clause =
|
||||
\subj,agr,vp -> {
|
||||
s = \\t,a,p,o =>
|
||||
let
|
||||
verb : Bool => Str
|
||||
= \\q => vp.ad ! q ++ vp.s ! t ! a ! p ! agr ! q ! Perf ;
|
||||
compl = vp.s2 ! agr
|
||||
in case o of {
|
||||
Main => subj ++ verb ! False ++ compl ;
|
||||
Inv => verb ! False ++ compl ++ subj ;
|
||||
Quest => subj ++ verb ! True ++ compl
|
||||
}
|
||||
} ;
|
||||
|
||||
-- For $Numeral$.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user