fix some of the coordination again

This commit is contained in:
Herbert Lange
2019-05-06 20:25:32 +02:00
parent a552ba9889
commit 2a3de7687f
4 changed files with 90 additions and 53 deletions

View File

@@ -8,31 +8,44 @@ concrete ConjunctionLat of Conjunction =
-- ConjS : Conj -> ListS -> S ; -- he walks and she runs
-- TO FIX
-- ConjS conj ss = { s = \\_ => conjunctDistrX conj (ss.l ! conj.c) ; sadv = lin Adv { s = []} ; neg = ss.neg } ;
ConjS conj ss = {
-- s = \\apos => coord conj.c { init = (ss.s ! conj.c).init ! SPreS ! apos ! CPreV ! SOV ;
-- last = (ss.s ! conj.c).last ! SPreS ! apos ! CPreV ! SOV} ;
s = \\apos => conj.s1 ++ (ss.s ! conj.c).init ! SPreS ! apos ! CPreV ! SOV ++ conj.s2 ++
(ss.s ! conj.c).last ! SPreS ! apos ! CPreV ! SOV ++ conj.s3 ;
o = \\_ => [] ;
v = \\_,_ => [] ;
neg = \\_ => [] ;
p = ss.p ;
sadv = [] ;
t = ss.t
} ;
-- ConjAdv : Conj -> ListAdv -> Adv ; -- here or there
ConjAdv conj ss = mkAdv (conjunctDistrSS conj (ss.l ! conj.c) ).s ;
-- ConjAdv conj ss = mkAdv (conjunctDistrSS conj (ss.l ! conj.c) ).s ;
-- ConjNP : Conj -> ListNP -> NP ; -- she or we
ConjNP conj nps =
{
s = case conj.c of {
And => case nps.isBase of {
False => (conjunctDistrTable Case conj (nps.l ! And)).s ;
True => \\c => conj.s1 ++ (nps.l ! And).s1 ! c ++ conj.s2 ++ (nps.l ! And).s2 ! c
} ;
c => (conjunctDistrTable Case conj (nps.l ! And)).s
} ;
n = case conj.c of { And => Pl ; _ => nps.n } ;
-- s = case conj.c of {
-- Et => case nps.isBase of {
-- False => (conjunctDistrTable Case conj (nps.l ! Et)).s ;
-- True => \\c => conj.s1 ++ (nps.l ! Et).s1 ! c ++ conj.s2 ++ (nps.l ! Et).s2 ! c
-- } ;
-- c => (conjunctDistrTable Case conj (nps.l ! Et)).s
-- } ;
s = \\ca => conj.s1 ++ (nps.s ! conj.c).init ! ca ++ conj.s2 ++ (nps.s ! conj.c).last ! ca++ conj.s3 ;
n = case conj.c of { Et => Pl ; _ => nps.n } ;
g = nps.g ;
p = nps.p ;
adv = nps.adv ;
preap = nps.preap ;
postap = nps.postap ;
det = { s = \\_,_ => "" ; sp = \\_,_ => "" ; n = nps.n };
postap = nps.postap ;
det = { s = \\_,_ => "" ; sp = \\_,_ => "" ; n = nps.n };
} ;
-- ConjAP : Conj -> ListAP -> AP ;
ConjAP conj ss = conjunctDistrTable Agr conj (ss.l ! conj.c) ;
-- ConjAP conj ss = conjunctDistrTable Agr conj (ss.l ! conj.c) ;
--
-- DConjS = conjunctDistrSS ;
@@ -53,32 +66,40 @@ concrete ConjunctionLat of Conjunction =
--
-- BaseS : S -> S -> ListS
-- BaseS x y = {
-- l = \\c => { s1 = x ; s2 = y } ;
-- } ;
BaseS x y = {
s = \\c => { init = combineSentence x ; last = combineSentence y } ;
p = y.p ;
t = y.t
} ;
-- ConsS : S -> ListS -> ListS
-- TO FIX
-- ConsS x xs = { l = \\_ => consrSS bindComma (ss (x.s ! PreS)) (xs.l ! Comma) };
-- ConsS s ss = {
-- l = \\c =>
-- { s1 = ss.s1 ++
-- table {
-- And => and_Conj
-- } ! c
-- ++ ss.s2 ;
-- s2 = s }
-- } ;
ConsS s ss = {
s = \\co =>
{ init = \\s,a,c,o => coord co { init = (ss.s ! co).init ! s ! a ! c ! o ; last = (ss.s ! co).last ! s ! a ! c ! o } ;
last = combineSentence s } ;
p = s.p ;
t = s.t
} ;
-- BaseAdv : Adv -> Adv -> ListAdv
BaseAdv x y = { l = \\c => twoSS (ss (x.s ! Posit)) (ss (y.s ! Posit)) } ;
BaseAdv x y =
{
s = \\_ => { init = x.s ! Posit ; last = y.s ! Posit }
} ;
-- ConsAdv : Adv -> ListAdv -> ListAdv
ConsAdv x xs = { l = \\_ => consrSS bindComma (ss (x.s ! Posit)) (xs.l ! Comma) } ;
ConsAdv x xs =
{
-- s = \\_ => consrSS bindComma (ss (x.s ! Posit)) (xs.l ! Comma)
s = \\c => { init = coord c (xs.s ! c) ; last = x.s ! Posit }
} ;
-- BaseNP : NP -> NP -> ListNP ; -- John, Mary
-- -- BaseNP : NP -> NP -> ListNP ; -- John, Mary
BaseNP x y = {
l = \\c => twoTable Case x y ;
-- s = \\c => twoTable Case x y ;
s = \\c => { init = x.s ; last = y.s } ;
g = Masc ; -- Just guessing (but maybe sexist bullshit)
n = matchNumber x.n y.n ;
p = P3 ;
@@ -86,13 +107,13 @@ concrete ConjunctionLat of Conjunction =
preap = lin AP { s = \\a => x.preap.s ! a ++ y.preap.s ! a } ;
postap = lin AP { s = \\a => x.postap.s ! a ++ y.postap.s ! a } ;
isBase = True ;
det = { s = \\g,c => x.det.s ! g ! c ++ y.det.s ! g ! c ; sp = \\g,c => x.det.sp ! g ! c ++ y.det.sp ! g ! c ; n = matchNumber x.get.n y.get.n } ;
det = { s = \\g,c => x.det.s ! g ! c ++ y.det.s ! g ! c ; sp = \\g,c => x.det.sp ! g ! c ++ y.det.sp ! g ! c ; n = matchNumber x.get.n y.get.n } ;
} ;
-- ConsNP : NP -> ListNP -> ListNP ; -- John, Mary, Bill
-- -- ConsNP : NP -> ListNP -> ListNP ; -- John, Mary, Bill
ConsNP x xs = {
l = \\_ => consrTable Case bindComma x ( xs.l ! Comma );
-- s = \\_ => consrTable Case bindComma x ( xs.s ! Comma );
s = \\co => { init = \\ca => coord co { init = (xs.s ! co).init ! ca ; last = (xs.s ! co).last ! ca} ; last = x.s } ;
n = matchNumber x.n xs.n ;
g = xs.g ;
p = xs.p ;
@@ -100,21 +121,21 @@ concrete ConjunctionLat of Conjunction =
preap = lin AP { s = \\a => x.preap.s ! a ++ xs.preap.s ! a } ;
postap = lin AP { s = \\a => x.postap.s ! a ++ xs.postap.s ! a } ;
isBase = False
-- TODO det
-- TODO det
} ;
-- BaseAP : AP -> AP -> ListAP
BaseAP x y = { l = \\c => twoTable Agr x y };
-- -- BaseAP : AP -> AP -> ListAP
-- BaseAP x y = { l = \\c => twoTable Agr x y };
-- ConsAP : AP -> ListAP -> ListAP
ConsAP x xs =
{ l = \\_ => consrTable Agr and_Conj.s2 x (xs.l ! Comma ) } ;
-- -- ConsAP : AP -> ListAP -> ListAP
-- ConsAP x xs =
-- { l = \\_ => consrTable Agr and_Conj.s2 x (xs.l ! Comma ) } ;
--
lincat
-- [S] = { l : Coordinator => {s1,s2 : S} } ; -- TO FIX
[Adv] = { l: Coordinator => {s1,s2 : Str}} ;
[NP] = {l : Coordinator => {s1,s2 : Case => Str} ; g : Gender ; n : Number ; p : Person ; adv : Str ; preap : AP ; postap : AP ; isBase : Bool } ;
[AP] = {l : Coordinator => {s1,s2 : Agr => Str } } ;
[S] = { s : Coordinator => {init,last : SAdvPos => AdvPos => ComplPos => Order => Str} ; p : Pol ; t : Tense } ; -- TO FIX
[Adv] = { s: Coordinator => {init,last : Str}} ;
[NP] = { s : Coordinator => {init,last : Case => Str} ; g : Gender ; n : Number ; p : Person ; adv : Str ; preap : AP ; postap : AP ; isBase : Bool } ;
[AP] = {s : Coordinator => {init,last : Agr => Str } } ;
oper
-- Generates a new number value given two number values.
@@ -126,5 +147,21 @@ concrete ConjunctionLat of Conjunction =
<_,Pl> => Pl ;
<_,_> => Sg
} ;
coord : Coordinator -> {init : Str ; last : Str} -> Str =
\c,l ->
l.init ++
table {
Aut => "aut" ;
Et => "et" ;
Sed => "sed" ;
Si => "si" ;
Vel => "vel" ;
Comma => bindComma ;
Colon => ":" ;
Empty => "" ;
Missing => nonExist
} ! c
++ l.last ;
--
}

