1
0
forked from GitHub/gf-core

French close to complete; reported on regexp bindings

This commit is contained in:
aarne
2006-01-23 16:38:42 +00:00
parent 29b47a37c9
commit 7364373223
12 changed files with 132 additions and 94 deletions

View File

@@ -14,6 +14,11 @@ Changes in functionality since May 17, 2005, release of GF Version 2.2
<p>
10/1 (AR) Forbade variable binding inside negation and Kleene star
patterns.
<p>
7/1 (AR) Full set of regular expression patterns, with
as-patterns to enable variable bindings to matched expressions:
<ul>

View File

@@ -57,9 +57,28 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in {
} ;
conjThan = elisQue ;
conjThat = elisQue ;
clitInf cli inf = cli ++ inf ;
relPron : Bool => AAgr => Case => Str = \\b,a,c =>
let
lequel = artDef a.g a.n c + quelPron ! a
in
case b of {
False => case c of {
Nom => "qui" ;
Acc => elisQue ;
CPrep P_de => "dont" ;
_ => lequel
} ;
_ => lequel
} ;
pronSuch : AAgr => Str = aagrForms "tel" "telle" "tels" "telles" ;
quelPron : AAgr => Str = aagrForms "quel" "quelle" "quels" "quelles" ;
copula : Verb = {s = table VF ["être";"suis";"es";"est";"sommes";"êtes";"sont";"sois";"sois";"soit";"soyons";"soyez";"soient";"étais";"étais";"était";"étions";"étiez";"étaient";"fusse";"fusses";"fût";"fussions";"fussiez";"fussent";"fus";"fus";"fut";"fûmes";"fûtes";"furent";"serai";"seras";"sera";"serons";"serez";"seront";"serais";"serais";"serait";"serions";"seriez";"seraient";"sois";"soyons";"soyez";"été";"étés";"étée";"étées";"étant"]; vtyp=VHabere} ;
avoir_V : Verb = {s=table VF ["avoir";"ai";"as";"a";"avons";"avez";"ont";"aie";"aies";"ait";"ayons";"ayez";"aient";"avais";"avais";"avait";"avions";"aviez";"avaient";"eusse";"eusses";"eût";"eussions";"eussiez";"eussent";"eus";"eus";"eut";"eûmes";"eûtes";"eurent";"aurai";"auras";"aura";"aurons";"aurez";"auront";"aurais";"aurais";"aurait";"aurions";"auriez";"auraient";"aie";"ayons";"ayez";"eu";"eus";"eue";"eues";"ayant"];vtyp=VHabere};

View File

@@ -5,10 +5,10 @@ concrete LangFre of Lang =
VerbFre,
AdjectiveFre,
AdverbFre,
-- NumeralFre,
NumeralFre,
SentenceFre,
QuestionFre,
-- RelativeFre,
RelativeFre,
ConjunctionFre,
PhraseFre,
TensedFre,

View File

@@ -298,15 +298,6 @@ oper
}
} ;
-}
-- Reflexive pronouns are defined in $SyntaxFre$.
-- The composable pronoun "lequel" is inflected by varying the definite
-- article and the determiner "quel" in the expected way.
lequelPron : Gender -> Number -> Case -> Str = \g,n,c ->
artDef g n c + quelPron g n ;
--2 Determiners
--
-- Determiners, traditionally called indefinite pronouns, are inflected
@@ -318,15 +309,6 @@ oper
Fem => nomReg telle ! n
} ;
quelPron : Gender -> Number -> Str = pronForms "quel" "quelle" ;
telPron : Gender -> Number -> Str = pronForms "tel" "telle" ;
toutPron : Gender -> Number -> Str = \g,n -> case g of {
Masc => numForms "tout" "tous" ! n ;
Fem => nomReg "toutee" ! n
} ;
-- The following macro generates the phrases "est-ce que", "est-ce qu'",
-- and "est-ce qui" (the last one used e.g. in "qu'est-ce qui").

View File

