From de82d4b35b0b7b1eb4f76a2e91803a393dc86ac0 Mon Sep 17 00:00:00 2001 From: Herbert Lange Date: Sat, 23 Mar 2019 23:39:44 +0100 Subject: [PATCH] make complememt position flexible --- src/latin/AdverbLat.gf | 4 +-- src/latin/CatLat.gf | 2 +- src/latin/ExtraLat.gf | 2 +- src/latin/PhraseLat.gf | 2 +- src/latin/ResLat.gf | 62 +++++++++++++++++++++++++----------------- src/latin/SymbolLat.gf | 2 +- 6 files changed, 43 insertions(+), 31 deletions(-) diff --git a/src/latin/AdverbLat.gf b/src/latin/AdverbLat.gf index 135d469d..cb92550c 100644 --- a/src/latin/AdverbLat.gf +++ b/src/latin/AdverbLat.gf @@ -18,7 +18,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 ! SOV ) ; + mkAdv (cadv.s ++ a.adv.s ! Compar ++ cadv.p ++ combineSentence s ! SPreS ! PreV ! CPreV ! SOV ) ; -- AdAdv : AdA -> Adv -> Adv ; -- very quickly AdAdv ada adv = mkAdv (ada.s ++ (adv.s ! Posit) ) ; @@ -30,7 +30,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 ! SOV ) ; + SubjS subj s = mkAdv (subj.s ++ combineSentence s ! SPreS ! PreV ! CPreV ! SOV ) ; -- AdnCAdv : CAdv -> AdN ; -- less (than five) AdnCAdv cadv = {s = cadv.s ++ cadv.p} ; diff --git a/src/latin/CatLat.gf b/src/latin/CatLat.gf index a40a502a..834b6c22 100644 --- a/src/latin/CatLat.gf +++ b/src/latin/CatLat.gf @@ -89,5 +89,5 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, ParamX, Prelude in { linref NP = \np -> np.preap.s ! Ag np.g np.n Nom ++ np.s ! Nom ++ np.postap.s ! Ag np.g np.n Nom ; VP = \vp -> vp.adv ++ vp.inf ! VInfActPres ++ vp.obj ++ vp.compl ! Ag Masc Sg Nom ; - S = \s -> combineSentence s ! SPreO ! PreO ! SOV ; + S = \s -> combineSentence s ! SPreO ! PreO ! CPreV ! SOV ; } diff --git a/src/latin/ExtraLat.gf b/src/latin/ExtraLat.gf index 06628352..9cc79290 100644 --- a/src/latin/ExtraLat.gf +++ b/src/latin/ExtraLat.gf @@ -3,7 +3,7 @@ concrete ExtraLat of ExtraLatAbs = open ResLat, ParadigmsLat, Coordination, Prelude in { lincat CS = Str ; lin - useS s = combineSentence s ! SPreO ! PreO ! SOV ; + useS s = combineSentence s ! SPreO ! PreO ! CPreV ! SOV ; -- PastPartAP : VPSlash -> AP ; -- lost (opportunity) ; (opportunity) lost in space -- PastPartAP vp = { s = vp.part ! VPassPerf } ; diff --git a/src/latin/PhraseLat.gf b/src/latin/PhraseLat.gf index 527384e7..c9d31697 100644 --- a/src/latin/PhraseLat.gf +++ b/src/latin/PhraseLat.gf @@ -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 ! SOV }; + UttS s = { s = combineSentence s ! SPreS ! PreS ! CPreV ! SOV }; -- UttQS : QS -> Utt UttQS qs = {s = qs.s ! QDir } ; diff --git a/src/latin/ResLat.gf b/src/latin/ResLat.gf index 24ae61f3..6fcbc706 100644 --- a/src/latin/ResLat.gf +++ b/src/latin/ResLat.gf @@ -27,6 +27,7 @@ param param Order = SVO | VSO | VOS | OSV | OVS | SOV ; AdvPos = PreS | PreV | PreO | PreNeg | InV | InS ; -- | InO + ComplPos = CPreV | CPostV ; SAdvPos = SPreS | SPreV | SPreO | SPreNeg ; param Agr = Ag Gender Number Case ; -- Agreement for NP et al. @@ -1226,19 +1227,22 @@ oper -- clauses Sentence = { - s,o,v,neg : AdvPos => Str ; -- Subject, verbphrase, object and negation particle plus potential adverb + s,o,neg : AdvPos => Str ; -- Subject, verbphrase, object and negation particle plus potential adverb + v : AdvPos => ComplPos => Str ; t : C.Tense ; -- tense marker p : C.Pol ; -- polarity marker sadv : Str -- sentence adverbĀ” } ; - Clause = {s,o : AdvPos => Str ; v : Tense => Anteriority => VQForm => AdvPos => Str ; neg : Polarity => AdvPos => Str ; adv : Str } ; + Clause = {s,o : AdvPos => Str ; v : Tense => Anteriority => VQForm => AdvPos => ComplPos => Str ; neg : Polarity => AdvPos => Str ; adv : Str } ; QClause = {s : C.Tense => Anteriority => C.Pol => QForm => Str} ; mkClause : NounPhrase -> VerbPhrase -> Clause = \np,vp -> let -- combines adverbs from noun phrase and verb phrase adv = np.adv ++ vp.adv ; + -- extracts the complement from the verb phrase + compl = vp.compl ! Ag np.g np.n Nom ; -- helper functions to either place the adverb in the designated position -- or an empty string instead pres : AdvPos -> Str = \ap -> case ap of { PreS => adv ; _ => [] } ; @@ -1246,33 +1250,38 @@ oper preo : AdvPos -> Str = \ap -> case ap of { PreO => adv ; _ => [] } ; preneg : AdvPos -> Str = \ap -> case ap of { PreNeg => adv ; _ => [] } ; ins : AdvPos -> Str = \ap -> case ap of { InS => adv ; _ => [] } ; - inv : AdvPos -> Str = \ap -> case ap of { InV => adv ; _ => [] } + inv : AdvPos -> Str = \ap -> case ap of { InV => adv ; _ => [] } ; + cprev : ComplPos -> Str = \cp -> case cp of { CPreV => compl ; _ => [] } ; + cpostv : ComplPos -> Str = \cp -> case cp of { CPostV => compl ; _ => [] } in { -- subject part of the clause: - -- ap is the adverb position in the clause - s = \\ap => - pres ap ++ -- adverbs can be placed in the beginning of the clause + -- advpos is the adverb position in the clause + s = \\advpos => + pres advpos ++ -- adverbs can be placed in the beginning of the clause np.det.s ! np.g ! Nom ++ -- the determiner, if any np.preap.s ! (Ag np.g np.n Nom) ++ -- adjectives which come before the subject noun, agreeing with it - ins ap ++ -- adverbs can be placed within the subject noun phrase + ins advpos ++ -- adverbs can be placed within the subject noun phrase np.s ! Nom ++ -- the noun of the subject noun phrase in nominative np.postap .s ! (Ag np.g np.n Nom) ++ -- adjectives which come after the subject noun, agreeing with it np.det.sp ! np.g ! Nom ; -- second part of split determiners -- verb part of the clause: -- tense and anter(ority) for the verb tense -- vqf is the VQForm parameter which defines if the ordinary verbform or the quistion form with suffix "-ne" will be used - -- ap is the adverb position in the clause - v = \\tense,anter,vqf,ap => - prev ap ++ -- adverbs can be placed in the before the verb phrase - vp.compl ! Ag np.g np.n Nom ++ -- verb phrase complement, e.g. predicative expression, agreeing with the subject - inv ap ++ -- adverbs can be placed within the verb phrase + -- advposis the adverb position in the clause + -- comppos is the position of the verb complement + v = \\tense,anter,vqf,advpos,complpos => + prev advpos ++ -- adverbs can be placed in the before the verb phrase + cprev complpos ++ -- verb phrase complement, e.g. predicative expression, agreeing with the subject, can go before the verb + inv advpos ++ -- adverbs can be placed within the verb phrase -- verb form with conversion between different forms of tense and aspect - vp.s ! VAct ( anteriorityToVAnter anter ) ( tenseToVTense tense ) np.n np.p ! vqf ; + vp.s ! VAct ( anteriorityToVAnter anter ) ( tenseToVTense tense ) np.n np.p ! vqf ++ + cpostv complpos ; -- complement can also go after the verb + -- object part of the clause - o = \\ap => preo ap ++ vp.obj ; + o = \\advpos => preo advpos ++ vp.obj ; -- optional negation particle, adverbs can be placed before the negation - neg = \\pol,ap => preneg ap ++ negation pol ; + neg = \\pol,advpos => preneg advpos ++ negation pol ; adv = "" } ; @@ -1286,20 +1295,23 @@ oper p = pol } ; - combineSentence : Sentence -> ( SAdvPos => AdvPos => Order => Str ) = \s -> + combineSentence : Sentence -> ( SAdvPos => AdvPos => 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 ; _ => [] } in - \\sap,ap,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 ++ preo sap ++ s.o ! ap; - VSO => s.t.s ++ s.p.s ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ++ 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 ++ 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; - OVS => s.t.s ++ s.p.s ++ preo sap ++ s.o ! ap ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ++ 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 + -- 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 } ; @@ -1307,8 +1319,8 @@ oper -- 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 ! OVS ; - QIndir => ss.s ++ (combineSentence (combineClause cl tense anter pol VQFalse)) ! SPreO ! PreO ! OSV + 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 } }; diff --git a/src/latin/SymbolLat.gf b/src/latin/SymbolLat.gf index 6dffa96d..f1274951 100644 --- a/src/latin/SymbolLat.gf +++ b/src/latin/SymbolLat.gf @@ -20,7 +20,7 @@ lin -- a = agrgP3 Sg cn.g -- } ; -- - SymbS sy = { s = \\_ => sy.s ; neg = \\_ => "" ; o = \\_ => "" ; p = PPos ; sadv = "" ; t = TPres ; v = \\_ => "" } ; + SymbS sy = { s = \\_ => sy.s ; neg = \\_ => "" ; o = \\_ => "" ; p = PPos ; sadv = "" ; t = TPres ; v = \\_,_ => "" } ; -- -- SymbNum sy = {s = sy.s ; n = Pl ; hasCard = True} ; SymbOrd sy = { s = \\g,n,c => sy.s } ; -- does not inflect properly