View File

@@ -25,13 +25,13 @@ concrete ExtraLat of ExtraLatAbs =
ConjNPque conj nps =
{
s = case conj.c of {
And => case nps.isBase of {
False => (conjunctDistrTable Case conj (nps.l ! And)).s ;
True => \\c => (nps.l ! And).s1 ! c ++ (nps.l ! And).s2 ! c ++ BIND ++ "que"
Et => case nps.isBase of {
False => \\cse => coord conj.c {init = (nps.s ! Et).init ! cse ; last = (nps.s ! Et).last ! cse } ;-- (conjunctDistrTable Case conj (nps.s ! Et)).s ;
True => \\cse => (nps.s ! Et).init ! cse ++ (nps.s ! Et).last ! cse ++ BIND ++ "que"
} ;
c => (conjunctDistrTable Case conj (nps.l ! And)).s
c => \\cse => coord conj.c {init = (nps.s ! c).init ! cse ; last = (nps.s ! c).last ! cse } -- (conjunctDistrTable Case conj (nps.l ! Et)).s
} ;
n = case conj.c of { And => Pl ; _ => nps.n } ;
n = case conj.c of { Et => Pl ; _ => nps.n } ;
g = nps.g ;
p = nps.p ;
adv = nps.adv ;

View File

@@ -1159,7 +1159,7 @@ oper
Preposition : Type = {s : Str ; c : Case ; isPost : Bool } ;
-- conjunctions
param Coordinator = And | Or | If | Neither | Because | Comma | Colon | Empty | Missing ; -- Missing means not implemented yet
param Coordinator = Aut | Et | Sed | Si | Vel | Comma | Colon | Empty | Missing ; -- Missing means not implemented yet
oper
Conjunction : Type = { s1 : Str ; s2 : Str ; s3 : Str ; n : Number ; c : Coordinator } ; -- s1 is in the beginning of the coordination phrase, s2 in the middle and s3 is a potential enclitic, s is the prefered number of the coordination phrase and c is the parameter to define which string to put within the phrase
mkConjunction : Str -> Str -> Str -> Number -> Coordinator -> Conjunction =

View File

@@ -11,19 +11,19 @@ concrete StructuralLat of Structural = CatLat **
almost_AdA, almost_AdN = ss "quasi" ; -- L...
although_Subj = ss "quamquam" ; -- L...
always_AdV = ss "semper" ; -- L...
and_Conj = mkConj [] "et" Pl And ; -- L...
and_Conj = mkConj [] "et" Pl Et ; -- L...
-----b and_Conj = ss "and" ** {n = Pl} ;
because_Subj = ss "cum" ; -- L...
before_Prep = mkPrep "ante" Acc ; -- acc. L...
behind_Prep = mkPrep "a tergo" Acc ; -- acc. L...
between_Prep = mkPrep "inter" Acc ; -- acc. L...
both7and_DConj = mkConj "et" "et" Pl And; --L...
both7and_DConj = mkConj "et" "et" Pl Et ; --L...
but_PConj = ss "sed" ; -- L...
by8agent_Prep = mkPrep "per" Abl ; -- L...
by8means_Prep = mkPrep "" Abl ; -- L...
can8know_VV, can_VV = mkVV IrregLat.can_V True ; --L...
during_Prep = mkPrep "inter" Acc ; -- L...
either7or_DConj = mkConj "aut" "aut" Sg Or ; -- L...
either7or_DConj = mkConj "aut" "aut" Sg Aut ; -- L...
everybody_NP = regNP "quisque" "quemque" "cuiusque" "cuique" "quoque" "quisque" Masc Sg ;-- regNP "quisquae" Sg ; -- L...
every_Det = mkDeterminer ( mkA "omnis" ) Pl ; -- Pons
everything_NP = regNP "omnia" "omnia" "omnium" "omnis" "omnis" "omnia" Neutr Pl ; --regNP "omnia" Pl ; -- L...
@@ -55,7 +55,7 @@ concrete StructuralLat of Structural = CatLat **
on_Prep = mkPrep "in" Acc ; -- L...
------ one_Quant = mkDeterminer Sg "one" ; -- DEPRECATED
only_Predet = ss "solum" ; -- L...
or_Conj = mkConj [] "aut" Sg Or ; -- L...
or_Conj = mkConj [] "aut" Sg Aut ; -- L...
otherwise_PConj = ss "praeterea" ; -- Pons
part_Prep = mkPrep [] Gen ; -- Bayer-Lindauer 127
please_Voc = ss "queso" ; -- L...
@@ -113,7 +113,7 @@ concrete StructuralLat of Structural = CatLat **
no_Quant = { s , sp = ( mkA "nullus" ).s ! Posit } ; -- nullus L...
not_Predet = ss "non" ; -- L...
if_then_Conj = mkConj "si" [] Sg If ; -- no word in s2 field L...
if_then_Conj = mkConj "si" [] Sg Si ; -- no word in s2 field L...
at_least_AdN = ss "saltem" ; -- L...
at_most_AdN = ss "summum" ; -- Pons
nobody_NP = regNP "nemo" "neminem" "neminis" "nemini" "nemine" "nemo" Masc Sg ; -- Bayer Lindauer 60.4