From 24207d40e9cb56173de22d9a424975f0da0bc416 Mon Sep 17 00:00:00 2001 From: aarne Date: Fri, 3 Oct 2008 20:42:09 +0000 Subject: [PATCH] extended AP with Ord and compar in 1.5 --- next-lib/src/abstract/Adjective.gf | 8 +++- next-lib/src/abstract/Noun.gf | 5 +-- next-lib/src/api/Combinators.gf | 6 --- next-lib/src/api/Constructors.gf | 16 ++++++-- next-lib/src/english/AdjectiveEng.gf | 15 +++++++- next-lib/src/english/NounEng.gf | 12 +++--- next-lib/src/finnish/AdjectiveFin.gf | 21 ++++++++--- next-lib/src/finnish/CatFin.gf | 10 ++--- next-lib/src/finnish/ConjunctionFin.gf | 8 ++-- next-lib/src/finnish/LexiconFin.gf | 2 +- next-lib/src/finnish/NounFin.gf | 42 +++------------------ next-lib/src/finnish/VerbFin.gf | 6 +-- next-lib/src/german/AdjectiveGer.gf | 13 ++++++- next-lib/src/romance/AdjectiveRomance.gf | 16 +++++++- next-lib/src/romance/NounRomance.gf | 33 ---------------- next-lib/src/scandinavian/AdjectiveScand.gf | 17 ++++++++- 16 files changed, 115 insertions(+), 115 deletions(-) diff --git a/next-lib/src/abstract/Adjective.gf b/next-lib/src/abstract/Adjective.gf index 4255b7eee..b934dfa82 100644 --- a/next-lib/src/abstract/Adjective.gf +++ b/next-lib/src/abstract/Adjective.gf @@ -7,13 +7,17 @@ abstract Adjective = Cat ** { -- The principal ways of forming an adjectival phrase are -- positive, comparative, relational, reflexive-relational, and -- elliptic-relational. --- (The superlative use is covered in [Noun Noun.html].$SuperlA$.) PositA : A -> AP ; -- warm ComparA : A -> NP -> AP ; -- warmer than I ComplA2 : A2 -> NP -> AP ; -- married to her ReflA2 : A2 -> AP ; -- married to itself - UseA2 : A2 -> A ; -- married + UseA2 : A2 -> AP ; -- married + UseComparA : A -> AP ; -- warmer + +-- The superlative use is covered in $Ord$. + + AdjOrd : Ord -> AP ; -- warmest -- Sentence and question complements defined for all adjectival -- phrases, although the semantics is only clear for some adjectives. diff --git a/next-lib/src/abstract/Noun.gf b/next-lib/src/abstract/Noun.gf index 3fdb7964f..0a149ba82 100644 --- a/next-lib/src/abstract/Noun.gf +++ b/next-lib/src/abstract/Noun.gf @@ -37,11 +37,10 @@ abstract Noun = Cat ** { --2 Determiners -- The determiner has a fine-grained structure, in which a 'nucleus' --- quantifier and two optional parts can be discerned: a cardinal and --- an ordinal numeral. +-- quantifier and an optional numeral can be discerned. + DetQuant : Quant -> Num -> Det ; -- these five DetQuantOrd : Quant -> Num -> Ord -> Det ; -- these five best - DetQuant : Quant -> Num -> Det ; -- these five -- Whether the resulting determiner is singular or plural depends on the -- cardinal. diff --git a/next-lib/src/api/Combinators.gf b/next-lib/src/api/Combinators.gf index 16e184fc1..07431c9af 100644 --- a/next-lib/src/api/Combinators.gf +++ b/next-lib/src/api/Combinators.gf @@ -80,12 +80,6 @@ incomplete resource Combinators = open Cat, Structural, Constructors in { neg : RCl -> RS }; ---2 Text append - --- This is not in ground API, because it would destroy parsing. - - appendText : Text -> Text -> Text ; - --. pred = overload { diff --git a/next-lib/src/api/Constructors.gf b/next-lib/src/api/Constructors.gf index 8ebd94958..05f40500c 100644 --- a/next-lib/src/api/Constructors.gf +++ b/next-lib/src/api/Constructors.gf @@ -593,7 +593,7 @@ incomplete resource Constructors = open Grammar in { -- Relational adjectives can be used with a complement or a reflexive mkAP : A2 -> NP -> AP ; -- 3. married to her - mkAP : A2 -> AP ; -- 4. married to myself + mkAP : A2 -> AP ; -- 4. married -- Some adjectival phrases can take as complements sentences, -- questions, or infinitives. Syntactically this is possible for @@ -613,8 +613,12 @@ incomplete resource Constructors = open Grammar in { mkAP : Conj -> AP -> AP -> AP ; -- 10. old and big mkAP : Conj -> ListAP -> AP ; -- 11. old, big, and warm + mkAP : Ord -> AP ; -- 12. oldest } ; + reflAP : A2 -> AP ; -- married to himself + comparAP : A -> AP ; -- warmer + --3 Adv, adverbial phrases mkAdv : overload { @@ -865,7 +869,7 @@ incomplete resource Constructors = open Grammar in { mkAP : A2 -> NP -> AP -- divisible by 2 = ComplA2 ; mkAP : A2 -> AP -- divisible by itself - = ReflA2 ; + = UseA2 ; mkAP : AP -> S -> AP -- great that she won = \ap,s -> SentAP ap (EmbedS s) ; mkAP : AP -> QS -> AP -- great that she won @@ -882,6 +886,9 @@ incomplete resource Constructors = open Grammar in { = \c,xy -> ConjAP c xy ; } ; + reflAP = ReflA2 ; + comparAP = UseComparA ; + mkAdv = overload { mkAdv : A -> Adv -- quickly = PositAdvAdj ; @@ -1686,10 +1693,13 @@ incomplete resource Constructors = open Grammar in { the_Art : Art = DefArt ; -- the a_Art : Art = IndefArt ; -- a + the_Quant : Quant = DefArt ; -- the + a_Quant : Quant = IndefArt ; -- a + DetArtSg : Art -> CN -> NP = \a -> DetCN (DetQuant a sgNum) ; DetArtPl : Art -> CN -> NP = \a -> DetCN (DetQuant a plNum) ; - DetArtOrd = DetQuantOrd ; + DetArtOrd : Quant -> Num -> Ord -> Det = DetQuantOrd ; DetArtCard : Art -> Card -> Det = \a,c -> DetQuant a (NumCard c) ; TUseCl : Tense -> Ant -> Pol -> Cl -> S = \t,a -> UseCl (TTAnt t a) ; diff --git a/next-lib/src/english/AdjectiveEng.gf b/next-lib/src/english/AdjectiveEng.gf index 19dd5dddc..2306f5d9c 100644 --- a/next-lib/src/english/AdjectiveEng.gf +++ b/next-lib/src/english/AdjectiveEng.gf @@ -10,8 +10,16 @@ concrete AdjectiveEng of Adjective = CatEng ** open ResEng, Prelude in { s = \\_ => a.s ! AAdj Compar ++ "than" ++ np.s ! Nom ; isPre = False } ; + UseComparA a = { + s = \\_ => a.s ! AAdj Compar ; + isPre = True + } ; + + AdjOrd ord = { + s = \\_ => ord.s ; + isPre = True + } ; --- $SuperlA$ belongs to determiner syntax in $Noun$. ComplA2 a np = { s = \\_ => a.s ! AAdj Posit ++ a.c2 ++ np.s ! Acc ; @@ -33,6 +41,9 @@ concrete AdjectiveEng of Adjective = CatEng ** open ResEng, Prelude in { isPre = ap.isPre } ; - UseA2 a = a ; + UseA2 a = { + s = \\_ => a.s ! AAdj Posit ; + isPre = True + } ; } diff --git a/next-lib/src/english/NounEng.gf b/next-lib/src/english/NounEng.gf index 18ceeaa22..9f7771e48 100644 --- a/next-lib/src/english/NounEng.gf +++ b/next-lib/src/english/NounEng.gf @@ -31,18 +31,18 @@ concrete NounEng of Noun = CatEng ** open ResEng, Prelude in { a = np.a } ; - DetQuantOrd quant num ord = { - s = quant.s ! num.hasCard ! num.n ++ num.s ++ ord.s ; - sp = quant.sp ! num.hasCard ! num.n ++ num.s ++ ord.s ; - n = num.n - } ; - DetQuant quant num = { s = quant.s ! num.hasCard ! num.n ++ num.s ; sp = quant.sp ! num.hasCard ! num.n ++ num.s ; n = num.n } ; + DetQuantOrd quant num ord = { + s = quant.s ! num.hasCard ! num.n ++ num.s ++ ord.s ; + sp = quant.sp ! num.hasCard ! num.n ++ num.s ++ ord.s ; + n = num.n + } ; + DetNP det = { s = \\c => det.sp ; ---- case a = agrP3 det.n diff --git a/next-lib/src/finnish/AdjectiveFin.gf b/next-lib/src/finnish/AdjectiveFin.gf index 78e7d4a7c..737887d17 100644 --- a/next-lib/src/finnish/AdjectiveFin.gf +++ b/next-lib/src/finnish/AdjectiveFin.gf @@ -5,26 +5,33 @@ concrete AdjectiveFin of Adjective = CatFin ** open ResFin, Prelude in { lin PositA a = { - s = \\_ => a.s ! Posit + s = \\_,nf => a.s ! Posit ! AN nf } ; ComparA a np = { s = \\isMod,af => case isMod of { - True => np.s ! NPCase Part ++ a.s ! Compar ! af ; -- minua isompi - _ => a.s ! Compar ! af ++ "kuin" ++ np.s ! NPCase Nom -- isompi kuin minä + True => np.s ! NPCase Part ++ a.s ! Compar ! AN af ; -- minua isompi + _ => a.s ! Compar ! AN af ++ "kuin" ++ np.s ! NPCase Nom -- isompi kuin minä } } ; + UseComparA a = { + s = \\_,nf => a.s ! Compar ! AN nf ; + } ; -- $SuperlA$ belongs to determiner syntax in $Noun$. + AdjOrd ord = { + s = \\_ => ord.s + } ; + ComplA2 adj np = { s = \\isMod,af => - preOrPost isMod (appCompl True Pos adj.c2 np) (adj.s ! Posit ! af) + preOrPost isMod (appCompl True Pos adj.c2 np) (adj.s ! Posit ! AN af) } ; ReflA2 adj = { s = \\isMod,af => preOrPost isMod - (appCompl True Pos adj.c2 (reflPron (agrP3 Sg))) (adj.s ! Posit ! af) + (appCompl True Pos adj.c2 (reflPron (agrP3 Sg))) (adj.s ! Posit ! AN af) } ; SentAP ap sc = { @@ -35,6 +42,8 @@ concrete AdjectiveFin of Adjective = CatFin ** open ResFin, Prelude in { s = \\b,af => ada.s ++ ap.s ! b ! af } ; - UseA2 a = a ; + UseA2 a = { + s = \\_,nf => a.s ! Posit ! AN nf + } ; } diff --git a/next-lib/src/finnish/CatFin.gf b/next-lib/src/finnish/CatFin.gf index aea41cac1..f0ca5784a 100644 --- a/next-lib/src/finnish/CatFin.gf +++ b/next-lib/src/finnish/CatFin.gf @@ -41,7 +41,7 @@ concrete CatFin of Cat = CommonX ** open ResFin, Prelude in { -- The $Bool$ tells whether usage is modifying (as opposed to -- predicative), e.g. "x on suurempi kuin y" vs. "y:tä suurempi luku". - AP = {s : Bool => AForm => Str} ; + AP = {s : Bool => NForm => Str} ; -- Noun @@ -59,11 +59,11 @@ concrete CatFin of Cat = CommonX ** open ResFin, Prelude in { isDef : Bool -- True (verb agrees in Pl, Nom is not Part) } ; ---- QuantSg, QuantPl = {s1 : Case => Str ; s2 : Str ; isPoss, isDef : Bool} ; - Ord = {s : Number => Case => Str} ; + Ord = {s : NForm => Str} ; Predet = {s : Number => NPForm => Str} ; - Quant = {s1 : Number => Case => Str ; s2 : Str ; isPoss : Bool ; isDef : Bool} ; - Card = {s : Number => Case => Str ; n : Number} ; - Num = {s : Number => Case => Str ; isNum : Bool ; n : Number} ; + Quant = {s1 : Number => Case => Str ; s2 : Str ; isPoss : Bool ; isDef : Bool} ; + Card = {s : Number => Case => Str ; n : Number} ; + Num = {s : Number => Case => Str ; isNum : Bool ; n : Number} ; -- Numeral diff --git a/next-lib/src/finnish/ConjunctionFin.gf b/next-lib/src/finnish/ConjunctionFin.gf index 94cea7f8c..8e7f7a3c8 100644 --- a/next-lib/src/finnish/ConjunctionFin.gf +++ b/next-lib/src/finnish/ConjunctionFin.gf @@ -14,7 +14,7 @@ concrete ConjunctionFin of Conjunction = isPron = False } ; - ConjAP conj ss = conjunctDistrTable2 Bool AForm conj ss ; + ConjAP conj ss = conjunctDistrTable2 Bool NForm conj ss ; -- These fun's are generated from the list cat's. @@ -24,13 +24,13 @@ concrete ConjunctionFin of Conjunction = ConsAdv = consrSS comma ; BaseNP x y = twoTable NPForm x y ** {a = conjAgr x.a y.a} ; ConsNP xs x = consrTable NPForm comma xs x ** {a = conjAgr xs.a x.a} ; - BaseAP x y = twoTable2 Bool AForm x y ; - ConsAP xs x = consrTable2 Bool AForm comma xs x ; + BaseAP x y = twoTable2 Bool NForm x y ; + ConsAP xs x = consrTable2 Bool NForm comma xs x ; lincat [S] = {s1,s2 : Str} ; [Adv] = {s1,s2 : Str} ; [NP] = {s1,s2 : NPForm => Str ; a : Agr} ; - [AP] = {s1,s2 : Bool => AForm => Str} ; + [AP] = {s1,s2 : Bool => NForm => Str} ; } diff --git a/next-lib/src/finnish/LexiconFin.gf b/next-lib/src/finnish/LexiconFin.gf index e15538b4f..9b9c91a2f 100644 --- a/next-lib/src/finnish/LexiconFin.gf +++ b/next-lib/src/finnish/LexiconFin.gf @@ -381,7 +381,7 @@ lin oper mkOrd : N -> Ord ; - mkOrd x = {s = \\n,c => x.s ! NCase n c; lock_Ord = <> } ; + mkOrd x = {s = x.s ; lock_Ord = <> } ; cpartitive = casePrep partitive ; } ; diff --git a/next-lib/src/finnish/NounFin.gf b/next-lib/src/finnish/NounFin.gf index 772815e3e..3d0d79bcf 100644 --- a/next-lib/src/finnish/NounFin.gf +++ b/next-lib/src/finnish/NounFin.gf @@ -77,7 +77,7 @@ concrete NounFin of Noun = CatFin ** open ResFin, Prelude in { } ; DetQuantOrd quant num ord = { - s1 = \\c => quant.s1 ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! Pl ! c ; + s1 = \\c => quant.s1 ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! NCase Pl c ; s2 = quant.s2 ; n = num.n ; isNum = num.isNum ; @@ -94,38 +94,6 @@ concrete NounFin of Noun = CatFin ** open ResFin, Prelude in { isDef = True } ; - -{- - DetArtSg det cn = - let - n : Number = Sg ; - ncase : Case -> NForm = \c -> NCase n c ; - in { - s = \\c => let k = npform2case n c in - det.s1 ! Sg ! k ++ cn.s ! ncase k ; - a = agrP3 Sg ; - isPron = False - } ; - - DetArtPl det cn = - let - n : Number = Pl ; - ncase : Case -> NForm = \c -> - case of { - => NCase Pl Part ; -- kytkimiä - _ => NCase n c -- kytkin, kytkimen,... - } - in { - s = \\c => let k = npform2case n c in - det.s1 ! Pl ! k ++ cn.s ! ncase k ; - a = agrP3 (case det.isDef of { - False => Sg ; -- autoja menee; kolme autoa menee - _ => Pl - }) ; - isPron = False - } ; --} - PossPron p = { s1 = \\_,_ => p.s ! NPCase Gen ; s2 = BIND ++ possSuffix p.a ; @@ -143,20 +111,20 @@ concrete NounFin of Noun = CatFin ** open ResFin, Prelude in { s = \\n,c => numeral.s ! NCard (NCase n c) ; n = numeral.n } ; - OrdDigits numeral = {s = \\n,c => numeral.s ! NOrd (NCase n c)} ; + OrdDigits numeral = {s = \\nc => numeral.s ! NOrd nc} ; NumNumeral numeral = { s = \\n,c => numeral.s ! NCard (NCase n c) ; n = numeral.n } ; - OrdNumeral numeral = {s = \\n,c => numeral.s ! NOrd (NCase n c)} ; + OrdNumeral numeral = {s = \\nc => numeral.s ! NOrd nc} ; AdNum adn num = { s = \\n,c => adn.s ++ num.s ! n ! c ; n = num.n } ; - OrdSuperl a = {s = \\n,c => a.s ! Superl ! AN (NCase n c)} ; + OrdSuperl a = {s = \\nc => a.s ! Superl ! AN nc} ; DefArt = { s1 = \\_,_ => [] ; @@ -210,7 +178,7 @@ concrete NounFin of Noun = CatFin ** open ResFin, Prelude in { } ; AdjCN ap cn = { - s = \\nf => ap.s ! True ! AN (n2nform nf) ++ cn.s ! nf + s = \\nf => ap.s ! True ! (n2nform nf) ++ cn.s ! nf } ; RelCN cn rs = {s = \\nf => cn.s ! nf ++ rs.s ! agrP3 (numN nf)} ; diff --git a/next-lib/src/finnish/VerbFin.gf b/next-lib/src/finnish/VerbFin.gf index 0e6498a0b..7b9c36b4a 100644 --- a/next-lib/src/finnish/VerbFin.gf +++ b/next-lib/src/finnish/VerbFin.gf @@ -33,7 +33,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin in { ComplVA v ap = insertObj (\\_,b,agr => - ap.s ! False ! AN (NCase agr.n (npform2case agr.n v.c2.c))) --- v.cs.s ignored + ap.s ! False ! (NCase agr.n (npform2case agr.n v.c2.c))) --- v.cs.s ignored (predV v) ; SlashV2S v s = @@ -46,7 +46,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin in { SlashV2A v ap = insertObj (\\fin,b,_ => - ap.s ! False ! AN (NCase Sg (npform2case Sg v.c3.c))) ----agr to obj + ap.s ! False ! (NCase Sg (npform2case Sg v.c3.c))) ----agr to obj (predV v) ** {c2 = v.c2} ; ComplSlash vp np = insertObj (\\fin,b,_ => appCompl fin b vp.c2 np) vp ; @@ -95,7 +95,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin in { Sg => Nom ; -- minä olen iso Pl => Part -- me olemme isoja } --- definiteness of NP ? - in ap.s ! False ! AN (NCase agr.n c) + in ap.s ! False ! (NCase agr.n c) } ; CompNP np = {s = \\_ => np.s ! NPCase Nom} ; CompAdv a = {s = \\_ => a.s} ; diff --git a/next-lib/src/german/AdjectiveGer.gf b/next-lib/src/german/AdjectiveGer.gf index 6f174bb1e..10b4b3cfd 100644 --- a/next-lib/src/german/AdjectiveGer.gf +++ b/next-lib/src/german/AdjectiveGer.gf @@ -12,6 +12,14 @@ concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in { s = \\af => a.s ! Compar ! af ++ conjThan ++ np.s ! Nom ; isPre = True } ; + UseComparA a = { + s = \\af => a.s ! Compar ! af ; + isPre = True + } ; + AdjOrd a = { + s = a.s ; + isPre = True + } ; -- $SuperlA$ belongs to determiner syntax in $Noun$. @@ -35,6 +43,9 @@ concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in { isPre = ap.isPre } ; - UseA2 a = a ; + UseA2 a = { + s = a.s ! Posit ; + isPre = True + } ; } diff --git a/next-lib/src/romance/AdjectiveRomance.gf b/next-lib/src/romance/AdjectiveRomance.gf index 5ff9babb0..eec0783a7 100644 --- a/next-lib/src/romance/AdjectiveRomance.gf +++ b/next-lib/src/romance/AdjectiveRomance.gf @@ -11,6 +11,17 @@ incomplete concrete AdjectiveRomance of Adjective = s = \\af => a.s ! Compar ! af ++ conjThan ++ np.s ! Ton Nom ; isPre = False } ; + UseComparA a = { + s = \\af => a.s ! Compar ! af ; + isPre = a.isPre + } ; + AdjOrd ord = { + s = \\af => ord.s ! (case af of { + AF g n => aagr g n ; + _ => aagr Masc Sg ---- + }) ; + isPre = False ---- + } ; -- $SuperlA$ belongs to determiner syntax in $Noun$. @@ -36,6 +47,9 @@ incomplete concrete AdjectiveRomance of Adjective = isPre = ap.isPre } ; - UseA2 a = a ** {isPre = False} ; + UseA2 a = { + s = a.s ! Posit ; + isPre = False ---- A2 has no isPre + } ; } diff --git a/next-lib/src/romance/NounRomance.gf b/next-lib/src/romance/NounRomance.gf index 5f5d16020..a5de71f99 100644 --- a/next-lib/src/romance/NounRomance.gf +++ b/next-lib/src/romance/NounRomance.gf @@ -93,30 +93,6 @@ incomplete concrete NounRomance of Noun = OrdSuperl adj = {s = \\a => adj.s ! Superl ! AF a.g a.n} ; -{- - DetArtSg det cn = - let - g = cn.g ; - n = Sg - in { - s = \\c => let cs = npform2case c in - det.s ! False ! n ! g ! cs ++ cn.s ! n ; - a = agrP3 g n ; - hasClit = False - } ; - - DetArtPl det cn = - let - g = cn.g ; - n = Pl - in { - s = \\c => let cs = npform2case c in - det.s ! False ! n ! g ! cs ++ cn.s ! n ; - a = agrP3 g n ; - hasClit = False - } ; --} - DefArt = { s = \\_,n,g,c => artDef g n c ; sp = \\n,g,c => artDef g n c ; ---- not for Fre @@ -138,15 +114,6 @@ incomplete concrete NounRomance of Noun = hasClit = False } ; -{---b - MassDet = { - s = \\b,n,g,c => case of { - => partitive g c ; - _ => prepCase genitive ---- - } - } ; --} - -- This is based on record subtyping. UseN, UseN2 = \noun -> noun ; diff --git a/next-lib/src/scandinavian/AdjectiveScand.gf b/next-lib/src/scandinavian/AdjectiveScand.gf index 1570574cb..3dfe36fec 100644 --- a/next-lib/src/scandinavian/AdjectiveScand.gf +++ b/next-lib/src/scandinavian/AdjectiveScand.gf @@ -15,8 +15,18 @@ incomplete concrete AdjectiveScand of Adjective = ++ conjThan ++ np.s ! nominative ; isPre = False } ; + UseComparA a = { + s = \\ap => case a.isComp of { + True => compMore ++ a.s ! AF (APosit ap) Nom ; + _ => a.s ! AF ACompar Nom + } ; + isPre = False + } ; --- $SuperlA$ belongs to determiner syntax in $Noun$. + AdjOrd ord = { + s = \\_ => ord.s ; + isPre = True + } ; ComplA2 a np = { s = \\ap => a.s ! AF (APosit ap) Nom ++ a.c2.s ++ np.s ! accusative ; @@ -39,6 +49,9 @@ incomplete concrete AdjectiveScand of Adjective = isPre = ap.isPre } ; - UseA2 a = a ; + UseA2 a = { + s = \\ap => a.s ! AF (APosit ap) Nom ; + isPre = True + } ; }