From 7ddf9650610b42444b9ea2c19159a40218714b29 Mon Sep 17 00:00:00 2001 From: aarne Date: Fri, 12 Sep 2014 11:59:50 +0000 Subject: [PATCH] separate independent (NP without CN) forms of IndefArt and DefArt in Romance languages. The choice of words was unsure in some cases, but at least this eliminates the problem of empty NP's translating to "ones". --- lib/src/catalan/DiffCat.gf | 17 ++++++++++++----- lib/src/french/DiffFre.gf | 10 +++++----- lib/src/italian/DiffIta.gf | 29 ++++++++++++++++++++--------- lib/src/romance/DiffRomance.gf | 4 ++-- lib/src/romance/NounRomance.gf | 10 +++++----- lib/src/romance/SymbolRomance.gf | 2 +- lib/src/romance/VerbRomance.gf | 2 +- lib/src/spanish/DiffSpa.gf | 26 ++++++++++++++++++++------ 8 files changed, 66 insertions(+), 34 deletions(-) diff --git a/lib/src/catalan/DiffCat.gf b/lib/src/catalan/DiffCat.gf index de5689215..12b138f4a 100644 --- a/lib/src/catalan/DiffCat.gf +++ b/lib/src/catalan/DiffCat.gf @@ -20,8 +20,8 @@ oper } ; - artDef : Gender -> Number -> Case -> Str = \g,n,c -> - case of { + artDef : Bool -> Gender -> Number -> Case -> Str = \isNP,g,n,c -> + case of { ---- TODO: check the NP forms => pre {"del" ; ["de l'"] / vocalForta} ; => pre {"al" ; ["a l'"] / vocalForta} ; => elisEl ; @@ -36,12 +36,19 @@ oper - artIndef = \g,n,c -> case of { + artIndef = \isNP,g,n,c -> case isNP of { + _ => case of { + => genForms ["d' un"] ["d' una"] ! g ; + => prepCase c ++ genForms "un" "una" ! g ; + => prepCase c ++ genForms "uns" "unes" ! g + } ; + _ => case of { => genForms ["d' un"] ["d' una"] ! g ; => prepCase c ++ genForms "un" "una" ! g ; --- => genForms ["d' uns"] ["d' unes"] ! g ; => prepCase c --- ++ genForms "uns" "unes" ! g --- take this as a determiner - } ; + } + } ; @@ -49,7 +56,7 @@ oper partitive = \g,c -> case c of { CPrep P_de => "de" ; - _ => prepCase c ++ artDef g Sg (CPrep P_de) + _ => prepCase c ++ artDef False g Sg (CPrep P_de) } ; conjunctCase : Case -> Case = \c -> case c of { diff --git a/lib/src/french/DiffFre.gf b/lib/src/french/DiffFre.gf index 77b2e9717..8d77fcb2f 100644 --- a/lib/src/french/DiffFre.gf +++ b/lib/src/french/DiffFre.gf @@ -26,7 +26,7 @@ instance DiffFre of DiffRomance - [ CPrep PNul => [] } ; - artDef : Gender -> Number -> Case -> Str = \g,n,c -> + artDef : Bool -> Gender -> Number -> Case -> Str = \isNP,g,n,c -> case of { => pre {"du" ; ("de l'" ++ Predef.BIND) / voyelle} ; => pre {"au" ; ("à l'" ++ Predef.BIND) / voyelle} ; @@ -39,17 +39,17 @@ instance DiffFre of DiffRomance - [ -- In these two, "de de/du/des" becomes "de". - artIndef = \g,n,c -> case of { + artIndef = \isNP,g,n,c -> case of { => prepCase c ++ genForms "un" "une" ! g ; - => elisDe ; - _ => prepCase c ++ "des" + => if_then_else Str isNP (prepCase c ++ genForms "quelques-uns" "quelques-unes" ! g) elisDe ; + _ => if_then_else Str isNP (prepCase c ++ genForms "quelques-uns" "quelques-unes" ! g) (prepCase c ++ "des") } ; possCase = \_,_,c -> prepCase c ; partitive = \g,c -> case c of { CPrep P_de => elisDe ; - _ => prepCase c ++ artDef g Sg (CPrep P_de) + _ => prepCase c ++ artDef False g Sg (CPrep P_de) } ; conjunctCase : Case -> Case = \c -> c ; diff --git a/lib/src/italian/DiffIta.gf b/lib/src/italian/DiffIta.gf index a54dac6a4..ab078ed65 100644 --- a/lib/src/italian/DiffIta.gf +++ b/lib/src/italian/DiffIta.gf @@ -25,8 +25,14 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud } } ; - artDef : Gender -> Number -> Case -> Str = \g,n,c -> - case of { + artDef : Bool -> Gender -> Number -> Case -> Str = \isNP,g,n,c -> + case isNP of { + True => prepCase c ++ case of { + => "lui" ; + => "lei" ; + <_,Pl> => "loro" + } ; + _ => case of { <_, _, CPrep P_di> => prepArt "de" ; <_, _, CPrep P_da> => prepArt "da" ; <_, _, CPrep P_a> => prepArt "a" ; @@ -37,7 +43,8 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud => elision "la" "l'" "la" ; => elision "i" "gli" "gli" ; => "le" - } + } + } where { prepArt : Tok -> Tok = \de -> case of { => elision (de + "l") (de + "ll'") (de + "llo") ; @@ -50,17 +57,21 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud -- In these two, "de de/du/des" becomes "de". - artIndef = \g,n,c -> case of { - => prepCase c ++ - genForms (pre {"un" ; "uno" / sImpuro}) (elision "una" "un'" "una") ! g ; - _ => prepCase c + artIndef = \isNP, g,n,c -> case of { + => prepCase c ++ + genForms "uno" "una" ! g ; + => prepCase c ++ + genForms (pre {"un" ; "uno" / sImpuro}) (elision "una" "un'" "una") ! g ; + => prepCase c ++ + genForms "alcuni" "alcune" ! g ; + _ => prepCase c } ; - possCase = artDef ; + possCase = artDef False ; partitive = \g,c -> case c of { CPrep P_di => "di" ; - _ => prepCase c ++ artDef g Sg (CPrep P_di) + _ => prepCase c ++ artDef False g Sg (CPrep P_di) } ; conjunctCase : Case -> Case = \c -> case c of { diff --git a/lib/src/romance/DiffRomance.gf b/lib/src/romance/DiffRomance.gf index 66e0f0cb7..4e9b7e8fb 100644 --- a/lib/src/romance/DiffRomance.gf +++ b/lib/src/romance/DiffRomance.gf @@ -70,8 +70,8 @@ interface DiffRomance = open CommonRomance, Prelude in { partitive : Gender -> Case -> Str ; - artDef : Gender -> Number -> Case -> Str ; - artIndef : Gender -> Number -> Case -> Str ; + artDef : Bool -> Gender -> Number -> Case -> Str ; + artIndef : Bool -> Gender -> Number -> Case -> Str ; -- True = used as NP, False = used as Det -- This is the definite article in Italian, $prepCase c$ in French and Spanish. diff --git a/lib/src/romance/NounRomance.gf b/lib/src/romance/NounRomance.gf index 1d19d0f7c..21355506b 100644 --- a/lib/src/romance/NounRomance.gf +++ b/lib/src/romance/NounRomance.gf @@ -101,15 +101,15 @@ incomplete concrete NounRomance of Noun = ---- could be discontinuous: la terza città più grande DefArt = { - s = \\_,n,g,c => artDef g n c ; - sp = \\n,g,c => artDef g n c ; ---- not for Fre + s = \\_,n,g,c => artDef False g n c ; + sp = \\n,g,c => artDef True g n c ; s2 = [] ; isNeg = False } ; IndefArt = { - s = \\b,n,g,c => if_then_Str b (prepCase c) (artIndef g n c) ; - sp = \\n,g,c => artIndef g n c ; ---- not for Fre + s = \\b,n,g,c => if_then_Str b (prepCase c) (artIndef False g n c) ; + sp = \\n,g,c => artIndef True g n c ; s2 = [] ; isNeg = False } ; @@ -118,7 +118,7 @@ incomplete concrete NounRomance of Noun = g = cn.g ; n = Sg in heavyNP { - s = table {Nom => artDef g n Nom ++ cn.s ! n ; c => partitive g c ++ cn.s ! n} ; -- le vin est bon ; je bois du vin + s = table {Nom => artDef False g n Nom ++ cn.s ! n ; c => partitive g c ++ cn.s ! n} ; -- le vin est bon ; je bois du vin a = agrP3 g n ; hasClit = False ; isNeg = False diff --git a/lib/src/romance/SymbolRomance.gf b/lib/src/romance/SymbolRomance.gf index 7319b1010..8f63a29cf 100644 --- a/lib/src/romance/SymbolRomance.gf +++ b/lib/src/romance/SymbolRomance.gf @@ -18,7 +18,7 @@ lin hasClit = False } ; CNNumNP cn i = heavyNP { - s = \\c => artDef cn.g Sg c ++ cn.s ! Sg ++ i.s ! Masc ; + s = \\c => artDef False cn.g Sg c ++ cn.s ! Sg ++ i.s ! Masc ; a = agrP3 cn.g Sg ; hasClit = False } ; diff --git a/lib/src/romance/VerbRomance.gf b/lib/src/romance/VerbRomance.gf index 13f29150e..e08d4cbb0 100644 --- a/lib/src/romance/VerbRomance.gf +++ b/lib/src/romance/VerbRomance.gf @@ -94,7 +94,7 @@ incomplete concrete VerbRomance of Verb = CompAP ap = {s = \\ag => let agr = complAgr ag in ap.s ! AF agr.g agr.n} ; CompCN cn = { s = \\ag => let agr = complAgr ag in - artIndef cn.g agr.n Nom ++ cn.s ! agr.n + artIndef False cn.g agr.n Nom ++ cn.s ! agr.n }; --- RE 7/12/2010 -- AR added indef 2/8/2011 CompNP np = {s = \\_ => (np.s ! Nom).ton} ; CompAdv a = {s = \\_ => a.s} ; diff --git a/lib/src/spanish/DiffSpa.gf b/lib/src/spanish/DiffSpa.gf index 457988be1..835f9dfe2 100644 --- a/lib/src/spanish/DiffSpa.gf +++ b/lib/src/spanish/DiffSpa.gf @@ -21,8 +21,15 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelud } ; - artDef : Gender -> Number -> Case -> Str = \g,n,c -> - case of { + artDef : Bool -> Gender -> Number -> Case -> Str = \isNP,g,n,c -> + case isNP of { + True => case of { + => prepCase c ++ "el" ; + => prepCase c ++ "la" ; ----- ?? + => prepCase c ++ "los" ; + => prepCase c ++ "las" + } ; + _ => case of { => "del" ; => "al" ; => prepCase c ++ "el" ; @@ -31,13 +38,20 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelud => prepCase c ++ chooseLa ; => prepCase c ++ "los" ; => prepCase c ++ "las" - } ; + } + } ; -- In these two, "de de/du/des" becomes "de". - artIndef = \g,n,c -> case n of { - Sg => prepCase c ++ genForms "un" "una" ! g ; - _ => prepCase c -- ++ genForms "unos" "unas" ! g --- take this as a determiner + artIndef = \isNP,g,n,c -> case isNP of { + True => case n of { + Sg => prepCase c ++ genForms "uno" "una" ! g ; + _ => prepCase c ++ genForms "unos" "unas" ! g + } ; + _ => case n of { + Sg => prepCase c ++ genForms "un" "una" ! g ; + _ => prepCase c + } } ; possCase = \_,_,c -> prepCase c ;