1
0
forked from GitHub/gf-rgl

(Romance) mv numForms to CommonRomance; rm from Morpho*

This commit is contained in:
odanoburu
2018-05-09 15:23:10 -03:00
parent 0fcf1d1f66
commit ba094d3af1
4 changed files with 83 additions and 97 deletions

View File

@@ -8,7 +8,7 @@
-- syntax. To build a lexicon, it is better to use $ParadigmsFre$, which
-- gives a higher-level access to this module.
resource MorphoFre = CommonRomance, ResFre **
resource MorphoFre = CommonRomance, ResFre **
open PhonoFre, Prelude, Predef in {
flags optimize=noexpand ;
@@ -24,41 +24,34 @@ oper
--2 Nouns
--
-- The following macro is useful for creating the forms of number-dependent
-- tables, such as common nouns.
numForms : Str -> Str -> Number => Str = \bon,bons ->
table {Sg => bon ; Pl => bons} ;
-- For example, the regular noun forms are defined as follows:
-- regular noun forms are defined as follows:
nomReg : Str -> Number => Str = \bu -> numForms bu (bu + "s") ;
-- Common nouns are inflected in number and have an inherent gender.
CNom = {s : Number => Str ; g : Gender} ;
mkCNom : (Number => Str) -> Gender -> CNom = \mecmecs,gen ->
mkCNom : (Number => Str) -> Gender -> CNom = \mecmecs,gen ->
{s = mecmecs ; g = gen} ;
mkCNomIrreg : Str -> Str -> Gender -> CNom = \mec,mecs ->
mkCNomIrreg : Str -> Str -> Gender -> CNom = \mec,mecs ->
mkCNom (numForms mec mecs) ;
mkCNomReg : Str -> Gender -> CNom = \mec ->
mkCNomReg : Str -> Gender -> CNom = \mec ->
mkCNom (nomReg mec) ;
mkCNomNiveau : Str -> Gender -> CNom = \niveau ->
mkCNomNiveau : Str -> Gender -> CNom = \niveau ->
mkCNomIrreg niveau (niveau + "x") ;
mkCNomCheval : Str -> Gender -> CNom = \cheval ->
let {cheva = Predef.tk 1 cheval} in
mkCNomCheval : Str -> Gender -> CNom = \cheval ->
let {cheva = Predef.tk 1 cheval} in
mkCNomIrreg cheval (cheva + "ux") ;
mkCNomInvar : Str -> Gender -> CNom = \cas ->
mkCNomInvar : Str -> Gender -> CNom = \cas ->
mkCNomIrreg cas cas ;
mkNomReg : Str -> Gender -> CNom = \cas ->
mkNomReg : Str -> Gender -> CNom = \cas ->
let cass = case Predef.dp 2 cas of {
"al" => init cas + "ux" ;
"au" => cas + "x" ;
@@ -72,7 +65,7 @@ oper
}
}
in mkCNomIrreg cas cass ;
--2 Adjectives
--
@@ -97,12 +90,12 @@ oper
})
} ;
adjInvar : Str -> Gender => Number => Str = \bien ->
adjInvar : Str -> Gender => Number => Str = \bien ->
\\_,_ => bien ;
-- Adjectives themselves are records. Here the most common cases:
adjGrand : Str -> Adj = \grand ->
adjGrand : Str -> Adj = \grand ->
let grande = case last grand of {
"e" => grand ;
_ => grand + "e"
@@ -112,32 +105,32 @@ oper
-- Masculine form used for adverbial; also covers "carré".
adjJoli : Str -> Adj = \joli ->
adjJoli : Str -> Adj = \joli ->
mkAdj joli (joli + "s") (joli + "e") (joli + "ment") ;
adjHeureux : Str -> Adj = \heureux ->
let {heureu = Predef.tk 1 heureux} in
let {heureu = Predef.tk 1 heureux} in
mkAdj heureux heureux (heureu+"se") (heureu+"sement") ;
adjBanal : Str -> Adj = \banal ->
let {bana = Predef.tk 1 banal} in
let {bana = Predef.tk 1 banal} in
mkAdj banal (bana + "ux") (banal+"e") (banal+"ement") ;
adjJeune : Str -> Adj = \jeune ->
adjJeune : Str -> Adj = \jeune ->
mkAdj jeune (jeune+"s") jeune (jeune+"ment") ;
adjIndien : Str -> Adj = \indien ->
adjIndien : Str -> Adj = \indien ->
mkAdj indien (indien+"s") (indien+"ne") (indien+"nement") ;
adjTel : Str -> Adj = \tel ->
adjTel : Str -> Adj = \tel ->
mkAdj tel (tel+"s") (tel+"le") (tel+"lement") ;
adjFrancais : Str -> Adj = \francais ->
adjFrancais : Str -> Adj = \francais ->
mkAdj francais francais (francais+"e") (francais+"ement") ;
adjCher : Str -> Adj = \cher ->
let {ch = Predef.tk 2 cher} in
mkAdj cher (cher + "s") (ch + "ère") (ch + "èrement") ;
mkAdj cher (cher + "s") (ch + "ère") (ch + "èrement") ;
adjPublic : Str -> Adj = \public ->
let publique = init public + "que" in
@@ -175,7 +168,7 @@ oper
-- All the eight personal pronouns can be built by the following macro.
-- The use of "en" as atonic genitive is debatable.
mkPronoun : (_,_,_,_,_,_,_ : Str) ->
mkPronoun : (_,_,_,_,_,_,_ : Str) ->
Gender -> Number -> Person -> Pronoun =
\il,le,lui,Lui,son,sa,ses,g,n,p ->
let
@@ -238,8 +231,8 @@ param
TSubj = SPres | SImparf ;
TPart = PPres | PPasse Gender Number ;
VForm = Inf
| Indi Temps Number Person
| Condi Number Person
| Indi Temps Number Person
| Condi Number Person
| Subjo TSubj Number Person
| Imper NumPersI
| Part TPart ;
@@ -247,13 +240,13 @@ param
-- This is a conversion to the type in $CommonRomance$.
oper
vvf : (VForm => Str) -> (VF => Str) = \aller -> table {
vvf : (VForm => Str) -> (VF => Str) = \aller -> table {
VInfin True => case last (aller ! Indi Presn Sg P3) of { --- terrible hack to store the binding here... 30/11/2014
"a" | "e" => bindHyphensT ; -- parle-t-il, va-t-il
_ => bindHyphen -- prend-il
} ;
VInfin False => aller ! Inf ;
VFin (VPres Indic) n p => aller ! Indi Presn n p ;
VFin (VPres Indic) n p => aller ! Indi Presn n p ;
VFin (VPres Subjunct) n p => aller ! Subjo SPres n p ;
VFin (VImperf Indic) n p => aller ! Indi Imparf n p ; --# notpresent
VFin (VImperf Subjunct) n p => aller ! Subjo SImparf n p ; --# notpresent
@@ -269,10 +262,10 @@ oper
-- the worst case
mkVerb12 :
mkVerb12 :
(tenir,tiens,tient,tenons,tenez,tiennent,tienne,tenions,tiensI,tint,tiendra,tenu : Str) -> Verbe =
\tenir,tiens,tient,tenons,tenez,tiennent,tienne,tenions,tiensI,tint,tiendra,tenu ->
let
\tenir,tiens,tient,tenons,tenez,tiennent,tienne,tenions,tiensI,tint,tiendra,tenu ->
let
tiens2 : Str = case tiens of {
_ + "e" => tiens + "s" ;
_ => tiens
@@ -317,7 +310,7 @@ oper
} ;
mkVerb7 : (tenir,tiens,tenons,tiennent,tint,tiendra,tenu : Str) -> Verbe =
\tenir,tiens,tenons,tiennent,tint,tiendra,tenu ->
\tenir,tiens,tenons,tiennent,tint,tiendra,tenu ->
let
tient : Str = case tiens of {
_ + "e" => tiens ;
@@ -389,12 +382,12 @@ oper
}
} ;
affixPlMes : (_,_ : Str) -> Affixe =
affixPlMes : (_,_ : Str) -> Affixe =
\è, â -> lesAffixes (â + "mes") (â + "tes") (è + "rent") ;
affixPasseAi : Number => Affixe = table {
Sg => affixSgAi ;
Pl => affixPlMes "è" "â"
Pl => affixPlMes "è" "â"
} ;
affixPasseS : (i,î : Str) -> Number => Affixe = \i,î -> table {
@@ -421,13 +414,13 @@ oper
affixPasseU : AffixPasse = affixPasse "u" "û" ;
affixPasseNonExist : AffixPasse =
let {aff : Number => Affixe =
affixPasseNonExist : AffixPasse =
let {aff : Number => Affixe =
table {_ => lesAffixes nonExist nonExist nonExist}} in
{ps = aff ; si = aff} ;
affixImper : NumPersI => Str = table {
SgP2 => "e" ;
SgP2 => "e" ;
PlP1 => "ons" ;
PlP2 => "ez"
} ;
@@ -437,7 +430,7 @@ oper
Pl => table {
P3 => v + "ont" ;
p => all + affixPlOns ! p
}
}
} ;
}

View File

@@ -19,9 +19,6 @@ resource MorphoPor = CommonRomance, ResPor **
-- number-dependent tables, such as common nouns.
oper
numForms : (_,_ : Str) -> Number => Str = \campus, campi ->
table {Sg => campus ; Pl => campi} ;
-- For example:
nomVinho : Str -> Number => Str = \vinho ->
numForms vinho (vinho + "s") ;

View File

@@ -24,8 +24,8 @@ param
Direct = DDir | DInv ;
-- Adjectives are inflected in gender and number, and there is also an
-- adverbial form (e.g. "infiniment"), which has different paradigms and
-- Adjectives are inflected in gender and number, and there is also an
-- adverbial form (e.g. "infiniment"), which has different paradigms and
-- can even be irregular ("bien").
-- Comparative adjectives are moreover inflected in degree
-- (which in Romance is usually syntactic, though).
@@ -61,18 +61,18 @@ oper
AF g n => aagr g n ;
_ => aagr Masc Sg -- "le plus lentement"
} ;
conjGender : Gender -> Gender -> Gender = \m,n ->
conjGender : Gender -> Gender -> Gender = \m,n ->
case m of {
Fem => n ;
_ => Masc
_ => Masc
} ;
--3 Verbs
--3 Verbs
--
-- In the current syntax, we use
-- a reduced conjugation with only the present tense infinitive,
-- In the current syntax, we use
-- a reduced conjugation with only the present tense infinitive,
-- indicative, subjunctive, and imperative forms.
-- But our morphology has full Bescherelle conjunctions:
-- so we use a coercion between full and reduced verbs.
@@ -84,17 +84,17 @@ oper
-- For Italian contracted forms, $VInfin$ should have
-- an alternative form, whose proper place is $Diff$.
param
param
VF =
VInfin Bool
| VFin TMood Number Person
| VImper NumPersI
| VPart Gender Number
| VFin TMood Number Person
| VImper NumPersI
| VPart Gender Number
| VGer
| VPresPart --- = VGer except in Italian
;
TMood =
TMood =
VPres Mood
| VImperf Mood --# notpresent
| VPasse --# notpresent
@@ -111,7 +111,7 @@ param
| VPInfinit Anteriority Bool ;
RTense =
RPres
RPres
| RPast --# notpresent
| RPasse --# notpresent
| RFut --# notpresent
@@ -129,7 +129,7 @@ oper
verbAgr : Agr -> {g : Gender ; n : Number ; p : Person} = \a -> a ;
conjAgr : Agr -> Agr -> Agr = \a,b ->
conjAgr : Agr -> Agr -> Agr = \a,b ->
{g = conjGender a.g b.g ; n = conjNumber a.n b.n ; p = conjPerson a.p b.p} ;
Ag : Gender -> Number -> Person -> Agr = \g,n,p -> {g = g ; n = n ; p = p} ;
@@ -137,11 +137,11 @@ oper
-- The imperative forms depend on number and person.
vImper : Number -> Person -> VF = \n,p -> case <n,p> of {
<Sg,P2> => VImper SgP2 ;
<Pl,P1> => VImper PlP1 ;
<Sg,P2> => VImper SgP2 ;
<Pl,P1> => VImper PlP1 ;
<Pl,P2> => VImper PlP2 ;
_ => VFin (VPres Conjunct) n p
} ;
} ;
{-
param
@@ -201,9 +201,14 @@ oper
oper
genForms : Str -> Str -> Gender => Str = \bon,bonne ->
table {
Masc => bon ;
Masc => bon ;
Fem => bonne
} ;
} ;
-- The following macro is useful for creating the forms of
-- number-dependent tables, such as common nouns.
numForms : (_,_ : Str) -> Number => Str = \campus, campi ->
table {Sg => campus ; Pl => campi} ;
aagrForms : (x1,_,_,x4 : Str) -> (AAgr => Str) = \tout,toute,tous,toutes ->
table {
@@ -215,7 +220,7 @@ oper
Adj = {s : AForm => Str} ;
appVPAgr : VPAgr -> AAgr -> AAgr = \vp,agr ->
appVPAgr : VPAgr -> AAgr -> AAgr = \vp,agr ->
case vp of {
VPAgrSubj => agr ;
VPAgrClit g n => {g = g ; n = n}
@@ -232,13 +237,12 @@ oper
bindIf : Bool -> Str = \b -> if_then_Str b BIND [] ;
param
VPAgr =
VPAgr =
VPAgrSubj -- elle est partie, elle s'est vue
| VPAgrClit Gender Number ; -- elle a dormi; elle les a vues
-- Polarity: three values (Fre positive,ne-pas,ne), presence of polarity element line "aucun"
param RPolarity = RPos | RNeg Bool ; -- RNeg True = "ne", RNeg False = "ne - pas"
param RPolarity = RPos | RNeg Bool ; -- RNeg True = "ne", RNeg False = "ne - pas"
}

View File

@@ -8,7 +8,7 @@
-- syntax. To build a lexicon, it is better to use $ParadigmsSpa$, which
-- gives a higher-level access to this module.
resource MorphoSpa = CommonRomance, ResSpa **
resource MorphoSpa = CommonRomance, ResSpa **
open PhonoSpa, Prelude, Predef,
CatSpa in {
@@ -17,20 +17,12 @@ resource MorphoSpa = CommonRomance, ResSpa **
--2 Nouns
--
-- The following macro is useful for creating the forms of number-dependent
-- tables, such as common nouns.
oper
numForms : (_,_ : Str) -> Number => Str = \vino, vini ->
table {Sg => vino ; Pl => vini} ;
-- For example:
nomVino : Str -> Number => Str = \vino ->
nomVino : Str -> Number => Str = \vino ->
numForms vino (vino + "s") ;
nomPilar : Str -> Number => Str = \pilar ->
nomPilar : Str -> Number => Str = \pilar ->
numForms pilar (pilar + "es") ;
nomTram : Str -> Number => Str = \tram ->
@@ -38,10 +30,10 @@ oper
-- Common nouns are inflected in number and have an inherent gender.
mkNoun : (Number => Str) -> Gender -> Noun = \mecmecs,gen ->
mkNoun : (Number => Str) -> Gender -> Noun = \mecmecs,gen ->
{s = mecmecs ; g = gen} ;
mkNounIrreg : Str -> Str -> Gender -> Noun = \mec,mecs ->
mkNounIrreg : Str -> Str -> Gender -> Noun = \mec,mecs ->
mkNoun (numForms mec mecs) ;
mkNomReg : Str -> Noun = \mec ->
@@ -75,15 +67,15 @@ oper
-- Then the regular and invariant patterns.
adjSolo : Str -> Adj = \solo ->
let
adjSolo : Str -> Adj = \solo ->
let
sol = Predef.tk 1 solo
in
mkAdj solo (sol + "a") (sol + "os") (sol + "as") (sol + "amente") ;
-- masculine and feminine are identical:
-- masculine and feminine are identical:
-- adjectives ending with -e, -a and many but not all that end in a consonant
adjUtil : Str -> Str -> Adj = \util,utiles ->
adjUtil : Str -> Str -> Adj = \util,utiles ->
mkAdj util util utiles utiles (util + "mente") ;
-- adjectives that end in consonant but have different masc and fem forms
@@ -91,15 +83,15 @@ oper
adjEspanol : Str -> Str -> Adj = \espanol,espanola ->
mkAdj espanol espanola (espanol + "es") (espanol + "as") (espanola + "mente") ;
adjBlu : Str -> Adj = \blu ->
mkAdj blu blu blu blu blu ; ---
adjBlu : Str -> Adj = \blu ->
mkAdj blu blu blu blu blu ; ---
-- francés francesa franceses francesas
adjEs : Str -> Adj = \francEs ->
let franc : Str = Predef.tk 2 francEs ;
frances : Str = franc + "es" ;
in mkAdj francEs (frances + "a") (frances + "es") (frances + "as") (frances + "amente") ;
-- alemán alemana alemanes alemanas
adjVn : Str -> Adj = \alemAn ->
@@ -117,7 +109,7 @@ oper
in mkAdj alemAn (alemVn + "a") (alemVn + "es")
(alemVn + "as") (alemVn + "amente") ;
mkAdjReg : Str -> Adj = \solo ->
mkAdjReg : Str -> Adj = \solo ->
case solo of {
_ + "o" => adjSolo solo ;
_ + ("e" | "a") => adjUtil solo (solo + "s") ;
@@ -132,7 +124,7 @@ oper
-- The use of "ne" as atonic genitive is debatable.
-- We follow the rule that the atonic nominative is empty.
mkPronoun : (_,_,_,_,_,_,_,_ : Str) ->
mkPronoun : (_,_,_,_,_,_,_,_ : Str) ->
Gender -> Number -> Person -> Pronoun =
\il,le,lui,Lui,son,sa,ses,see,g,n,p ->
let
@@ -148,7 +140,7 @@ oper
<Sg,Masc> => son ;
<Sg,Fem> => sa ;
<Pl,Masc> => ses ;
<Pl,Fem> => see
<Pl,Fem> => see
} ;
a = Ag g n p ;
@@ -169,7 +161,7 @@ oper
} ;
mkQuantifier : (ese,esa,esos,esas : Str) -> Quant = \ese,esa,esos,esas->
let
let
se : Str = Predef.drop 1 ese ;
sa : Str = Predef.drop 1 esa ;
sos : Str = Predef.drop 1 esos ;
@@ -177,7 +169,7 @@ oper
E : Str = "é" ;
attrforms : Number => Gender => Case => Str = table {
Sg => \\g,c => prepCase c ++ genForms ese esa ! g ;
Pl => \\g,c => prepCase c ++ genForms esos esas ! g ----
Pl => \\g,c => prepCase c ++ genForms esos esas ! g ----
} ;
npforms : Number => Gender => Case => Str = table {
Sg => \\g,c => prepCase c ++ genForms (E + se) (E + sa) ! g ;
@@ -195,7 +187,7 @@ oper
s2 = [] ;
isNeg = neg
} ;
mkIDet : (cuantos, cuantas : Str) -> Number -> IDet = \cuantos,cuantas,number ->
lin IDet {
s = \\g,c => prepCase c ++ genForms cuantos cuantas ! g ;