mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 08:58:55 -06:00
make CompoundN more flexible
This commit is contained in:
@@ -10,7 +10,7 @@ flags
|
||||
oper
|
||||
regFN : Str -> N = \s -> femN (regN s) ;
|
||||
regMN : Str -> N = \s -> regN s ;
|
||||
irregMN : Str -> Str -> N = \pa,pans -> M.mkNounIrreg pa pans masculine ** {lock_N=<>} ;
|
||||
irregMN : Str -> Str -> N = \pa,pans -> M.mkNounIrreg pa pans masculine ** {relType=D.NRelPrep D.P_de; lock_N=<>} ;
|
||||
saberV : V = verbV (saber_99 "saber") ;
|
||||
|
||||
lin
|
||||
|
||||
@@ -348,11 +348,11 @@ oper
|
||||
mkPrep p = {s = p ; c = Acc ; isDir = False ; lock_Prep = <>} ;
|
||||
|
||||
|
||||
mk2N x y g = mkNounIrreg x y g ** {lock_N = <>} ;
|
||||
regN x = mkNomReg x ** {lock_N = <>} ;
|
||||
compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ;
|
||||
femN x = {s = x.s ; g = feminine ; lock_N = <>} ;
|
||||
mascN x = {s = x.s ; g = masculine ; lock_N = <>} ;
|
||||
mk2N x y g = mkNounIrreg x y g ** {relType = NRelPrep P_de; lock_N = <>} ;
|
||||
regN x = mkNomReg x ** {relType = NRelPrep P_de; lock_N = <>} ;
|
||||
compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; relType = x.relType ; lock_N = <>} ;
|
||||
femN x = x ** {g = feminine} ;
|
||||
mascN x = x ** {g = masculine} ;
|
||||
|
||||
mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ;
|
||||
deN2 n = mkN2 n genitive ;
|
||||
@@ -525,7 +525,7 @@ oper
|
||||
|
||||
mkN = overload {
|
||||
mkN : (llum : Str) -> N = regN ;
|
||||
mkN : Str -> Gender -> N = \s,g -> {s = (regN s).s ; g = g ; lock_N = <>};
|
||||
mkN : Str -> Gender -> N = \s,g -> (regN s) ** {g = g};
|
||||
mkN : (disc,discos : Str) -> Gender -> N = mk2N
|
||||
} ;
|
||||
regN : Str -> N ;
|
||||
|
||||
@@ -59,7 +59,16 @@ lin ApposNP np1 np2 = np1 ** { -- guessed by KA
|
||||
} ;
|
||||
} ;
|
||||
|
||||
lin CompoundN a b = lin N {s = \\n => b.s ! n ++ a.s ! Sg ; g = b.g} ; -- connessione internet = internet connection
|
||||
lin CompoundN a b = lin N {
|
||||
s = \\n => b.s ! n ++
|
||||
case b.relType of {
|
||||
NRelPrep p => prepCase (CPrep p) ; -- tasa de suicidio
|
||||
NRelNoPrep => [] -- connessione internet = internet connection
|
||||
} ++
|
||||
a.s ! Sg ;
|
||||
g = b.g ;
|
||||
relType = b.relType
|
||||
} ;
|
||||
|
||||
lin UseDAP = \dap ->
|
||||
let
|
||||
|
||||
@@ -393,16 +393,16 @@ oper
|
||||
regGenN : Str -> Gender -> N ;
|
||||
regN : Str -> N ;
|
||||
mk2N : (oeil,yeux : Str) -> Gender -> N ;
|
||||
mk2N x y g = mkCNomIrreg x y g ** {lock_N = <>} ;
|
||||
mk2N x y g = mkCNomIrreg x y g ** {relType = NRelPrep P_de; lock_N = <>} ;
|
||||
regN x = regGenN x g where {
|
||||
g = case <x : Str> of {
|
||||
_ + ("e" | "ion") => Fem ;
|
||||
_ => Masc
|
||||
}
|
||||
} ;
|
||||
regGenN x g = mkNomReg x g ** {lock_N = <>} ;
|
||||
regGenN x g = mkNomReg x g ** {relType = NRelPrep P_de; lock_N = <>} ;
|
||||
compN : N -> Str -> N ;
|
||||
compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ;
|
||||
compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; relType = NRelPrep P_de ; lock_N = <>} ;
|
||||
|
||||
mkN = overload {
|
||||
mkN : Str -> N = regN ;
|
||||
|
||||
@@ -378,11 +378,11 @@ oper
|
||||
in_Prep = {s = [] ; c = CPrep P_in ; isDir = False ; lock_Prep = <>} ;
|
||||
su_Prep = {s = [] ; c = CPrep P_su ; isDir = False ; lock_Prep = <>} ;
|
||||
|
||||
mk2N x y g = mkNounIrreg x y g ** {lock_N = <>} ;
|
||||
regN x = mkNomReg x ** {lock_N = <>} ;
|
||||
compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ;
|
||||
femN x = {s = x.s ; g = feminine ; lock_N = <>} ;
|
||||
mascN x = {s = x.s ; g = masculine ; lock_N = <>} ;
|
||||
mk2N x y g = mkNounIrreg x y g ** {relType=NRelPrep P_da; lock_N = <>} ;
|
||||
regN x = mkNomReg x ** {relType=NRelPrep P_da; lock_N = <>} ;
|
||||
compN x y = x ** {s = \\n => x.s ! n ++ y} ;
|
||||
femN x = {s = x.s ; g = feminine ; relType=NRelPrep P_da; lock_N = <>} ;
|
||||
mascN x = {s = x.s ; g = masculine ; relType=NRelPrep P_da; lock_N = <>} ;
|
||||
|
||||
|
||||
mk2N2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ;
|
||||
@@ -518,7 +518,7 @@ oper
|
||||
|
||||
mkN = overload {
|
||||
mkN : (cane : Str) -> N = regN ;
|
||||
mkN : (carne : Str) -> Gender -> N = \n,g -> {s = (regN n).s ; g = g ; lock_N = <>} ;
|
||||
mkN : (carne : Str) -> Gender -> N = \n,g -> (regN n) ** {g = g} ;
|
||||
mkN : (uomo,uomini : Str) -> Gender -> N = mk2N ;
|
||||
mkN : N -> Str -> N = compN
|
||||
} ;
|
||||
|
||||
@@ -67,10 +67,14 @@ concrete ExtendPor of Extend = CatPor ** ExtendRomanceFunctor -
|
||||
|
||||
lin
|
||||
CompoundN noun noun2 = { -- order is different because that's needed for correct translation from english
|
||||
s = \\n => noun2.s ! n
|
||||
++ variants {"de" ; genForms "do" "da" ! noun.g}
|
||||
++ noun.s ! Sg ;
|
||||
g = noun2.g
|
||||
s = \\n => noun2.s ! n ++
|
||||
case noun2.relType of {
|
||||
NRelPrep p => artDef True noun.g Sg (CPrep p) ; -- tasa de suicidio
|
||||
NRelNoPrep => [] -- connessione internet = internet connection
|
||||
} ++
|
||||
noun.s ! Sg ;
|
||||
g = noun2.g ;
|
||||
relType = noun2.relType
|
||||
} ;
|
||||
|
||||
CompoundAP noun adj = {
|
||||
|
||||
@@ -102,7 +102,7 @@ oper
|
||||
--2 Nouns
|
||||
|
||||
regN : Str -> N ; --%
|
||||
regN x = lin N (mkNomReg x) ;
|
||||
regN x = lin N (mkNomReg x ** {relType=NRelPrep P_de}) ;
|
||||
|
||||
femN : N -> N ; --%
|
||||
femN n = n ** {g = feminine} ;
|
||||
@@ -111,7 +111,7 @@ oper
|
||||
mascN n = n ** {g = masculine} ;
|
||||
|
||||
mk2N : (bastão, bastões : Str) -> Gender -> N ; --%
|
||||
mk2N x y g = lin N (mkNounIrreg x y g) ;
|
||||
mk2N x y g = lin N (mkNounIrreg x y g ** {relType=NRelPrep P_de}) ;
|
||||
|
||||
-- The regular function takes the singular form and the gender, and
|
||||
-- computes the plural and the gender by a heuristic (see MorphoPor
|
||||
|
||||
@@ -110,9 +110,9 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol,MU]
|
||||
A = {s : AForm => Str ; compar : ComparAgr => Str ; isPre : Bool ; copTyp : CopulaType ; isDeg : Bool} ;
|
||||
A2 = {s : AForm => Str ; compar : ComparAgr => Str ; c2 : Compl ; copTyp : CopulaType ; isDeg : Bool} ;
|
||||
|
||||
N = Noun ;
|
||||
N2 = Noun ** {c2 : Compl} ;
|
||||
N3 = Noun ** {c2,c3 : Compl} ;
|
||||
N = Noun ** {relType : NRelType};
|
||||
N2 = Noun ** {relType : NRelType; c2 : Compl} ;
|
||||
N3 = Noun ** {relType : NRelType; c2,c3 : Compl} ;
|
||||
GN, PN = {s : Str ; g : Gender} ;
|
||||
SN = {s : Gender => Str ; pl : Str} ;
|
||||
LN = {s : Str;
|
||||
|
||||
@@ -140,6 +140,8 @@ interface DiffRomance = open CommonRomance, Prelude in {
|
||||
param
|
||||
Case = Nom | Acc | CPrep Prepos ;
|
||||
|
||||
NRelType = NRelPrep Prepos | NRelNoPrep ; -- How do build a compound noun
|
||||
|
||||
oper
|
||||
Verb = {s : VF => Str ; vtyp : VType ; p : Str} ;
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ incomplete concrete ExtendRomanceFunctor of Extend =
|
||||
ExistPluralCN cn = ExistNP (DetCN (DetQuant IndefArt NumPl) cn) ;
|
||||
AdvIsNP adv np = mkClause adv.s False False np.a (UseComp_estar (CompNP np)) ;
|
||||
AdvIsNPAP adv np ap = -- <aquí:Adv> está <documentada:AP> <la examinación:NP>
|
||||
let emptyN : N = lin N {s = \\_ => [] ; g = np.a.g} ; -- To match the gender of the N
|
||||
let emptyN : N = lin N {s = \\_ => [] ; relType = NRelNoPrep ; g = np.a.g} ; -- To match the gender of the N
|
||||
indef : Quant = IndefArt ** {s = \\b,n,g,c => []} ;
|
||||
det : Det = case np.a.n of {Sg => DetQuant indef NumSg ; Pl => DetQuant indef NumPl} ;
|
||||
apAsNP : NP = DetCN det (AdjCN ap (UseN emptyN)) ; -- NP where the string comes only from AP
|
||||
@@ -166,7 +166,16 @@ incomplete concrete ExtendRomanceFunctor of Extend =
|
||||
ComplGenVV = variants {} ; -- VV -> Ant -> Pol -> VP -> VP ; -- want not to have slept
|
||||
ComplSlashPartLast = ComplSlash ;
|
||||
|
||||
CompoundN a b = lin N {s = \\n => b.s ! n ++ a.s ! Sg ; g = b.g} ; -- connessione internet = internet connection
|
||||
CompoundN a b = lin N {
|
||||
s = \\n => b.s ! n ++
|
||||
case b.relType of {
|
||||
NRelPrep p => prepCase (CPrep p) ; -- tasa de suicidio
|
||||
NRelNoPrep => [] -- connessione internet = internet connection
|
||||
} ++
|
||||
a.s ! Sg ;
|
||||
g = b.g ;
|
||||
relType = b.relType
|
||||
} ;
|
||||
CompoundAP = variants {} ; -- N -> A -> AP ; -- language independent / language-independent
|
||||
|
||||
lin
|
||||
|
||||
@@ -158,11 +158,13 @@ incomplete concrete NounRomance of Noun =
|
||||
ComplN2 f x = {
|
||||
s = \\n => f.s ! n ++ appCompl f.c2 x ;
|
||||
g = f.g ;
|
||||
relType = f.relType
|
||||
} ;
|
||||
|
||||
ComplN3 f x = {
|
||||
s = \\n => f.s ! n ++ appCompl f.c2 x ;
|
||||
g = f.g ;
|
||||
relType = f.relType ;
|
||||
c2 = f.c3
|
||||
} ;
|
||||
|
||||
|
||||
@@ -73,10 +73,14 @@ concrete ExtendSpa of Extend = CatSpa ** ExtendRomanceFunctor -
|
||||
(predV (mkV "existir"))) ;
|
||||
|
||||
CompoundN noun noun2 = { -- order is different because that's needed for correct translation from english
|
||||
s = \\n => noun2.s ! n
|
||||
++ variants {"de" ; genForms "del" "de la" ! noun.g}
|
||||
++ noun.s ! Sg ;
|
||||
g = noun2.g
|
||||
s = \\n => noun2.s ! n ++
|
||||
case noun2.relType of {
|
||||
NRelPrep p => prepCase (CPrep p) ; -- tasa de suicidio
|
||||
NRelNoPrep => [] -- connessione internet = internet connection
|
||||
} ++
|
||||
noun.s ! Sg ;
|
||||
g = noun2.g ;
|
||||
relType = noun2.relType
|
||||
} ;
|
||||
|
||||
CompoundAP noun adj = {
|
||||
|
||||
@@ -380,11 +380,11 @@ oper
|
||||
} ;
|
||||
|
||||
|
||||
mk2N x y g = mkNounIrreg x y g ** {lock_N = <>} ;
|
||||
regN x = mkNomReg x ** {lock_N = <>} ;
|
||||
compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ;
|
||||
femN x = {s = x.s ; g = feminine ; lock_N = <>} ;
|
||||
mascN x = {s = x.s ; g = masculine ; lock_N = <>} ;
|
||||
mk2N x y g = mkNounIrreg x y g ** {relType=NRelPrep P_de; lock_N = <>} ;
|
||||
regN x = mkNomReg x ** {relType=NRelPrep P_de; lock_N = <>} ;
|
||||
compN x y = x ** {s = \\n => x.s ! n ++ y} ;
|
||||
femN x = {s = x.s ; g = feminine ; relType=NRelPrep P_de; lock_N = <>} ;
|
||||
mascN x = {s = x.s ; g = masculine ; relType=NRelPrep P_de; lock_N = <>} ;
|
||||
|
||||
mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ;
|
||||
deN2 n = mkN2 n genitive ;
|
||||
@@ -550,7 +550,7 @@ oper
|
||||
|
||||
mkN = overload {
|
||||
mkN : (luz : Str) -> N = regN ;
|
||||
mkN : Str -> Gender -> N = \s,g -> {s = (regN s).s ; g = g ; lock_N = <>};
|
||||
mkN : Str -> Gender -> N = \s,g -> (regN s) ** {g = g};
|
||||
mkN : (baston,bastones : Str) -> Gender -> N = mk2N ;
|
||||
mkN : N -> Str -> N = compN ;
|
||||
} ;
|
||||
|
||||
Reference in New Issue
Block a user