@@ -1,47 +1,83 @@
concrete NumeralFre of Numeral = CatFre ** open ResRomance, MorphoFre in {
-- originally written in 1998, automatically translated to current notation...
lincat
Digit = {s : DForm => CardOrd => Str} ;
Sub10 = {s : DForm => CardOrd => Str ; n : Number} ;
Sub100, Sub1000, Sub1000000 =
{s : CardOrd => Str ; n : Number} ;
Digit = {inh : DForm ; inh1 : Number ; s : Gender => DForm => Str ; n : Number} ;
Sub10 = {inh : Number ; s : Gender => {p1 : DForm ; p2 : Place} => Str ; n : Number} ;
Sub100 = {s : Gender => Place => Str ; n : Number} ;
Sub1000 = {s : Gender => Place => Str ; n : Number} ;
Sub1000000 = {s : Gender => Str ; n : Number} ;
lin
num x = x ;
n2 = mkTal "två" "tolv" "tjugo" "andra" "tolfte" ;
n3 = mkTal "tre" "tretton" "trettio" "tredje" "trettonde" ;
n4 = mkTal "fyra" "fjorton" "fyrtio" "fjärde" "fjortonde" ;
n5 = mkTal "fem" "femton" "femtio" "femte" "femtonde" ;
n6 = mkTal "sex" "sexton" "sextion" "sjätte" "sextonde" ;
n7 = mkTal "sju" "sjutton" "sjuttio" "sjunde" "sjuttonde" ;
n8 = mkTal "åtta" "arton" "åttio" "åttonde" "artonde" ;
n9 = mkTal "nio" "nitton" "nittio" "nionde" "nittonde" ;
pot01 = {
s = \\f => table {
NCard g => case g of {Neutr => "ett" ; _ => "en"} ;
_ => "första"
} ;
n = Sg
} ;
pot0 d = {s = \\f,g => d.s ! f ! g ; n = Pl} ;
pot110 = numPl (cardReg "tio") ;
pot111 = numPl (cardOrd "elva" "elfte") ;
pot1to19 d = numPl (d.s ! ton) ;
pot0as1 n = {s = n.s ! ental ; n = n.n} ;
pot1 d = numPl (d.s ! tiotal) ;
pot1plus d e = {s = \\g => d.s ! tiotal ! invNum ++ e.s ! ental ! g ; n = Pl} ;
pot1as2 n = n ;
pot2 d =
numPl (\\g => d.s ! ental ! invNum ++ cardOrd "hundra" "hundrade" ! g) ;
pot2plus d e =
{s = \\g => d.s ! ental ! invNum ++ "hundra" ++ e.s ! g ; n = Pl} ;
pot2as3 n = n ;
pot3 n =
numPl (\\g => n.s ! invNum ++ "tusen" ++ cardOrd "tusen" "tusende" ! g) ;
pot3plus n m =
{s = \\g => n.s ! invNum ++ "tusen" ++ m.s ! g ; n = Pl} ;
}
lin num x0 = {s = \\_ => x0.s ! Masc} ; ---- ord
lin n2 =
digitPl {inh = unit ; inh1 = Sg ; s = table {unit => "deux" ; teen => "douze" ; jten => "vingt" ; ten => "vingt" ; tenplus => "vingt"}} ;
lin n3 =
digitPl {inh = unit ; inh1 = Sg ; s = table {unit => "trois" ; teen => "treize" ; jten => "trente" ; ten => "trente" ; tenplus => "trente"}} ;
lin n4 =
digitPl {inh = unit ; inh1 = Sg ; s = table {unit => "quatre" ; teen => "quatorze" ; jten => "quarante" ; ten => "quarante" ; tenplus => "quarante"}} ;
lin n5 =
digitPl {inh = unit ; inh1 = Sg ; s = table {unit => "cinq" ; teen => "quinze" ; jten => "cinquante" ; ten => "cinquante" ; tenplus => "cinquante"}} ;
lin n6 =
digitPl {inh = unit ; inh1 = Sg ; s = table {unit => "six" ; teen => "seize" ; jten => "soixante" ; ten => "soixante" ; tenplus => "soixante"}} ;
lin n7 =
digitPl {inh = teen ; inh1 = Sg ; s = table {unit => "sept" ; teen => "dix" ++ "-" ++ "sept" ; jten => "soixante" ++ "-" ++ "dix" ; ten => "soixante" ++ "-" ++ "dix" ; tenplus => "soixante"}} ;
lin n8 =
digitPl {inh = unit ; inh1 = Pl ; s = table {unit => "huit" ; teen => "dix" ++ "-" ++ "huit" ; jten => "quatre" ++ "-" ++ "vingts" ; ten => "quatre" ++ "-" ++ "vingt" ; tenplus => "quatre" ++ "-" ++ "vingt"}} ;
lin n9 =
digitPl {inh = teen ; inh1 = Pl ; s = table {unit => "neuf" ; teen => "dix" ++ "-" ++ "neuf" ; jten => "quatre" ++ "-" ++ "vingt" ++ "-" ++ "dix" ; ten => "quatre" ++ "-" ++ "vingt" ++ "-" ++ "dix" ; tenplus => "quatre" ++ "-" ++ "vingt"}} ;
lin pot01 =
{inh = Sg ; s = \\g => table {{p1 = unit ; p2 = indep} => case g of {Masc =>
"un" ; Fem => "une"} ; {p1 = unit ; p2 = attr} => [] ; {p1 = teen ;
p2 = indep} => "onze" ; {p1 = teen ; p2 = attr} => [] ; {p1 = jten ;
p2 = indep} => "dix" ; {p1 = jten ; p2 = attr} => [] ; {p1 = ten ;
p2 = indep} => "dix" ; {p1 = ten ; p2 = attr} => [] ; {p1 = tenplus
; p2 = indep} => "dix" ; {p1 = tenplus ; p2 = attr} => []} ; n = Sg} ;
lin pot0 d =
{inh = Pl ; s = \\g => table {{p1 = unit ; p2 = indep} => d.s ! g ! unit
; {p1 = unit ; p2 = attr} => d.s ! g ! unit ; {p1 = teen ; p2 = indep}
=> d.s ! g ! teen ; {p1 = teen ; p2 = attr} => d.s ! g ! teen ; {p1 = jten ;
p2 = indep} => d.s ! g ! jten ; {p1 = jten ; p2 = attr} => d.s ! g ! jten ;
{p1 = ten ; p2 = indep} => d.s ! g ! ten ; {p1 = ten ; p2 = attr} => d.s
! g ! ten ; {p1 = tenplus ; p2 = indep} => d.s ! g ! tenplus ; {p1 = tenplus
; p2 = attr} => d.s ! g ! tenplus} ; n = Pl} ;
lin pot110 =
{s = \\_ => table {indep => "dix" ; attr => "dix"} ; n = Pl} ;
lin pot111 =
{s = \\_ => table {indep => "onze" ; attr => "onze"} ; n = Pl} ;
lin pot1to19 d =
{s = \\g => table {indep => d.s ! g ! teen ; attr => d.s ! g ! teen} ; n = Pl} ;
lin pot0as1 n =
{s = \\g => table {indep => n.s ! g ! {p1 = unit ; p2 = indep} ;
attr => n.s ! g ! {p1 = unit ; p2 = attr}} ; n = n.n} ;
lin pot1 d =
{s = \\g => table {indep => d.s ! g ! jten ; attr => d.s ! g ! ten}
; n = Pl} ;
lin pot1plus d e =
{s = \\g => table {indep => (d.s ! g ! tenplus) ++ (table {{p1 = Sg
; p2 = Sg} => "et" ; {p1 = Sg ; p2 = pl} => "-" ; {p1 = Pl ; p2 =
Sg} => "-" ; {p1 = Pl ; p2 = pl} => "-"} ! {p1 = d.inh1 ; p2 =
e.inh}) ++ e.s ! g ! {p1 = d.inh ; p2 = indep} ; attr => (d.s ! g !
tenplus) ++ (table {{p1 = Sg ; p2 = Sg} => "et" ; {p1 = Sg ; p2 =
pl} => "-" ; {p1 = Pl ; p2 = Sg} => "-" ; {p1 = Pl ; p2 = pl} =>
"-"} ! {p1 = d.inh1 ; p2 = e.inh}) ++ e.s ! g ! {p1 = d.inh ; p2 =
indep}} ; n = Pl} ;
lin pot1as2 n = n ;
---- {s = \\g,d => n.s ! indep ; attr => n.s ! attr}} ;
lin pot2 d =
{s = \\g => table {indep => (d.s ! Masc ! {p1 = unit ; p2 = attr})
++ table {Sg => "cent" ; Pl => "cents"} ! (d.inh) ; attr => (d.s !
Masc ! {p1 = unit ; p2 = attr}) ++ "cent"} ; n = Pl} ;
lin pot2plus d e =
{s = \\g => table {indep => (d.s ! Masc ! {p1 = unit ; p2 = attr})
++ "cent" ++ e.s ! g ! indep ; attr => (d.s ! Masc ! {p1 = unit ; p2
= attr}) ++ "cent" ++ e.s ! g ! indep} ; n = Pl} ;
lin pot2as3 n =
{s = \\g => n.s ! g ! indep ; n = n.n} ;
lin pot3 n =
{s = \\_ => (n.s ! Masc ! attr) ++ "mille" ; n = Pl} ;
lin pot3plus n m =
{s = \\g => (n.s ! Masc ! attr) ++ "mille" ++ m.s ! g ! indep ; n =
Pl} ;
}

