mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-06-30 11:08:35 -06:00
updated createSentence/add defaultSentence
This commit is contained in:
@@ -17,7 +17,7 @@ concrete AdverbLat of Adverb = CatLat ** open ResLat, Prelude, ParadigmsLat in
|
||||
|
||||
-- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs
|
||||
ComparAdvAdjS cadv a s =
|
||||
mkAdv (cadv.s ++ a.adv.s ! Compar ++ cadv.p ++ combineSentence s ! SPreS ! PreV ! CPreV ! SOV ) ;
|
||||
mkAdv (cadv.s ++ a.adv.s ! Compar ++ cadv.p ++ defaultSentence s ! SOV ) ;
|
||||
|
||||
-- AdAdv : AdA -> Adv -> Adv ; -- very quickly
|
||||
AdAdv ada adv = mkAdv (ada.s ++ (adv.s ! Posit) ) ;
|
||||
@@ -29,7 +29,7 @@ concrete AdverbLat of Adverb = CatLat ** open ResLat, Prelude, ParadigmsLat in
|
||||
-- Subordinate clauses can function as adverbs.
|
||||
|
||||
-- SubjS : Subj -> S -> Adv ; -- when she sleeps
|
||||
SubjS subj s = mkAdv (subj.s ++ combineSentence s ! SPreS ! PreV ! CPreV ! SOV ) ;
|
||||
SubjS subj s = mkAdv (subj.s ++ defaultSentence s ! SOV ) ;
|
||||
|
||||
-- AdnCAdv : CAdv -> AdN ; -- less (than five)
|
||||
AdnCAdv cadv = {s = cadv.s ++ cadv.p} ;
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, ParamX, Prelude in {
|
||||
linref
|
||||
NP = \np -> combineNounPhrase np ! PronNonDrop ! APreN ! DPostN ! Nom ;
|
||||
VP = \vp -> vp.adv ++ vp.inf ! VInfActPres ++ vp.obj ++ vp.compl ! Ag Masc Sg Nom ;
|
||||
S = \s -> combineSentence s ! SPreO ! PreO ! CPreV ! SOV ;
|
||||
S = \s -> defaultSentence s ! SOV ;
|
||||
V, VS, VQ, VA, VV = \v -> v.act ! (VAct VSim (VPres VInd) Sg P1) ;
|
||||
V2, V2A, V2Q, V2S = \v -> v.act ! (VAct VSim (VPres VInd) Sg P1) ;
|
||||
Pron = \p -> p.pers.s ! PronNonDrop ! PronNonRefl ! Nom ;
|
||||
|
||||
@@ -3,7 +3,7 @@ concrete PhraseLat of Phrase = CatLat ** open Prelude, ResLat in {
|
||||
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
|
||||
--
|
||||
-- UttS : S -> Utt
|
||||
UttS s = { s = combineSentence s ! SPreS ! PreS ! CPreV ! SOV };
|
||||
UttS s = { s = defaultSentence s ! SOV };
|
||||
|
||||
-- UttQS : QS -> Utt
|
||||
UttQS qs = {s = qs.s ! QDir } ;
|
||||
|
||||
+69
-21
@@ -25,11 +25,19 @@ param
|
||||
det : Determiner
|
||||
} ;
|
||||
param
|
||||
-- Parameters to determine word order
|
||||
-- top level order, e.g. subject verb object
|
||||
Order = SVO | VSO | VOS | OSV | OVS | SOV ;
|
||||
-- determiner position in a noun phrase, e.g. before or after noun
|
||||
DetPos = DPreN | DPostN ;
|
||||
-- verb position, eithe regular or interleaved in the subject
|
||||
VPos = VReg | VInS ;
|
||||
-- (verb-modifying) adverb position
|
||||
AdvPos = APreS | APreV | APreO | APreNeg | AInV | AInS | APreN | APostN ; -- | InO
|
||||
-- verb complement position in relation to verb
|
||||
ComplPos = CPreV | CPostV ;
|
||||
SAdvPos = SPreS | SPreV | SPreO | SPreNeg ;
|
||||
-- sentence adverb position
|
||||
SAdvPos = SAPreS | SAPreV | SAPreO | SAPreNeg ;
|
||||
param
|
||||
Agr = Ag Gender Number Case ; -- Agreement for NP et al.
|
||||
oper
|
||||
@@ -1303,10 +1311,12 @@ oper
|
||||
Sentence =
|
||||
{
|
||||
s,o,neg : AdvPos => Str ; -- Subject, verbphrase, object and negation particle plus potential adverb
|
||||
v : AdvPos => ComplPos => Str ;
|
||||
v : AdvPos => Str ;
|
||||
t : C.Tense ; -- tense marker
|
||||
p : C.Pol ; -- polarity marker
|
||||
sadv : Str -- sentence adverb¡
|
||||
sadv : Str ; -- sentence adverb¡
|
||||
det : { s , sp : Case => Str } ;
|
||||
compl : Str -- verb complement
|
||||
} ;
|
||||
|
||||
Clause =
|
||||
@@ -1379,32 +1389,70 @@ oper
|
||||
p = pol ;
|
||||
} ;
|
||||
|
||||
combineSentence : Sentence -> ( SAdvPos => AdvPos => ComplPos => Order => Str ) = \s ->
|
||||
combineSentence : Sentence -> ( SAdvPos => AdvPos => DetPos => VPos => ComplPos => Order => Str ) = \s ->
|
||||
let
|
||||
pres : SAdvPos -> Str = \ap -> case ap of { SPreS => s.sadv ; _ => [] } ;
|
||||
prev : SAdvPos -> Str = \ap -> case ap of { SPreV => s.sadv ; _ => [] } ;
|
||||
preo : SAdvPos -> Str = \ap -> case ap of { SPreO => s.sadv ; _ => [] } ;
|
||||
preneg : SAdvPos -> Str = \ap -> case ap of { SPreNeg => s.sadv ; _ => [] }
|
||||
advpres : SAdvPos -> Str = \ap -> case ap of { SAPreS => s.sadv ; _ => [] } ;
|
||||
advprev : SAdvPos -> Str = \ap -> case ap of { SAPreV => s.sadv ; _ => [] } ;
|
||||
advpreo : SAdvPos -> Str = \ap -> case ap of { SAPreO => s.sadv ; _ => [] } ;
|
||||
advpreneg : SAdvPos -> Str = \ap -> case ap of { SAPreNeg => s.sadv ; _ => [] } ;
|
||||
detpren : DetPos -> { s, sp : Case => Str } = \dp -> case dp of { DPreN => s.det; _ => { s,sp = \\_ => [] } } ;
|
||||
detpostn : DetPos -> { s, sp : Case => Str } = \dp -> case dp of { DPostN => s.det ; _ => { s , sp = \\_ => [] } } ;
|
||||
verbins : VPos -> ResLat.AdvPos => Str = \vp -> case vp of { VInS => s.v ; _ => \\_ => [] } ;
|
||||
verbreg : VPos -> ResLat.AdvPos => Str = \vp -> case vp of { VReg => s.v ; _ => \\_ => [] } ;
|
||||
complprev : ComplPos -> Str = \cp -> case cp of { CPreV => s.compl ; _ => [] } ;
|
||||
complpostv : ComplPos -> Str = \cp -> case cp of { CPostV => s.compl ; _ => [] }
|
||||
in
|
||||
-- sap is the position of the sentence adverbial
|
||||
-- ap is the position of the adverb
|
||||
-- cp is the position of the verb complement
|
||||
\\sap,ap,cp,order => case order of {
|
||||
SVO => s.t.s ++ s.p.s ++ pres sap ++ s.s ! ap ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp ++ preo sap ++ s.o ! ap;
|
||||
VSO => s.t.s ++ s.p.s ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp ++ pres sap ++ s.s ! ap ++ preo sap ++ s.o ! ap;
|
||||
VOS => s.t.s ++ s.p.s ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp ++ preo sap ++ s.o ! ap ++ pres sap ++ s.s ! ap ;
|
||||
OSV => s.t.s ++ s.p.s ++ preo sap ++ s.o ! ap ++ pres sap ++ s.s ! ap ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp;
|
||||
OVS => s.t.s ++ s.p.s ++ preo sap ++ s.o ! ap ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp ++ pres sap ++ s.s ! ap ;
|
||||
SOV => s.t.s ++ s.p.s ++ pres sap ++ s.s ! ap ++ preo sap ++ s.o ! ap ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp
|
||||
-- sadvpos is the position of the sentence adverbial
|
||||
-- advpos is the position of the adverb
|
||||
-- detpos is the position of the determiner (relative to the noun)
|
||||
-- vpos is the position of the main verb (either regular or interleaved)
|
||||
-- complosp is the position of the verb complement
|
||||
\\sadvpos,advpos,detpos,verbpos,complpos,order => case order of {
|
||||
SVO =>
|
||||
s.t.s ++ s.p.s ++
|
||||
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ++
|
||||
advpreneg sadvpos ++ s.neg ! advpos ++
|
||||
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ++
|
||||
advpreo sadvpos ++ s.o ! advpos;
|
||||
VSO =>
|
||||
s.t.s ++ s.p.s ++
|
||||
advpreneg sadvpos ++ s.neg ! advpos ++
|
||||
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ++
|
||||
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ++
|
||||
advpreo sadvpos ++ s.o ! advpos;
|
||||
VOS =>
|
||||
s.t.s ++ s.p.s ++
|
||||
advpreneg sadvpos ++ s.neg ! advpos ++
|
||||
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ++
|
||||
advpreo sadvpos ++ s.o ! advpos ++
|
||||
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ;
|
||||
OSV =>
|
||||
s.t.s ++ s.p.s ++
|
||||
advpreo sadvpos ++ s.o ! advpos ++
|
||||
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom++
|
||||
advpreneg sadvpos ++ s.neg ! advpos ++
|
||||
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ;
|
||||
OVS =>
|
||||
s.t.s ++ s.p.s ++
|
||||
advpreo sadvpos ++ s.o ! advpos ++
|
||||
advpreneg sadvpos ++ s.neg ! advpos ++
|
||||
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ++
|
||||
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ;
|
||||
SOV =>
|
||||
s.t.s ++ s.p.s ++
|
||||
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ++
|
||||
advpreo sadvpos ++ s.o ! advpos ++
|
||||
advpreneg sadvpos ++ s.neg ! advpos ++
|
||||
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos)
|
||||
} ;
|
||||
|
||||
|
||||
defaultSentence : Sentence -> Order => Str = \s -> combineSentence s ! SAPreS ! APreV ! DPreN ! VReg ! CPreV ;
|
||||
|
||||
-- questions
|
||||
mkQuestion : SS -> Clause -> QClause = \ss,cl -> {
|
||||
s = \\tense,anter,pol,form => case form of {
|
||||
QDir => ss.s ++ (combineSentence (combineClause cl tense anter pol VQFalse)) ! SPreS ! PreS ! CPreV ! OVS ;
|
||||
QIndir => ss.s ++ (combineSentence (combineClause cl tense anter pol VQFalse)) ! SPreO ! PreO ! CPreV ! OSV
|
||||
QDir => ss.s ++ (defaultSentence (combineClause cl tense anter pol VQFalse)) ! OVS ;
|
||||
QIndir => ss.s ++ (combineSentence (combineClause cl tense anter pol VQFalse)) ! SAPreO ! APreO ! DPreN ! VReg ! CPreV ! OSV
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ concrete SentenceLat of Sentence = CatLat ** open Prelude, ResLat in {
|
||||
{
|
||||
s = let qs = combineClause cl t t.a p VQTrue in
|
||||
\\q => case q of {
|
||||
QDir => cl.q ++ combineSentence qs ! SPreS ! PreV ! CPostV ! SVO ; -- t.s ++ p.s ++ cl.q ++ cl.s ! PreV ++ cl.v ! t.t ! t.a ! VQTrue ! PreV ! CPostV ++ cl.o ! PreV ;
|
||||
QIndir => cl.q ++ combineSentence qs ! SPreS ! PreV ! CPostV ! SOV -- t.s ++ p.s ++ cl.q ++ cl.s ! PreV ++ cl.o ! PreV ++ cl.v ! t.t ! t.a ! VQTrue ! PreV ! CPostV
|
||||
QDir => cl.q ++ defaultSentence qs ! SVO ; -- t.s ++ p.s ++ cl.q ++ cl.s ! PreV ++ cl.v ! t.t ! t.a ! VQTrue ! PreV ! CPostV ++ cl.o ! PreV ;
|
||||
QIndir => cl.q ++ defaultSentence qs ! SOV -- t.s ++ p.s ++ cl.q ++ cl.s ! PreV ++ cl.o ! PreV ++ cl.v ! t.t ! t.a ! VQTrue ! PreV ! CPostV
|
||||
}
|
||||
} ;
|
||||
-- UseRCl : Temp -> Pol -> RCl -> RS ;
|
||||
|
||||
@@ -20,7 +20,7 @@ concrete VerbLat of Verb = CatLat ** open (S=StructuralLat),ResLat,IrregLat,Extr
|
||||
ComplVS vs s = -- insertObj ( dummyNP (S.that_Subj.s ++ s.s ! PreS)) Nom_Prep (predV v) ;
|
||||
vs ** {
|
||||
s = \\af,qf => vs.act ! af ;
|
||||
compl = \\ag => combineSentence s ! SPreS ! PreV ! CPostV ! SOV ; -- s.s ! QIndir ;
|
||||
compl = \\ag => defaultSentence s ! SOV ; -- s.s ! QIndir ;
|
||||
adv = [] ;
|
||||
obj = []
|
||||
} ;
|
||||
|
||||
Reference in New Issue
Block a user