diff --git a/lib/resource-1.0/Makefile b/lib/resource-1.0/Makefile index e4e11087a..861b3afcc 100644 --- a/lib/resource-1.0/Makefile +++ b/lib/resource-1.0/Makefile @@ -1,9 +1,9 @@ all: langs test test: - echo "gr -cat=S -number=11 -prob | tb" | gf -probs=lang.gfprob langs.gfcm + echo "gr -cat=S -number=11 -prob | tb" | gf -nocf -probs=lang.gfprob langs.gfcm langs: - echo "s ;; pm | wf langs.gfcm" | gf -src */Lang??*.gf english/LangEng.gf +RTS -M400M + echo "s ;; pm | wf langs.gfcm" | gf -src -nocf */Lang??*.gf english/LangEng.gf +RTS -M500M stat: wc */*.gfc diff --git a/lib/resource-1.0/italian/DiffIta.gf b/lib/resource-1.0/italian/DiffIta.gf index 88c132772..887adf413 100644 --- a/lib/resource-1.0/italian/DiffIta.gf +++ b/lib/resource-1.0/italian/DiffIta.gf @@ -2,6 +2,8 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelude in { + flags optimize=all ; + param Prep = P_di | P_a | P_da | P_in | P_su | P_con ; NPForm = Ton Case | Aton Case | PreClit | Poss {g : Gender ; n : Number} ; --- AAgr @@ -77,14 +79,27 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud vpAgrClit : Agr -> VPAgr = \a -> vpAgrNone ; ---- This assumes that Acc clitics are in place before Dat. + pronArg = \n,p,acc,dat -> + let + pacc = case acc of { --- only accusative refl handled + CRefl => case p of { + P3 => "si" ; + _ => argPron Fem n p Acc False --- no clitic after acc + } ; + CPron a => argPron a.g a.n a.p Acc False ; + _ => [] + } ; + hasAcc = case acc of { + CNone => False ; + _ => True + } ; + pdat = case dat of { + CPron a => argPron a.g a.n a.p dative hasAcc ; + _ => [] + } ; + in + ; - placeNewClitic = \ci,c,pro,isc,old -> - case of { - => pro.s ! PreClit ++ old ; -- there is an old clitic - {p3 = True} => pro.s ! Aton c ; -- no old but a new - _ => [] -- no clitics - } ; negation : Polarity => (Str * Str) = table { Pos => <[],[]> ; @@ -109,14 +124,14 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud partQIndir = "ciò" ; - reflPron : Number => Person => Case => Str = + reflPron : Number -> Person -> Case -> Str = let - cases : (x,y : Str) -> (Case => Str) = \me,moi -> table { + cases : (x,y : Str) -> (Case -> Str) = \me,moi,c -> case c of { Acc | CPrep P_a => me ; _ => moi } ; in - \\n,p => case of { + \n,p -> case of { => cases "mi" "me" ; => cases "ti" "te" ; => cases "ci" "noi" ; -- unlike French with just one alt! @@ -124,6 +139,30 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud _ => cases "si" "se" } ; + argPron : Gender -> Number -> Person -> Case -> Bool -> Str = + let + cases : (x,y,z : Str) -> Case -> Bool -> Str = + \ci,ce,noi,c,isPre -> case c of { + Acc | CPrep P_a => if_then_Str isPre ce ci ; + _ => noi + } ; + cases4 : (x,y,z,u : Str) -> Case -> Bool -> Str = + \lo,gli,glie,lui,c,isPre -> case c of { + Acc => lo ; + CPrep P_a => if_then_Str isPre glie gli ; + _ => lui + } ; + in + \g,n,p -> case of { + <_,Sg,P1> => cases "mi" "me" "me" ; + <_,Sg,P2> => cases "ti" "te" "te" ; + <_,Pl,P1> => cases "ci" "ce" "noi" ; -- unlike French with just one alt! + <_,Pl,P2> => cases "vi" "ve" "voi" ; + => cases4 "lo" "gli" "glie" "lui" ; + => cases4 "la" "le" "glie" "lei" ; + <_, Pl,P3> => cases4 "li" "li" "glie" "loro" + } ; + vRefl : VType = VRefl ; isVRefl : VType -> Bool = \ty -> case ty of { VRefl => True ; diff --git a/lib/resource-1.0/italian/ResIta.gf b/lib/resource-1.0/italian/ResIta.gf index 4f9efda10..d18906d9a 100644 --- a/lib/resource-1.0/italian/ResIta.gf +++ b/lib/resource-1.0/italian/ResIta.gf @@ -8,4 +8,6 @@ instance ResIta of ResRomance = DiffIta ** open CommonRomance, Prelude in { + flags optimize=all ; + } ; diff --git a/lib/resource-1.0/romance/DiffRomance.gf b/lib/resource-1.0/romance/DiffRomance.gf index 3a7e5f176..42b449c93 100644 --- a/lib/resource-1.0/romance/DiffRomance.gf +++ b/lib/resource-1.0/romance/DiffRomance.gf @@ -82,7 +82,7 @@ interface DiffRomance = open CommonRomance, Prelude in { partQIndir : Str ; -- ce, ciò reflPron : Number -> Person -> Case -> Str ; - argPron : Gender -> Number -> Person -> Case -> Str ; +-- argPron : Gender -> Number -> Person -> Case -> Str ; auxPassive : Verb ; diff --git a/lib/resource-1.0/spanish/DiffSpa.gf b/lib/resource-1.0/spanish/DiffSpa.gf index 180fd89fb..e46470483 100644 --- a/lib/resource-1.0/spanish/DiffSpa.gf +++ b/lib/resource-1.0/spanish/DiffSpa.gf @@ -2,6 +2,8 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelude in { + flags optimize=noexpand ; + param Prep = P_de | P_a ; NPForm = Ton Case | Aton Case | Poss {g : Gender ; n : Number} ; --- AAgr @@ -52,25 +54,24 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelud vpAgrClit : Agr -> VPAgr = \a -> vpAgrNone ; ---- This assumes that Acc clitics are in place before Dat. - - placeNewClitic = \ci,c,pro,isc,old -> - if_then_Str isc ( - case of { - => old ++ pro.s ! Aton c ; -- te me, ---se me - => "se" ++ old ; -- se lo - _ => pro.s ! Aton c ++ old -- indirect first - }) [] ; -- no clitics - -{- - placeNewClitic = \ci,c,pro,isc,old -> - case of { - => old ++ pro.s ! Aton c ; -- te me, ---se me - => "se" ++ old ; -- se lo - {p5 = True} => pro.s ! Aton c ++ old ; -- indirect first - _ => [] -- no clitics - } ; --} + pronArg = \n,p,acc,dat -> + let + paccp = case acc of { + CRefl => ; + CPron a => ; + _ => <[],P2> + } ; + pdatp = case dat of { + CPron a => ; + _ => <[],P2> + } + in case of { + => <"se" ++ paccp.p1, []> ; + _ => + } ; +-- case of { +-- => <"te" ++ "me", []> ; +-- <_,_,CPron {n = Sg ; p = P2},CPron {n = Sg ; p = P1}> => <"te" ++ "me", []> ; negation : Polarity => (Str * Str) = table { Pos => <[],[]> ; @@ -95,19 +96,38 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelud partQIndir = [] ; ---- ? - reflPron : Number => Person => Case => Str = + reflPron : Number -> Person -> Case -> Str = \n,p,c -> + let pro = argPron Fem n p c + in + case p of { + P3 => case c of { + Acc | CPrep P_a => "se" ; + _ => "sí" + } ; + _ => pro + } ; + + argPron : Gender -> Number -> Person -> Case -> Str = let - cases : (x,y : Str) -> (Case => Str) = \me,moi -> table { + cases : (x,y : Str) -> Case -> Str = \me,moi,c -> case c of { Acc | CPrep P_a => me ; _ => moi } ; + cases3 : (x,y,z : Str) -> Case -> Str = \les,leur,eux,c -> case c of { + Acc => les ; + CPrep P_a => leur ; + _ => eux + } ; in - \\n,p => case of { - => cases "mi" "me" ; - => cases "ti" "te" ; - => cases "ci" "noi" ; -- unlike French with just one alt! - => cases "vi" "voi" ; - _ => cases "si" "se" + \g,n,p -> case of { + <_,Sg,P1> => cases "me" "mí" ; + <_,Sg,P2> => cases "te" "tí" ; + <_,Pl,P1> => cases "nos" "nosotras" ; --- nosotros + <_,Pl,P2> => cases "vos" "vosotras" ; --- vosotros + => cases3 "la" "le" "ella" ; + <_, Sg,P3> => cases3 "lo" "le" "èl" ; + => cases3 "las" "les" "ellas" ; + <_, Pl,P3> => cases3 "los" "les" "ellos" } ; vRefl : VType = VRefl ; diff --git a/lib/resource-1.0/spanish/ResSpa.gf b/lib/resource-1.0/spanish/ResSpa.gf index 050e40467..0479b8ebc 100644 --- a/lib/resource-1.0/spanish/ResSpa.gf +++ b/lib/resource-1.0/spanish/ResSpa.gf @@ -8,4 +8,6 @@ instance ResSpa of ResRomance = DiffSpa ** open CommonRomance, Prelude in { + flags optimize=noexpand ; + } ;