View File

@@ -1,2 +1,2 @@
concrete RelativeFre of Relative = CatFre ** RelativeRomance with
(DiffRomance = DiffFre) ;
(ResRomance = ResFre) ;

View File

@@ -31,7 +31,7 @@ incomplete concrete CatRomance of Cat =
-- Relative
RCl = {s : Tense => Anteriority => Polarity => Mood => Agr => Str} ;
RP = {s : AAgr => RelForm => Str} ; ---- ; a : RAgr} ;
RP = {s : Bool => AAgr => Case => Str ; a : RAgr} ;
-- Verb

View File

@@ -10,14 +10,16 @@ incomplete concrete ConjunctionRomance of Conjunction =
ConjAdv conj ss = conjunctSS conj ss ;
DConjAdv conj ss = conjunctDistrSS conj ss ;
{-
ConjNP conj ss = conjunctTable NPForm conj ss ** {
a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p}
a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p} ;
c = Clit0
} ;
DConjNP conj ss = conjunctDistrTable NPForm conj ss ** {
a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p}
a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p} ;
c = Clit0
} ;
-}
ConjAP conj ss = conjunctTable AForm conj ss ** {
isPre = ss.isPre
} ;

View File

@@ -31,9 +31,13 @@ oper
partAgr : VType -> VPAgr ;
conjThan : Str ;
conjThat : Str ;
clitInf : Str -> Str -> Str ;
relPron : Bool => AAgr => Case => Str ;
pronSuch : AAgr => Str ;
-- These needed above.
param

