(Romance) Move AForm from Common to Diff

Por,Ita: no attributive. Fre,Cat: only Sg M, Spa: Sg M+F
This commit is contained in:
Inari Listenmaa
2021-09-17 09:52:24 +08:00
parent ef3270ae29
commit 354990319d
3 changed files with 26 additions and 62 deletions

View File

@@ -133,8 +133,8 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol]
NP = \np -> (np.s ! Nom).comp ;
Conj = \c -> c.s2 ;
A = \a -> a.s ! ASg Masc APred ;
A2 = \a -> a.s ! ASg Masc APred ++ a.c2.s ;
A = \a -> a.s ! genNum2Aform Masc Sg ;
A2 = \a -> a.s ! genNum2Aform Masc Sg ++ a.c2.s ;
N = \n -> n.s ! Sg ;
N2 = \n -> n.s ! Sg ++ n.c2.s ;

View File

@@ -30,9 +30,12 @@ param
-- Comparative adjectives are moreover inflected in degree
-- (which in Romance is usually syntactic, though).
AForm = ASg Gender APosition | APl Gender | AA ;
-- AForm = AF Gender Number | AA ;
-- IL 2021-09: Moved AForm from Common to Diff, because of differences between languages in
-- attributive and predicative forms: e.g. Spanish "un/a gran __" vs. "__ es grande".
-- Ita,Por have no distinction, Fre,Cat have special form only in masc. sg, Spa also for fem. sg.
APosition = AAttr | APred ;
-- Gender is not morphologically determined for first and second person pronouns.
@@ -42,17 +45,6 @@ param
CardOrd = NCard Gender | NOrd Gender Number ;
--- a workaround for a lost constructor used e.g. in Attempto: AR 2019-09-11
oper
AF : Gender -> Number -> AForm = \g,n -> case n of {Sg => ASg g AAttr ; Pl => APl g} ;
-- helper functions for comparative/superlative forms
oper
af2num : AForm -> Number = \af -> case af of {
APl _ => Pl ;
_ => Sg -- singular and adverbial use Sg form. As of 2021, there are no funs from AP to Adv, so it doesn't matter.
} ;
-- The following coercions are useful:
oper
@@ -61,46 +53,6 @@ oper
PNoGen => variants {Masc ; Fem} --- the best we can do for je, tu, nous, vous
} ;
-- genderpos2gender : GenderPosition -> {p1:Gender,p2:Number} = \gp -> case gp of {
-- MascSg _ => <Masc,Sg> ;
-- MascPl => <Masc,Pl> ;
-- FemSg => <Fem,Sg> ;
-- FemPl => <Fem,Pl>
-- } ;
aform2gender : AForm -> Gender = \a -> case a of {
ASg g _ => g ;
APl g => g ;
_ => Masc -- "le plus lentement"
} ;
aform2number : AForm -> Number = \a -> case a of {
APl _ => Pl ;
_ => Sg -- "le plus lentement"
} ;
aform2aagr : AForm -> AAgr = \a -> case a of {
ASg g _ => aagr g Sg ;
APl g => aagr g Pl ;
_ => aagr Masc Sg -- "le plus lentement"
} ;
aagr2aform : AAgr -> AForm = \gn -> case gn of {
{g=g ; n=Sg} => ASg g APred ;
{g=g ; n=Pl} => APl g
} ;
genNum2Aform : Gender -> Number -> AForm ;
genNum2Aform g n = case n of {
Sg => ASg g APred ;
Pl => APl g
} ;
genNumPos2Aform : Gender -> Number -> Bool -> AForm ;
genNumPos2Aform g n isPre = case n of {
Sg => ASg g (if_then_else APosition isPre AAttr APred) ;
Pl => APl g
} ;
conjGender : Gender -> Gender -> Gender = \m,n ->
case m of {
Fem => n ;
@@ -263,8 +215,6 @@ oper
Noun = {s : Number => Str ; g : Gender} ;
Adj = {s : AForm => Str} ;
appVPAgr : VPAgr -> AAgr -> AAgr = \vp,agr ->
case vp of {
VPAgrSubj => agr ;
@@ -274,8 +224,6 @@ oper
vpAgrNone : VPAgr = VPAgrClit Masc Sg ;
oper
mkOrd : Adj -> {s : AAgr => Str} ;
mkOrd x = {s = \\ag => x.s ! aagr2aform ag } ;
-- This is used in Spanish and Italian to bind clitics with preceding verb.

View File

@@ -59,12 +59,28 @@ interface DiffRomance = open CommonRomance, Prelude in {
oper serCopula : CopulaType ;
oper estarCopula : CopulaType ;
-- Whether comparatives and superlatives inflect in only number, or also in gender: el/la mejor, but le meilleur, la meilleure
oper ComparAgr : PType = Number ; -- except Fre, where it's Number and Gender
-- Adjective and AForm, two things:
-- 1) Whether AForm has different attributive forms:
-- e.g. un bon amic (Cat), una gran parte (Spa) vs. predicative bo/bona, grande
oper AForm : PType ;
oper Adj : Type = {s : AForm => Str} ;
oper mkOrd : Adj -> {s : AAgr => Str} = \x -> {s = \\ag => x.s ! aagr2aform ag} ;
oper af2compar : AForm -> ComparAgr = af2num ; -- except Fre
oper aform2aagr : AForm -> AAgr ;
oper aform2gender : AForm -> Gender = \af -> (aform2aagr af).g ;
oper aform2number : AForm -> Number = \af -> (aform2aagr af).n ;
oper aagr2aform : AAgr -> AForm = \a -> genNum2Aform a.g a.n ;
oper genNum2Aform : Gender -> Number -> AForm ;
oper genNumPos2Aform : Gender -> Number -> Bool -> AForm ; -- depends on language, whether attributive is different from predicative
-- 2) Whether comparatives and superlatives inflect in only number, or also in gender:
-- e.g. el/la mejor, but le meilleur, la meilleure
oper ComparAgr : PType = Number ; -- except Fre, where it's Number and Gender
oper af2compar : AForm -> ComparAgr = aform2number ; -- except Fre
oper aagr2compar : AAgr -> ComparAgr = \a -> a.n ; -- except Fre
-- To decide if adverbial questions are inverted
oper iAdvQuestionInv : Direct = DInv ; -- except Fre