make complememt position flexible

This commit is contained in:
Herbert Lange
2019-03-23 23:39:44 +01:00
parent 76c1c2453e
commit de82d4b35b
6 changed files with 43 additions and 31 deletions

View File

@@ -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 -> Adv ; -- more warmly than he runs
ComparAdvAdjS cadv a s = 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 -> Adv ; -- very quickly
AdAdv ada adv = mkAdv (ada.s ++ (adv.s ! Posit) ) ; 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. -- Subordinate clauses can function as adverbs.
-- SubjS : Subj -> S -> Adv ; -- when she sleeps -- 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 -> AdN ; -- less (than five)
AdnCAdv cadv = {s = cadv.s ++ cadv.p} ; AdnCAdv cadv = {s = cadv.s ++ cadv.p} ;

View File

@@ -89,5 +89,5 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, ParamX, Prelude in {
linref linref
NP = \np -> np.preap.s ! Ag np.g np.n Nom ++ np.s ! Nom ++ np.postap.s ! Ag np.g np.n Nom ; 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 ; 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 ;
} }

View File

@@ -3,7 +3,7 @@ concrete ExtraLat of ExtraLatAbs =
open ResLat, ParadigmsLat, Coordination, Prelude in { open ResLat, ParadigmsLat, Coordination, Prelude in {
lincat CS = Str ; lincat CS = Str ;
lin 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 : VPSlash -> AP ; -- lost (opportunity) ; (opportunity) lost in space
-- PastPartAP vp = { s = vp.part ! VPassPerf } ; -- PastPartAP vp = { s = vp.part ! VPassPerf } ;

View File

@@ -3,7 +3,7 @@ concrete PhraseLat of Phrase = CatLat ** open Prelude, ResLat in {
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
-- --
-- UttS : S -> Utt -- 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 -> Utt
UttQS qs = {s = qs.s ! QDir } ; UttQS qs = {s = qs.s ! QDir } ;

View File

@@ -27,6 +27,7 @@ param
param param
Order = SVO | VSO | VOS | OSV | OVS | SOV ; Order = SVO | VSO | VOS | OSV | OVS | SOV ;
AdvPos = PreS | PreV | PreO | PreNeg | InV | InS ; -- | InO AdvPos = PreS | PreV | PreO | PreNeg | InV | InS ; -- | InO
ComplPos = CPreV | CPostV ;
SAdvPos = SPreS | SPreV | SPreO | SPreNeg ; SAdvPos = SPreS | SPreV | SPreO | SPreNeg ;
param param
Agr = Ag Gender Number Case ; -- Agreement for NP et al. Agr = Ag Gender Number Case ; -- Agreement for NP et al.
@@ -1226,19 +1227,22 @@ oper
-- clauses -- clauses
Sentence = 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 t : C.Tense ; -- tense marker
p : C.Pol ; -- polarity marker p : C.Pol ; -- polarity marker
sadv : Str -- sentence adverb¡ 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} ; QClause = {s : C.Tense => Anteriority => C.Pol => QForm => Str} ;
mkClause : NounPhrase -> VerbPhrase -> Clause = \np,vp -> mkClause : NounPhrase -> VerbPhrase -> Clause = \np,vp ->
let let
-- combines adverbs from noun phrase and verb phrase -- combines adverbs from noun phrase and verb phrase
adv = np.adv ++ vp.adv ; 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 -- helper functions to either place the adverb in the designated position
-- or an empty string instead -- or an empty string instead
pres : AdvPos -> Str = \ap -> case ap of { PreS => adv ; _ => [] } ; pres : AdvPos -> Str = \ap -> case ap of { PreS => adv ; _ => [] } ;
@@ -1246,33 +1250,38 @@ oper
preo : AdvPos -> Str = \ap -> case ap of { PreO => adv ; _ => [] } ; preo : AdvPos -> Str = \ap -> case ap of { PreO => adv ; _ => [] } ;
preneg : AdvPos -> Str = \ap -> case ap of { PreNeg => adv ; _ => [] } ; preneg : AdvPos -> Str = \ap -> case ap of { PreNeg => adv ; _ => [] } ;
ins : AdvPos -> Str = \ap -> case ap of { InS => 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 in
{ {
-- subject part of the clause: -- subject part of the clause:
-- ap is the adverb position in the clause -- advpos is the adverb position in the clause
s = \\ap => s = \\advpos =>
pres ap ++ -- adverbs can be placed in the beginning of the clause pres advpos ++ -- adverbs can be placed in the beginning of the clause
np.det.s ! np.g ! Nom ++ -- the determiner, if any 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 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.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.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 np.det.sp ! np.g ! Nom ; -- second part of split determiners
-- verb part of the clause: -- verb part of the clause:
-- tense and anter(ority) for the verb tense -- 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 -- 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 -- advposis the adverb position in the clause
v = \\tense,anter,vqf,ap => -- comppos is the position of the verb complement
prev ap ++ -- adverbs can be placed in the before the verb phrase v = \\tense,anter,vqf,advpos,complpos =>
vp.compl ! Ag np.g np.n Nom ++ -- verb phrase complement, e.g. predicative expression, agreeing with the subject prev advpos ++ -- adverbs can be placed in the before the verb phrase
inv ap ++ -- adverbs can be placed within 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 -- 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 -- 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 -- 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 = "" adv = ""
} ; } ;
@@ -1286,20 +1295,23 @@ oper
p = pol p = pol
} ; } ;
combineSentence : Sentence -> ( SAdvPos => AdvPos => Order => Str ) = \s -> combineSentence : Sentence -> ( SAdvPos => AdvPos => ComplPos => Order => Str ) = \s ->
let let
pres : SAdvPos -> Str = \ap -> case ap of { SPreS => s.sadv ; _ => [] } ; pres : SAdvPos -> Str = \ap -> case ap of { SPreS => s.sadv ; _ => [] } ;
prev : SAdvPos -> Str = \ap -> case ap of { SPreV => s.sadv ; _ => [] } ; prev : SAdvPos -> Str = \ap -> case ap of { SPreV => s.sadv ; _ => [] } ;
preo : SAdvPos -> Str = \ap -> case ap of { SPreO => s.sadv ; _ => [] } ; preo : SAdvPos -> Str = \ap -> case ap of { SPreO => s.sadv ; _ => [] } ;
preneg : SAdvPos -> Str = \ap -> case ap of { SPreNeg => s.sadv ; _ => [] } preneg : SAdvPos -> Str = \ap -> case ap of { SPreNeg => s.sadv ; _ => [] }
in in
\\sap,ap,order => case order of { -- sap is the position of the sentence adverbial
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; -- ap is the position of the adverb
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; -- cp is the position of the verb complement
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 ; \\sap,ap,cp,order => case order of {
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; 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;
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 ; 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;
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 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 -- questions
mkQuestion : SS -> Clause -> QClause = \ss,cl -> { mkQuestion : SS -> Clause -> QClause = \ss,cl -> {
s = \\tense,anter,pol,form => case form of { s = \\tense,anter,pol,form => case form of {
QDir => ss.s ++ (combineSentence (combineClause cl tense anter pol VQFalse)) ! SPreS ! PreS ! OVS ; 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 ! OSV QIndir => ss.s ++ (combineSentence (combineClause cl tense anter pol VQFalse)) ! SPreO ! PreO ! CPreV ! OSV
} }
}; };

View File

@@ -20,7 +20,7 @@ lin
-- a = agrgP3 Sg cn.g -- 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} ; -- SymbNum sy = {s = sy.s ; n = Pl ; hasCard = True} ;
SymbOrd sy = { s = \\g,n,c => sy.s } ; -- does not inflect properly SymbOrd sy = { s = \\g,n,c => sy.s } ; -- does not inflect properly