mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 17:08:54 -06:00
@@ -40,7 +40,7 @@ concrete AdjectiveAra of Adjective = CatAra ** open ResAra, Prelude in {
|
||||
UseA2 = PositA ;
|
||||
|
||||
UseComparA a = {
|
||||
s = \\h,g,n,d,c => a.s ! AComp d c
|
||||
s = \\h,g,n,d,c => a.s ! AComp d c
|
||||
};
|
||||
|
||||
-- : Ord -> AP ; -- warmest
|
||||
|
||||
@@ -26,7 +26,7 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
|
||||
QCl = ResAra.QCl ; -- {s : Tense => Polarity => QForm => Str} ;
|
||||
IDet = ResAra.IDet ; -- {s : Gender => State => Case => Str ; n : Number} ;
|
||||
IP = ResAra.IP ; -- {s : (isPred : Bool) => State => Case => Str ; n : Number} ;
|
||||
IComp = ResAra.IComp ; --
|
||||
IComp = ResAra.IComp ; --
|
||||
IQuant = {s : State => Case => Str} ;
|
||||
|
||||
-- Relative
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete ConjunctionAra of Conjunction =
|
||||
concrete ConjunctionAra of Conjunction =
|
||||
CatAra ** open ResAra, Coordination, Prelude in {
|
||||
|
||||
lincat
|
||||
@@ -28,7 +28,7 @@ lin
|
||||
empty = []
|
||||
} ;
|
||||
ConjNP conj ss = conjunctDistrTable Case conj ss ** {
|
||||
a = let gn = pgn2gn ss.a.pgn in
|
||||
a = let gn = pgn2gn ss.a.pgn in
|
||||
{pgn = Per3 gn.g (conjNumber conj.n gn.n) ; isPron = False} ;
|
||||
empty = []
|
||||
} ;
|
||||
@@ -53,30 +53,25 @@ oper
|
||||
|
||||
-- move to predef?
|
||||
|
||||
ListTable5 : PType -> PType -> PType -> PType -> PType -> Type = \P,Q,R,T,S ->
|
||||
{s1,s2 : P => Q => R => T => S => Str} ;
|
||||
ListTable5 : PType -> PType -> PType -> PType -> PType -> Type = \P,Q,R,T,S ->
|
||||
{s1,s2 : P => Q => R => T => S => Str} ;
|
||||
|
||||
twoTable5 : (P,Q,R,T,S : PType) -> (_,_ : {s : P => Q => R => T => S => Str}) ->
|
||||
ListTable5 P Q R T S =
|
||||
twoTable5 : (P,Q,R,T,S : PType) -> (_,_ : {s : P => Q => R => T => S => Str}) ->
|
||||
ListTable5 P Q R T S =
|
||||
\_,_,_,_,_,x,y ->
|
||||
{s1 = x.s ; s2 = y.s} ;
|
||||
{s1 = x.s ; s2 = y.s} ;
|
||||
|
||||
consrTable5 :
|
||||
(P,Q,R,T,S : PType) -> Str -> {s : P => Q => R => T => S => Str} ->
|
||||
consrTable5 :
|
||||
(P,Q,R,T,S : PType) -> Str -> {s : P => Q => R => T => S => Str} ->
|
||||
ListTable5 P Q R T S -> ListTable5 P Q R T S =
|
||||
\P,Q,R,T,S,c,x,xs ->
|
||||
{s1 = \\p,q,r,t,s => xs.s1 ! p ! q ! r ! t ! s ++ c ++ xs.s2 ! p ! q ! r ! t ! s ;
|
||||
{s1 = \\p,q,r,t,s => xs.s1 ! p ! q ! r ! t ! s ++ c ++ xs.s2 ! p ! q ! r ! t ! s ;
|
||||
s2 = x.s
|
||||
} ;
|
||||
} ;
|
||||
|
||||
conjunctTable5 :
|
||||
(P,Q,R,T,S : PType) -> Conjunction -> ListTable5 P Q R T S -> {s : P => Q => R => T => S => Str} =
|
||||
\P,Q,R,T,S,or,xs ->
|
||||
{s = \\p,q,r,t,s => xs.s1 ! p ! q ! r ! t ! s ++ or.s ++ xs.s2 ! p ! q ! r ! t ! s} ;
|
||||
|
||||
conjunctDistrTable5 :
|
||||
(P,Q,R,T,S : PType) -> ConjunctionDistr -> ListTable5 P Q R T S ->
|
||||
{s : P => Q => R => T => S => Str} =
|
||||
conjunctDistrTable5 :
|
||||
(P,Q,R,T,S : PType) -> ConjunctionDistr -> ListTable5 P Q R T S ->
|
||||
{s : P => Q => R => T => S => Str} =
|
||||
\P,Q,R,T,S,or,xs ->
|
||||
{s = \\p,q,r,t,s => or.s1++ xs.s1 ! p ! q ! r ! t ! s ++ or.s2 ++ xs.s2 ! p ! q ! r ! t ! s} ;
|
||||
}
|
||||
|
||||
@@ -46,10 +46,19 @@ lin
|
||||
intYear = symb ;
|
||||
intMonthday = symb ;
|
||||
|
||||
-- n_units_AP
|
||||
|
||||
-- : Card -> CN -> A -> AP
|
||||
n_units_AP card cn a =
|
||||
let ap = mkAP a in ap ** {
|
||||
s = \\s,g,n,d,c =>
|
||||
ap.s ! s ! g ! n ! d ! c
|
||||
++ (mkAdv R.biPrep (mkNP amount_N)).s
|
||||
++ (mkNP card cn).s ! R.Bare ---- ? /IL
|
||||
} ;
|
||||
|
||||
oper
|
||||
|
||||
amount_N : N = mkN "مِقْدَار" "مَقَادِير" masc nohum ;
|
||||
|
||||
-- hack used in the name constructions
|
||||
toNP : Bool -> NP -> NP = \b -> if_then_else NP b R.emptyNP ;
|
||||
|
||||
|
||||
@@ -36,15 +36,15 @@ concrete ExtendAra of Extend =
|
||||
-- : Temp -> Pol -> VP -> VPS ; -- hasn't slept
|
||||
MkVPS t p vp = {
|
||||
s = \\pgn => let vps =
|
||||
wordOrderNoSubj
|
||||
wordOrderNoSubj
|
||||
Nominal -- Nominal (=SVO) generalises best for ConjVPS.
|
||||
vp.obj.a.isPron
|
||||
vp.obj.a.isPron
|
||||
(vStr vp pgn t.t p.p Nominal)
|
||||
(case <vp.isPred,vp.obj.a.isPron> of {
|
||||
<False,True> => BIND ++ vp.obj.s ;
|
||||
_ => vp.obj.s })
|
||||
(pred vp pgn t.t p.p)
|
||||
vp.s2
|
||||
(pred vp pgn t.t p.p)
|
||||
vp.s2
|
||||
in vps.before ++ vps.after -- word order is SVO, so this is safe for just this case.
|
||||
} ;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--# -path=.:../abstract:../common:../api:../prelude
|
||||
|
||||
concrete LangAra of Lang =
|
||||
concrete LangAra of Lang =
|
||||
GrammarAra,
|
||||
LexiconAra,
|
||||
ConstructionAra
|
||||
@@ -9,5 +9,3 @@ concrete LangAra of Lang =
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ; coding = utf8 ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ oper ReflA2 : A2 -> AP = notYet "ReflA2" ;
|
||||
oper ReflVP : VPSlash -> VP = notYet "ReflVP" ;
|
||||
oper SentCN : CN -> SC -> CN = notYet "SentCN" ;
|
||||
oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ;
|
||||
oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ;
|
||||
oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ;
|
||||
oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ;
|
||||
oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ;
|
||||
|
||||
@@ -27,7 +27,7 @@ lin
|
||||
let c' = case c of {Dat => Gen ; x => x} in
|
||||
case cnB4det det of {
|
||||
False => determiner c'
|
||||
++ noun c'
|
||||
++ noun c'
|
||||
++ adj c'
|
||||
++ cn.np ! c' ;
|
||||
True => noun (cas c) -- deal with possessive suffix + dative hack
|
||||
@@ -205,10 +205,10 @@ lin
|
||||
PossNP cn np = cn ** {
|
||||
s = \\n,d,c => cn.s ! n ! case d of {Poss=>d ; _=>Const} ! c ;
|
||||
s2 = \\n,d,c => cn.s2 ! n ! case d of {Poss=>d ; _=>Const} ! Gen ;
|
||||
np = \\c => cn.np ! c
|
||||
np = \\c => cn.np ! c
|
||||
++ case is1sg np.a of {
|
||||
True => "لَدَي" ++ np.empty ;
|
||||
False =>
|
||||
False =>
|
||||
case np.a.isPron of {
|
||||
True => "لَدَي" ++ BIND ++ np.s ! Gen ;
|
||||
False => np.s ! Gen }
|
||||
|
||||
@@ -27,7 +27,7 @@ lincat
|
||||
lin n5 = num3_10 "خَمس" "خامِس";
|
||||
lin n6 = num3_10 "سِتّ" "سادِس";
|
||||
lin n7 = num3_10 "سَبع" "سابِع";
|
||||
lin n8 = num3_10 "ثَمانِي" "ثامِن";
|
||||
lin n8 = num3_10 "ثَمَانِي" "ثامِن";
|
||||
lin n9 = num3_10 "تِسع" "تاسِع";
|
||||
|
||||
lin pot01 = mkNum "واحِد" "أَوَّل" "أُولى" ** { n = One } ;
|
||||
|
||||
@@ -42,8 +42,8 @@ oper
|
||||
l@(""|"ل"|"ال") + ("أ"|"أَ") + #hamza + tail => l + "آ" + tail;
|
||||
l@(""|"ال") + #hamza + v@("َ"|"ُ") + tail => l + "أ" + v + tail;
|
||||
l@(""|"ال") + #hamza + v@("ِ") + tail => l + "إ" + v + tail;
|
||||
head + v1@#vstar
|
||||
+ #hamza + v2@(#vow|"ْ") + tail =>
|
||||
head + v1@#vstar
|
||||
+ #hamza + v2@(#vow|"ْ") + tail =>
|
||||
case v2 of { "ْ" => head + v1 + bHmz v1 v2 + tail ; -- unsure about this /IL
|
||||
_ => head + v1 + bHmz v1 v2 + v2 + tail } ;
|
||||
head + v1@#vstar -- the same but it ends in vowel
|
||||
|
||||
@@ -148,6 +148,13 @@ resource ParadigmsAra = open
|
||||
= \r -> lin A (clrA r);
|
||||
mkA : (root,sg,pl : Str) -> A -- adjective with broken plural
|
||||
= \r,s,p -> lin A (brkA r s p) ;
|
||||
mkA : A -> Str -> A = \a,s -> a ** { -- add non-inflecting component after adjective
|
||||
s = table {af => a.s ! af ++ s}
|
||||
} ;
|
||||
mkA : Str -> A -> A = \s,a -> a ** { -- add non-inflecting component before adjective
|
||||
s = table {af => s ++ a.s ! af}
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
idaafaA : N -> A -> A ; -- first argument will be in constructus but inflect in case, adjective in genitive, but inflect in gender, number and definiteness. e.g. غَيْرُ طَيِّبٍ
|
||||
@@ -276,10 +283,10 @@ resource ParadigmsAra = open
|
||||
-- questions, verb phrases, and adjectives.
|
||||
|
||||
mkV0 : V -> V0 ;
|
||||
-- mkVS = overload {
|
||||
-- mkVS : V -> VS ;
|
||||
-- mkVS : V -> Str -> VS
|
||||
-- } ;
|
||||
mkVS : overload {
|
||||
mkVS : V -> VS ;
|
||||
mkVS : V -> Str -> VS
|
||||
} ;
|
||||
mkV2S : V -> Str -> V2S ;
|
||||
mkVV = overload {
|
||||
mkVV : V -> VV = regVV ;
|
||||
|
||||
@@ -20,8 +20,6 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
|
||||
cl = PredVP np vp ;
|
||||
in { s = \\t,p,qf => cl.s ! t ! p ! toOrder qf } ;
|
||||
|
||||
|
||||
|
||||
---- AR guessed
|
||||
QuestIAdv iadv cl = {s = \\t,p,qf => iadv.s ++ cl.s ! t ! p ! toOrder qf} ;
|
||||
|
||||
@@ -34,7 +32,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
|
||||
in QuestVP ip vp ;
|
||||
|
||||
-- : IP -> IComp ;
|
||||
CompIP ip = ip ** {
|
||||
CompIP ip = ip ** {
|
||||
s = \\gn => ip.s ! True -- True=IP will be a subject of predicative sentence
|
||||
! gn.g -- IComp agrees in gender with eventual head
|
||||
! Def ! Nom ; -- IP will be a subject
|
||||
@@ -44,11 +42,11 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
|
||||
|
||||
-- QCl = {s : Tense => Polarity => QForm => Str} ;
|
||||
QuestSlash ip cls = { ----IL just guessing
|
||||
s = \\t,p,qf =>
|
||||
s = \\t,p,qf =>
|
||||
let cl : ResAra.Cl = complClSlash cls ; -- dummy conversion to Cl
|
||||
o = toOrder qf
|
||||
in cls.c2.s ++ bindIf cls.c2.binds
|
||||
++ ip.s ! False ! Masc ! Def ! Nom
|
||||
in cls.c2.s ++ bindIf cls.c2.binds
|
||||
++ ip.s ! False ! Masc ! Def ! Nom
|
||||
++ cl.s ! t ! p ! o
|
||||
} ;
|
||||
|
||||
@@ -66,14 +64,14 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
|
||||
AdvIAdv iadv adv = {s = iadv.s ++ adv.s} ;
|
||||
|
||||
-- : IDet -> IP
|
||||
IdetIP idet = idet ** {
|
||||
IdetIP idet = idet ** {
|
||||
s = \\isPred => idet.s ;
|
||||
a = { pgn = agrP3 NoHum Masc idet.n ; isPron = False }
|
||||
} ;
|
||||
|
||||
-- : IDet -> CN -> IP
|
||||
IdetCN idet cn = {
|
||||
s = \\isPred,g,s,c
|
||||
s = \\isPred,g,s,c
|
||||
=> idet.s ! cn.g ! s ! c ++
|
||||
cn2str cn idet.n idet.d Gen ;
|
||||
a = { pgn = agrP3 NoHum cn.g idet.n ; isPron = False }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete RelativeAra of Relative = CatAra **
|
||||
concrete RelativeAra of Relative = CatAra **
|
||||
open ResAra in {
|
||||
flags coding=utf8;
|
||||
|
||||
@@ -10,8 +10,8 @@ concrete RelativeAra of Relative = CatAra **
|
||||
|
||||
-- : RP -> VP -> RCl ; -- who loves John
|
||||
RelVP rp vp = {
|
||||
s = \\t,p,agr,c =>
|
||||
let
|
||||
s = \\t,p,agr,c =>
|
||||
let
|
||||
npS : Case => Str = \\_ => rp.s ! agr2ragr agr c ;
|
||||
np : ResAra.NP = agrNP agr ** {s = npS} ;
|
||||
cl = predVP np vp ;
|
||||
@@ -19,9 +19,9 @@ concrete RelativeAra of Relative = CatAra **
|
||||
cl.s ! t ! p ! Nominal
|
||||
} ;
|
||||
|
||||
-- : RP -> ClSlash -> RCl ; -- whom John loves
|
||||
-- : RP -> ClSlash -> RCl ; -- whom John loves
|
||||
RelSlash rp cls = cls ** {
|
||||
s = \\t,p,agr,c =>
|
||||
s = \\t,p,agr,c =>
|
||||
let --empty : Agr -> NP = emptyNP ;
|
||||
obj : ResAra.NP = pgn2pron agr.pgn ; -- head is repeated as a clitic object pronoun
|
||||
cl : ResAra.Cl = complClSlash obj cls ;
|
||||
@@ -45,6 +45,6 @@ concrete RelativeAra of Relative = CatAra **
|
||||
RDl Fem Bare => "اَللَّتَيْن" ;
|
||||
RDl Fem Nom => "اَللَّتَانِ" ;
|
||||
RDl Fem _ => "اَللَّتَيْنِ"
|
||||
}
|
||||
}
|
||||
} ;
|
||||
}
|
||||
|
||||
@@ -1721,8 +1721,9 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
insertObj : NP -> VPSlash -> VP = \np,vp -> vp ** {
|
||||
obj = {s = vp.obj.s -- old object, if there was one
|
||||
++ bindIfPron np vp -- new object, bind if pronoun and not pred
|
||||
++ vp.agrObj ! np.a.pgn ; -- only used for SlashV2V
|
||||
a = agrLite np.a}
|
||||
++ vp.agrObj ! np.a.pgn ; -- only used for SlashV2V and Slash3V3
|
||||
a = agrLite np.a} ;
|
||||
agrObj = \\_ => []
|
||||
} ;
|
||||
|
||||
bindIf : Bool -> Str = \b -> if_then_Str b BIND [] ;
|
||||
|
||||
@@ -20,7 +20,7 @@ concrete SentenceAra of Sentence = CatAra ** open
|
||||
case p of {
|
||||
Pos => vp.s ! Per2 g n ! VPImp ;
|
||||
Neg => "لَا" ++ vp.s ! Per2 g n ! VPImpf Jus
|
||||
} ++ vp.obj.s ++ vp.pred.s ! {g=g;n=n} ! Acc ++ vp.s2
|
||||
} ++ vp.obj.s ++ vp.pred.s ! {g=g;n=n} ! Acc ++ vp.s2
|
||||
};
|
||||
|
||||
--
|
||||
|
||||
@@ -43,7 +43,7 @@ concrete StructuralAra of Structural = CatAra **
|
||||
how_IAdv = ss "كَيفَ" ;
|
||||
how8many_IDet = {
|
||||
s = \\g,s,c => "كَمْ عَدَد" + caseTbl ! c ;
|
||||
n = Pl ; d = Def
|
||||
n = Pl ; d = Def
|
||||
} ; -- IL
|
||||
how8much_IAdv = ss "كَمْ" ;
|
||||
if_Subj = mkSubj "إِذَا" Verbal ;
|
||||
|
||||
@@ -35,7 +35,22 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
|
||||
} ;
|
||||
|
||||
SlashV2a = slashV2 ;
|
||||
Slash3V3 v np = insertObj np (slashV2 v) ** {c2 = v.c3 ; agrObj = \\_ => []};
|
||||
Slash2V3 v np = insertObj np (slashV2 v) ** {c2 = v.c3 ; agrObj = \\_ => []};
|
||||
|
||||
Slash3V3 v np =
|
||||
let vp = slashV2 v ** {c2 =
|
||||
v.c2 ** {
|
||||
s = case np.a.isPron of {
|
||||
True => case v.c2.binds of {
|
||||
True => v.c2.s ; -- to make sure there's something for the object to attach to
|
||||
False => v.c2.s ++ "إِيَّا" } ; -- see https://en.wiktionary.org/wiki/%D8%A5%D9%8A%D8%A7#Particle /IL
|
||||
False => v.c2.s }
|
||||
}
|
||||
}
|
||||
in vp ** {
|
||||
c2 = v.c3 ;
|
||||
agrObj = \\_ => bindIfPron np vp -- will be emptied when insertObj is called /IL
|
||||
} ;
|
||||
|
||||
ComplSlash vp np = insertObj np vp ;
|
||||
|
||||
@@ -51,7 +66,7 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
|
||||
|
||||
-- : VS -> S -> VP ; -- say that she runs
|
||||
ComplVS vs s = predV vs ** { -- IL
|
||||
obj = emptyObj ** {s = vs.s2 ++ s.s ! vs.o}
|
||||
obj = emptyObj ** {s = vs.s2 ++ s.s ! vs.o}
|
||||
} ;
|
||||
|
||||
-- : VQ -> QS -> VP ; -- wonder who runs
|
||||
@@ -68,7 +83,7 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
|
||||
UseComp xabar =
|
||||
case xabar.isNP of {
|
||||
False => kaan xabar ;
|
||||
True => predV copula ** {obj = xabar.obj ; isPred=True}
|
||||
True => predV copula ** {obj = xabar.obj ; isPred=True}
|
||||
} ;
|
||||
|
||||
UseCopula = predV copula ;
|
||||
@@ -97,8 +112,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
|
||||
|
||||
CompCN cn = {s = \\agr,c => cn2str cn agr.n Indef Nom ;
|
||||
obj = emptyObj ; isNP = False} ;
|
||||
CompNP np = {s = \\_,_ => [] ;
|
||||
obj = {s = np.s ! Nom ; a = agrLite np.a} ;
|
||||
CompNP np = {s = \\_,_ => [] ;
|
||||
obj = {s = np.s ! Nom ; a = agrLite np.a} ;
|
||||
isNP = True} ;
|
||||
--
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user