View File

@@ -120,7 +120,7 @@ oper
Agr : Type = AAgr ** {p : Person} ;
param
RAgr = RAg AAgr | RNoAg ;
RAgr = RAg {g : Gender ; n : Number} | RNoAg ; --- AAgr
oper
aagr : Gender -> Number -> AAgr = \g,n ->

View File

@@ -1,44 +1,42 @@
incomplete concrete RelativeRomance of Relative =
CatRomance ** open DiffRomance, ResRomance in {
CatRomance ** open Prelude, CommonRomance, ResRomance in {
flags optimize=all_subs ;
lin
RelCl cl = {
s = \\t,a,p,ag => pronSuch ! ag.gn ++ conjThat ++ cl.s ! t ! a ! p ! Sub
s = \\t,a,p,m,ag => pronSuch ! ag ++ conjThat ++ cl.s ! t ! a ! p ! m
} ;
RelVP rp vp = {
s = \\t,ant,b,ag =>
s = \\t,ant,b,m,ag =>
let
agr = case rp.a of {
RNoAg => ag ;
RAg a => a
RAg a => a ** {p = P3}
} ;
cl = mkClause (rp.s ! ag.gn ! RNom) agr vp
cl = mkClause (rp.s ! False ! ag ! Nom) agr vp
in
cl.s ! t ! ant ! b ! Sub
cl.s ! t ! ant ! b ! m
} ;
--- We make this easy by using "som" and preposition stranding. It would be
--- a proble to determine whether $slash$ takes a direct object, since
--- $slash.c2$ is defined to be just a string.
--
-- The empty relative is left to $ExtRomance$.
{-
RelSlash rp slash = {
s = \\t,a,p,ag =>
rp.s ! ag.gn ! RNom ++ slash.s ! t ! a ! p ! Sub ++ slash.c2
} ;
--- The case here could be genitive.
-}
FunRP p np rp = {
s = \\gn,c => np.s ! nominative ++ p.s ++ rp.s ! gn ! RPrep ;
s = \\_,a,c => np.s ! Ton Nom ++ p.s ++ rp.s ! True ! a ! p.c ;
a = RAg np.a
} ;
IdRP = {
s = relPron ;
a = RNoAg
} ;
IdRP = {s = relPron ; a = RNoAg} ;
-- RCl = {s : Tense => Anteriority => Polarity => Mood => Agr => Str} ;
-- RP = {s : AAgr => RelForm => Str ; a : RAgr} ;
}

View File

@@ -10,9 +10,6 @@ param
NPForm = Ton Case | Aton Case | Poss {g : Gender ; n : Number} ; --- AAgr
RelForm = RSimple Case | RComplex Gender Number Case ;
oper
nominative : Case = Nom ;
@@ -44,11 +41,6 @@ oper
_ => Ton c
} ;
npRelForm : NPForm -> RelForm = \np -> case np of {
Ton c => RSimple c ;
Aton c => RSimple c ;
Poss _ => RSimple genitive
} ;
appCompl : Compl -> (NPForm => Str) -> Str = \comp,np ->
comp.s ++ np ! Ton comp.c ;