mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-07-02 03:58:34 -06:00
(Por) improve adjective smart paradigms
- make it about guessing feminine form from the lemma (masculine form) - this way one can reuse the noun paradigm in the adjective paradigms, simplifying it and improving it at the same time - add cases for 'mente' obs: works but doesn't compile?
This commit is contained in:
+29
-64
@@ -157,75 +157,40 @@ oper
|
||||
}
|
||||
} ;
|
||||
|
||||
mkAdj2 : (_,_: Str) -> Adj ;
|
||||
mkAdj2 aj av = let
|
||||
adj = mkAdjReg aj
|
||||
in {
|
||||
s = table {
|
||||
ASg g _ => adj.s ! ASg g APred ;
|
||||
APl g => adj.s ! APl g ;
|
||||
AA => av
|
||||
mkAdj4 : (_,_,_,_ : Str) -> Adj ;
|
||||
mkAdj4 ms fs mp fp = {
|
||||
s = table {
|
||||
ASg g _ => genForms ms fs ! g ;
|
||||
APl g => genForms mp fp ! g ;
|
||||
AA => case fs of {
|
||||
exeg + v@("é"|"á"|"í"|"ó"|"ú"|"ê"|"ô") + tica
|
||||
=> exeg + (diacriticToVowel v) + tica + "mente" ;
|
||||
|
||||
comu + "m" => comu + "mente" ; -- for Brazilian Portuguese
|
||||
|
||||
_ => fs + "mente"
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
-- Then the regular and invariant patterns.
|
||||
mkAdjFromNouns : Noun -> Noun -> Adj ;
|
||||
mkAdjFromNouns nm nf = mkAdj4 (nm.s ! Sg) (nf.s ! Sg) (nm.s ! Pl) (nf.s ! Pl) ;
|
||||
|
||||
adjPreto : Str -> Adj = \preto ->
|
||||
let
|
||||
pret = Predef.tk 1 preto
|
||||
in
|
||||
mkAdj preto (pret + "a") (pret + "os") (pret + "as") (pret + "amente") ;
|
||||
|
||||
-- masculine and feminine are identical:
|
||||
-- adjectives ending with -e, -a and many but not all that end in a
|
||||
-- consonant
|
||||
adjUtil : Str -> Str -> Adj = \útil,úteis ->
|
||||
mkAdj útil útil úteis úteis (útil + "mente") ;
|
||||
|
||||
-- adjectives that end in consonant but have different masc and fem
|
||||
-- forms español, hablador ...
|
||||
adjOuvidor : Str -> Str -> Adj = \ouvidor,ouvidora ->
|
||||
mkAdj ouvidor ouvidora (ouvidor + "es") (ouvidor + "as") (ouvidora + "mente") ;
|
||||
|
||||
adjBlu : Str -> Adj = \blu ->
|
||||
mkAdj blu blu blu blu blu ; --- blasé
|
||||
|
||||
-- francês francesa franceses francesas
|
||||
adjFrances : Str -> Adj = \francês ->
|
||||
let franc : Str = Predef.tk 2 francês ;
|
||||
frances : Str = franc + "es" ;
|
||||
in mkAdj francês (frances + "a") (frances + "es") (frances + "as") (frances + "amente") ;
|
||||
|
||||
|
||||
-- alemão alemã alemães alemãs
|
||||
-- is there really a need for this? is it as useful as the spanish
|
||||
-- one?
|
||||
adjVo : Str -> Adj = \alemão ->
|
||||
let alemã : Str = init alemão ;
|
||||
alem : Str = init alemã ;
|
||||
ã : Str = last alemã ;
|
||||
v : Str = case ã of {
|
||||
"ã" => "a"
|
||||
} ;
|
||||
alemvo : Str = alem + v + "o" ;
|
||||
in mkAdj alemão alemã (alemã + "s") (alemã + "es") (alemã + "mente") ;
|
||||
|
||||
adjEuropeu : Str -> Adj = \europeu -> let europe = init europeu in
|
||||
mkAdj europeu (europe + "ia") (europeu + "s") (europe + "ias")
|
||||
(europe + "iamente") ;
|
||||
mkAdjReg2 : Str -> Str -> Adj ;
|
||||
mkAdjReg2 ms fs = mkAdjFromNouns (mkNomReg ms) (mkNomReg fs) ;
|
||||
|
||||
-- smart paradigm for adjectives amounts to guessing the feminine
|
||||
-- form from the masculine form given, and then using the noun smart
|
||||
-- paradigm for the plural forms
|
||||
mkAdjReg : Str -> Adj = \a ->
|
||||
case a of {
|
||||
pret + "o" => adjPreto a ;
|
||||
anarquist + v@("e" | "a") => adjUtil a (a + "s") ;
|
||||
ouvido + "r" => adjOuvidor a (ouvido + "ra") ;
|
||||
chin + "ês" => adjFrances a ;
|
||||
europ + "eu" => adjEuropeu a ;
|
||||
alem + "ão" => adjVo a ;
|
||||
provav + v@("e" | "i") + "l" => adjUtil a (provav + "eis") ; -- fails at pueril
|
||||
nomina + "l" => adjUtil a (nomina + "is") ;
|
||||
jove + "m" => adjUtil a (jove + "ns") ;
|
||||
_ => adjUtil a (a + "s")
|
||||
let mkAdj : Str -> Adj = mkAdjReg2 a ;
|
||||
in case a of {
|
||||
alem + "ão" => mkAdj (alem + "ã") ; -- fails for patrão/patroa
|
||||
pret + "o" => mkAdj (pret + "a") ;
|
||||
ouvido + "r" => mkAdj (ouvido + "ra") ;
|
||||
chin + "ês" => mkAdj (chin + "esa") ;
|
||||
europ + "eu" => mkAdj (europ + "eia") ;
|
||||
_ => mkAdj a
|
||||
} ;
|
||||
|
||||
--2 Personal pronouns
|
||||
@@ -314,4 +279,4 @@ oper
|
||||
n = number
|
||||
} ;
|
||||
|
||||
}
|
||||
} ;
|
||||
|
||||
Reference in New Issue
Block a user