Problem
I'm trying to generate the sentence It's sunny on Monday and rainy on Tuesday on GF using RGL. I looked for a method to generate this sentence on the RGL page, but I couldn't find anything that might help with this. Checked Extend.gf on GitHub for more information about GF, and I found these three lines:
MkVPS : Temp -> Pol -> VP -> VPS ; -- hasn't slept
ConjVPS : Conj -> [VPS] -> VPS ; -- has walked and won't sleep
PredVPS : NP -> VPS -> S ; -- she [has walked and won't sleep]
They seemed promising at first glance, but when I tried implementing them on a real code, it seems like I misused [VPS]. My code:
mkPhr(PredVPS
(it_NP)
(ConjVPS
(and_Conj)
(MkVPS
(mkTemp (futureTense) (simultaneousAnt))
(positivePol)
(mkVP
(mkVP (mkA "sunny"))
(SyntaxEng.mkAdv (on_Prep) (mkNP (mkN ("Monday"))))))
(MkVPS
(mkTemp (futureTense) (simultaneousAnt))
(positivePol)
(mkVP
(mkVP (mkA "rainy"))
(SyntaxEng.mkAdv (on_Prep) (mkNP (mkN ("Tuesday"))))))));
But I ran into this error, which obviously a problem with the defined variable and the expected one.
missing record fields: s1, s2 type of MkVPS (mkTemp futureTense simultaneousAnt) positivePol (AdvVP ((\a -> UseComp (CompAP (PositA a))) (regA "rainy")) (PrepNP on_Prep ((\n -> MassNP (UseN n)) (regN "Monday"))))
expected: {s1 : ResEng.Agr => Str; s2 : ResEng.Agr => Str}
inferred: {s : ResEng.Agr => Str; lock_VPS : {}}
Question
What is the correct way to use [VPS]?
Clarification on lists
Just like with other list categories
C, you need to use a constructor that takes two (or more)Cs and creates a[C].For categories that are in the RGL API, there are convenience opers of type
mkC : Conj -> C -> C -> C, but under the hood, those opers also need to call the proper constructors for[C]. (The constructors are calledBaseCandConsC, and you can read more on lists here.)How to use conjunctions with VPSs
So
VPSis not in the API, so there is no convenience oper with type signatureConj -> VPS -> VPS -> VPS. Instead, you need to callBaseVPSexplicitly. Here is working code, I cut your long expression into smaller pieces.And it works like this:
So the tenses are repeated in both cases, because the conjunction is on the VPS level, not on the AP level.
How to create the phrase you wanted
If you want to have ellipsis, "it will be sunny on Monday and rainy on Tuesday", you will need to attach the Adv "on Monday" to the AP "sunny" using AdvAP, then do an AP conjunction, turn that AP into VP, and then use that VP in a Cl as you normally would. Here is code, a separate file from the previous:
Works like this: