From 8eee3df7396b0d6929d79b99cf88f923a01acf77 Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Tue, 19 Jul 2022 18:27:56 +0200 Subject: [PATCH 01/16] Modifications of Prep\', Predet\', Quant\', Det\', NP\' to remove PCase and use NP.s : Agr => Str * Str instead --- src/abstract/Adjective'.gf | 39 ++++++++ src/abstract/Adverb'.gf | 35 +++++++ src/abstract/Cat'.gf | 1 + src/abstract/Conjunction'.gf | 82 ++++++++++++++++ src/abstract/Grammar'.gf | 24 +++++ src/abstract/Idiom'.gf | 35 +++++++ src/abstract/Lang'.gf | 16 +++ src/abstract/Noun'.gf | 161 +++++++++++++++++++++++++++++++ src/abstract/NumeralTransfer'.gf | 97 +++++++++++++++++++ src/abstract/Phrase'.gf | 48 +++++++++ src/abstract/Question'.gf | 55 +++++++++++ src/abstract/Relative'.gf | 26 +++++ src/abstract/Sentence'.gf | 107 ++++++++++++++++++++ src/abstract/Structural'.gf | 130 +++++++++++++++++++++++++ src/abstract/Transfer'.gf | 29 ++++++ src/abstract/Verb'.gf | 85 ++++++++++++++++ src/german/AdjectiveGer.gf | 13 +-- src/german/AdverbGer.gf | 4 +- src/german/CatGer.gf | 39 ++++++-- src/german/ConjunctionGer.gf | 8 +- src/german/GrammarGer.gf | 4 +- src/german/IdiomGer.gf | 14 +-- src/german/LangGer.gf | 6 +- src/german/LexiconGer.gf | 3 +- src/german/MorphoGer.gf | 16 ++- src/german/NounGer.gf | 67 ++++++++++--- src/german/ParadigmsGer.gf | 135 +++++++++++++------------- src/german/PhraseGer.gf | 7 +- src/german/QuestionGer.gf | 7 +- src/german/RelativeGer.gf | 11 ++- src/german/ResGer.gf | 146 +++++++++++++++++++++++++--- src/german/SentenceGer.gf | 8 +- src/german/StructuralGer.gf | 7 +- src/german/VerbGer.gf | 53 +++------- 34 files changed, 1331 insertions(+), 187 deletions(-) create mode 100644 src/abstract/Adjective'.gf create mode 100644 src/abstract/Adverb'.gf create mode 100644 src/abstract/Cat'.gf create mode 100644 src/abstract/Conjunction'.gf create mode 100644 src/abstract/Grammar'.gf create mode 100644 src/abstract/Idiom'.gf create mode 100644 src/abstract/Lang'.gf create mode 100644 src/abstract/Noun'.gf create mode 100644 src/abstract/NumeralTransfer'.gf create mode 100644 src/abstract/Phrase'.gf create mode 100644 src/abstract/Question'.gf create mode 100644 src/abstract/Relative'.gf create mode 100644 src/abstract/Sentence'.gf create mode 100644 src/abstract/Structural'.gf create mode 100644 src/abstract/Transfer'.gf create mode 100644 src/abstract/Verb'.gf diff --git a/src/abstract/Adjective'.gf b/src/abstract/Adjective'.gf new file mode 100644 index 00000000..b3b78483 --- /dev/null +++ b/src/abstract/Adjective'.gf @@ -0,0 +1,39 @@ +--1 Adjective: Adjectives and Adjectival Phrases + +abstract Adjective' = Cat' ** { + + fun + +-- The principal ways of forming an adjectival phrase are +-- positive, comparative, relational, reflexive-relational, and +-- elliptic-relational. + + 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 -> AP ; -- married + UseComparA : A -> AP ; -- warmer + CAdvAP : CAdv -> AP -> NP -> AP ; -- as cool as John + +-- 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. + + SentAP : AP -> SC -> AP ; -- good that she is here + +-- An adjectival phrase can be modified by an *adadjective*, such as "very". + + AdAP : AdA -> AP -> AP ; -- very warm + +-- It can also be postmodified by an adverb, typically a prepositional phrase. + + AdvAP : AP -> Adv -> AP ; -- warm by nature + +-- The formation of adverbs from adjectives (e.g. "quickly") is covered +-- in [Adverb Adverb.html]; the same concerns adadjectives (e.g. "extremely"). + +} diff --git a/src/abstract/Adverb'.gf b/src/abstract/Adverb'.gf new file mode 100644 index 00000000..ca5e9541 --- /dev/null +++ b/src/abstract/Adverb'.gf @@ -0,0 +1,35 @@ +--1 Adverb: Adverbs and Adverbial Phrases + +abstract Adverb' = Cat' ** { + + fun + +-- The two main ways of forming adverbs are from adjectives and by +-- prepositions from noun phrases. + + PositAdvAdj : A -> Adv ; -- warmly + PrepNP : Prep' -> NP' -> Adv ; -- in the house + +-- Comparative adverbs have a noun phrase or a sentence as object of +-- comparison. + + ComparAdvAdj : CAdv -> A -> NP -> Adv ; -- more warmly than John + ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs + +-- Adverbs can be modified by 'adadjectives', just like adjectives. + + AdAdv : AdA -> Adv -> Adv ; -- very quickly + +-- Like adverbs, adadjectives can be produced by adjectives. + + PositAdAAdj : A -> AdA ; -- extremely + +-- Subordinate clauses can function as adverbs. + + SubjS : Subj -> S -> Adv ; -- when she sleeps + +-- Comparison adverbs also work as numeral adverbs. + + AdnCAdv : CAdv -> AdN ; -- less (than five) + +} diff --git a/src/abstract/Cat'.gf b/src/abstract/Cat'.gf new file mode 100644 index 00000000..2ba01828 --- /dev/null +++ b/src/abstract/Cat'.gf @@ -0,0 +1 @@ +abstract Cat' = Cat ** {cat NP'; Det'; Quant'; Predet'; Prep'; } diff --git a/src/abstract/Conjunction'.gf b/src/abstract/Conjunction'.gf new file mode 100644 index 00000000..c9b3fb7c --- /dev/null +++ b/src/abstract/Conjunction'.gf @@ -0,0 +1,82 @@ +--1 Conjunction: Coordination + +-- Coordination is defined for many different categories; here is +-- a sample. The rules apply to *lists* of two or more elements, +-- and define two general patterns: +-- - ordinary conjunction: X,...X and X +-- - distributed conjunction: both X,...,X and X +-- +-- +-- $VP$ conjunctions are not covered here, because their applicability +-- depends on language. Some special cases are defined in +-- [``Extra`` ../abstract/Extra.gf]. + + +abstract Conjunction' = Cat' ** { + +--2 Rules + + fun + ConjS : Conj -> ListS -> S ; -- he walks and she runs + ConjRS : Conj -> ListRS -> RS ; -- who walks and whose mother runs + ConjAP : Conj -> ListAP -> AP ; -- cold and warm + ConjNP' : Conj -> ListNP' -> NP' ; -- she or we + ConjAdv : Conj -> ListAdv -> Adv ; -- here or there + ConjAdV : Conj -> ListAdV -> AdV ; -- always or sometimes + ConjIAdv : Conj -> ListIAdv -> IAdv ; -- where and with whom + ConjCN : Conj -> ListCN -> CN ; -- man and woman + ConjDet : Conj -> ListDAP -> Det ; -- his or her + +--2 Categories + +-- These categories are only used in this module. + + cat + [S]{2} ; + [RS]{2} ; + [Adv]{2} ; + [AdV]{2} ; + [NP']{2} ; + [AP]{2} ; + [IAdv]{2} ; + [CN] {2} ; + [DAP] {2} ; + +--2 List constructors + +-- The list constructors are derived from the list notation and therefore +-- not given explicitly. But here are their type signatures: +{- +-- overview + BaseC : C -> C -> [C] ; --- for C = AdV, Adv, AP, CN, Det, IAdv, NP, RS, S + ConsC : C -> [C] -> [C] ; --- for C = AdV, Adv, AP, CN, Det, IAdv, NP, RS, S + +-- complete list + + BaseAP : AP -> AP -> ListAP ; -- red, white + ConsAP : AP -> ListAP -> ListAP ; -- red, white, blue + + BaseAdV : AdV -> AdV -> ListAdV ; -- always, sometimes + ConsAdV : AdV -> ListAdV -> ListAdV ; -- always, sometimes, never + + BaseAdv : Adv -> Adv -> ListAdv ; -- here, there + ConsAdv : Adv -> ListAdv -> ListAdv ; -- here, there, everywhere + + BaseCN : CN -> CN -> ListCN ; -- man, woman + ConsCN : CN -> ListCN -> ListCN ; -- man, woman, child + + BaseIAdv : IAdv -> IAdv -> ListIAdv ; -- where, when + ConsIAdv : IAdv -> ListIAdv -> ListIAdv ; -- where, when, why + + BaseNP : NP -> NP -> ListNP ; -- John, Mary + ConsNP : NP -> ListNP -> ListNP ; -- John, Mary, Bill + + BaseRS : RS -> RS -> ListRS ; -- who walks, whom I know + ConsRS : RS -> ListRS -> ListRS ; -- who wals, whom I know, who is here + + BaseS : S -> S -> ListS ; -- John walks, Mary runs + ConsS : S -> ListS -> ListS ; -- John walks, Mary runs, Bill swims + +-} +} + diff --git a/src/abstract/Grammar'.gf b/src/abstract/Grammar'.gf new file mode 100644 index 00000000..de3322a7 --- /dev/null +++ b/src/abstract/Grammar'.gf @@ -0,0 +1,24 @@ +--1 Grammar: the Main Module of the Resource Grammar + +-- This grammar is a collection of the different grammar modules, +-- To test the resource, import [``Lang`` Lang.html], which also contains +-- a lexicon. + +abstract Grammar' = + Noun', + Verb', + Adjective', + Adverb', + Numeral, + Sentence', + Question', + Relative', + Conjunction', + Phrase', + Text, + Structural', + Idiom', + Tense, + Transfer' + ; + diff --git a/src/abstract/Idiom'.gf b/src/abstract/Idiom'.gf new file mode 100644 index 00000000..5fa876ce --- /dev/null +++ b/src/abstract/Idiom'.gf @@ -0,0 +1,35 @@ +--1 Idiom: Idiomatic Expressions + +abstract Idiom' = Cat' ** { + +-- This module defines constructions that are formed in fixed ways, +-- often different even in closely related languages. + + fun + ImpersCl : VP -> Cl ; -- it is hot + GenericCl : VP -> Cl ; -- one sleeps + + CleftNP : NP' -> RS -> Cl ; -- it is I who did it + CleftAdv : Adv -> S -> Cl ; -- it is here she slept + + ExistNP : NP' -> Cl ; -- there is a house + ExistIP : IP -> QCl ; -- which houses are there + +-- 7/12/2012 generalizations of these + + ExistNPAdv : NP' -> Adv -> Cl ; -- there is a house in Paris + ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris + + ProgrVP : VP -> VP ; -- be sleeping + + ImpPl1 : VP -> Utt ; -- let's go + + ImpP3 : NP' -> VP -> Utt ; -- let John walk + +-- 3/12/2013 non-reflexive uses of "self" + + SelfAdvVP : VP -> VP ; -- is at home himself + SelfAdVVP : VP -> VP ; -- is himself at home + SelfNP : NP' -> NP' ; -- the president himself (is at home) + +} diff --git a/src/abstract/Lang'.gf b/src/abstract/Lang'.gf new file mode 100644 index 00000000..a9a7218b --- /dev/null +++ b/src/abstract/Lang'.gf @@ -0,0 +1,16 @@ +--1 Lang: a Test Module for the Resource Grammar + +-- This grammar is for testing the resource as included in the +-- language-independent API, consisting of a grammar and a lexicon. +-- The grammar without a lexicon is [``Grammar`` Grammar.html], +-- which may be more suitable to open in applications. + +abstract Lang' = + Grammar', + Lexicon +-- ,Construction --- could be compiled here, but not in concretes, as they call Syntax and Grammar +-- ,Documentation --# notpresent + ,Markup - [stringMark] + ** { + flags startcat=Phr ; + } ; diff --git a/src/abstract/Noun'.gf b/src/abstract/Noun'.gf new file mode 100644 index 00000000..e1ef86cc --- /dev/null +++ b/src/abstract/Noun'.gf @@ -0,0 +1,161 @@ +--1 Noun: Nouns, noun phrases, and determiners + +abstract Noun' = Cat' ** { + + +--2 Noun phrases + +-- The three main types of noun phrases are +-- - common nouns with determiners +-- - proper names +-- - pronouns +-- +-- + fun + DetCN : Det -> CN -> NP ; -- the man + DetCN' : Det' -> CN -> NP' ; -- the man + UsePN : PN -> NP ; -- John + UsePron : Pron -> NP ; -- he + +-- Pronouns are defined in the module [``Structural`` Structural.html]. + +-- A noun phrase already formed can be modified by a $Predet$erminer. + + PredetNP : Predet -> NP -> NP ; -- only the man + +-- A noun phrase can also be postmodified by the past participle of a +-- verb, by an adverb, or by a relative clause + + PPartNP : NP -> V2 -> NP ; -- the man seen + AdvNP : NP -> Adv -> NP ; -- Paris today + ExtAdvNP: NP -> Adv -> NP ; -- boys, such as .. + RelNP : NP -> RS -> NP ; -- Paris, which is here + +-- Determiners can form noun phrases directly. + + DetNP : Det -> NP ; -- these five + + +--2 Determiners + +-- The determiner has a fine-grained structure, in which a 'nucleus' +-- quantifier and an optional numeral can be discerned. + + DetQuant : Quant -> Num -> Det ; -- these five + DetQuant' : Quant' -> Num -> Det'; -- these five + DetQuantOrd : Quant -> Num -> Ord -> Det ; -- these five best + +-- Whether the resulting determiner is singular or plural depends on the +-- cardinal. + +-- All parts of the determiner can be empty, except $Quant$, which is +-- the "kernel" of a determiner. It is, however, the $Num$ that determines +-- the inherent number. + + NumSg : Num ; -- [no numeral, but marked as singular] + NumPl : Num ; -- [no numeral, but marked as plural] + NumCard : Card -> Num ; -- one/five [explicit numeral] + +-- $Card$ consists of either digits or numeral words. + + data + NumDigits : Digits -> Card ; -- 51 + NumNumeral : Numeral -> Card ; -- fifty-one + +-- The construction of numerals is defined in [Numeral Numeral.html]. + +-- A $Card$ can be modified by certain adverbs. + + fun + AdNum : AdN -> Card -> Card ; -- almost 51 + +-- An $Ord$ consists of either digits or numeral words. +-- Also superlative forms of adjectives behave syntactically like ordinals. + + OrdDigits : Digits -> Ord ; -- 51st + OrdNumeral : Numeral -> Ord ; -- fifty-first + OrdSuperl : A -> Ord ; -- warmest + +-- One can combine a numeral and a superlative. + + OrdNumeralSuperl : Numeral -> A -> Ord ; -- third largest + +-- Definite and indefinite noun phrases are sometimes realized as +-- neatly distinct words (Spanish "un, unos ; el, los") but also without +-- any particular word (Finnish; Swedish definites). + + IndefArt : Quant ; -- a/an + DefArt : Quant ; -- the + DefArt' : Quant'; -- the + +-- Nouns can be used without an article as mass nouns. The resource does +-- not distinguish mass nouns from other common nouns, which can result +-- in semantically odd expressions. + + MassNP : CN -> NP ; -- (beer) + +-- Pronouns have possessive forms. Genitives of other kinds +-- of noun phrases are not given here, since they are not possible +-- in e.g. Romance languages. They can be found in $Extra$ modules. + + PossPron : Pron -> Quant ; -- my (house) + +-- Other determiners are defined in [Structural Structural.html]. + + + +--2 Common nouns + +-- Simple nouns can be used as nouns outright. + + UseN : N -> CN ; -- house + +-- Relational nouns take one or two arguments. + + ComplN2 : N2 -> NP' -> CN ; -- mother of the king + ComplN3 : N3 -> NP' -> N2 ; -- distance from this city (to Paris) + +-- Relational nouns can also be used without their arguments. +-- The semantics is typically derivative of the relational meaning. + + UseN2 : N2 -> CN ; -- mother + Use2N3 : N3 -> N2 ; -- distance (from this city) + Use3N3 : N3 -> N2 ; -- distance (to Paris) + +-- Nouns can be modified by adjectives, relative clauses, and adverbs +-- (the last rule will give rise to many 'PP attachment' ambiguities +-- when used in connection with verb phrases). + + AdjCN : AP -> CN -> CN ; -- big house + RelCN : CN -> RS -> CN ; -- house that John bought + AdvCN : CN -> Adv -> CN ; -- house on the hill + +-- Nouns can also be modified by embedded sentences and questions. +-- For some nouns this makes little sense, but we leave this for applications +-- to decide. Sentential complements are defined in [Verb Verb.html]. + + SentCN : CN -> SC -> CN ; -- question where she sleeps + +--2 Apposition + +-- This is certainly overgenerating. + + ApposCN : CN -> NP -> CN ; -- city Paris (, numbers x and y) + +--2 Possessive and partitive constructs + +-- (New 13/3/2013 AR; Structural.possess_Prep and part_Prep should be deprecated in favour of these.) + + PossNP : CN -> NP -> CN ; -- house of Paris, house of mine + PartNP : CN -> NP -> CN ; -- glass of wine + +-- This is different from the partitive, as shown by many languages. + + CountNP : Det -> NP -> NP ; -- three of them, some of the boys + +--3 Conjoinable determiners and ones with adjectives + + AdjDAP : DAP -> AP -> DAP ; -- the large (one) + DetDAP : Det -> DAP ; -- this (or that) + +} diff --git a/src/abstract/NumeralTransfer'.gf b/src/abstract/NumeralTransfer'.gf new file mode 100644 index 00000000..639524e5 --- /dev/null +++ b/src/abstract/NumeralTransfer'.gf @@ -0,0 +1,97 @@ +abstract NumeralTransfer' = Numeral, Noun' ** { + +fun digits2numeral : Card -> Card ; +def + digits2numeral (NumDigits d) = NumNumeral (digits2num d) ; + digits2numeral n = n ; + +fun digits2num : Digits -> Numeral ; +def digits2num (IDig d1) = num (pot2as3 (pot1as2 (pot0as1 (dn10 d1)))) ; + digits2num (IIDig d2 (IDig d1)) = num (pot2as3 (pot1as2 (dn100 d2 d1))) ; + digits2num (IIDig d3 (IIDig d2 (IDig d1))) = num (pot2as3 (dn1000 d3 d2 d1)) ; + digits2num (IIDig d4 (IIDig d3 (IIDig d2 (IDig d1)))) = num (dn1000000a d4 d3 d2 d1) ; + digits2num (IIDig d5 (IIDig d4 (IIDig d3 (IIDig d2 (IDig d1))))) = num (dn1000000b d5 d4 d3 d2 d1) ; + digits2num (IIDig d6 ((IIDig d5 (IIDig d4 (IIDig d3 (IIDig d2 (IDig d1))))))) = num (dn1000000c d6 d5 d4 d3 d2 d1) ; + +fun num2digits : Numeral -> Digits ; +def num2digits (num x) = nd1000000 x ; + +fun dn10 : Dig -> Sub10 ; +def dn10 D_1 = pot01 ; + dn10 d1 = pot0 (dn d1) ; + +fun dn100 : Dig -> Dig -> Sub100 ; +def dn100 D_0 d1 = pot0as1 (dn10 d1) ; + dn100 D_1 D_0 = pot110 ; + dn100 D_1 D_1 = pot111 ; + dn100 D_1 d1 = pot1to19 (dn d1) ; + dn100 d2 D_0 = pot1 (dn d2) ; + dn100 d2 d1 = pot1plus (dn d2) (dn10 d1) ; + +fun dn1000 : Dig -> Dig -> Dig -> Sub1000 ; +def dn1000 D_0 d2 d1 = pot1as2 (dn100 d2 d1) ; + dn1000 d3 D_0 D_0 = pot2 (dn10 d3) ; + dn1000 d3 d2 d1 = pot2plus (dn10 d3) (dn100 d2 d1) ; + +fun dn1000000a : Dig -> Dig -> Dig -> Dig -> Sub1000000 ; +def dn1000000a D_0 d3 d2 d1 = pot2as3 (dn1000 d3 d2 d1) ; + dn1000000a d4 D_0 D_0 D_0 = pot3 (pot1as2 (pot0as1 (dn10 d4))) ; + dn1000000a d4 d3 d2 d1 = pot3plus (pot1as2 (pot0as1 (dn10 d4))) (dn1000 d3 d2 d1) ; + +fun dn1000000b : Dig -> Dig -> Dig -> Dig -> Dig -> Sub1000000 ; +def dn1000000b D_0 d4 d3 d2 d1 = dn1000000a d4 d3 d2 d1 ; + dn1000000b d5 d4 D_0 D_0 D_0 = pot3 (pot1as2 (dn100 d5 d4)) ; + dn1000000b d5 d4 d3 d2 d1 = pot3plus (pot1as2 (dn100 d5 d4)) (dn1000 d3 d2 d1) ; + +fun dn1000000c : Dig -> Dig -> Dig -> Dig -> Dig -> Dig -> Sub1000000 ; +def dn1000000c D_0 d5 d4 d3 d2 d1 = dn1000000b d5 d4 d3 d2 d1 ; + dn1000000c d6 d5 d4 D_0 D_0 D_0 = pot3 (dn1000 d6 d5 d4) ; + dn1000000c d6 d5 d4 d3 d2 d1 = pot3plus (dn1000 d6 d5 d4) (dn1000 d3 d2 d1) ; + +fun dn : Dig -> Digit ; +def dn D_2 = n2 ; + dn D_3 = n3 ; + dn D_4 = n4 ; + dn D_5 = n5 ; + dn D_6 = n6 ; + dn D_7 = n7 ; + dn D_8 = n8 ; + dn D_9 = n9 ; + +fun nd10 : Sub10 -> Digits ; +def nd10 pot01 = IDig D_1 ; + nd10 (pot0 d1) = IDig (nd d1) ; + +fun nd100 : Sub100 -> Digits ; +def nd100 (pot0as1 d) = nd10 d ; + nd100 pot110 = IIDig D_1 (IDig D_0) ; + nd100 pot111 = IIDig D_1 (IDig D_1) ; + nd100 (pot1to19 d) = IIDig D_1 (IDig (nd d)) ; + nd100 (pot1 d) = IIDig (nd d) (IDig D_0) ; + nd100 (pot1plus d x) = IIDig (nd d) (nd10 x) ; + +fun nd1000 : Sub1000 -> Digits ; +def nd1000 (pot1as2 x) = nd100 x ; + nd1000 (pot2 x) = dconcat (nd10 x) (IIDig D_0 (IDig D_0)) ; + nd1000 (pot2plus x y) = dconcat (nd10 x) (nd100 y) ; + +fun nd1000000 : Sub1000000 -> Digits ; +def nd1000000 (pot2as3 x) = nd1000 x ; + nd1000000 (pot3 x) = dconcat (nd1000 x) (IIDig D_0 (IIDig D_0 (IDig D_0))) ; + nd1000000 (pot3plus x y) = dconcat (nd1000 x) (nd1000 y) ; + +fun dconcat : Digits -> Digits -> Digits ; +def dconcat (IDig d) ys = IIDig d ys ; + dconcat (IIDig d xs) ys = IIDig d (dconcat xs ys) ; + +fun nd : Digit -> Dig ; +def nd n2 = D_2 ; + nd n3 = D_3 ; + nd n4 = D_4 ; + nd n5 = D_5 ; + nd n6 = D_6 ; + nd n7 = D_7 ; + nd n8 = D_8 ; + nd n9 = D_9 ; + +} diff --git a/src/abstract/Phrase'.gf b/src/abstract/Phrase'.gf new file mode 100644 index 00000000..35ae77da --- /dev/null +++ b/src/abstract/Phrase'.gf @@ -0,0 +1,48 @@ +--1 Phrase: Phrases and Utterances + +abstract Phrase' = Cat' ** { + +-- When a phrase is built from an utterance it can be prefixed +-- with a phrasal conjunction (such as "but", "therefore") +-- and suffixing with a vocative (typically a noun phrase). + + fun + PhrUtt : PConj -> Utt -> Voc -> Phr ; -- but come here, my friend + +-- Utterances are formed from sentences, questions, and imperatives. + + UttS : S -> Utt ; -- John walks + UttQS : QS -> Utt ; -- is it good + UttImpSg : Pol -> Imp -> Utt ; -- (don't) love yourself + UttImpPl : Pol -> Imp -> Utt ; -- (don't) love yourselves + UttImpPol : Pol -> Imp -> Utt ; -- (don't) sleep (polite) + +-- There are also 'one-word utterances'. A typical use of them is +-- as answers to questions. +-- *Note*. This list is incomplete. More categories could be covered. +-- Moreover, in many languages e.g. noun phrases in different cases +-- can be used. + + UttIP : IP -> Utt ; -- who + UttIAdv : IAdv -> Utt ; -- why + UttNP : NP' -> Utt ; -- this man + UttAdv : Adv -> Utt ; -- here + UttVP : VP -> Utt ; -- to sleep + UttCN : CN -> Utt ; -- house + UttCard : Card -> Utt ; -- five + UttAP : AP -> Utt ; -- fine + UttInterj : Interj -> Utt ; -- alas + +-- The phrasal conjunction is optional. A sentence conjunction +-- can also be used to prefix an utterance. + + NoPConj : PConj ; -- [plain phrase without conjunction in front] + PConjConj : Conj -> PConj ; -- and + +-- The vocative is optional. Any noun phrase can be made into vocative, +-- which may be overgenerating (e.g. "I"). + + NoVoc : Voc ; -- [plain phrase without vocative] + VocNP : NP' -> Voc ; -- my friend + +} diff --git a/src/abstract/Question'.gf b/src/abstract/Question'.gf new file mode 100644 index 00000000..21a33258 --- /dev/null +++ b/src/abstract/Question'.gf @@ -0,0 +1,55 @@ +--1 Question: Questions and Interrogative Pronouns + +abstract Question' = Cat' ** { + +-- A question can be formed from a clause ('yes-no question') or +-- with an interrogative. + + fun + QuestCl : Cl -> QCl ; -- does John walk + QuestVP : IP -> VP -> QCl ; -- who walks + QuestSlash : IP -> ClSlash -> QCl ; -- whom does John love + QuestIAdv : IAdv -> Cl -> QCl ; -- why does John walk + QuestIComp : IComp -> NP' -> QCl ; -- where is John + +-- Interrogative pronouns can be formed with interrogative +-- determiners, with or without a noun. + + IdetCN : IDet -> CN -> IP ; -- which five songs + IdetIP : IDet -> IP ; -- which five + +-- They can be modified with adverbs. + + AdvIP : IP -> Adv -> IP ; -- who in Paris + +-- Interrogative quantifiers have number forms and can take number modifiers. + + IdetQuant : IQuant -> Num -> IDet ; -- which (five) + +-- Interrogative adverbs can be formed prepositionally. + + PrepIP : Prep -> IP -> IAdv ; -- with whom + +-- They can be modified with other adverbs. + + AdvIAdv : IAdv -> Adv -> IAdv ; -- where in Paris + +-- Interrogative complements to copulas can be both adverbs and +-- pronouns. + + CompIAdv : IAdv -> IComp ; -- where (is it) + CompIP : IP -> IComp ; -- who (is it) + +-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$. + +-- Wh questions with two or more question words require a new, special category. + + cat + QVP ; -- buy what where + fun + ComplSlashIP : VPSlash -> IP -> QVP ; -- buys what + AdvQVP : VP -> IAdv -> QVP ; -- lives where + AddAdvQVP : QVP -> IAdv -> QVP ; -- buys what where + + QuestQVP : IP -> QVP -> QCl ; -- who buys what where +} diff --git a/src/abstract/Relative'.gf b/src/abstract/Relative'.gf new file mode 100644 index 00000000..3c936a36 --- /dev/null +++ b/src/abstract/Relative'.gf @@ -0,0 +1,26 @@ +--1 Relative clauses and pronouns + +abstract Relative' = Cat' ** { + + fun + +-- The simplest way to form a relative clause is from a clause by +-- a pronoun similar to "such that". + + RelCl : Cl -> RCl ; -- such that John loves her + +-- The more proper ways are from a verb phrase +-- (formed in [``Verb`` Verb.html]) or a sentence +-- with a missing noun phrase (formed in [``Sentence`` Sentence.html]). + + RelVP : RP -> VP -> RCl ; -- who loves John + RelSlash : RP -> ClSlash -> RCl ; -- whom John loves + +-- Relative pronouns are formed from an 'identity element' by prefixing +-- or suffixing (depending on language) prepositional phrases or genitives. + + IdRP : RP ; -- which + FunRP : Prep' -> NP' -> RP -> RP ; -- the mother of whom + +} + diff --git a/src/abstract/Sentence'.gf b/src/abstract/Sentence'.gf new file mode 100644 index 00000000..821970ed --- /dev/null +++ b/src/abstract/Sentence'.gf @@ -0,0 +1,107 @@ +--1 Sentence: Sentences, Clauses, and Imperatives + +abstract Sentence' = Cat' ** { + +--2 Clauses + +-- The $NP VP$ predication rule form a clause whose linearization +-- gives a table of all tense variants, positive and negative. +-- Clauses are converted to $S$ (with fixed tense) with the +-- $UseCl$ function below. + + data + PredVP : NP' -> VP -> Cl ; -- John walks + +-- Using an embedded sentence as a subject is treated separately. +-- This can be overgenerating. E.g. "whether you go" as subject +-- is only meaningful for some verb phrases. + + PredSCVP : SC -> VP -> Cl ; -- that she goes is good + +--2 Clauses missing object noun phrases + +-- This category is a variant of the 'slash category' $S/NP$ of +-- GPSG and categorial grammars, which in turn replaces +-- movement transformations in the formation of questions +-- and relative clauses. Except $SlashV2$, the construction +-- rules can be seen as special cases of function composition, in +-- the style of CCG. +-- *Note* the set is not complete and lacks e.g. verbs with more than 2 places. + + SlashVP : NP' -> VPSlash -> ClSlash ; -- (whom) he sees + AdvSlash : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today + SlashPrep : Cl -> Prep' -> ClSlash ; -- (with whom) he walks + SlashVS : NP' -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves + +--2 Imperatives + +-- An imperative is straightforwardly formed from a verb phrase. +-- It has variation over positive and negative, singular and plural. +-- To fix these parameters, see [Phrase Phrase.html]. + + ImpVP : VP -> Imp ; -- love yourselves + AdvImp : Adv -> Imp -> Imp ; -- please love yourselves + +--2 Embedded sentences + +-- Sentences, questions, and infinitival phrases can be used as +-- subjects and (adverbial) complements. + + EmbedS : S -> SC ; -- that she goes + EmbedQS : QS -> SC ; -- who goes + EmbedVP : VP -> SC ; -- to go + +--2 Sentences + +-- These are the 2 x 4 x 4 = 16 forms generated by different +-- combinations of tense, polarity, and +-- anteriority, which are defined in [``Common`` Common.html]. + + fun + UseCl : Temp -> Pol -> Cl -> S ; -- she had not slept + UseQCl : Temp -> Pol -> QCl -> QS ; -- who had not slept + UseRCl : Temp -> Pol -> RCl -> RS ; -- that had not slept + UseSlash : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen + +-- An adverb can be added to the beginning of a sentence, either with comma ("externally") +-- or without: + + AdvS : Adv -> S -> S ; -- then I will go home + ExtAdvS : Adv -> S -> S ; -- next week, I will go home + +-- This covers subjunctive clauses, but they can also be added to the end. + + SSubjS : S -> Subj -> S -> S ; -- I go home, if she comes + +-- A sentence can be modified by a relative clause referring to its contents. + + RelS : S -> RS -> S ; -- she sleeps, which is good + +---- A sentence can also be post-modified by a subjunct sentence. + +---- ModSubjS : S -> Subj -> S -> S ; -- she sleeps, because she is old +---- cf. Adverb.SubjS + +} + +--. + +-- Examples for English $S$/$Cl$: +{- + Pres Simul Pos ODir : he sleeps + Pres Simul Neg ODir : he doesn't sleep + Pres Anter Pos ODir : he has slept + Pres Anter Neg ODir : he hasn't slept + Past Simul Pos ODir : he slept + Past Simul Neg ODir : he didn't sleep + Past Anter Pos ODir : he had slept + Past Anter Neg ODir : he hadn't slept + Fut Simul Pos ODir : he will sleep + Fut Simul Neg ODir : he won't sleep + Fut Anter Pos ODir : he will have slept + Fut Anter Neg ODir : he won't have slept + Cond Simul Pos ODir : he would sleep + Cond Simul Neg ODir : he wouldn't sleep + Cond Anter Pos ODir : he would have slept + Cond Anter Neg ODir : he wouldn't have slept +-} diff --git a/src/abstract/Structural'.gf b/src/abstract/Structural'.gf new file mode 100644 index 00000000..a20f202c --- /dev/null +++ b/src/abstract/Structural'.gf @@ -0,0 +1,130 @@ +--1 Structural: Structural Words +-- +-- Here we have some words belonging to closed classes and appearing +-- in all languages we have considered. +-- Sometimes more distinctions are needed, e.g. $we_Pron$ in Spanish +-- should be replaced by masculine and feminine variants, found in +-- [``ExtendSpa`` ../spanish/ExtendSpa.gf]. + +abstract Structural' = Cat' ** { + + fun + +-- This is an alphabetical list of structural words + + above_Prep : Prep' ; + after_Prep : Prep' ; + all_Predet : Predet ; + all_Predet' : Predet' ; + almost_AdA : AdA ; + almost_AdN : AdN ; + although_Subj : Subj ; + always_AdV : AdV ; + and_Conj : Conj ; + because_Subj : Subj ; + before_Prep : Prep' ; + behind_Prep : Prep' ; + between_Prep : Prep' ; + both7and_DConj : Conj ; -- both...and +---b both7and_DConj : DConj ; + but_PConj : PConj ; + by8agent_Prep : Prep' ; -- by (agent) + by8means_Prep : Prep' ; -- by (means of) + can8know_VV : VV ; -- can (capacity) + can_VV : VV ; -- can (possibility) + during_Prep : Prep' ; + either7or_DConj : Conj ; -- either...or +---b either7or_DConj : DConj ; + every_Det : Det ; + everybody_NP : NP ; -- everybody + everything_NP : NP ; + everywhere_Adv : Adv ; +--- first_Ord : Ord ; DEPRECATED + few_Det : Det ; + for_Prep : Prep' ; + from_Prep : Prep' ; + he_Pron : Pron ; + here_Adv : Adv ; + here7to_Adv : Adv ; -- to here + here7from_Adv : Adv ; -- from here + how_IAdv : IAdv ; + how8many_IDet : IDet ; + how8much_IAdv : IAdv ; + i_Pron : Pron ; + if_Subj : Subj ; + in8front_Prep : Prep' ; -- in front of + in_Prep : Prep' ; + it_Pron : Pron ; + less_CAdv : CAdv ; + many_Det : Det ; + more_CAdv : CAdv ; + most_Predet : Predet ; + most_Predet' : Predet' ; + much_Det : Det ; + must_VV : VV ; +---b no_Phr : Phr ; + no_Utt : Utt ; + on_Prep : Prep' ; +--- one_Quant : QuantSg ; DEPRECATED + only_Predet : Predet ; + or_Conj : Conj ; + otherwise_PConj : PConj ; + part_Prep : Prep' ; + please_Voc : Voc ; + possess_Prep : Prep' ; -- of (possessive) + quite_Adv : AdA ; + she_Pron : Pron ; + so_AdA : AdA ; + someSg_Det : Det ; + somePl_Det : Det ; + somebody_NP : NP ; + something_NP : NP ; + somewhere_Adv : Adv ; + that_Quant : Quant ; + that_Subj : Subj ; + there_Adv : Adv ; + there7to_Adv : Adv ; -- to there + there7from_Adv : Adv ; -- from there + therefore_PConj : PConj ; + they_Pron : Pron ; + this_Quant : Quant ; + through_Prep : Prep' ; + to_Prep : Prep' ; + too_AdA : AdA ; + under_Prep : Prep' ; + very_AdA : AdA ; + want_VV : VV ; + we_Pron : Pron ; + whatPl_IP : IP ; -- what (plural) + whatSg_IP : IP ; -- what (singular) + when_IAdv : IAdv ; + when_Subj : Subj ; + where_IAdv : IAdv ; + which_IQuant : IQuant ; + whoPl_IP : IP ; -- who (plural) + whoSg_IP : IP ; -- who (singular) + why_IAdv : IAdv ; + with_Prep : Prep' ; + without_Prep : Prep' ; +---b yes_Phr : Phr ; + yes_Utt : Utt ; + youSg_Pron : Pron ; -- you (singular) + youPl_Pron : Pron ; -- you (plural) + youPol_Pron : Pron ; -- you (polite) + + no_Quant : Quant ; + not_Predet : Predet ; + if_then_Conj : Conj ; + at_least_AdN : AdN ; + at_most_AdN : AdN ; + nobody_NP : NP ; + nothing_NP : NP ; + except_Prep : Prep' ; + + as_CAdv : CAdv ; + + have_V2 : V2 ; + + fun language_title_Utt : Utt ; + +} diff --git a/src/abstract/Transfer'.gf b/src/abstract/Transfer'.gf new file mode 100644 index 00000000..0c41fa52 --- /dev/null +++ b/src/abstract/Transfer'.gf @@ -0,0 +1,29 @@ +abstract Transfer' = Sentence', Verb', Adverb', Structural', NumeralTransfer' ** { + +{- +-- examples of transfer: to test, + + > i LangEng.gf + + > p "she sees him" | pt -transfer=active2passive | l + he is seen by her + + > p "wouldn't she see him" | pt -transfer=active2passive | l + wouldn't he be seen by her + + > p -cat=NP "3 cats with 4 dogs" | pt -transfer=digits2numeral | l + three cats with four dogs +-} + +fun + active2passive : Cl -> Cl ; +def + active2passive (PredVP subj (ComplSlash (SlashV2a v) obj)) = + PredVP obj (AdvVP (PassV2 v) (PrepNP by8agent_Prep subj)) ; + active2passive (PredVP subj (AdvVP (ComplSlash (SlashV2a v) obj) adv)) = + PredVP obj (AdvVP (AdvVP (PassV2 v) (PrepNP by8agent_Prep subj)) adv) ; + active2passive (PredVP subj (AdVVP adv (ComplSlash (SlashV2a v) obj))) = + PredVP obj (AdVVP adv (AdvVP (PassV2 v) (PrepNP by8agent_Prep subj))) ; + active2passive cl = cl ; + +} diff --git a/src/abstract/Verb'.gf b/src/abstract/Verb'.gf new file mode 100644 index 00000000..7d1b983a --- /dev/null +++ b/src/abstract/Verb'.gf @@ -0,0 +1,85 @@ +--1 The construction of verb phrases + +abstract Verb' = Cat' ** { + + flags coding = utf8 ; + +--2 Complementization rules + +-- Verb phrases are constructed from verbs by providing their +-- complements. There is one rule for each verb category. + + data + UseV : V -> VP ; -- sleep + + ComplVV : VV -> VP -> VP ; -- want to run + ComplVS : VS -> S -> VP ; -- say that she runs + ComplVQ : VQ -> QS -> VP ; -- wonder who runs + ComplVA : VA -> AP -> VP ; -- they become red + + SlashV2a : V2 -> VPSlash ; -- love (it) + Slash2V3 : V3 -> NP' -> VPSlash ; -- give it (to her) + Slash3V3 : V3 -> NP' -> VPSlash ; -- give (it) to her + + SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go + SlashV2S : V2S -> S -> VPSlash ; -- answer (to him) that it is good + SlashV2Q : V2Q -> QS -> VPSlash ; -- ask (him) who came + SlashV2A : V2A -> AP -> VPSlash ; -- paint (it) red + + ComplSlash : VPSlash -> NP' -> VP ; -- love it + + SlashVV : VV -> VPSlash -> VPSlash ; -- want to buy + SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy + SlashV2VNP' : V2V -> NP' -> VPSlash -> VPSlash ; -- beg me to buy + +--2 Other ways of forming verb phrases + +-- Verb phrases can also be constructed reflexively and from +-- copula-preceded complements. + + ReflVP : VPSlash -> VP ; -- love himself + UseComp : Comp -> VP ; -- be warm + +-- Passivization of two-place verbs is another way to use +-- them. In many languages, the result is a participle that +-- is used as complement to a copula ("is used"), but other +-- auxiliary verbs are possible (Ger. "wird angewendet", It. +-- "viene usato"), as well as special verb forms (Fin. "käytetään", +-- Swe. "används"). +-- +-- *Note*. the rule can be overgenerating, since the $V2$ need not +-- take a direct object. + + PassV2 : V2 -> VP ; -- be loved + +-- Adverbs can be added to verb phrases. Many languages make +-- a distinction between adverbs that are attached in the end +-- vs. next to (or before) the verb. + + AdvVP : VP -> Adv -> VP ; -- sleep here + ExtAdvVP : VP -> Adv -> VP ; -- sleep , even though ... + AdVVP : AdV -> VP -> VP ; -- always sleep + + AdvVPSlash : VPSlash -> Adv -> VPSlash ; -- use (it) here + AdVVPSlash : AdV -> VPSlash -> VPSlash ; -- always use (it) + + VPSlashPrep : VP -> Prep' -> VPSlash ; -- live in (it) + + +-- *Agents of passives* are constructed as adverbs with the +-- preposition [Structural Structural.html]$.8agent_Prep$. + + +--2 Complements to copula + +-- Adjectival phrases, noun phrases, and adverbs can be used. + + CompAP : AP -> Comp ; -- (be) small + CompNP : NP -> Comp ; -- (be) the man + CompAdv : Adv -> Comp ; -- (be) here + CompCN : CN -> Comp ; -- (be) a man/men + +-- Copula alone + + UseCopula : VP ; -- be +} diff --git a/src/german/AdjectiveGer.gf b/src/german/AdjectiveGer.gf index c014c624..9b2688b0 100644 --- a/src/german/AdjectiveGer.gf +++ b/src/german/AdjectiveGer.gf @@ -1,4 +1,4 @@ -concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in { +concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in { flags optimize=all_subs ; @@ -38,8 +38,8 @@ concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in { ComplA2 a np = let CExt = case a.c2.isPrep of { - False => ; - True => <[], appPrepNP a.c2 np> } + isCase => ; + _ => <[], appPrepNP' a.c2 np> } -- HL: check 7/22 in { s = a.s ! Posit ; isPre = True ; @@ -49,10 +49,11 @@ concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in { ReflA2 a = let - compl = appPrep a.c2 (\\k => usePrepC k (\c -> reflPron ! agrP3 Sg ! c)) ; +-- compl = appPrep a.c2 (\\k => usePrepC k (\c -> reflPron ! agrP3 Sg ! c)) ; + compl = appPrep' a.c2 (reflPron ! agrP3 Sg) ; CExt = case a.c2.isPrep of - {False => ; - True => <[], compl> } + {isCase => ; + _ => <[], compl> } -- HL Check isPrepDefArt in { s = a.s ! Posit ; isPre = True ; diff --git a/src/german/AdverbGer.gf b/src/german/AdverbGer.gf index df777441..1d9c6e9f 100644 --- a/src/german/AdverbGer.gf +++ b/src/german/AdverbGer.gf @@ -1,4 +1,4 @@ -concrete AdverbGer of Adverb = CatGer ** open ResGer, Prelude in { +concrete AdverbGer of Adverb' = CatGer ** open ResGer, Prelude in { lin PositAdvAdj a = {s = a.s ! Posit ! APred} ; @@ -10,7 +10,7 @@ concrete AdverbGer of Adverb = CatGer ** open ResGer, Prelude in { s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ s.s ! Sub } ; - PrepNP prep np = {s = appPrepNP prep np} ; + PrepNP prep np = {s = appPrepNP' prep np} ; AdAdv = cc2 ; diff --git a/src/german/CatGer.gf b/src/german/CatGer.gf index d76d60d8..08103c5c 100644 --- a/src/german/CatGer.gf +++ b/src/german/CatGer.gf @@ -1,4 +1,5 @@ -concrete CatGer of Cat = +--# -path=.:../abstract:../common:../prelude +concrete CatGer of Cat' = CommonX - [Tense,Temp] ** open ResGer, Prelude in { @@ -11,14 +12,14 @@ concrete CatGer of Cat = S = {s : Order => Str} ; QS = {s : QForm => Str} ; RS = {s : RelGenNum => Str ; c : Case} ; - SSlash = {s : Order => Str} ** {c2 : Preposition} ; + SSlash = {s : Order => Str} ** {c2 : Preposition'} ; -- Sentence Cl = {s : Mood => ResGer.Tense => Anteriority => Polarity => Order => Str} ; ClSlash = { s : Mood => ResGer.Tense => Anteriority => Polarity => Order => Str ; - c2 : Preposition + c2 : Preposition' } ; Imp = {s : Polarity => ImpForm => Str} ; @@ -71,6 +72,24 @@ concrete CatGer of Cat = c : {p : Str ; k : PredetCase} ; a : PredetAgr -- if an agr is forced, e.g. jeder von uns ist ... } ; + + -- HL: To reduce PCase to Case: + NP' = ResGer.NP' ; + Det' = {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ; + Quant' = { + s : Bool => Number => Gender => Case => Str ; -- Bool is True if a cardinal number is present + sp : Bool => Number => Gender => Case => Str ; + a : Adjf ; + aPl : Adjf ; --- to distinguish "meine guten Freunde" / "gute Freunde" + hasDefArt : Bool + } ; + Predet' = { + s : Number => Gender => Case => Str ; + c : {p : Str ; k : PredetCase} ; + a : PredetAgr -- if an agr is forced, e.g. jeder von uns ist ... + } ; + + Num = {s : Gender => Case => Str ; n : Number ; isNum : Bool} ; Card = {s : Gender => Case => Str ; n : Number} ; Ord = {s : AForm => Str} ; @@ -85,21 +104,22 @@ concrete CatGer of Cat = Conj = {s1,s2 : Str ; n : Number} ; Subj = {s : Str} ; Prep = Preposition ; + Prep' = Preposition' ; -- Open lexical classes, e.g. Lexicon V, VA, VS, VQ = ResGer.Verb ; -- = {s : VForm => Str} ; VV = Verb ** {isAux : Bool} ; - V2, V2A, V2S, V2Q = Verb ** {c2 : Preposition} ; - V2V = Verb ** {c2 : Preposition ; isAux : Bool ; objCtrl : Bool} ; - V3 = Verb ** {c2, c3 : Preposition} ; + V2, V2A, V2S, V2Q = Verb ** {c2 : Preposition'} ; + V2V = Verb ** {c2 : Preposition' ; isAux : Bool ; objCtrl : Bool} ; + V3 = Verb ** {c2, c3 : Preposition'} ; A = {s : Degree => AForm => Str} ; - A2 = {s : Degree => AForm => Str ; c2 : Preposition} ; + A2 = {s : Degree => AForm => Str ; c2 : Preposition'} ; N = ResGer.Noun ; - N2 = ResGer.Noun ** {c2 : Preposition} ; - N3 = ResGer.Noun ** {c2,c3 : Preposition} ; + N2 = ResGer.Noun ** {c2 : Preposition'} ; + N3 = ResGer.Noun ** {c2,c3 : Preposition'} ; PN = {s : Case => Str; g : Gender} ; -- tense with possibility to choose conjunctive forms @@ -109,6 +129,7 @@ concrete CatGer of Cat = linref NP = \np -> np.s!(NPC Nom) ++ np.ext ++ np.rc ; -- HL 6/2019 + NP' = \np -> (np.s!Nom).p1 ++ (np.s!Nom).p2 ++ np.ext ++ np.rc ; -- HL 6/2019 CN = \cn -> cn.s ! Strong ! Pl ! Nom ++ cn.adv ++ cn.ext ++ cn.rc ! Pl ; SSlash = \ss -> ss.s ! Main ++ ss.c2.s ; diff --git a/src/german/ConjunctionGer.gf b/src/german/ConjunctionGer.gf index 0a9ae944..5b16cb2b 100644 --- a/src/german/ConjunctionGer.gf +++ b/src/german/ConjunctionGer.gf @@ -1,4 +1,4 @@ -concrete ConjunctionGer of Conjunction = +concrete ConjunctionGer of Conjunction' = CatGer ** open ResGer, Coordination, Prelude in { flags optimize=all_subs ; @@ -9,7 +9,7 @@ concrete ConjunctionGer of Conjunction = ConjAdv conj ss = conjunctDistrSS conj ss ; - ConjNP conj ss = heavyNP (conjunctDistrTable PCase conj ss ** { + ConjNP conj ss = heavyNP' (conjunctDistrTable Case conj ss ** { a = Ag Fem (conjNumber conj.n (numberAgr ss.a)) (personAgr ss.a) ; }) ; @@ -39,11 +39,11 @@ concrete ConjunctionGer of Conjunction = BaseAdv = twoSS ; ConsAdv = consrSS comma ; BaseNP x y = { - s1 = \\c => x.s ! c ++ bigNP x ; + s1 = \\c => (x.s ! c).p1 ++ (x.s ! c).p2 ++ bigNP x ; s2 = \\c => y.s ! c ++ bigNP y ; a = conjAgr x.a y.a } ; ConsNP xs x = { - s1 = \\c => xs.s ! c ++ bigNP xs ++ comma ++ x.s1 ! c ; + s1 = \\c => (x.s ! c).p1 ++ (x.s ! c).p2 ++ bigNP xs ++ comma ++ x.s1 ! c ; s2 = x.s2 ; a = conjAgr xs.a x.a } ; BaseAP x y = { diff --git a/src/german/GrammarGer.gf b/src/german/GrammarGer.gf index ea79032a..06860974 100644 --- a/src/german/GrammarGer.gf +++ b/src/german/GrammarGer.gf @@ -1,8 +1,8 @@ --# -path=.:../abstract:../common:prelude -concrete GrammarGer of Grammar = +concrete GrammarGer of Grammar' = NounGer, - VerbGer, + VerbGer, -- to save compile time during development HL 7/22 AdjectiveGer, AdverbGer, NumeralGer, diff --git a/src/german/IdiomGer.gf b/src/german/IdiomGer.gf index 4802a1dd..7a6090af 100644 --- a/src/german/IdiomGer.gf +++ b/src/german/IdiomGer.gf @@ -1,4 +1,4 @@ -concrete IdiomGer of Idiom = CatGer ** +concrete IdiomGer of Idiom' = CatGer ** open MorphoGer, ParadigmsGer, Prelude in { flags optimize=all_subs ; @@ -10,7 +10,8 @@ concrete IdiomGer of Idiom = CatGer ** CleftNP np rs = mkClause "es" (agrP3 Sg) (insertExtrapos (rs.s ! RGenNum (gennum (genderAgr np.a) (numberAgr np.a))) ---- - (insertObj (\\_ => np.s ! NPC rs.c ++ bigNP np) (predV MorphoGer.sein_V))) ; +-- (insertObj (\\_ => np.s ! NPC rs.c ++ bigNP np) (predV MorphoGer.sein_V))) ; + (insertObj (\\_ => (np.s ! rs.c).p1 ++ (np.s ! rs.c).p2 ++ bigNP' np) (predV MorphoGer.sein_V))) ; --HL CleftAdv ad s = mkClause "es" (agrP3 Sg) (insertExtrapos (conjThat ++ s.s ! Sub) @@ -19,7 +20,7 @@ concrete IdiomGer of Idiom = CatGer ** ExistNP np = mkClause "es" (agrP3 Sg) - (insertObj (\\_ => appPrep geben.c2 np.s ++ bigNP np) + (insertObj (\\_ => appPrep2' geben.c2 np.s ++ bigNP' np) (predV geben)) ; ExistIP ip = { @@ -36,7 +37,8 @@ concrete IdiomGer of Idiom = CatGer ** ExistNPAdv np adv= mkClause "es" (agrP3 Sg) - (insertAdv adv.s (insertObj (\\_ => appPrep geben.c2 np.s ++ bigNP np) +-- (insertAdv adv.s (insertObj (\\_ => appPrep geben.c2 np.s ++ bigNP np) + (insertAdv adv.s (insertObj (\\_ => appPrep2' geben.c2 np.s ++ bigNP' np) (predV geben))) ; ExistIPAdv ip adv = { @@ -59,14 +61,14 @@ concrete IdiomGer of Idiom = CatGer ** } ; ImpP3 np vp = { - s = (mkClause ((mkSubj np vp.c1).p1) np.a vp).s ! + s = (mkClause ((mkSubj' np vp.c1).p1) np.a vp).s ! MConjunct ! Pres ! Simul ! Pos ! Inv } ; SelfAdvVP vp = insertAdv "selbst" vp ; SelfAdVVP vp = insertAdv "selbst" vp ; SelfNP np = np ** { - s = \\c => np.s ! c ++ "selbst" ++ bigNP np ; + s = \\c => <(np.s ! c).p1, (np.s ! c).p2 ++ "selbst" ++ bigNP' np> ; isPron = False ; } ; diff --git a/src/german/LangGer.gf b/src/german/LangGer.gf index 811ae3b7..7a44c4ed 100644 --- a/src/german/LangGer.gf +++ b/src/german/LangGer.gf @@ -1,10 +1,10 @@ --# -path=.:../abstract:../common:../api:../prelude -concrete LangGer of Lang = +concrete LangGer of Lang' = GrammarGer, LexiconGer - ,ConstructionGer - ,DocumentationGer --# notpresent +-- ,ConstructionGer +-- ,DocumentationGer --# notpresent ,MarkupGer - [stringMark] ** { diff --git a/src/german/LexiconGer.gf b/src/german/LexiconGer.gf index 93a39cac..72fddacb 100644 --- a/src/german/LexiconGer.gf +++ b/src/german/LexiconGer.gf @@ -185,7 +185,8 @@ lin sock_N = reg2N "Strumpf" "Strümpfe" masculine ; song_N = reg2N "Lied" "Lieder" neuter ; speak_V2 = dirV2 Irreg.sprechen_V ; - star_N = mkN "Sterne" ; +-- star_N = mkN "Sterne" ; + star_N = mkN "Stern" ; -- HL 7/22 steel_N = mkN "Stahl" ; stone_N = mkN "Stein" ; stop_V = seinV Irreg.halten_V ; diff --git a/src/german/MorphoGer.gf b/src/german/MorphoGer.gf index f7b6a75f..73c744f2 100644 --- a/src/german/MorphoGer.gf +++ b/src/german/MorphoGer.gf @@ -17,15 +17,15 @@ oper -- For $StructuralGer$. - mkPrep : Str -> PCase -> Preposition = \s,c -> - {s = s ; s2 = [] ; c = c ; isPrep = True} ; + mkPrep : Str -> Case -> Preposition' = \s,c -> + {s = s ; s2 = [] ; c = c ; sg = \\_ => [] ; isPrep = isPrep} ; - nameNounPhrase : {s : Case => Str} -> {s : PCase => Str ; a : Agr ; + nameNounPhrase : {s : Case => Str} -> {s : PCase => Str ; a : Agr ; -- isLight, isPron : Bool ; w : Weight ; ext,rc : Str} = \name -> heavyNP { s = \\c => usePrepC c (\k -> name.s ! k) ; - a = agrP3 Sg + a = agrP3 Sg } ; detLikeAdj : Bool -> Number -> Str -> @@ -36,6 +36,14 @@ oper {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> {s,sp = appAdj (regDetA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; + -- HL: to reduce PCase to Case: + detLikeAdj' : Bool -> Number -> Str -> + {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> + {s,sp = appAdj' (regA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; + detUnlikeAdj' : Bool -> Number -> Str -> + {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> + {s,sp = appAdj' (regDetA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; + mkOrd : {s : Degree => AForm => Str} -> {s : AForm => Str} = \a -> {s = a.s ! Posit} ; diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index 8bae4da5..9c858d7c 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -1,4 +1,5 @@ -concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { +--# -path=.:../abstract:../common: +concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { flags optimize=all_subs ; @@ -17,6 +18,24 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { ext = cn.ext } ; + -- HL: + DetCN' det' cn = { + s = \\c => ; + a = agrgP3 cn.g det'.n ; + -- isLight = det.isDef ; -- ich sehe den Mann nicht vs. ich sehe nicht einen Mann + -- isPron = False ; -- HL 6/2019 (but:) sehe (die|einige) Männer nicht + -- don't see a|no man = sehe keinen Mann + -- w = case det'.isDef of { True => WLight' ; _ => WHeavy' } ; + -- Would be clearer with w:Weight and hasDefArt:Bool with |NP|=|Agr|*3*2 = 108 + -- instead of the more efficient w:Weigth' with |NP|=|Agr|*4 = 18*4 = 54 + w = case det'.isDef of { True => case det'.hasDefArt of { True => WDefArt ; + _ => WLight' } ; + _ => WHeavy' + } ; + rc = cn.rc ! det'.n ; + ext = cn.ext + } ; + DetNP det = { s = \\c => det.sp ! Neutr ! c ; -- more genders in ExtraGer -- HL: der+er,den+en ; der drei,den drei+en a = agrP3 det.n ; @@ -105,6 +124,18 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { a = case n of {Sg => a ; Pl => quant.aPl} ; isDef = case of { => False ; _ => True} ; } ; + DetQuant' quant num = + let + n = num.n ; + a = quant.a + in { + s = \\g,c => quant.s ! num.isNum ! n ! g ! c ++ num.s!g!c ; + sp = \\g,c => quant.sp ! num.isNum ! n ! g ! c ++ num.s!g!c ; -- HL: der+er,den+en ; der drei,den drei+en + n = n ; + a = case n of {Sg => a ; Pl => quant.aPl} ; + isDef = case of { => False ; _ => True} ; + hasDefArt = quant.hasDefArt ; + } ; PossPron p = { @@ -163,6 +194,16 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { } ; a, aPl = Strong } ; + -- HL + DefArt' = { + s = \\_,n,g,c => artDef ! (gennum g n) ! c ; + sp = \\_,n,g,c => case of { + => "denen" ; -- HL 6/2019 + => "derer" ; -- HL 6/2019 + _ => artDef ! (gennum g n) ! c } ; + a, aPl = Weak ; + hasDefArt = True + } ; MassNP cn = { s = \\c => usePrepC c (\k -> cn.s ! Strong ! Sg ! k) ++ cn.adv ; @@ -182,20 +223,20 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { } ; ComplN2 f x = { - s = \\_,n,c => f.s ! n ! c ++ appPrepNP f.c2 x ; + s = \\_,n,c => f.s ! n ! c ++ appPrepNP' f.c2 x ; g = f.g ; rc = \\_ => [] ; - ext,adv = [] + ext,adv = [] } ; ComplN3 f x = { - s = \\n,c => f.s ! n ! c ++ appPrepNP f.c2 x ; - co = f.co ++ appPrepNP f.c2 x ; ---- should not occur at all; the abstract syntax is problematic in giving N2 + s = \\n,c => f.s ! n ! c ++ appPrepNP' f.c2 x ; + co = f.co ++ appPrepNP' f.c2 x ; ---- should not occur at all; the abstract syntax is problematic in giving N2 uncap = { - s = \\n,c => f.uncap.s ! n ! c ++ appPrepNP f.c2 x ; - co = f.uncap.co ++ appPrepNP f.c2 x ; ---- should not occur at all; the abstract syntax is problematic in giving N2 + s = \\n,c => f.uncap.s ! n ! c ++ appPrepNP' f.c2 x ; + co = f.uncap.co ++ appPrepNP' f.c2 x ; ---- should not occur at all; the abstract syntax is problematic in giving N2 } ; - g = f.g ; + g = f.g ; c2 = f.c3 ; } ; @@ -205,11 +246,11 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { c2 = f.c3; } ; - AdjCN ap cn = + AdjCN ap cn = let - g = cn.g + g = cn.g in cn ** { - s = \\a,n,c => + s = \\a,n,c => preOrPost ap.isPre (ap.c.p1 ++ ap.c.p2 ++ ap.s ! agrAdj g a n c ++ ap.ext) (cn.s ! a ! n ! c) ; @@ -222,8 +263,8 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { RelNP np rs = np ** { rc = (np.rc ++ embedInCommas (rs.s ! RGenNum (gennum (genderAgr np.a) (numberAgr np.a)))) ; - -- isPron = False - w = case isPron np of { True => WLight ; _ => np.w } + -- isPron = False + w = case isPron np of { True => WLight ; _ => np.w } } ; SentCN cn s = cn ** {ext = cn.ext ++ embedInCommas s.s} ; diff --git a/src/german/ParadigmsGer.gf b/src/german/ParadigmsGer.gf index 1afd0886..cde85fcf 100644 --- a/src/german/ParadigmsGer.gf +++ b/src/german/ParadigmsGer.gf @@ -48,12 +48,6 @@ oper dative : Case ; genitive : Case ; - anDat_Case : Case ; -- preposition "an" accusative with contraction "am" --% - inAcc_Case : Case ; -- preposition "in" accusative with contraction "ins" --% - inDat_Case : Case ; -- preposition "in" dative with contraction "im" --% - zuDat_Case : Case ; -- preposition "zu" dative with contractions "zum", "zur" --% - vonDat_Case : Case ; - -- To abstract over number names, we define the following. Number : Type ; @@ -108,7 +102,7 @@ mkN : overload { mkN2 : overload { mkN2 : Str -> N2 ; --% mkN2 : N -> N2 ; -- noun + von - mkN2 : N -> Prep -> N2 -- noun + other preposition + mkN2 : N -> Prep' -> N2 -- noun + other preposition } ; -- Use the function $mkPrep$ or see the section on prepositions below to @@ -117,7 +111,7 @@ mkN : overload { -- -- Three-place relational nouns ("die Verbindung von x nach y") need two prepositions. - mkN3 : N -> Prep -> Prep -> N3 ; -- noun + two prepositions + mkN3 : N -> Prep' -> Prep' -> N3 ; -- noun + two prepositions --3 Proper names and noun phrases -- @@ -174,7 +168,7 @@ mkN : overload { -- Two-place adjectives are formed by adding a preposition to an adjective. - mkA2 : A -> Prep -> A2 ; -- e.g. teilbar + durch + mkA2 : A -> Prep' -> A2 ; -- e.g. teilbar + durch --2 Adverbs @@ -188,24 +182,24 @@ mkN : overload { -- A preposition is formed from a string and a case. mkPrep : overload { - mkPrep : Str -> Case -> Prep ; -- e.g. "durch" + accusative - mkPrep : Case -> Str -> Prep ; -- postposition - mkPrep : Str -> Case -> Str -> Prep ; -- both sides + mkPrep : Str -> Case -> Prep' ; -- e.g. "durch" + accusative + mkPrep : Case -> Str -> Prep' ; -- postposition + mkPrep : Str -> Case -> Str -> Prep' ; -- both sides } ; -- Often just a case with the empty string is enough. - accPrep : Prep ; -- no string, just accusative case - datPrep : Prep ; -- no string, just dative case - genPrep : Prep ; -- no string, just genitive case + accPrep : Prep' ; -- no string, just accusative case + datPrep : Prep' ; -- no string, just dative case + genPrep : Prep' ; -- no string, just genitive case -- A couple of common prepositions (the first two always with the dative). - von_Prep : Prep ; -- von + dative - zu_Prep : Prep ; -- zu + dative, with contractions zum, zur - anDat_Prep : Prep ; -- an + dative, with contraction am - inDat_Prep : Prep ; -- in + dative, with contraction ins - inAcc_Prep : Prep ; -- in + accusative, with contraction im + von_Prep : Prep' ; -- von + dative + zu_Prep : Prep' ; -- zu + dative, with contractions zum, zur + anDat_Prep : Prep' ; -- an + dative, with contraction am + inDat_Prep : Prep' ; -- in + dative, with contraction ins + inAcc_Prep : Prep' ; -- in + accusative, with contraction im --2 Verbs @@ -275,7 +269,7 @@ mkV2 : overload { -- Two-place verbs with a preposition. - mkV2 : V -> Prep -> V2 ; -- preposition for complement + mkV2 : V -> Prep' -> V2 ; -- preposition for complement -- Two-place verbs with object in the given case. @@ -289,11 +283,11 @@ mkV2 : overload { -- the first one or both can be absent. accdatV3 : V -> V3 ; -- geben + dat(c2) + acc(c3) (Eng: no prepositions) - dirV3 : V -> Prep -> V3 ; -- senden + acc + nach (preposition on second arg) + dirV3 : V -> Prep' -> V3 ; -- senden + acc + nach (preposition on second arg) mkV3 : overload { mkV3 : V -> V3 ; -- geben + dat(c3) + acc(c2) (Eng: give sth to-sb) - mkV3 : V -> Prep -> Prep -> V3 ; -- sprechen + mit + über + mkV3 : V -> Prep' -> Prep' -> V3 ; -- sprechen + mit + über } ; --3 Other complement patterns @@ -315,16 +309,16 @@ mkV2 : overload { subjV2V : V2V -> V2V ; -- force subject-control mkV2A : overload { - mkV2A : V -> V2A ; - mkV2A : V -> Prep -> V2A ; + mkV2A : V -> V2A ; + mkV2A : V -> Prep' -> V2A ; } ; mkV2S : overload { mkV2S : V -> V2S ; - mkV2S : V -> Prep -> V2S ; + mkV2S : V -> Prep' -> V2S ; } ; mkV2Q : overload { mkV2Q : V -> V2Q ; - mkV2Q : V -> Prep -> V2Q ; + mkV2Q : V -> Prep' -> V2Q ; } ; @@ -340,9 +334,9 @@ mkV2 : overload { mkAS : A -> AS ; --% - mkA2S : A -> Prep -> A2S ; --% + mkA2S : A -> Prep' -> A2S ; --% mkAV : A -> AV ; --% - mkA2V : A -> Prep -> A2V ; --% + mkA2V : A -> Prep' -> A2V ; --% -- Notice: categories $AS, A2S, AV, A2V$ are just $A$, -- and the second argument is given as an adverb. Likewise @@ -364,20 +358,15 @@ mkV2 : overload { Gender = MorphoGer.Gender ; - Case = MorphoGer.PCase ; + Case = MorphoGer.Case ; Number = MorphoGer.Number ; masculine = Masc ; feminine = Fem ; neuter = Neutr ; - nominative = NPC Nom ; - accusative = NPC Acc ; - dative = NPC Dat ; - genitive = NPC Gen ; - anDat_Case = NPP CAnDat ; - inAcc_Case = NPP CInAcc ; - inDat_Case = NPP CInDat ; - zuDat_Case = NPP CZuDat ; - vonDat_Case = NPP CVonDat ; + nominative = Nom ; + accusative = Acc ; + dative = Dat ; + genitive = Gen ; singular = Sg ; plural = Pl ; @@ -454,11 +443,11 @@ mkV2 : overload { mkN2 = overload { mkN2 : Str -> N2 = \s -> vonN2 (regN s) ; mkN2 : N -> N2 = vonN2 ; - mkN2 : N -> Prep -> N2 = mmkN2 + mkN2 : N -> Prep' -> N2 = mmkN2 } ; - mmkN2 : N -> Prep -> N2 = \n,p -> n ** {c2 = p ; lock_N2 = <>} ; + mmkN2 : N -> Prep' -> N2 = \n,p -> n ** {c2 = p ; lock_N2 = <>} ; vonN2 : N -> N2 = \n -> n ** {c2 = von_Prep ; lock_N2 = <>} ; mkN3 = \n,p,q -> n ** {c2 = p ; c3 = q ; lock_N3 = <>} ; @@ -509,20 +498,28 @@ mkV2 : overload { mkAdv s = {s = s ; lock_Adv = <>} ; mkPrep = overload { - mkPrep : Str -> PCase -> Prep = \s,c -> {s = s ; s2 = [] ; c = c ; isPrep = True ; lock_Prep = <>} ; - mkPrep : PCase -> Str -> Prep = \c,s -> {s = [] ; s2 = s ; c = c ; isPrep = True ; lock_Prep = <>} ; - mkPrep : Str -> PCase -> Str -> Prep = \s,c,t -> {s = s ; s2 = t ; c = c ; isPrep = True ; lock_Prep = <>} + mkPrep : Str -> Case -> Prep' = \s,c -> {s = s ; s2 = [] ; sg = \\_ => [] ; + c = c ; isPrep = isPrep ; lock_Prep' = <>} ; + mkPrep : Case -> Str -> Prep' = \c,s -> {s = [] ; s2 = s ; sg = \\_ => [] ; + c = c ; isPrep = isPrep ; lock_Prep' = <>} ; + mkPrep : Str -> Case -> Str -> Prep' = \s,c,t -> {s = s ; s2 = t ; sg = \\_ => [] ; + c = c ; isPrep = isPrep ; lock_Prep' = <>} } ; - accPrep = {s,s2 = [] ; c = accusative ; isPrep = False ; lock_Prep = <>} ; - datPrep = {s,s2 = [] ; c = dative ; isPrep = False ; lock_Prep = <>} ; - genPrep = {s,s2 = [] ; c = genitive ; isPrep = False ; lock_Prep = <>} ; - --von_Prep = mkPrep "von" dative ; - von_Prep = mkPrep [] vonDat_Case ; - zu_Prep = mkPrep [] zuDat_Case ; - anDat_Prep = mkPrep [] anDat_Case ; - inDat_Prep = mkPrep [] inDat_Case ; - inAcc_Prep = mkPrep [] inAcc_Case ; + accPrep = {s,s2 = [] ; sg = \\_ => [] ; c = accusative ; isPrep = isCase ; lock_Prep' = <>} ; + datPrep = {s,s2 = [] ; sg = \\_ => [] ; c = dative ; isPrep = isCase ; lock_Prep' = <>} ; + genPrep = {s,s2 = [] ; sg = \\_ => [] ; c = genitive ; isPrep = isCase ; lock_Prep' = <>} ; + --von_Prep = mkPrep "von" dative ; + von_Prep = {s = "von"; s2=[]; sg = table{ Masc|Neutr => "vom" ; Fem => "von der" } ; + c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ; + zu_Prep = {s = "zu"; s2=[]; sg = table{ Masc|Neutr => "zum" ; Fem => "zur" } ; + c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ; + anDat_Prep = {s = "an"; s2=[]; sg = table{ Masc|Neutr => "am" ; Fem => "an der" } ; + c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ; + inDat_Prep = {s = "in"; s2=[]; sg = table{ Masc|Neutr => "im" ; Fem => "in der" } ; + c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ; + inAcc_Prep = {s = "in"; s2=[]; sg = table{ Masc => "in den" ; Fem => "in die" ; Neutr => "ins" } ; + c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ; mk6V geben gibt gib gab gaebe gegeben = let @@ -562,7 +559,7 @@ mkV2 : overload { habenV v = v ** {aux = VHaben} ; seinV v = v ** {aux = VSein} ; - reflV v c = v ** {aux = VHaben ; vtype = VRefl (prepC c).c} ; + reflV v c = v ** {aux = VHaben ; vtype = VRefl c} ; no_geV v = let vs = v.s in v ** { s = table { @@ -587,7 +584,7 @@ mkV2 : overload { mkV3 = overload { mkV3 : V -> V3 = \v -> lin V3 (v ** {c2 = accPrep ; c3 = datPrep}) ; - mkV3 : V -> Prep -> Prep -> V3 + mkV3 : V -> Prep' -> Prep' -> V3 = \v,c,d -> lin V3 (v ** {c2 = c ; c3 = d}) ; } ; @@ -606,41 +603,40 @@ mkV2 : overload { mkV0 v = v ** {lock_V = <>} ; mkV2V = overload { -- default: object-control - mkV2V : V -> V2V + mkV2V : V -> V2V = \v -> dirV2 v ** {isAux = False ; objCtrl = True ; lock_V2V = <>} ; -- ermahne jmdn, sich zu waschen - mkV2V : V -> Prep -> V2V + mkV2V : V -> Prep' -> V2V = \v,p -> prepV2 v p ** {isAux = False ; objCtrl = True ; lock_V2V = <>} ; } ; auxV2V = overload { - auxV2V : V -> V2V + auxV2V : V -> V2V = \v -> dirV2 v ** {isAux = True ; objCtrl = True ; lock_V2V = <>} ; -- lasse jmdn sich waschen - auxV2V : V -> Prep -> V2V + auxV2V : V -> Prep' -> V2V = \v,p -> prepV2 v p ** {isAux = True ; objCtrl = True ; lock_V2V = <>} ; } ; subjV2V v = v ** {objCtrl = False} ; mkV2A = overload { - mkV2A : V -> V2A - = \v -> dirV2 v ** {isAux = False ; lock_V2A = <>} ; - mkV2A : V -> Prep -> V2A + mkV2A : V -> V2A = \v -> dirV2 v ** {isAux = False ; lock_V2A = <>} ; + mkV2A : V -> Prep' -> V2A = \v,p -> prepV2 v p ** {isAux = False ; lock_V2A = <>} ; } ; mkV2S = overload { mkV2S : V -> V2S = \v -> dirV2 v ** {isAux = False ; lock_V2S = <>} ; - mkV2S : V -> Prep -> V2S + mkV2S : V -> Prep' -> V2S = \v,p -> prepV2 v p ** {isAux = False ; lock_V2S = <>} ; } ; mkV2Q = overload { - mkV2Q : V -> V2Q + mkV2Q : V -> V2Q = \v -> dirV2 v ** {isAux = False ; lock_V2Q = <>} ; - mkV2Q : V -> Prep -> V2Q + mkV2Q : V -> Prep' -> V2Q = \v,p -> prepV2 v p ** {isAux = False ; lock_V2Q = <>} ; } ; mkVA = overload { mkVA : V -> VA = \v -> lin VA (dirV2 v) ; - mkVA : V -> Prep -> VA = \v,p -> lin VA (v ** {c2 = p}) ; + mkVA : V -> Prep' -> VA = \v,p -> lin VA (v ** {c2 = p}) ; } ; mkAS v = v ** {lock_A = <>} ; @@ -711,7 +707,7 @@ mkV2 : overload { }; - prepV2 : V -> Prep -> V2 ; + prepV2 : V -> Prep' -> V2 ; dirV2 : V -> V2 ; @@ -720,8 +716,9 @@ mkV2 : overload { mkV2 = overload { mkV2 : Str -> V2 = \s -> dirV2 (regV s) ; mkV2 : V -> V2 = dirV2 ; - mkV2 : V -> Prep -> V2 = prepV2; - mkV2 : V -> Case -> V2 = \v,c -> prepV2 v (lin Prep {s,s2 = [] ; c = c ; isPrep = False}) ; + mkV2 : V -> Prep' -> V2 = prepV2; + mkV2 : V -> Case -> V2 = \v,c -> + prepV2 v (lin Prep' {s,s2 = [] ; sg = \\_ => [] ; c = c ; isPrep = isCase}) ; } ; } diff --git a/src/german/PhraseGer.gf b/src/german/PhraseGer.gf index dc49fa3a..46442bd5 100644 --- a/src/german/PhraseGer.gf +++ b/src/german/PhraseGer.gf @@ -1,4 +1,5 @@ -concrete PhraseGer of Phrase = CatGer ** open Prelude, ResGer in { +--# -path=.:../abstract:../common:prelude -- HL +concrete PhraseGer of Phrase' = CatGer ** open Prelude, ResGer in { flags optimize=all_subs ; @@ -13,7 +14,7 @@ concrete PhraseGer of Phrase = CatGer ** open Prelude, ResGer in { UttIP ip = {s = ip.s ! Nom} ; --- Acc also UttIAdv iadv = iadv ; - UttNP np = {s = np.s ! NPC Nom ++ bigNP np} ; + UttNP np = {s = (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ bigNP' np} ; UttVP vp = {s = useInfVP True vp} ; -- without zu UttAdv adv = adv ; UttCN n = {s = n.s ! Strong ! Sg ! Nom ++ n.adv ++ n.ext ++ n.rc ! Sg} ; @@ -25,6 +26,6 @@ concrete PhraseGer of Phrase = CatGer ** open Prelude, ResGer in { PConjConj conj = ss (conj.s2) ; NoVoc = {s = []} ; - VocNP np = {s = "," ++ np.s ! NPC Nom ++ bigNP np} ; + VocNP np = {s = "," ++ (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ bigNP' np} ; } diff --git a/src/german/QuestionGer.gf b/src/german/QuestionGer.gf index 2f89455f..4edf7887 100644 --- a/src/german/QuestionGer.gf +++ b/src/german/QuestionGer.gf @@ -1,4 +1,4 @@ -concrete QuestionGer of Question = CatGer ** open ResGer in { +concrete QuestionGer of Question' = CatGer ** open ResGer in { flags optimize=all_subs ; @@ -28,7 +28,8 @@ concrete QuestionGer of Question = CatGer ** open ResGer in { s = \\m,t,a,p => let cls = slash.s ! m ! t ! a ! p ; - who = appPrep slash.c2 (\\k => usePrepC k (\c -> ip.s ! c)) ; +-- who = appPrep slash.c2 (\\k => usePrepC k (\c -> ip.s ! c)) ; + who = appPrep' slash.c2 ip.s ; in table { QDir => who ++ cls ! Inv ; QIndir => who ++ cls ! Sub @@ -50,7 +51,7 @@ concrete QuestionGer of Question = CatGer ** open ResGer in { s = \\m,t,a,p => let vp = predV sein_V ** {ext = icomp.ext}; - subj = mkSubj np vp.c1 ; + subj = mkSubj' np vp.c1 ; cls = (mkClause subj.p1 subj.p2 vp).s ! m ! t ! a ! p ; why = icomp.s ! np.a in table { diff --git a/src/german/RelativeGer.gf b/src/german/RelativeGer.gf index 2a97913b..b0643c45 100644 --- a/src/german/RelativeGer.gf +++ b/src/german/RelativeGer.gf @@ -1,4 +1,4 @@ -concrete RelativeGer of Relative = CatGer ** open ResGer in { +concrete RelativeGer of Relative' = CatGer ** open ResGer in { flags optimize=all_subs ; @@ -28,13 +28,16 @@ concrete RelativeGer of Relative = CatGer ** open ResGer in { RelSlash rp slash = { s = \\m,t,a,p,gn => - appPrep slash.c2 (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ++ +-- appPrep slash.c2 (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ++ + appPrep' slash.c2 (rp.s ! gn) ++ slash.s ! m ! t ! a ! p ! Sub ; - c = (prepC slash.c2.c).c +-- c = (prepC slash.c2.c).c + c = slash.c2.c } ; FunRP p np rp = { - s = \\gn,c => np.s ! NPC c ++ appPrep p (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ; +-- s = \\gn,c => np.s ! NPC c ++ appPrep p (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ; + s = \\gn,c => (np.s ! c).p1 ++ (np.s !c).p2 ++ appPrep' p (rp.s ! gn) ; a = RAg (numberAgr np.a) (personAgr np.a) } ; diff --git a/src/german/ResGer.gf b/src/german/ResGer.gf index cd4da865..d02e490d 100644 --- a/src/german/ResGer.gf +++ b/src/german/ResGer.gf @@ -92,6 +92,15 @@ resource ResGer = ParamX ** open Prelude in { isLight : {w : Weight} -> Bool = \np -> case np.w of {WHeavy => False ; _ => True} ; + -- To reduce c:PCase to c:Case in Preposition' and NP.s:PCase => Str to NP'.s:Case => Str*Str: + param + Weight' = WPron' | WLight' | WHeavy' | WDefArt ; + -- oper + -- isPron : {w : Weight} -> Bool = \np -> + -- case np.w of {WPron => True ; _ => False} ; + -- isLight : {w : Weight} -> Bool = \np -> + -- case np.w of {WHeavy => False ; _ => True} ; + --2 For $Adjective$ -- The predicative form of adjectives is not inflected further. @@ -257,6 +266,13 @@ resource ResGer = ParamX ** open Prelude in { -- isPron : Bool ; -- needed to put accPron before datPron w : Weight } ; + NP' : Type = { + s : Case => Str * Str ; + rc : Str ; -- die Frage , [rc die ich gestellt habe] + ext : Str ; -- die Frage , [sc wo sie schläft] ; die Regel , [vp kein Fleisch zu essen] | [s dass ...] + a : Agr ; + w : Weight' } ; + mkN : (x1,_,_,_,_,x6,x7 : Str) -> Gender -> Noun = \Mann, Mannen, Manne, Mannes, Maenner, Maennern, Mann_, g -> { s = table { @@ -436,11 +452,75 @@ resource ResGer = ParamX ** open Prelude in { -- revised appPrep for discontinuous NPs bigNP : NP -> Str = \np -> np.ext ++ np.rc ; - + bigNP' : NP' -> Str = \np -> np.ext ++ np.rc ; + -- To build a preposition from just a case. -- HL 9/19: no longer used in RGL - noPreposition : Case -> Preposition = \c -> + noPreposition : Case -> Preposition = \c -> {s,s2 = [] ; c = NPC c ; isPrep = False} ; + noPreposition' : Case -> Preposition' = \c -> + {s,s2 = [] ; c = c ; isPrep = isCase ; sg = \\_ => []} ; + PrepNom' : Preposition' = {s,s2 = "" ; sg = \\_ => []; isPrep = isCase ; c = Nom} ; + +-- New version of Prepositions to reduce c:PCase to c:Case. + + param PrepType = isCase | isPrep | isPrepDefArt ; + oper + Preposition' : Type = {s : Str ; s2 : Str ; sg : Gender => Str; + c : Case ; isPrep : PrepType} ; + + appPrep' : Preposition' -> (Case => Str) -> Str = \prep,arg -> + prep.s ++ arg ! prep.c ++ prep.s2 ; -- todo + appPrep2' : Preposition' -> (Case => Str * Str) -> Str = \prep,arg -> + let det : Str = (arg ! prep.c).p1 ; + cn : Str = (arg ! prep.c).p2 ; + in prep.s ++ det ++ cn ++ prep.s2 ; + + appPrepNP' : Preposition' -> NP' -> Str = \prep,np -> + let n = numberAgr np.a ; + g = genderAgr np.a ; + w = np.w ; + det = (np.s ! prep.c).p1 ; + cn = (np.s ! prep.c).p2 ; + in + case prep.isPrep of { + isCase => det ++ cn ++ np.ext ++ np.rc; + isPrep => prep.s ++ det ++ cn ++ prep.s2 ++ np.ext ++ np.rc; + isPrepDefArt => case of { + => -- e.g. "zum Hof|zur Tür|zum Fenster herein" + prep.sg!g ++ cn ++ prep.s2 ++ np.ext ++ np.rc ; + _ => + prep.s ++ det ++ cn ++ prep.s2 ++ np.ext ++ np.rc + } } ; + + npM' : NP' = {s = table Case {Nom => <"der","Hund">; Acc => <"den","Hund">; + Dat => <"dem","Hund">; Gen => <"des","Hundes">}; + rc = []; ext=[]; a = (Ag Masc Sg P3); w = WDefArt}; + npN' : NP' = {s = table Case {Nom => <"das","Haus">; Acc => <"das","Haus">; + Dat => <"dem","Haus">; Gen => <"des","Hauses">}; + rc = []; ext=[]; a = (Ag Neutr Sg P3); w = WDefArt}; + npInDefM' : NP' = {s = table Case {Nom => <"ein","Hund">; Acc => <"einen","Hund">; + Dat => <"einem","Hund">; Gen => <"eines","Hundes">}; + rc = []; ext=[]; a = (Ag Masc Sg P3); w = WLight'}; + npInDefN' : NP' = {s = table Case {Nom => <"ein","Haus">; Acc => <"ein","Haus">; + Dat => <"einem","Haus">; Gen => <"eines","Hauses">}; + rc = []; ext=[]; a = (Ag Neutr Sg P3); w = WLight'}; -- WHeavy' ? + npF' : NP' = {s = table Case {Nom => <"die","Frau">; Acc => <"die","Frau">; + Dat => <"der","Frau">; Gen => <"der","Frau">}; + rc = []; ext=[]; a = (Ag Fem Sg P3); w = WDefArt}; + + Dat' : Preposition' = {s=""; s2=""; sg = \\c => []; c=Dat; isPrep=isCase} ; + mit' : Preposition' = {s="zusammen mit"; s2=""; sg = \\_ => []; c=Dat; isPrep=isPrep} ; + + zuDat' : Preposition' = {s="zu"; s2="herein"; sg = \\_ => ""; c=Dat; isPrep=isPrep} ; + zum' : Preposition' = {s="zu"; s2="herein"; sg = table{Masc=>"zum"; Fem=>"zur"; Neutr=>"zum"}; + c=Dat; isPrep=isPrepDefArt} ; + inDat' : Preposition' = {s="in"; s2="drin"; sg = \\_ => ""; c=Dat; isPrep=isPrep} ; + im' : Preposition' = {s="in"; s2="drin"; sg = table{Masc=>"im"; Fem=>"in der"; Neutr=>"im"}; + c=Dat; isPrep=isPrepDefArt} ; + inAcc' : Preposition' = {s="in"; s2="hinein"; sg = \\_ => ""; c=Acc; isPrep=isPrep} ; + ins' : Preposition' = {s="in"; s2="hinein"; sg = table{Masc=>"in den"; Fem=>"in die"; Neutr=>"ins"}; + c=Acc; isPrep=isPrepDefArt} ; -- Pronouns and articles -- Here we define personal and relative pronouns. @@ -504,6 +584,15 @@ resource ResGer = ParamX ** open Prelude in { _ => ad GPl k }) ; + -- HL: To reduce PCase to Case: todo: check if we can omit the prep-string of a PCase + -- perhaps needed for "am besten"? But the adj is used in Posit only + appAdj' : Adjective -> Number => Gender => Case => Str = \adj -> + let + ad : GenNum -> Case -> Str = \gn,c -> + adj.s ! Posit ! AMod gn c + in + \\n,g,c => case n of {Sg => ad (GSg g) c ;_ => ad GPl c} ; + -- This auxiliary gives the forms in each degree of adjectives. adjForms : (x1,x2 : Str) -> AForm => Str = \teuer,teur -> @@ -551,10 +640,9 @@ resource ResGer = ParamX ** open Prelude in { ext : Str ; -- sentential complement of V(2)S, V(2)Q, e.g. dass|ob sie kommt inf : {inpl: (Agr => Str)*Str ; -- infinitival complement of V(2)V HL 3/2022 extr: (Agr => Str)} ; -- e.g. ihn [] versuchen (lasse) [, ihr zu helfen] - c1 : Preposition -- case of subject + c1 : Preposition' -- case of subject } ; - - VPSlash = VP ** {c2 : Preposition ; objCtrl : Bool} ; -- HL 3/2019 objCtr added + VPSlash = VP ** {c2 : Preposition' ; objCtrl : Bool} ; -- HL 3/2019 objCtr added -- objCtrl distinguishes object-control from subject-control verb v:V2V in VP.s: -- if True, reflexives in vp.inf and vp.nn have to agree with c2-object (added @@ -616,7 +704,7 @@ resource ResGer = ParamX ** open Prelude in { predV : Verb -> VP = predVGen False ; - predVc : Verb ** {c2 : Preposition} -> VPSlash = \v -> + predVc : Verb ** {c2 : Preposition'} -> VPSlash = \v -> predV v ** {c2 = v.c2 ; objCtrl = False} ; predVGen : Bool -> Verb -> VP = \isAux, verb -> { @@ -630,7 +718,7 @@ resource ResGer = ParamX ** open Prelude in { -- default infinitival complement: inf = {inpl = <\\_ => [], []>; extr = \\_ => []} ; ext,adj : Str = [] ; - c1 = PrepNom + c1 = PrepNom' } ; auxPerfect : Verb -> VForm => Str = \verb -> @@ -731,16 +819,44 @@ resource ResGer = ParamX ** open Prelude in { } } ; -- the ordering of objects of v:V3 (and v:V4) is also determined by Slash?V3 (and Slash?V4) + insertObjNP' : NP' -> Preposition' -> VPSlash -> VPSlash = \np,prep,vp -> + let c = prep.c ; + obj = appPrepNP' prep np ; + isPrep : Bool = case prep.isPrep of {isPrep | isPrepDefArt => True ; _ => False} ; + in vp ** { + nn = \\a => + let vpnn = vp.nn ! a in + -- HL 11/6/19: rough object NP order (expensive): + -- vfin < accPron < refl < (gen|dat)Pron < lightNP < neg < heavyNP|PP < vinf|comp + case of { -- 2 * 3 * 4 = 24 cases + => -- + ; + => -- + ; + => -- + ; + => -- (assuming v.c2=acc) nonPron: dat < acc|gen + -- + ; + => -- + ; + => -- + ; + => -- + } + } ; -- the ordering of objects of v:V3 (and v:V4) is also determined by Slash?V3 (and Slash?V4) + + insertObjRefl : VPSlash -> VPSlash = \vp -> -- HL 6/2019, to order reflPron < neg < prep+reflPron let prep = vp.c2 ; - c = case prep.c of { NPC cc => cc ; _ => Acc } ; - obj : Agr => Str = \\a => prep.s ++ reflPron ! a ! c ; -- HL: to test ReflVP: reflPronSelf + c = prep.c ; -- HL 7/22 reduced to c:Case + obj : Agr => Str = \\a => prep.s ++ reflPron ! a ! c ++ prep.s2 ; in vp ** { nn = \\a => let vpnn = vp.nn ! a in case prep.isPrep of { - False => ; - True => } + isCase => ; + _ => } } ; insertAdV : Str -> VP -> VP = \adv,vp -> vp ** { -- not used in Ger, so VP.a1 can be skipped @@ -979,6 +1095,9 @@ resource ResGer = ParamX ** open Prelude in { heavyNP : {s : PCase => Str ; a : Agr} -> {s : PCase => Str ; a : Agr ; w : Weight ; ext,rc : Str} = \np -> np ** {w = WHeavy ; ext,rc = []} ; -- this could be wrong + heavyNP' : + {s : Case => Str ; a : Agr} -> {s : Case => Str ; a : Agr ; w : Weight' ; ext,rc : Str} = \np -> + np ** {w = WHeavy' ; ext,rc = []} ; -- this could be wrong relPron : RelGenNum => Case => Str = \\rgn,c => case rgn of { @@ -999,5 +1118,10 @@ resource ResGer = ParamX ** open Prelude in { agr = case prep.c of { NPC Nom => np.a ; _ => Ag Masc Sg P3 } ; subj = appPrepNP prep np in ; + mkSubj' : NP' -> Preposition' -> Str * Agr = \np, prep -> + let + agr = case prep.c of { Nom => np.a ; _ => Ag Masc Sg P3 } ; + subj = appPrepNP' prep np + in ; } diff --git a/src/german/SentenceGer.gf b/src/german/SentenceGer.gf index cf30c30c..856df34a 100644 --- a/src/german/SentenceGer.gf +++ b/src/german/SentenceGer.gf @@ -1,11 +1,11 @@ -concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { +concrete SentenceGer of Sentence' = CatGer ** open ResGer, Prelude in { flags optimize=all_subs ; lin PredVP np vp = - let subj = mkSubj np vp.c1 + let subj = mkSubj' np vp.c1 in mkClause subj.p1 subj.p2 vp ; {- applies verb's subject case to subject ; @@ -34,7 +34,7 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { } ; SlashVP np vp = - let subj = mkSubj np vp.c1 ; -- HL 3/2022: need a mkClSlash to prevent + let subj = mkSubj' np vp.c1 ; -- HL 3/2022: need a mkClSlash to prevent in mkClause subj.p1 subj.p2 vp ** { c2 = vp.c2 } ; -- reflexives in vp instantiated to np.a AdvSlash slash adv = { @@ -45,7 +45,7 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { SlashPrep cl prep = cl ** {c2 = prep} ; SlashVS np vs slash = - let subj = mkSubj np PrepNom + let subj = mkSubj' np PrepNom' in mkClause subj.p1 subj.p2 (insertExtrapos (conjThat ++ slash.s ! Sub) (predV vs)) ** {c2 = slash.c2} ; diff --git a/src/german/StructuralGer.gf b/src/german/StructuralGer.gf index 73accdab..8cbaff8f 100644 --- a/src/german/StructuralGer.gf +++ b/src/german/StructuralGer.gf @@ -1,4 +1,4 @@ -concrete StructuralGer of Structural = CatGer ** +concrete StructuralGer of Structural' = CatGer ** open MorphoGer, MakeStructuralGer, (X = ConstructX), (P = ParadigmsGer), IrregGer, Prelude in { @@ -11,6 +11,7 @@ concrete StructuralGer of Structural = CatGer ** above_Prep = mkPrep "über" P.dative ; after_Prep = mkPrep "nach" P.dative ; all_Predet = {s = appAdj (regA "all") ; c = noCase ; a = PAgNone} ; + all_Predet' = {s = appAdj' (regA "all") ; c = noCase ; a = PAgNone} ; almost_AdA, almost_AdN = ss "fast" ; although_Subj = ss "obwohl" ; always_AdV = ss "immer" ; @@ -49,12 +50,14 @@ concrete StructuralGer of Structural = CatGer ** if_Subj = ss "wenn" ; --- no variants in the RGL! | ss "falls" ; in8front_Prep = mkPrep "vor" P.dative ; i_Pron = mkPronPers "ich" "mich" "mir" "meiner" "mein" Masc Sg P1 ; - in_Prep = mkPrep [] (NPP CInDat) ; +-- in_Prep = mkPrep [] (NPP CInDat) ; + in_Prep = P.inDat_Prep ; -- HL 7/2022 it_Pron = mkPronPers "es" "es" "ihm" "seiner" "sein" Neutr Sg P3 ; less_CAdv = X.mkCAdv "weniger" "als" ; many_Det = detLikeAdj False Pl "viel" ; more_CAdv = X.mkCAdv "mehr" "als" ; most_Predet = {s = appAdj (regA "meist") ; c = noCase ; a = PAgNone} ; + most_Predet' = {s = appAdj' (regA "meist") ; c = noCase ; a = PAgNone} ; much_Det = {s = \\_,_ => "viel" ; sp = \\_,_ => "vieles" ; n = Sg ; a = Weak ; isDef = False} ; must_VV = auxVV (mkV diff --git a/src/german/VerbGer.gf b/src/german/VerbGer.gf index 7a25b1a0..04c90436 100644 --- a/src/german/VerbGer.gf +++ b/src/german/VerbGer.gf @@ -1,20 +1,9 @@ -concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { +concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in { flags optimize=all_subs ; lin UseV = predV ; -{- - ComplVV v vp = - let - vpi = infVP v.isAux vp ; - vps = predVGen v.isAux v ; - in - insertExtrapos vpi.p4 ( - insertInfExt vpi.p3 ( - insertInf vpi.p2 ( - insertObjc vpi.p1 vps))) ; --} ComplVV v vp = -- HL 3/22: leave inf-complement in-place, extract infzu-complement let @@ -32,25 +21,14 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { SlashV2a v = (predVc v) ; - Slash2V3 v np = insertObjNP np v.c2 (predVc v) ** {c2 = v.c3} ; - Slash3V3 v np = insertObjNP np v.c3 (predVc v) ; + Slash2V3 v np = insertObjNP' np v.c2 (predVc v) ** {c2 = v.c3} ; + Slash3V3 v np = insertObjNP' np v.c3 (predVc v) ; SlashV2S v s = insertExtrapos (comma ++ conjThat ++ s.s ! Sub) (predV v) ** {c2 = v.c2; objCtrl = False} ; SlashV2Q v q = insertExtrapos (comma ++ q.s ! QIndir) (predV v) ** {c2 = v.c2; objCtrl = False} ; -{- - SlashV2V v vp = - let - vpi = infVP v.isAux vp ; - vps = predVGen v.isAux v ** {c2 = v.c2} ; - in vps ** - insertExtrapos vpi.p4 ( -- inplace vp; better extract it! - insertInfExt vpi.p3 ( - insertInf vpi.p2 ( - insertObjc vpi.p1 vps))) ; --} SlashV2V v vp = -- (jmdn) bitten, sich zu waschen | sich waschen lassen HL 7/19 let vps = predVGen v.isAux v ; -- e.g. verspricht|bittet.isAux=False | läßt.isAux=True @@ -62,23 +40,14 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { SlashV2A v ap = insertAdj (ap.s ! APred) ap.c ap.ext (predV v) ** {c2 = v.c2; objCtrl = False} ; +-- to save compile time, comment out: ComplSlash vps np = -- IL 24/04/2018 force reflexive in the VPSlash to take the agreement of np. -- HL 3/22 better before inserting np, using objCtrl let vp = case vps.objCtrl of { True => objAgr np vps ; _ => vps } ** { c2 = vps.c2 ; objCtrl = vps.objCtrl } ; - in insertObjNP np vps.c2 vp ; - -{- - SlashVV v vp = - let - vpi = infVP v.isAux vp ; - vps = predVGen v.isAux v ** {c2 = vp.c2 } ; - in vps ** - insertExtrapos vpi.p3 ( - insertInf vpi.p2 ( - insertObj vpi.p1 vps)) ; --} + in insertObjNP' np vps.c2 vp ; + -- compiler: + ComplSlash' 414720 (199680,352) -- SlashVV v vps is like ComplVV v vp, but infinite vps should not be extracted SlashVV v vp = -- HL 3/2022 @@ -123,9 +92,11 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { -- expensive: + SlashV2VNP 503.884.800 (2880,540), reaches memory limit with SlashVV -- does not work for nested uses: the nn-levels are confused HL 3/22 - SlashV2VNP v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22 - insertObjNP np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ; - + -- SlashV2VNP v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22 + -- insertObjNP np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ; +-- to save compile time, comment out: + SlashV2VNP' v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22 + insertObjNP' np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ; UseComp comp = insertExtrapos comp.ext (insertObj comp.s (predV sein_V)) ; -- agr not used @@ -159,7 +130,7 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { PassV2 v = -- acc object -> nom subject; all others: same PCase let c = case of { - => NPC Nom ; _ => v.c2.c} + => Nom ; _ => v.c2.c} in insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) ** { c1 = v.c2 ** {c = c} } ; {- HL: The construction VPSlashPrep : VP -> Prep -> VPSlash does not exist From ec41af609d5ae4879e0da6d5786e0e2fe804e0e2 Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Fri, 22 Jul 2022 11:49:19 +0200 Subject: [PATCH 02/16] 1. updated types in ../abstract/*'.gf to replace NP,Det,Quant,Predep,Prep,DAP by their primed versions 2. implemented all linearizations to use the primed categories This allows linearization with prep+defart's, but parsing gives metavariables in parses (DetQuant ? NumSg) and (DetQuantOrd ? NumSg ord) for prep+defart. Todo: make Quant.s and NP. depend on PronType = isCat | isPron | isPronDefArt. Without SlashV2VNP', compiles in 84 sec and gives 3,6M VerbGer.gfo, 2,3M SentenceGer.gfo. Uses |Prep'|=12 instead of |Prep|=18, |NP'|=72 instead of |NP|=54 --- src/abstract/Adjective'.gf | 4 +- src/abstract/Adverb'.gf | 2 +- src/abstract/Cat'.gf | 2 +- src/abstract/Lang'.gf | 2 +- src/abstract/Noun'.gf | 43 ++++--- src/abstract/Structural'.gf | 40 +++---- src/abstract/Verb'.gf | 2 +- src/german/AdjectiveGer.gf | 50 ++++---- src/german/AdverbGer.gf | 6 +- src/german/CatGer.gf | 12 +- src/german/GrammarGer.gf | 2 +- src/german/LexiconGer.gf | 4 +- src/german/MarkupGer.gf | 6 +- src/german/MorphoGer.gf | 10 ++ src/german/NounGer.gf | 229 +++++++++++++++++------------------- src/german/ParadigmsGer.gf | 20 ++-- src/german/ResGer.gf | 23 ++-- src/german/SentenceGer.gf | 2 +- src/german/StructuralGer.gf | 72 +++++++----- src/german/VerbGer.gf | 9 +- 20 files changed, 283 insertions(+), 257 deletions(-) diff --git a/src/abstract/Adjective'.gf b/src/abstract/Adjective'.gf index b3b78483..38eedba0 100644 --- a/src/abstract/Adjective'.gf +++ b/src/abstract/Adjective'.gf @@ -9,12 +9,12 @@ abstract Adjective' = Cat' ** { -- elliptic-relational. PositA : A -> AP ; -- warm - ComparA : A -> NP -> AP ; -- warmer than I + ComparA : A -> NP' -> AP ; -- warmer than I ComplA2 : A2 -> NP' -> AP ; -- married to her ReflA2 : A2 -> AP ; -- married to itself UseA2 : A2 -> AP ; -- married UseComparA : A -> AP ; -- warmer - CAdvAP : CAdv -> AP -> NP -> AP ; -- as cool as John + CAdvAP : CAdv -> AP -> NP' -> AP ; -- as cool as John -- The superlative use is covered in $Ord$. diff --git a/src/abstract/Adverb'.gf b/src/abstract/Adverb'.gf index ca5e9541..99d9c599 100644 --- a/src/abstract/Adverb'.gf +++ b/src/abstract/Adverb'.gf @@ -13,7 +13,7 @@ abstract Adverb' = Cat' ** { -- Comparative adverbs have a noun phrase or a sentence as object of -- comparison. - ComparAdvAdj : CAdv -> A -> NP -> Adv ; -- more warmly than John + ComparAdvAdj : CAdv -> A -> NP' -> Adv ; -- more warmly than John ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs -- Adverbs can be modified by 'adadjectives', just like adjectives. diff --git a/src/abstract/Cat'.gf b/src/abstract/Cat'.gf index 2ba01828..18f9f46b 100644 --- a/src/abstract/Cat'.gf +++ b/src/abstract/Cat'.gf @@ -1 +1 @@ -abstract Cat' = Cat ** {cat NP'; Det'; Quant'; Predet'; Prep'; } +abstract Cat' = Cat ** {cat NP'; Det'; Quant'; Predet'; Prep'; DAP' ;} diff --git a/src/abstract/Lang'.gf b/src/abstract/Lang'.gf index a9a7218b..62f2afd4 100644 --- a/src/abstract/Lang'.gf +++ b/src/abstract/Lang'.gf @@ -10,7 +10,7 @@ abstract Lang' = Lexicon -- ,Construction --- could be compiled here, but not in concretes, as they call Syntax and Grammar -- ,Documentation --# notpresent - ,Markup - [stringMark] + ,Markup' - [stringMark] ** { flags startcat=Phr ; } ; diff --git a/src/abstract/Noun'.gf b/src/abstract/Noun'.gf index e1ef86cc..8a9e14a5 100644 --- a/src/abstract/Noun'.gf +++ b/src/abstract/Noun'.gf @@ -12,28 +12,27 @@ abstract Noun' = Cat' ** { -- -- fun - DetCN : Det -> CN -> NP ; -- the man - DetCN' : Det' -> CN -> NP' ; -- the man - UsePN : PN -> NP ; -- John - UsePron : Pron -> NP ; -- he - + DetCN : Det' -> CN -> NP' ; -- the man + UsePN : PN -> NP' ; -- John + UsePron : Pron -> NP' ; -- he + -- Pronouns are defined in the module [``Structural`` Structural.html]. -- A noun phrase already formed can be modified by a $Predet$erminer. - PredetNP : Predet -> NP -> NP ; -- only the man + PredetNP : Predet' -> NP' -> NP' ; -- only the man -- A noun phrase can also be postmodified by the past participle of a -- verb, by an adverb, or by a relative clause - PPartNP : NP -> V2 -> NP ; -- the man seen - AdvNP : NP -> Adv -> NP ; -- Paris today - ExtAdvNP: NP -> Adv -> NP ; -- boys, such as .. - RelNP : NP -> RS -> NP ; -- Paris, which is here + PPartNP : NP' -> V2 -> NP' ; -- the man seen + AdvNP : NP' -> Adv -> NP' ; -- Paris today + ExtAdvNP: NP' -> Adv -> NP' ; -- boys, such as .. + RelNP : NP' -> RS -> NP' ; -- Paris, which is here -- Determiners can form noun phrases directly. - DetNP : Det -> NP ; -- these five + DetNP : Det' -> NP' ; -- these five --2 Determiners @@ -41,9 +40,8 @@ abstract Noun' = Cat' ** { -- The determiner has a fine-grained structure, in which a 'nucleus' -- quantifier and an optional numeral can be discerned. - DetQuant : Quant -> Num -> Det ; -- these five - DetQuant' : Quant' -> Num -> Det'; -- these five - DetQuantOrd : Quant -> Num -> Ord -> Det ; -- these five best + DetQuant : Quant' -> Num -> Det' ; -- these five + DetQuantOrd : Quant' -> Num -> Ord -> Det' ; -- these five best -- Whether the resulting determiner is singular or plural depends on the -- cardinal. @@ -84,21 +82,20 @@ abstract Noun' = Cat' ** { -- neatly distinct words (Spanish "un, unos ; el, los") but also without -- any particular word (Finnish; Swedish definites). - IndefArt : Quant ; -- a/an - DefArt : Quant ; -- the - DefArt' : Quant'; -- the + DefArt : Quant'; -- the + IndefArt : Quant' ; -- a/an -- Nouns can be used without an article as mass nouns. The resource does -- not distinguish mass nouns from other common nouns, which can result -- in semantically odd expressions. - MassNP : CN -> NP ; -- (beer) + MassNP : CN -> NP' ; -- (beer) -- Pronouns have possessive forms. Genitives of other kinds -- of noun phrases are not given here, since they are not possible -- in e.g. Romance languages. They can be found in $Extra$ modules. - PossPron : Pron -> Quant ; -- my (house) + PossPron : Pron -> Quant' ; -- my (house) -- Other determiners are defined in [Structural Structural.html]. @@ -140,14 +137,14 @@ abstract Noun' = Cat' ** { -- This is certainly overgenerating. - ApposCN : CN -> NP -> CN ; -- city Paris (, numbers x and y) + ApposCN : CN -> NP' -> CN ; -- city Paris (, numbers x and y) --2 Possessive and partitive constructs -- (New 13/3/2013 AR; Structural.possess_Prep and part_Prep should be deprecated in favour of these.) - PossNP : CN -> NP -> CN ; -- house of Paris, house of mine - PartNP : CN -> NP -> CN ; -- glass of wine + PossNP : CN -> NP' -> CN ; -- house of Paris, house of mine + PartNP : CN -> NP' -> CN ; -- glass of wine -- This is different from the partitive, as shown by many languages. @@ -156,6 +153,6 @@ abstract Noun' = Cat' ** { --3 Conjoinable determiners and ones with adjectives AdjDAP : DAP -> AP -> DAP ; -- the large (one) - DetDAP : Det -> DAP ; -- this (or that) + DetDAP : Det' -> DAP' ; -- this (or that) } diff --git a/src/abstract/Structural'.gf b/src/abstract/Structural'.gf index a20f202c..1db750a2 100644 --- a/src/abstract/Structural'.gf +++ b/src/abstract/Structural'.gf @@ -14,8 +14,7 @@ abstract Structural' = Cat' ** { above_Prep : Prep' ; after_Prep : Prep' ; - all_Predet : Predet ; - all_Predet' : Predet' ; + all_Predet : Predet' ; almost_AdA : AdA ; almost_AdN : AdN ; although_Subj : Subj ; @@ -35,12 +34,12 @@ abstract Structural' = Cat' ** { during_Prep : Prep' ; either7or_DConj : Conj ; -- either...or ---b either7or_DConj : DConj ; - every_Det : Det ; - everybody_NP : NP ; -- everybody - everything_NP : NP ; + every_Det : Det' ; + everybody_NP : NP' ; -- everybody + everything_NP : NP' ; everywhere_Adv : Adv ; --- first_Ord : Ord ; DEPRECATED - few_Det : Det ; + few_Det : Det' ; for_Prep : Prep' ; from_Prep : Prep' ; he_Pron : Pron ; @@ -56,17 +55,16 @@ abstract Structural' = Cat' ** { in_Prep : Prep' ; it_Pron : Pron ; less_CAdv : CAdv ; - many_Det : Det ; + many_Det : Det' ; more_CAdv : CAdv ; - most_Predet : Predet ; - most_Predet' : Predet' ; - much_Det : Det ; + most_Predet : Predet' ; + much_Det : Det' ; must_VV : VV ; ---b no_Phr : Phr ; no_Utt : Utt ; on_Prep : Prep' ; --- one_Quant : QuantSg ; DEPRECATED - only_Predet : Predet ; + only_Predet : Predet' ; or_Conj : Conj ; otherwise_PConj : PConj ; part_Prep : Prep' ; @@ -75,19 +73,19 @@ abstract Structural' = Cat' ** { quite_Adv : AdA ; she_Pron : Pron ; so_AdA : AdA ; - someSg_Det : Det ; - somePl_Det : Det ; - somebody_NP : NP ; - something_NP : NP ; + someSg_Det : Det' ; + somePl_Det : Det' ; + somebody_NP : NP' ; + something_NP : NP' ; somewhere_Adv : Adv ; - that_Quant : Quant ; + that_Quant : Quant' ; that_Subj : Subj ; there_Adv : Adv ; there7to_Adv : Adv ; -- to there there7from_Adv : Adv ; -- from there therefore_PConj : PConj ; they_Pron : Pron ; - this_Quant : Quant ; + this_Quant : Quant' ; through_Prep : Prep' ; to_Prep : Prep' ; too_AdA : AdA ; @@ -112,13 +110,13 @@ abstract Structural' = Cat' ** { youPl_Pron : Pron ; -- you (plural) youPol_Pron : Pron ; -- you (polite) - no_Quant : Quant ; - not_Predet : Predet ; + no_Quant : Quant' ; + not_Predet : Predet' ; if_then_Conj : Conj ; at_least_AdN : AdN ; at_most_AdN : AdN ; - nobody_NP : NP ; - nothing_NP : NP ; + nobody_NP : NP' ; + nothing_NP : NP' ; except_Prep : Prep' ; as_CAdv : CAdv ; diff --git a/src/abstract/Verb'.gf b/src/abstract/Verb'.gf index 7d1b983a..1a8eca59 100644 --- a/src/abstract/Verb'.gf +++ b/src/abstract/Verb'.gf @@ -75,7 +75,7 @@ abstract Verb' = Cat' ** { -- Adjectival phrases, noun phrases, and adverbs can be used. CompAP : AP -> Comp ; -- (be) small - CompNP : NP -> Comp ; -- (be) the man + CompNP : NP' -> Comp ; -- (be) the man CompAdv : Adv -> Comp ; -- (be) here CompCN : CN -> Comp ; -- (be) a man/men diff --git a/src/german/AdjectiveGer.gf b/src/german/AdjectiveGer.gf index 9b2688b0..7449740f 100644 --- a/src/german/AdjectiveGer.gf +++ b/src/german/AdjectiveGer.gf @@ -10,14 +10,18 @@ concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in { c = <[],[]> ; ext = [] } ; - ComparA a np = { - s = \\af => a.s ! Compar ! af ++ conjThan ++ np.s ! NPC Nom ++ bigNP np ; + ComparA a np = + let nps = (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ bigNP' np + in { + s = \\af => a.s ! Compar ! af ++ conjThan ++ nps ; isPre = True ; c = <[],[]> ; ext = [] } ; - CAdvAP ad ap np = ap ** { - s = \\af => ad.s ++ ap.s ! af ++ ad.p ++ np.s ! NPC Nom ++ bigNP np ; + CAdvAP ad ap np = + let nps = (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ bigNP' np in + ap ** { + s = \\af => ad.s ++ ap.s ! af ++ ad.p ++ nps ; isPre = False } ; UseComparA a = { @@ -37,33 +41,31 @@ concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in { -- $SuperlA$ belongs to determiner syntax in $Noun$. ComplA2 a np = - let CExt = case a.c2.isPrep of { - isCase => ; - _ => <[], appPrepNP' a.c2 np> } -- HL: check 7/22 - in { - s = a.s ! Posit ; - isPre = True ; - c = CExt ; - ext = [] + let CExt = case a.c2.isPrep of { + isCase => ; + _ => <[], appPrepNP' a.c2 np> } -- HL: check 7/22 + in { + s = a.s ! Posit ; + isPre = True ; + c = CExt ; + ext = [] } ; ReflA2 a = - let --- compl = appPrep a.c2 (\\k => usePrepC k (\c -> reflPron ! agrP3 Sg ! c)) ; - compl = appPrep' a.c2 (reflPron ! agrP3 Sg) ; - CExt = case a.c2.isPrep of - {isCase => ; - _ => <[], compl> } -- HL Check isPrepDefArt - in { - s = a.s ! Posit ; - isPre = True ; - c = CExt ; - ext = [] + let + compl = appPrep' a.c2 (reflPron ! agrP3 Sg) ; + CExt = case a.c2.isPrep of + {isCase => ; _ => <[], compl> } + in { + s = a.s ! Posit ; + isPre = True ; + c = CExt ; + ext = [] } ; SentAP ap sc = ap ** { isPre = False ; - ext = ap.ext ++ sc.s + ext = ap.ext ++ sc.s } ; AdAP ada ap = ap ** {s = \\a => ada.s ++ ap.s ! a} ; diff --git a/src/german/AdverbGer.gf b/src/german/AdverbGer.gf index 1d9c6e9f..253427aa 100644 --- a/src/german/AdverbGer.gf +++ b/src/german/AdverbGer.gf @@ -3,8 +3,10 @@ concrete AdverbGer of Adverb' = CatGer ** open ResGer, Prelude in { lin PositAdvAdj a = {s = a.s ! Posit ! APred} ; - ComparAdvAdj cadv a np = { - s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ np.s ! NPC Nom + ComparAdvAdj cadv a np = + let nps = (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ bigNP' np in + { + s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ nps } ; ComparAdvAdjS cadv a s = { s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ s.s ! Sub diff --git a/src/german/CatGer.gf b/src/german/CatGer.gf index 08103c5c..d282a83c 100644 --- a/src/german/CatGer.gf +++ b/src/german/CatGer.gf @@ -75,7 +75,8 @@ concrete CatGer of Cat' = -- HL: To reduce PCase to Case: NP' = ResGer.NP' ; - Det' = {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ; + Det' = {s,sp : Gender => Case => {quant,num:Str}; n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ; + DAP' = {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ; Quant' = { s : Bool => Number => Gender => Case => Str ; -- Bool is True if a cardinal number is present sp : Bool => Number => Gender => Case => Str ; @@ -85,11 +86,10 @@ concrete CatGer of Cat' = } ; Predet' = { s : Number => Gender => Case => Str ; - c : {p : Str ; k : PredetCase} ; + c : {p : Str ; k : PredetCase'} ; a : PredetAgr -- if an agr is forced, e.g. jeder von uns ist ... } ; - Num = {s : Gender => Case => Str ; n : Number ; isNum : Bool} ; Card = {s : Gender => Case => Str ; n : Number} ; Ord = {s : AForm => Str} ; @@ -129,7 +129,7 @@ concrete CatGer of Cat' = linref NP = \np -> np.s!(NPC Nom) ++ np.ext ++ np.rc ; -- HL 6/2019 - NP' = \np -> (np.s!Nom).p1 ++ (np.s!Nom).p2 ++ np.ext ++ np.rc ; -- HL 6/2019 + NP' = \np -> (np.s!Nom).p1 ++ (np.s!Nom).p2 ++ np.ext ++ np.rc ; -- HL 7/2022 CN = \cn -> cn.s ! Strong ! Pl ! Nom ++ cn.adv ++ cn.ext ++ cn.rc ! Pl ; SSlash = \ss -> ss.s ! Main ++ ss.c2.s ; @@ -149,4 +149,8 @@ concrete CatGer of Cat' = V2V = \v -> useInfVP v.isAux (predVGen v.isAux v) ++ v.c2.s ; Conj = \c -> c.s1 ++ c.s2 ; + + Det' = \det -> (det.s ! Masc ! Nom).quant ++ (det.s ! Masc ! Nom).num ; + Prep' = \prep -> case prep.isPrep of {PrepDefArf => prep.sg ! Masc ; + _ => prep.s ++ prep.s2 } ; } diff --git a/src/german/GrammarGer.gf b/src/german/GrammarGer.gf index 06860974..84db9a03 100644 --- a/src/german/GrammarGer.gf +++ b/src/german/GrammarGer.gf @@ -2,7 +2,7 @@ concrete GrammarGer of Grammar' = NounGer, - VerbGer, -- to save compile time during development HL 7/22 + VerbGer, AdjectiveGer, AdverbGer, NumeralGer, diff --git a/src/german/LexiconGer.gf b/src/german/LexiconGer.gf index 72fddacb..7499b5cc 100644 --- a/src/german/LexiconGer.gf +++ b/src/german/LexiconGer.gf @@ -13,6 +13,7 @@ flags lin add_V3 = dirV3 (prefixV "hinzu" (regV "fügen")) zu_Prep ; airplane_N = mkN "Flugzeug" "Flugzeuge" neuter ; + alas_Interj = {s = "ach" } ; already_Adv = mkAdv "schon" ; answer_V2S = mkV2S (regV "antworten") datPrep ; apartment_N = mkN "Wohnung" ; @@ -212,7 +213,8 @@ lin dirV2 (irregV "verstehen" "versteht" "verstand" "verstände" "verstanden") ; university_N = reg2N "Universität" "Universitäten" feminine ; village_N = reg2N "Dorf" "Dörfer" neuter ; - wait_V2 = prepV2 (regV "warten") (mkPrep "auf" accusative) ; +-- wait_V2 = prepV2 (regV "warten") (mkPrep "auf" accusative) ; + wait_V2 = prepV2 (regV "warten") (mkPrep "auf" "auf den" "auf die" "aufs" accusative) ; walk_V = seinV Irreg.gehen_V ; warm_A = mk3A "warm" "wärmer" "wärmste" ; war_N = mkN "Krieg" ; diff --git a/src/german/MarkupGer.gf b/src/german/MarkupGer.gf index 79fe7c95..3aac5cda 100644 --- a/src/german/MarkupGer.gf +++ b/src/german/MarkupGer.gf @@ -1,10 +1,11 @@ --# -path=.:../abstract:../common -concrete MarkupGer of Markup = CatGer, MarkHTMLX ** { +concrete MarkupGer of Markup' = CatGer, MarkHTMLX ** { lin MarkupCN m cn = cn ** {s = \\a,n,c => appMark m (cn.s ! a ! n ! c)} ; --- other fields e.g ext intact MarkupNP m np = np ** {s = \\c => appMark m (np.s ! c)} ; + MarkupNP' m np = np ** {s = \\c => appMark2 m (np.s ! c)} ; MarkupAP m ap = ap ** {s = \\a => appMark m (ap.s ! a)} ; MarkupAdv m adv = {s = appMark m adv.s} ; MarkupS m s = {s = \\o => appMark m (s.s ! o)} ; @@ -12,5 +13,8 @@ lin MarkupPhr m phr = {s = appMark m phr.s} ; MarkupText m txt = {s = appMark m txt.s} ; +oper + appMark2 : {begin,end : Str} -> Str * Str -> Str * Str + = \m,s -> ; } diff --git a/src/german/MorphoGer.gf b/src/german/MorphoGer.gf index 73c744f2..e0c15155 100644 --- a/src/german/MorphoGer.gf +++ b/src/german/MorphoGer.gf @@ -27,6 +27,16 @@ oper s = \\c => usePrepC c (\k -> name.s ! k) ; a = agrP3 Sg } ; + nameNounPhrase' : Gender -> {s : Case => Str} -> {s : Case => Str * Str; + a : Agr ; + w : Weight' ; + ext,rc : Str} = + \g,name -> { + s = \\c => <[],name.s ! c> ; + a = agrgP3 g Sg ; + ext,rc = [] ; + w = WHeavy' -- ok? + } ; detLikeAdj : Bool -> Number -> Str -> {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index 9c858d7c..4e7b91ae 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -7,142 +7,116 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { lin DetCN det cn = { - s = \\c => det.s ! cn.g ! c ++ - (let k = (prepC c).c in cn.s ! adjfCase det.a k ! det.n ! k ++ cn.adv) ; - a = agrgP3 cn.g det.n ; + s = \\c => <(det.s ! cn.g ! c).quant, + (det.s ! cn.g ! c).num ++ cn.s ! (adjfCase det.a c) ! det.n ! c ++ cn.adv> ; + a = agrgP3 cn.g det.n ; -- isLight = det.isDef ; -- ich sehe den Mann nicht vs. ich sehe nicht einen Mann -- isPron = False ; -- HL 6/2019 (but:) sehe (die|einige) Männer nicht -- don't see a|no man = sehe keinen Mann - w = case det.isDef of { True => WLight ; _ => WHeavy } ; - rc = cn.rc ! det.n ; - ext = cn.ext - } ; - - -- HL: - DetCN' det' cn = { - s = \\c => ; - a = agrgP3 cn.g det'.n ; - -- isLight = det.isDef ; -- ich sehe den Mann nicht vs. ich sehe nicht einen Mann - -- isPron = False ; -- HL 6/2019 (but:) sehe (die|einige) Männer nicht - -- don't see a|no man = sehe keinen Mann - -- w = case det'.isDef of { True => WLight' ; _ => WHeavy' } ; + -- w = case det.isDef of { True => WLight' ; _ => WHeavy' } ; -- Would be clearer with w:Weight and hasDefArt:Bool with |NP|=|Agr|*3*2 = 108 -- instead of the more efficient w:Weigth' with |NP|=|Agr|*4 = 18*4 = 54 - w = case det'.isDef of { True => case det'.hasDefArt of { True => WDefArt ; - _ => WLight' } ; - _ => WHeavy' - } ; - rc = cn.rc ! det'.n ; + w = case det.isDef of { True => case det.hasDefArt of { True => WDefArt ; + _ => WLight' } ; + _ => WHeavy' } ; + rc = cn.rc ! det.n ; ext = cn.ext } ; - DetNP det = { - s = \\c => det.sp ! Neutr ! c ; -- more genders in ExtraGer -- HL: der+er,den+en ; der drei,den drei+en + DetNP det = { -- more genders in ExtraGer -- HL: der+er,den+en ; der drei,den drei+en + s = \\c => <(det.sp ! Neutr ! c).quant, (det.sp ! Neutr ! c).num> ; a = agrP3 det.n ; -- isLight = det.isDef ; -- isPron = False ; -- HL 6/2019: don't apply pronoun switch: ich gebe ihr das vs. ich gebe es ihr - w = case det.isDef of { True => WLight ; _ => WHeavy } ; + w = case det.isDef of { True => WLight' ; _ => WHeavy' } ; rc, ext = [] } ; UsePN pn = { - s = \\c => usePrepC c (\k -> pn.s ! k) ; + s = \\c => <[], pn.s ! c> ; a = agrgP3 pn.g Sg ; --- isLight = True ; -- means: this is not a heavy NP, but comes before negation --- isPron = False ; -- HL 6/2019: to regulate Pron/NonPronNP order - w = WLight ; - rc, ext = [] + w = WLight' ; -- means: this is not a heavy NP, but comes before negation + rc, ext = [] -- Pron => Light HL 6/2019: to regulate Pron/NonPronNP order } ; UsePron pron = { - s = \\c => usePrepC c (\k -> pron.s ! NPCase k) ; + s = \\c => <[], pron.s ! NPCase c> ; a = pron.a ; - -- isLight = True ; - -- isPron = True ; - w = WPron ; + w = WPron' ; rc, ext = [] } ; PredetNP pred np = let ag = case pred.a of {PAg n => agrP3 n ; _ => np.a} in np ** { s = \\c0 => - let c = case pred.c.k of {NoCase => c0 ; PredCase k => k} in - pred.s ! numberAgr ag ! genderAgr np.a ! c0 ++ pred.c.p ++ np.s ! c ; + let c = case pred.c.k of {NoCase' => c0 ; PredCase' k => k} in + ; a = ag ; - -- isLight = False ; - -- isPron = False - w = WHeavy + w = WHeavy' } ; PPartNP np v2 = np ** { - s = \\c => np.s ! c ++ embedInCommas (v2.s ! VPastPart APred) ; --- invar part --- isPron = False - w = WHeavy + s = incr2 np.s (embedInCommas (v2.s ! VPastPart APred)) ; --- invar part + w = WHeavy' } ; {- "eine erfolgreiche Frau, geliebt von vielen," but only with v2 not possible in German? HL: PPartNP np vps|vp: "der Autor, heute vergessen" , "der Mond, gerade aufgegangen," -} AdvNP np adv = np ** { - s = \\c => np.s ! c ++ adv.s ; - -- isLight = False ; - -- isPron = False - w = WHeavy + s = incr2 np.s adv.s ; + w = WHeavy' } ; ExtAdvNP np adv = np ** { - s = \\c => np.s ! c ++ embedInCommas adv.s ; - -- isLight = False ; - -- isPron = False - w = WHeavy + s = incr2 np.s (embedInCommas adv.s) ; + w = WHeavy' } ; - DetQuantOrd quant num ord = - let - n = num.n ; - a = quant.a - in { - s = \\g,c => quant.s ! num.isNum ! n ! g ! c ++ (let k = (prepC c).c in - num.s!g!k ++ ord.s ! agrAdj g (adjfCase a k) n k) ; - sp = \\g,c => quant.sp ! num.isNum ! n ! g ! c ++ (let k = (prepC c).c in - num.s!g!k ++ ord.s ! agrAdj g (adjfCase quant.aPl k) n k) ; - n = n ; - a = case n of {Sg => a ; Pl => quant.aPl} ; - isDef = case of { => False ; _ => True} ; - } ; + -- HL 21.7.2022: the dropping of DefArt in Prep+DefArt via hasDefArt works by splitting the + -- np.s into det':Str and cn:Str and (det.s ! g ! n) into {quant:Str; num:Str}, so that in + -- PrepNP in_Prep np we can replace "in" + "das" by "im" to get + -- PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (warme Meer)) => im warmen Meer + -- But parsing "im warmen Meer" results in a + -- PrepNP in_Prep (DetCN (DetQuant ? NumSg) (AdjCN ... )) + -- because (DetQuant.s!g!c).quant is ignored, but the .num is part of (np.s!c).p2. + -- To avoid the metavariable ?, we have to make Det.s and NP.s depend on t:PrepType = isPrep. - DetQuant quant num = - let - n = num.n ; + DetQuantOrd quant num ord = + let -- does not work, since here DefArt is combined with ord + n = num.n ; -- a = quant.a in { - s = \\g,c => quant.s ! num.isNum ! n ! g ! c ++ (let k = (prepC c).c in - num.s!g!k) ; - sp = \\g,c => quant.sp ! num.isNum ! n ! g ! c ++ (let k = (prepC c).c in - num.s!g!k) ; -- HL: der+er,den+en ; der drei,den drei+en - n = n ; - a = case n of {Sg => a ; Pl => quant.aPl} ; - isDef = case of { => False ; _ => True} ; - } ; - DetQuant' quant num = - let - n = num.n ; - a = quant.a - in { - s = \\g,c => quant.s ! num.isNum ! n ! g ! c ++ num.s!g!c ; - sp = \\g,c => quant.sp ! num.isNum ! n ! g ! c ++ num.s!g!c ; -- HL: der+er,den+en ; der drei,den drei+en + s = \\g,c => {quant = quant.s ! num.isNum ! n ! g ! c; + num = num.s!g!c ++ ord.s ! agrAdj g (adjfCase a c) n c} ; + sp = \\g,c => {quant = quant.sp ! num.isNum ! n ! g ! c; + num = num.s!g!c ++ ord.s ! agrAdj g (adjfCase quant.aPl c) n c} ; n = n ; a = case n of {Sg => a ; Pl => quant.aPl} ; isDef = case of { => False ; _ => True} ; hasDefArt = quant.hasDefArt ; } ; + DetQuant quant num = + let + n = num.n ; + a = quant.a + in { + s = \\g,c => {quant = quant.s ! num.isNum ! n ! g ! c ; num = num.s!g!c} ; + sp = \\g,c => {quant = quant.sp ! num.isNum ! n ! g ! c ; num = num.s!g!c} ; + -- HL: der+er,den+en ; der drei,den drei+en + n = n ; + a = case n of {Sg => a ; Pl => quant.aPl} ; + isDef = case of { => False ; _ => True} ; + hasDefArt = quant.hasDefArt ; + } ; PossPron p = { - s = \\_,n,g,c => usePrepC c (\k -> p.s ! NPPoss (gennum g n) k) ; - sp = \\_,n,g,c => usePrepC c (\k -> p.s ! NPPoss (gennum g n) k) ; + s = \\_,n,g,c => p.s ! NPPoss (gennum g n) c ; + sp = \\_,n,g,c => p.s ! NPPoss (gennum g n) c ; a = Strong ; aPl = Weak ; + hasDefArt = False ; } ; NumCard n = n ** {isNum = True} ; @@ -163,39 +137,6 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { OrdNumeralSuperl n a = {s = \\af => n.s ! NOrd APred ++ Predef.BIND ++ a.s ! Superl ! af} ; -- drittbeste DefArt = { - s = \\_,n,g,c => artDefContr (gennum g n) c ; --- sp = \\_,n,g,c => artDefContr (gennum g n) c ; ---- deren, denen ... - sp = \\_,n,g,c => case of { - => let sp = prepC c ; gn = gennum g n - in sp.s ++ artDef ! gn ! sp.c ; - => let sp = prepC c in sp.s ++ "die" ; - => let sp = prepC c ; gn = gennum g n - in sp.s ++ (artDef ! gn ! sp.c + "en") ; - => "denen" ; -- HL 6/2019 - => "derer" ; -- HL 6/2019 - _ => artDefContr (gennum g n) c } ; -- von den+en - a, aPl = Weak - } ; - - IndefArt = { - s = table { - True => \\_,_,c => usePrepC c (\k -> []) ; - False => table { - Sg => \\g,c => usePrepC c (\k -> "ein" + pronEnding ! GSg g ! k) ; - Pl => \\_,c => usePrepC c (\k -> []) - } - } ; - sp = table { - True => \\_,_,c => usePrepC c (\k -> []) ; - False => table { - Sg => \\g,c => usePrepC c (\k -> (detUnlikeAdj False Sg "ein").s ! g ! NPC k) ; - Pl => \\_,c => usePrepC c (\k -> caselist "einige" "einige" "einigen" "einiger" ! k) - } - } ; - a, aPl = Strong - } ; - -- HL - DefArt' = { s = \\_,n,g,c => artDef ! (gennum g n) ! c ; sp = \\_,n,g,c => case of { => "denen" ; -- HL 6/2019 @@ -204,15 +145,34 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { a, aPl = Weak ; hasDefArt = True } ; + IndefArt = { + s = table { + True => \\_,_,c => [] ; + False => table { + Sg => \\g,c => "ein" + pronEnding ! GSg g ! c ; + Pl => \\_,c => [] + } + } ; + sp = table { + True => \\_,_,c => [] ; + False => table { + Sg => \\g,c => (detUnlikeAdj' False Sg "ein").s ! g ! c ; + Pl => \\_,c => caselist "einige" "einige" "einigen" "einiger" ! c + } + } ; + a, aPl = Strong ; + hasDefArt = False + } ; MassNP cn = { - s = \\c => usePrepC c (\k -> cn.s ! Strong ! Sg ! k) ++ cn.adv ; + s = \\c => <[], cn.s ! Strong ! Sg ! c ++ cn.adv> ; a = agrgP3 cn.g Sg ; -- isLight = True ; -- ich trinke Bier nicht vs. ich trinke kein Bier -- isPron = False ; - w = WLight ; + w = WLight' ; rc = cn.rc ! Sg ; - ext = cn.ext + ext = cn.ext ; + hasDefArt = False } ; UseN, UseN2 = \n -> { @@ -262,9 +222,8 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { ---- another layer of embedInCommas needed if there is a non-empty rc RelNP np rs = np ** { - rc = (np.rc ++ embedInCommas (rs.s ! RGenNum (gennum (genderAgr np.a) (numberAgr np.a)))) ; - -- isPron = False - w = case isPron np of { True => WLight ; _ => np.w } + rc = np.rc ++ embedInCommas (rs.s ! RGenNum (gennum (genderAgr np.a) (numberAgr np.a))) ; + w = case isPron' np of { True => WLight' ; _ => np.w } } ; SentCN cn s = cn ** {ext = cn.ext ++ embedInCommas s.s} ; @@ -272,11 +231,33 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { AdvCN cn a = cn ** {adv = cn.adv ++ a.s} ; ApposCN cn np = let g = cn.g in cn ** { - s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! NPC c ++ bigNP np } ; + s = \\a,n,c => cn.s ! a ! n ! c ++ (np.s ! c).p1 ++ (np.s ! c).p2 ++ bigNP' np } ; + -- PossNP cn np = cn ** { + -- s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! NPP CVonDat ++ bigNP np } ; PossNP cn np = cn ** { - s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! NPP CVonDat ++ bigNP np } ; + s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep2' vonDat' np.s ++ bigNP' np } ; -- HL, ad hoc - DetDAP det = det ; + -- PartNP cn np = todo -- glass of wine + + CountNP det np = -- drei der Kinder | drei von den Kindern -- HL 7/22, ad-hoc + -- det or numeral? np or rather (DefArt +) cn? drei (einiger Kinder) ? + let g = genderAgr np.a + in { + s = \\c => det.s ! g ! c ++ np.s ! NPP CVonDat ++ bigNP np ; + a = agrgP3 g det.n ; + w = case det.isDef of { True => WLight ; _ => WHeavy } ; + rc = np.rc ; + ext = np.ext + } ; + +-- AdjDAP dap adj = ?? TODO -- the large (one) + + DetDAP det = {s = \\g,c => (det.s ! g ! c).quant ++ (det.s ! g ! c).num ; -- HL 7/22 + sp = \\g,c => (det.sp ! g ! c).quant ++ (det.sp ! g ! c).num ; + n = det.n ; a = det.a ; isDef = det.isDef ; hasDefArt = det.hasDefArt} ; + oper + incr2 : (Case => Str * Str) -> Str -> (Case => Str * Str) = \tab,str -> + \\c => <(tab ! c).p1, (tab ! c).p2 ++ str> ; } diff --git a/src/german/ParadigmsGer.gf b/src/german/ParadigmsGer.gf index cde85fcf..1dd08c1a 100644 --- a/src/german/ParadigmsGer.gf +++ b/src/german/ParadigmsGer.gf @@ -137,10 +137,10 @@ mkN : overload { } ; --- To extract the number of a noun phrase +-- To extract the number of a noun phrase --never used in RGL - ifPluralNP : NP -> Bool - = \np -> case (numberAgr np.a) of {Sg => False ; Pl => True} ; + -- ifPluralNP : NP -> Bool + -- = \np -> case (numberAgr np.a) of {Sg => False ; Pl => True} ; --2 Adjectives @@ -185,6 +185,9 @@ mkN : overload { mkPrep : Str -> Case -> Prep' ; -- e.g. "durch" + accusative mkPrep : Case -> Str -> Prep' ; -- postposition mkPrep : Str -> Case -> Str -> Prep' ; -- both sides + -- for preposition glued with DefArt in singular: + -- e.g. "auf" "auf den" "auf die" "aufs" + accusative + mkPrep : Str -> Str -> Str -> Str-> Case -> Prep' ; } ; -- Often just a case with the empty string is enough. @@ -195,11 +198,11 @@ mkN : overload { -- A couple of common prepositions (the first two always with the dative). - von_Prep : Prep' ; -- von + dative + von_Prep : Prep' ; -- von + dative, with contraction vom zu_Prep : Prep' ; -- zu + dative, with contractions zum, zur anDat_Prep : Prep' ; -- an + dative, with contraction am - inDat_Prep : Prep' ; -- in + dative, with contraction ins - inAcc_Prep : Prep' ; -- in + accusative, with contraction im + inDat_Prep : Prep' ; -- in + dative, with contraction im + inAcc_Prep : Prep' ; -- in + accusative, with contraction ins --2 Verbs @@ -503,7 +506,10 @@ mkV2 : overload { mkPrep : Case -> Str -> Prep' = \c,s -> {s = [] ; s2 = s ; sg = \\_ => [] ; c = c ; isPrep = isPrep ; lock_Prep' = <>} ; mkPrep : Str -> Case -> Str -> Prep' = \s,c,t -> {s = s ; s2 = t ; sg = \\_ => [] ; - c = c ; isPrep = isPrep ; lock_Prep' = <>} + c = c ; isPrep = isPrep ; lock_Prep' = <>} ; + mkPrep : Str -> Str -> Str -> Str-> Case -> Prep' = \s,masc,fem,neutr, c -> + {s = s ; s2 = [] ; sg = table{Masc => masc ; Fem => fem ; Neutr => neutr} ; + c = c ; isPrep = isPrepDefArt ; lock_Prep' = <>} ; } ; accPrep = {s,s2 = [] ; sg = \\_ => [] ; c = accusative ; isPrep = isCase ; lock_Prep' = <>} ; datPrep = {s,s2 = [] ; sg = \\_ => [] ; c = dative ; isPrep = isCase ; lock_Prep' = <>} ; diff --git a/src/german/ResGer.gf b/src/german/ResGer.gf index d02e490d..5b115c8d 100644 --- a/src/german/ResGer.gf +++ b/src/german/ResGer.gf @@ -82,6 +82,12 @@ resource ResGer = ParamX ** open Prelude in { oper noCase : {p : Str ; k : PredetCase} = {p = [] ; k = NoCase} ; + param + PredetCase' = NoCase' | PredCase' Case ; +-- PredetAgr = PAg Number | PAgNone ; + oper + noCase' : {p : Str ; k : PredetCase'} = {p = [] ; k = NoCase'} ; + -- Pronominal nps are ordered differently, and light nps come before negation in clauses. -- (To save space, reduce isPron * isLight = 4 values to the following three.) HL 9/19 param @@ -95,11 +101,11 @@ resource ResGer = ParamX ** open Prelude in { -- To reduce c:PCase to c:Case in Preposition' and NP.s:PCase => Str to NP'.s:Case => Str*Str: param Weight' = WPron' | WLight' | WHeavy' | WDefArt ; - -- oper - -- isPron : {w : Weight} -> Bool = \np -> - -- case np.w of {WPron => True ; _ => False} ; - -- isLight : {w : Weight} -> Bool = \np -> - -- case np.w of {WHeavy => False ; _ => True} ; + oper + isPron' : {w : Weight'} -> Bool = \np -> + case np.w of {WPron' => True ; _ => False} ; + isLight' : {w : Weight'} -> Bool = \np -> + case np.w of {WHeavy' => False ; _ => True} ; --2 For $Adjective$ @@ -512,6 +518,8 @@ resource ResGer = ParamX ** open Prelude in { Dat' : Preposition' = {s=""; s2=""; sg = \\c => []; c=Dat; isPrep=isCase} ; mit' : Preposition' = {s="zusammen mit"; s2=""; sg = \\_ => []; c=Dat; isPrep=isPrep} ; + vonDat' : Preposition' = {s="von"; s2=""; sg = table{Fem => "von der"; _ => "vom"}; c=Dat; isPrep=isPrep} ; + zuDat' : Preposition' = {s="zu"; s2="herein"; sg = \\_ => ""; c=Dat; isPrep=isPrep} ; zum' : Preposition' = {s="zu"; s2="herein"; sg = table{Masc=>"zum"; Fem=>"zur"; Neutr=>"zum"}; c=Dat; isPrep=isPrepDefArt} ; @@ -848,9 +856,8 @@ resource ResGer = ParamX ** open Prelude in { insertObjRefl : VPSlash -> VPSlash = \vp -> -- HL 6/2019, to order reflPron < neg < prep+reflPron - let prep = vp.c2 ; - c = prep.c ; -- HL 7/22 reduced to c:Case - obj : Agr => Str = \\a => prep.s ++ reflPron ! a ! c ++ prep.s2 ; + let prep = vp.c2 ; -- HL 7/22 reduced to c:Case + obj : Agr => Str = \\a => prep.s ++ reflPron ! a ! prep.c ++ prep.s2 ; in vp ** { nn = \\a => let vpnn = vp.nn ! a in diff --git a/src/german/SentenceGer.gf b/src/german/SentenceGer.gf index 856df34a..aeb855c1 100644 --- a/src/german/SentenceGer.gf +++ b/src/german/SentenceGer.gf @@ -32,7 +32,7 @@ concrete SentenceGer of Sentence' = CatGer ** open ResGer, Prelude in { -- verb.fin ++ ps.p2 ++ (vp.nn ! agr).p1 ++ vp.a1 ! pol ++ obj ++ vp.a2 ++ inf ++ vp.ext verb.fin ++ ps.p2 ++ (vp.nn ! agr).p1 ++ vp.a1 ++ negation ! pol ++ obj ++ vp.a2 ++ inf ++ vp.ext } ; - +-- to save (67299 - 27432 = 39863 msec) compile time: HL 7/22, comment out: SlashVP np vp = let subj = mkSubj' np vp.c1 ; -- HL 3/2022: need a mkClSlash to prevent in mkClause subj.p1 subj.p2 vp ** { c2 = vp.c2 } ; -- reflexives in vp instantiated to np.a diff --git a/src/german/StructuralGer.gf b/src/german/StructuralGer.gf index 8cbaff8f..128fdbb2 100644 --- a/src/german/StructuralGer.gf +++ b/src/german/StructuralGer.gf @@ -10,8 +10,7 @@ concrete StructuralGer of Structural' = CatGer ** above_Prep = mkPrep "über" P.dative ; after_Prep = mkPrep "nach" P.dative ; - all_Predet = {s = appAdj (regA "all") ; c = noCase ; a = PAgNone} ; - all_Predet' = {s = appAdj' (regA "all") ; c = noCase ; a = PAgNone} ; + all_Predet = {s = appAdj' (regA "all") ; c = noCase' ; a = PAgNone} ; almost_AdA, almost_AdN = ss "fast" ; although_Subj = ss "obwohl" ; always_AdV = ss "immer" ; @@ -32,11 +31,14 @@ concrete StructuralGer of Structural' = CatGer ** VHaben) ; during_Prep = mkPrep "während" P.genitive ; --- no variants in the rgl | P.mkPrep P.accusative "über" ; either7or_DConj = sd2 "entweder" "oder" ** {n = Sg} ; - everybody_NP = nameNounPhrase {s = caselist "jeder" "jeden" "jedem" "jedes"} ; - every_Det = detUnlikeAdj False Sg "jed" ; - everything_NP = nameNounPhrase {s = caselist "alles" "alles" "allem" "alles"} ; + everybody_NP = nameNounPhrase' Masc {s = caselist "jeder" "jeden" "jedem" "jedes"} ; + -- every_Det = detUnlikeAdj False Sg "jed" ; + every_Det = let tab = (detUnlikeAdj' False Sg "jed").s + in {s,sp = asQuant tab ; n = Sg ; a = Weak ; isDef = False ; hasDefArt = False} ; + everything_NP = nameNounPhrase' Neutr {s = caselist "alles" "alles" "allem" "alles"} ; everywhere_Adv = ss "überall" ; - few_Det = detLikeAdj False Pl "wenig" ; + few_Det = let tab = (detLikeAdj' False Pl "wenig").s + in {s,sp = asQuant tab ; n = Pl ; a = Weak ; isDef = False ; hasDefArt = False} ; ---- first_Ord = {s = (regA "erst").s ! Posit} ; for_Prep = mkPrep "für" P.accusative ; from_Prep = mkPrep "aus" P.dative ; @@ -54,11 +56,13 @@ concrete StructuralGer of Structural' = CatGer ** in_Prep = P.inDat_Prep ; -- HL 7/2022 it_Pron = mkPronPers "es" "es" "ihm" "seiner" "sein" Neutr Sg P3 ; less_CAdv = X.mkCAdv "weniger" "als" ; - many_Det = detLikeAdj False Pl "viel" ; + many_Det = let tab = (detLikeAdj' False Pl "viel").s + in {s,sp = asQuant tab ; n = Pl ; a = Weak ; isDef = False ; hasDefArt = False} ; more_CAdv = X.mkCAdv "mehr" "als" ; - most_Predet = {s = appAdj (regA "meist") ; c = noCase ; a = PAgNone} ; - most_Predet' = {s = appAdj' (regA "meist") ; c = noCase ; a = PAgNone} ; - much_Det = {s = \\_,_ => "viel" ; sp = \\_,_ => "vieles" ; n = Sg ; a = Weak ; isDef = False} ; + most_Predet = {s = appAdj' (regA "meist") ; c = noCase' ; a = PAgNone} ; +-- much_Det = {s = \\_,_ => "viel" ; sp = \\_,_ => "vieles" ; n = Sg ; a = Weak ; isDef = False} ; + much_Det = {s = asQuant (\\_,_ => "viel") ; sp = asQuant (\\_,_ => "vieles") ; + n = Sg ; a = Weak ; isDef = False ; hasDefArt = False} ; must_VV = auxVV (mkV "müssen" "muss" "musst" "muss" "müsst" "müss" @@ -66,10 +70,11 @@ concrete StructuralGer of Structural' = CatGer ** "müsste" "gemusst" [] VHaben) ; --- one_Quant = DEPREC - only_Predet = {s = \\_,_,_ => "nur" ; c = noCase ; a = PAgNone} ; + only_Predet = {s = \\_,_,_ => "nur" ; c = noCase' ; a = PAgNone} ; no_Utt = ss "nein" ; ---b no_Phr = ss "nein" ; - on_Prep = mkPrep "auf" P.dative ; +-- on_Prep = mkPrep "auf" P.dative ; + on_Prep = P.mkPrep "auf" "auf den" "auf die" "aufs" P.accusative ; -- test HL 7/2022 or_Conj = {s1 = [] ; s2 = "oder" ; n = Sg} ; otherwise_PConj = ss "sonst" ; part_Prep = P.von_Prep ; -- mkPrep "von" P.dative ; @@ -78,21 +83,21 @@ concrete StructuralGer of Structural' = CatGer ** quite_Adv = ss "ziemlich" ; she_Pron = mkPronPers "sie" "sie" "ihr" "ihrer" "ihr" Fem Sg P3 ; so_AdA = ss "so" ; - somebody_NP = nameNounPhrase {s = caselist "jemand" "jemanden" "jemandem" "jemands"} ; - somePl_Det = detLikeAdj True Pl "einig" ; + somebody_NP = nameNounPhrase' Masc {s = caselist "jemand" "jemanden" "jemandem" "jemands"} ; + somePl_Det = let tab = (detLikeAdj' True Pl "einig").s + in {s,sp = asQuant tab ; isDef = True ; n = Pl ; a = Weak ; hasDefArt = False} ; someSg_Det = { - s,sp = \\g,c => - usePrepC c (\k -> "ein" + pronEnding ! GSg g ! k) ; ---- einer,eines + s,sp = asQuant (\\g,c => "ein" + pronEnding ! GSg g ! c) ; ---- einer,eines n = Sg ; a = Strong ; hasNum = True ; - isDef = False ; + isDef = False ; hasDefArt = False } ; - something_NP = nameNounPhrase {s = \\_ => "etwas"} ; + something_NP = nameNounPhrase' Neutr {s = \\_ => "etwas"} ; somewhere_Adv = ss "irgendwo" ; that_Quant = let - jener : Number => Gender => PCase => Str = \\n => (detUnlikeAdj True n "jen").s in - {s,sp = \\_ => jener ; a,aPl = Weak} ; + jener : Number => Gender => Case => Str = \\n => (detUnlikeAdj' True n "jen").s in + {s,sp = \\_ => jener ; a,aPl = Weak ; hasDefArt = False} ; ---b that_NP = nameNounPhrase {s = caselist "das" "das" "denem" "dessen"} ; ---- there_Adv = ss "da" ; --- no variants in the rgl | ss "dort" ; there7to_Adv = ss "dahin" ; @@ -101,8 +106,8 @@ concrete StructuralGer of Structural' = CatGer ** ---b these_NP = {s = caselist "diese" "diese" "diesen" "dieser" ; a = agrP3 Pl} ; they_Pron = mkPronPers "sie" "sie" "ihnen" "ihrer" "ihr" Fem Pl P3 ; this_Quant = let - dieser : Number => Gender => PCase => Str = \\n => (detUnlikeAdj True n "dies").s in - {s,sp = \\_ => dieser ; a,aPl = Weak} ; + dieser : Number => Gender => Case => Str = \\n => (detUnlikeAdj' True n "dies").s in + {s,sp = \\_ => dieser ; a,aPl = Weak ; hasDefArt = False} ; ---b this_NP = nameNounPhrase {s = caselist "dies" "dies" "diesem" "dieses"} ; ---- ---b those_NP = {s = caselist "jene" "jene" "jenen" "jener" ; a = agrP3 Pl} ; through_Prep = mkPrep "durch" P.accusative ; @@ -124,7 +129,7 @@ concrete StructuralGer of Structural' = CatGer ** when_IAdv = ss "wann" ; when_Subj = ss "wenn" ; where_IAdv = ss "wo" ; - which_IQuant = {s = \\n,g,c => (detUnlikeAdj True n "welch").s ! g ! NPC c} ; + which_IQuant = {s = \\n,g,c => (detUnlikeAdj' True n "welch").s ! g ! c} ; whoSg_IP = {s = caselist "wer" "wen" "wem" "wessen" ; n = Sg} ; whoPl_IP = {s = caselist "wer" "wen" "wem" "wessen" ; n = Sg} ; -- HL 6/2016 @@ -136,19 +141,19 @@ concrete StructuralGer of Structural' = CatGer ** youPol_Pron = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Fem Pl P3 ; yes_Utt = ss "ja" ; - not_Predet = {s = \\_,_,_ => "nicht" ; c = noCase ; a = PAgNone} ; + not_Predet = {s = \\_,_,_ => "nicht" ; c = noCase' ; a = PAgNone} ; no_Quant = let - keiner : Number => Gender => PCase => Str = table { - Sg => \\g,c => usePrepC c (\k -> "kein" + pronEnding ! GSg g ! k) ; - Pl => (detUnlikeAdj False Pl "kein").s + keiner : Number => Gender => Case => Str = table { + Sg => \\g,c => "kein" + pronEnding ! GSg g ! c ; + Pl => (detUnlikeAdj' False Pl "kein").s } in - {s,sp = \\_ => keiner ; a = Strong ; aPl = Weak} ; ---- sp + {s,sp = \\_ => keiner ; a = Strong ; aPl = Weak ; hasDefArt = False} ; ---- sp if_then_Conj = {s1 = "wenn" ; s2 = "dann" ; n = Sg ; lock_Conj = <>} ; nobody_NP = - nameNounPhrase {s = caselist "niemand" "niemanden" "niemandem" "niemands"} ; + nameNounPhrase' Masc {s = caselist "niemand" "niemanden" "niemandem" "niemands"} ; nothing_NP = - nameNounPhrase {s = \\_ => "nichts"} ; --maybe add: nameNounPhrase {s = \\_ => "garnichts"} + nameNounPhrase' Neutr {s = \\_ => "nichts"} ; --maybe add: nameNounPhrase {s = \\_ => "garnichts"} at_least_AdN = ss "wenigstens" ; at_most_AdN = ss "höchstens" ; except_Prep = mkPrep "außer" P.dative ; @@ -159,4 +164,11 @@ concrete StructuralGer of Structural' = CatGer ** lin language_title_Utt = ss "Deutsch" ; + oper + asQuant : (Gender => Case => Str) -> (Gender => Case => {quant,num:Str}) = + \tab -> \\g,c => {quant = tab ! g ! c; num = []} ; + asNum : (Gender => Case => Str) -> (Gender => Case => {quant,num:Str}) = + \tab -> \\g,c => {quant = []; num = tab ! g ! c} ; + pairTable : (Gender => Case => Str) -> (Gender => Case => Str) -> (Gender => Case => {quant,num:Str}) + = \qt,nt -> \\g,c => {quant = qt ! g ! c; num = nt ! g ! c} ; } diff --git a/src/german/VerbGer.gf b/src/german/VerbGer.gf index 04c90436..b737badb 100644 --- a/src/german/VerbGer.gf +++ b/src/german/VerbGer.gf @@ -40,7 +40,7 @@ concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in { SlashV2A v ap = insertAdj (ap.s ! APred) ap.c ap.ext (predV v) ** {c2 = v.c2; objCtrl = False} ; --- to save compile time, comment out: +-- to save (83669 - 67299 = 16370 msec) compile time, comment out: ComplSlash vps np = -- IL 24/04/2018 force reflexive in the VPSlash to take the agreement of np. -- HL 3/22 better before inserting np, using objCtrl @@ -94,10 +94,11 @@ concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in { -- SlashV2VNP v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22 -- insertObjNP np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ; --- to save compile time, comment out: +{- +-- to save (571098 = 83669 = 487429 msec) compile time (in 58% memory), comment out: SlashV2VNP' v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22 insertObjNP' np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ; - +-} UseComp comp = insertExtrapos comp.ext (insertObj comp.s (predV sein_V)) ; -- agr not used -- adj slot not used here for e.g. "ich bin alt" but same behaviour as NPs? @@ -106,7 +107,7 @@ concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in { UseCopula = predV sein_V ; CompAP ap = {s = \\_ => ap.c.p1 ++ ap.s ! APred ++ ap.c.p2 ; ext = ap.ext} ; - CompNP np = {s = \\_ => np.s ! NPC Nom ++ np.rc ; ext = np.ext} ; + CompNP np = {s = \\_ => (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ np.rc ; ext = np.ext} ; CompAdv a = {s = \\_ => a.s ; ext = []} ; CompCN cn = {s = \\a => case numberAgr a of { From 787f9d10e837b324226c48090db3287d4951ba5a Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Thu, 11 Aug 2022 21:07:03 +0200 Subject: [PATCH 03/16] The files for GrammarGer and AllGer (but not Construction, Documentation, Markup) are edited to allow for glued Prep+DefArt, using new categories NP',Det',Quant', Predet',DAP'. The previous NP.s : Case => Str*Str allows parsing "in dem Meer" = in_Prep ++ (np.s ! Case).p1 "im Meer" = in_Prep ++ (np.s ! Case).p2, but since only one of the strings of (np.s!Case) is used, the tree contains a metavariable like ?2 (the grammar is "erasing"). (Similarly, if we used NP.s : Case => Str and NP.s2 : Case => Str.) To get rid of the metavariables, we have to choose BY A PARAMETER, say NP.s : droppedDefArt? => Case => Str Using np.a = Ag g n p, the preposition can select between preposition alone or preposition with definite article (glued or not), via Prep = {s : GenNum => Str ; s2 :Str ; c : Case ; isPrep : PrepType } The combination is done in appPrepNP' and appPrep'. This is independent of the number of glued Prep+DefArt. But LangGer compiles now in 200s using 30% memory (without SlashV2VNP). Can AppPrepNP' (and insertObjNP') be simplified? --- src/abstract/Conjunction'.gf | 4 +- src/abstract/Grammar'.gf | 1 - src/abstract/Lang'.gf | 2 +- src/abstract/Noun'.gf | 4 +- src/abstract/Question'.gf | 2 +- src/abstract/Verb'.gf | 3 +- src/api/CombinatorsGer.gf | 6 +- src/api/ConstructorsGer.gf | 2 +- src/api/SyntaxGer.gf | 4 +- src/german/AdjectiveGer.gf | 4 +- src/german/AdverbGer.gf | 2 +- src/german/AllGer.gf | 7 +- src/german/CatGer.gf | 42 +++--- src/german/ConjunctionGer.gf | 19 +-- src/german/ConstructionGer.gf | 4 +- src/german/ExtraGer.gf | 48 +++---- src/german/GrammarGer.gf | 2 +- src/german/IdiomGer.gf | 22 ++- src/german/LangGer.gf | 2 +- src/german/LexiconGer.gf | 3 +- src/german/MakeStructuralGer.gf | 30 ++-- src/german/MarkupGer.gf | 6 +- src/german/MorphoGer.gf | 22 +-- src/german/NounGer.gf | 91 ++++++------ src/german/ParadigmsGer.gf | 47 ++++--- src/german/PhraseGer.gf | 4 +- src/german/QuestionGer.gf | 2 +- src/german/RelativeGer.gf | 4 +- src/german/ResGer.gf | 237 ++++++++------------------------ src/german/SentenceGer.gf | 7 +- src/german/StructuralGer.gf | 16 +-- src/german/SymbolGer.gf | 7 +- src/german/VerbGer.gf | 11 +- 33 files changed, 261 insertions(+), 406 deletions(-) diff --git a/src/abstract/Conjunction'.gf b/src/abstract/Conjunction'.gf index c9b3fb7c..b15d5d9d 100644 --- a/src/abstract/Conjunction'.gf +++ b/src/abstract/Conjunction'.gf @@ -20,12 +20,12 @@ abstract Conjunction' = Cat' ** { ConjS : Conj -> ListS -> S ; -- he walks and she runs ConjRS : Conj -> ListRS -> RS ; -- who walks and whose mother runs ConjAP : Conj -> ListAP -> AP ; -- cold and warm - ConjNP' : Conj -> ListNP' -> NP' ; -- she or we + ConjNP : Conj -> ListNP' -> NP' ; -- she or we ConjAdv : Conj -> ListAdv -> Adv ; -- here or there ConjAdV : Conj -> ListAdV -> AdV ; -- always or sometimes ConjIAdv : Conj -> ListIAdv -> IAdv ; -- where and with whom ConjCN : Conj -> ListCN -> CN ; -- man and woman - ConjDet : Conj -> ListDAP -> Det ; -- his or her + ConjDet : Conj -> ListDAP -> Det' ; -- his or her --2 Categories diff --git a/src/abstract/Grammar'.gf b/src/abstract/Grammar'.gf index de3322a7..b90e2e9d 100644 --- a/src/abstract/Grammar'.gf +++ b/src/abstract/Grammar'.gf @@ -21,4 +21,3 @@ abstract Grammar' = Tense, Transfer' ; - diff --git a/src/abstract/Lang'.gf b/src/abstract/Lang'.gf index 62f2afd4..ad859414 100644 --- a/src/abstract/Lang'.gf +++ b/src/abstract/Lang'.gf @@ -10,7 +10,7 @@ abstract Lang' = Lexicon -- ,Construction --- could be compiled here, but not in concretes, as they call Syntax and Grammar -- ,Documentation --# notpresent - ,Markup' - [stringMark] +-- ,Markup' - [stringMark] ** { flags startcat=Phr ; } ; diff --git a/src/abstract/Noun'.gf b/src/abstract/Noun'.gf index 8a9e14a5..b56b92dd 100644 --- a/src/abstract/Noun'.gf +++ b/src/abstract/Noun'.gf @@ -148,11 +148,11 @@ abstract Noun' = Cat' ** { -- This is different from the partitive, as shown by many languages. - CountNP : Det -> NP -> NP ; -- three of them, some of the boys + CountNP : Det' -> NP' -> NP' ; -- three of them, some of the boys --3 Conjoinable determiners and ones with adjectives - AdjDAP : DAP -> AP -> DAP ; -- the large (one) + AdjDAP : DAP' -> AP -> DAP' ; -- the large (one) DetDAP : Det' -> DAP' ; -- this (or that) } diff --git a/src/abstract/Question'.gf b/src/abstract/Question'.gf index 21a33258..139ce4e3 100644 --- a/src/abstract/Question'.gf +++ b/src/abstract/Question'.gf @@ -28,7 +28,7 @@ abstract Question' = Cat' ** { -- Interrogative adverbs can be formed prepositionally. - PrepIP : Prep -> IP -> IAdv ; -- with whom + PrepIP : Prep' -> IP -> IAdv ; -- with whom -- They can be modified with other adverbs. diff --git a/src/abstract/Verb'.gf b/src/abstract/Verb'.gf index 1a8eca59..b3e4c1f5 100644 --- a/src/abstract/Verb'.gf +++ b/src/abstract/Verb'.gf @@ -29,8 +29,7 @@ abstract Verb' = Cat' ** { ComplSlash : VPSlash -> NP' -> VP ; -- love it SlashVV : VV -> VPSlash -> VPSlash ; -- want to buy - SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy - SlashV2VNP' : V2V -> NP' -> VPSlash -> VPSlash ; -- beg me to buy + SlashV2VNP : V2V -> NP' -> VPSlash -> VPSlash ; -- beg me to buy --2 Other ways of forming verb phrases diff --git a/src/api/CombinatorsGer.gf b/src/api/CombinatorsGer.gf index 2fbed5a4..6847da62 100644 --- a/src/api/CombinatorsGer.gf +++ b/src/api/CombinatorsGer.gf @@ -7,9 +7,9 @@ resource CombinatorsGer = Combinators - [appCN, appCNc] with (Constructors = ConstructorsGer) ** { oper -appCN : CN -> NP -> NP +appCN : CN -> NP' -> NP' = \cn,x -> mkNP the_Art (PossNP cn x) ; -appCNc : CN -> [NP] -> NP - = \cn,xs -> let np : NP = mkNP and_Conj xs +appCNc : CN -> [NP'] -> NP' + = \cn,xs -> let np : NP' = mkNP and_Conj xs in mkNP the_Art (PossNP cn np) ; } diff --git a/src/api/ConstructorsGer.gf b/src/api/ConstructorsGer.gf index 907bf90a..d70f05be 100644 --- a/src/api/ConstructorsGer.gf +++ b/src/api/ConstructorsGer.gf @@ -1,3 +1,3 @@ --# -path=.:alltenses:prelude -resource ConstructorsGer = Constructors with (Grammar = GrammarGer) ; +resource ConstructorsGer = Constructors' with (Grammar = GrammarGer) ; diff --git a/src/api/SyntaxGer.gf b/src/api/SyntaxGer.gf index 59f49527..206061f9 100644 --- a/src/api/SyntaxGer.gf +++ b/src/api/SyntaxGer.gf @@ -1,4 +1,4 @@ ---# -path=.:alltenses:prelude +--# -path=../abstract:.:alltenses:prelude: -instance SyntaxGer of Syntax = ConstructorsGer, CatGer, StructuralGer, CombinatorsGer ; +instance SyntaxGer of Syntax' = ConstructorsGer, CatGer, StructuralGer, CombinatorsGer ; diff --git a/src/german/AdjectiveGer.gf b/src/german/AdjectiveGer.gf index 7449740f..540edb3c 100644 --- a/src/german/AdjectiveGer.gf +++ b/src/german/AdjectiveGer.gf @@ -11,7 +11,7 @@ concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in { ext = [] } ; ComparA a np = - let nps = (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ bigNP' np + let nps = np.s ! False ! Nom ++ bigNP' np in { s = \\af => a.s ! Compar ! af ++ conjThan ++ nps ; isPre = True ; @@ -19,7 +19,7 @@ concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in { ext = [] } ; CAdvAP ad ap np = - let nps = (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ bigNP' np in + let nps = np.s ! False ! Nom ++ bigNP' np in ap ** { s = \\af => ad.s ++ ap.s ! af ++ ad.p ++ nps ; isPre = False diff --git a/src/german/AdverbGer.gf b/src/german/AdverbGer.gf index 253427aa..7f6310b9 100644 --- a/src/german/AdverbGer.gf +++ b/src/german/AdverbGer.gf @@ -4,7 +4,7 @@ concrete AdverbGer of Adverb' = CatGer ** open ResGer, Prelude in { PositAdvAdj a = {s = a.s ! Posit ! APred} ; ComparAdvAdj cadv a np = - let nps = (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ bigNP' np in + let nps = np.s ! False ! Nom ++ bigNP' np in { s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ nps } ; diff --git a/src/german/AllGer.gf b/src/german/AllGer.gf index dd57eec3..3788cab2 100644 --- a/src/german/AllGer.gf +++ b/src/german/AllGer.gf @@ -1,10 +1,9 @@ --# -path=.:../abstract:../common:../api:../prelude -concrete AllGer of AllGerAbs = +concrete AllGer of AllGerAbs' = LangGer, IrregGer, ---- ExtendGer, ---- to replace ExtraGer ExtraGer - ** - open ExtendGer in ---- to force compilation - {} ; + -- ** open ExtendGer in {} ---- to force compilation HL 7/22 todo: ListNP' in ExtendGer + ; diff --git a/src/german/CatGer.gf b/src/german/CatGer.gf index d282a83c..76feb458 100644 --- a/src/german/CatGer.gf +++ b/src/german/CatGer.gf @@ -58,8 +58,9 @@ concrete CatGer of Cat' = adv : Str ; -- Haus [adv auf dem Hügel] g : Gender } ; - NP = ResGer.NP ; +-- NP = ResGer.NP ; Pron = {s : NPForm => Str ; a : Agr} ; +{- Det, DAP = {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} ; Quant = { s : Bool => Number => Gender => PCase => Str ; -- Bool is True if a cardinal number is present @@ -72,14 +73,15 @@ concrete CatGer of Cat' = c : {p : Str ; k : PredetCase} ; a : PredetAgr -- if an agr is forced, e.g. jeder von uns ist ... } ; - +-} -- HL: To reduce PCase to Case: NP' = ResGer.NP' ; - Det' = {s,sp : Gender => Case => {quant,num:Str}; n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ; + Det' = {s,sp : Bool => Gender => Case => Str ; -- True if DefArt is dropped + n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ; DAP' = {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ; - Quant' = { - s : Bool => Number => Gender => Case => Str ; -- Bool is True if a cardinal number is present - sp : Bool => Number => Gender => Case => Str ; + Quant' = { -- HL 7/2022: first Bool = True if used to glue in Sg with preposition + s : Bool => Bool => Number => Gender => Case => Str ; -- second Bool is True if a cardinal number is present + sp : Bool => Bool => Number => Gender => Case => Str ; a : Adjf ; aPl : Adjf ; --- to distinguish "meine guten Freunde" / "gute Freunde" hasDefArt : Bool @@ -103,7 +105,7 @@ concrete CatGer of Cat' = Conj = {s1,s2 : Str ; n : Number} ; Subj = {s : Str} ; - Prep = Preposition ; +-- Prep = Preposition ; Prep' = Preposition' ; -- Open lexical classes, e.g. Lexicon @@ -128,29 +130,29 @@ concrete CatGer of Cat' = Tense = {s : Str ; t : ResGer.Tense ; m : Mood} ; linref - NP = \np -> np.s!(NPC Nom) ++ np.ext ++ np.rc ; -- HL 6/2019 - NP' = \np -> (np.s!Nom).p1 ++ (np.s!Nom).p2 ++ np.ext ++ np.rc ; -- HL 7/2022 +-- NP = \np -> np.s!(NPC Nom) ++ np.ext ++ np.rc ; -- HL 6/2019 + NP' = \np -> np.s ! False ! Nom ++ np.ext ++ np.rc ; -- HL 7/2022 Bool added CN = \cn -> cn.s ! Strong ! Pl ! Nom ++ cn.adv ++ cn.ext ++ cn.rc ! Pl ; - SSlash = \ss -> ss.s ! Main ++ ss.c2.s ; - ClSlash = \cls -> cls.s ! MIndic ! Pres ! Simul ! Pos ! Main ++ cls.c2.s ; + SSlash = \ss -> ss.s ! Main ++ ss.c2.s ! GPl ; + ClSlash = \cls -> cls.s ! MIndic ! Pres ! Simul ! Pos ! Main ++ cls.c2.s ! GPl ; VP = \vp -> useInfVP False vp ; - VPSlash = \vps -> useInfVP False vps ++ vps.c2.s ++ vps.ext; + VPSlash = \vps -> useInfVP False vps ++ vps.c2.s ! GPl ++ vps.ext; - AP = \ap -> ap.c.p1 ++ ap.s ! APred ++ ap.c.p2 ++ ap.ext ; - A2 = \a2 -> a2.s ! Posit ! APred ++ a2.c2.s ; + AP = \ap -> ap.c.p1 ++ ap.s ! APred ++ ap.c.p2 ++ ap.ext ; + A2 = \a2 -> a2.s ! Posit ! APred ++ a2.c2.s ! GPl ; V, VS, VQ, VA = \v -> useInfVP False (predV v) ; - V2, V2A, V2Q, V2S = \v -> useInfVP False (predV v) ++ v.c2.s ; - V3 = \v -> useInfVP False (predV v) ++ v.c2.s ++ v.c3.s ; + V2, V2A, V2Q, V2S = \v -> useInfVP False (predV v) ++ v.c2.s ! GPl ; + V3 = \v -> useInfVP False (predV v) ++ v.c2.s ! GPl ++ v.c3.s ! GPl; VV = \v -> useInfVP v.isAux (predVGen v.isAux v) ; - V2V = \v -> useInfVP v.isAux (predVGen v.isAux v) ++ v.c2.s ; + V2V = \v -> useInfVP v.isAux (predVGen v.isAux v) ++ v.c2.s ! GPl ; Conj = \c -> c.s1 ++ c.s2 ; - Det' = \det -> (det.s ! Masc ! Nom).quant ++ (det.s ! Masc ! Nom).num ; - Prep' = \prep -> case prep.isPrep of {PrepDefArf => prep.sg ! Masc ; - _ => prep.s ++ prep.s2 } ; + Det' = \det -> det.s ! False ! Masc ! Nom ; + Prep' = \prep -> case prep.isPrep of {isPrepDefArt => prep.s ! GSg Masc ; + _ => prep.s ! GPl } ; } diff --git a/src/german/ConjunctionGer.gf b/src/german/ConjunctionGer.gf index 5b16cb2b..82633718 100644 --- a/src/german/ConjunctionGer.gf +++ b/src/german/ConjunctionGer.gf @@ -9,9 +9,11 @@ concrete ConjunctionGer of Conjunction' = ConjAdv conj ss = conjunctDistrSS conj ss ; - ConjNP conj ss = heavyNP' (conjunctDistrTable Case conj ss ** { + -- ConjNP : Conj -> ListNP' -> NP' ; -- she or we + + ConjNP conj ss = { s = \\_ => (conjunctDistrTable Case conj { s1 = ss.s1 ; s2 = ss.s2 }).s } ** { a = Ag Fem (conjNumber conj.n (numberAgr ss.a)) (personAgr ss.a) ; - }) ; + w = WHeavy' ; ext,rc = [] } ; ConjAP conj ss = conjunctDistrTable AForm conj ss ** { isPre = ss.isPre ; c = ss.c ; ext = ss.ext} ; @@ -38,12 +40,12 @@ concrete ConjunctionGer of Conjunction' = BaseAdv = twoSS ; ConsAdv = consrSS comma ; - BaseNP x y = { - s1 = \\c => (x.s ! c).p1 ++ (x.s ! c).p2 ++ bigNP x ; - s2 = \\c => y.s ! c ++ bigNP y ; + BaseNP' x y = { + s1 = \\c => x.s ! False ! c ++ bigNP' x ; + s2 = \\c => y.s ! False ! c ++ bigNP' y ; a = conjAgr x.a y.a } ; - ConsNP xs x = { - s1 = \\c => (x.s ! c).p1 ++ (x.s ! c).p2 ++ bigNP xs ++ comma ++ x.s1 ! c ; + ConsNP' xs x = { + s1 = \\c => xs.s ! False ! c ++ bigNP' xs ++ comma ++ x.s1 ! c ; s2 = x.s2 ; a = conjAgr xs.a x.a } ; BaseAP x y = { @@ -75,7 +77,8 @@ concrete ConjunctionGer of Conjunction' = lincat [S] = {s1,s2 : Order => Str} ; [Adv] = {s1,s2 : Str} ; - [NP] = {s1,s2 : PCase => Str ; a : Agr} ; +-- [NP] = {s1,s2 : PCase => Str ; a : Agr} ; + [NP'] = {s1,s2 : Case => Str ; a : Agr} ; [AP] = {s1,s2 : AForm => Str ; isPre : Bool; c : Str * Str ; ext : Str} ; [RS] = {s1,s2 : RelGenNum => Str ; c : Case} ; [CN] = {s1,s2 : Adjf => Number => Case => Str ; g : Gender} ; diff --git a/src/german/ConstructionGer.gf b/src/german/ConstructionGer.gf index 27f53f62..72bdf606 100644 --- a/src/german/ConstructionGer.gf +++ b/src/german/ConstructionGer.gf @@ -1,7 +1,7 @@ --# -path=.:../abstract -concrete ConstructionGer of Construction = CatGer ** - open SyntaxGer, SymbolicGer, ParadigmsGer, +concrete ConstructionGer of Construction' = CatGer ** + open SyntaxGer, SymbolicGer, ParadigmsGer, (L = LexiconGer), (E = ExtraGer), (G = GrammarGer), (I = IrregGer), (R = ResGer), (N = NounGer), Prelude in { flags coding=utf8 ; diff --git a/src/german/ExtraGer.gf b/src/german/ExtraGer.gf index df1906d0..7bdfe46d 100644 --- a/src/german/ExtraGer.gf +++ b/src/german/ExtraGer.gf @@ -1,4 +1,4 @@ -concrete ExtraGer of ExtraGerAbs = CatGer ** +concrete ExtraGer of ExtraGerAbs' = CatGer ** open ResGer, Coordination, Prelude, IrregGer, (P = ParadigmsGer) in { flags coding=utf8 ; @@ -34,30 +34,27 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** IAdvAdv adv = {s = "wie" ++ adv.s} ; DetNPMasc det = { - s = \\c => det.sp ! Masc ! c ; ---- genders - a = agrP3 det.n ; - w = WLight ; + s = \\b,c => det.sp ! b ! Masc ! c ; + a = agrgP3 Masc det.n ; + w = case det.isDef of { True => WLight' ; _ => WHeavy' } ; ext, rc = [] } ; DetNPFem det = { - s = \\c => det.sp ! Fem ! c ; ---- genders - a = agrP3 det.n ; - w = WLight ; + s = \\b,c => det.sp ! b ! Fem ! c ; + a = agrgP3 Fem det.n ; + w = case det.isDef of { True => WLight' ; _ => WHeavy' } ; ext, rc = [] } ; EmptyRelSlash slash = { s = \\m,t,a,p,gn => - appPrep slash.c2 (\\k => usePrepC k (\c -> relPron ! gn ! c)) ++ - slash.s ! m ! t ! a ! p ! Sub ; - c = (prepC slash.c2.c).c + appPrep' slash.c2 (relPron ! gn) ++ slash.s ! m ! t ! a ! p ! Sub ; + c = slash.c2.c } ; PassVPSlash vp = - let c = case of { - => NPC Nom ; - _ => vp.c2.c} + let c = case of { => Nom ; _ => vp.c2.c} in insertObj (\\_ => (PastPartAP vp).s ! APred) (predV werdenPass) ** { c1 = vp.c2 ** {c = c}} ; -- regulates passivised object: accusative objects -> nom; all others: same case @@ -70,7 +67,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** Pass3V3 v = -- HL 7/19 let bekommenPass : Verb = P.habenV (P.irregV "bekommen" "bekommt" "bekam" "bekäme" "bekommen") in insertObj (\\_ => (v.s ! VPastPart APred)) (predV bekommenPass) ** - { c1 = PrepNom ; c2 = v.c2 ; objCtrl = False } ; + { c1 = PrepNom' ; c2 = v.c2 ; objCtrl = False } ; PastPartAP vp = let a = agrP3 Sg in { @@ -83,11 +80,11 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** PastPartAgentAP vp np = let a = agrP3 Sg ; - agent = appPrepNP P.von_Prep np + agent = appPrepNP' P.von_Prep np in { s = \\af => (vp.nn ! a).p1 ++ (vp.nn ! a).p2 ++ (vp.nn ! a).p3 ++ vp.a2 ++ agent ++ vp.inf.inpl.p2 - ++ vp.c2.s -- junk if not TV + ++ vp.c2.s ! GPl -- junk if not TV ++ vp.ext ++ (vp.inf.extr ! a) ++ vp.s.s ! VPastPart af ; isPre = True ; c = <[],[]> ; @@ -104,7 +101,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** PredVPS np vpi = let - subj = np.s ! NPC Nom ++ bigNP np ; + subj = np.s ! False ! Nom ++ bigNP' np ; agr = np.a ; in { s = \\o => @@ -178,8 +175,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** RNP = {s : Agr => Case => Str} ; lin ReflRNP vps rnp = - insertObj (\\a => appPrep vps.c2 - (\\k => usePrepC k (\c -> rnp.s ! a ! c))) vps ; + insertObj (\\a => appPrep' vps.c2 (rnp.s ! a)) vps ; ReflPoss num cn = {s = \\a,c => num.s ! cn.g ! c ++ possPron a num.n cn.g c ++ cn.s ! adjfCase Strong c ! num.n ! c} ; @@ -206,7 +202,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** lin FocObj np cl = - let n = appPrepNP cl.c2 np in mkFoc n cl ; + let n = appPrepNP' cl.c2 np in mkFoc n cl ; FocAdv adv cl = mkFoc adv.s cl ; @@ -218,7 +214,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** -- "treu ist sie ihm" -- "froh ist sie dass er da ist" -- "stolz ist sie auf ihn" - subj = mkSubj np vp.c1 ; + subj = mkSubj' np vp.c1 ; cl = mkClause subj.p1 subj.p2 vp in mkFoc adj cl ; @@ -243,7 +239,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** -- "es wird gelacht"; generating formal sentences lincat - FClause = ResGer.VP ** {subj : ResGer.NP} ; + FClause = ResGer.VP ** {subj : ResGer.NP'} ; lin VPass v = @@ -254,7 +250,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** AdvFor adv fcl = fcl ** {a2 = adv.s} ; FtoCl cl = - let subj = mkSubj cl.subj cl.c1 + let subj = mkSubj' cl.subj cl.c1 in DisToCl subj.p1 subj.p2 cl ; @@ -263,11 +259,11 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** mkFoc : Str -> Cl -> Foc = \focus, cl -> lin Foc {s = \\m,t,a,p => focus ++ cl.s ! m ! t ! a ! p ! Inv} ; - esSubj : CatGer.NP = lin NP { - s = \\_ => "es" ; + esSubj : CatGer.NP' = lin NP' { + s = \\_,_ => "es" ; rc, ext = [] ; a = Ag Neutr Sg P3 ; - w = WPron + w = WPron' } ; DisToCl : Str -> Agr -> FClause -> Clause = \subj,agr,vp -> diff --git a/src/german/GrammarGer.gf b/src/german/GrammarGer.gf index 84db9a03..1c0ed02a 100644 --- a/src/german/GrammarGer.gf +++ b/src/german/GrammarGer.gf @@ -13,7 +13,7 @@ concrete GrammarGer of Grammar' = PhraseGer, TextX - [Tense,Temp], IdiomGer, - StructuralGer, + StructuralGer - [part_Prep,possess_Prep], -- use PartNP, PossNP instead TenseGer ** { diff --git a/src/german/IdiomGer.gf b/src/german/IdiomGer.gf index 7a6090af..4f69772f 100644 --- a/src/german/IdiomGer.gf +++ b/src/german/IdiomGer.gf @@ -8,26 +8,24 @@ concrete IdiomGer of Idiom' = CatGer ** ImpersCl vp = mkClause "es" (agrP3 Sg) vp ; GenericCl vp = mkClause "man" (agrP3 Sg) vp ; - CleftNP np rs = mkClause "es" (agrP3 Sg) + CleftNP np rs = mkClause "es" (agrP3 Sg) (insertExtrapos (rs.s ! RGenNum (gennum (genderAgr np.a) (numberAgr np.a))) ---- --- (insertObj (\\_ => np.s ! NPC rs.c ++ bigNP np) (predV MorphoGer.sein_V))) ; - (insertObj (\\_ => (np.s ! rs.c).p1 ++ (np.s ! rs.c).p2 ++ bigNP' np) (predV MorphoGer.sein_V))) ; --HL + (insertObj (\\_ => (np.s ! False ! rs.c ++ bigNP' np)) (predV MorphoGer.sein_V))) ; --HL - CleftAdv ad s = mkClause "es" (agrP3 Sg) + CleftAdv ad s = mkClause "es" (agrP3 Sg) (insertExtrapos (conjThat ++ s.s ! Sub) (insertObj (\\_ => ad.s) (predV MorphoGer.sein_V))) ; ExistNP np = - mkClause "es" (agrP3 Sg) - (insertObj (\\_ => appPrep2' geben.c2 np.s ++ bigNP' np) + mkClause "es" (agrP3 Sg) + (insertObj (\\_ => appPrep' geben.c2 (np.s ! False) ++ bigNP' np) (predV geben)) ; ExistIP ip = { - s = \\m,t,a,p => - let - cls = - (mkClause "es" (agrP3 Sg) (predV geben)).s ! m ! t ! a ! p ; + s = \\m,t,a,p => + let + cls = (mkClause "es" (agrP3 Sg) (predV geben)).s ! m ! t ! a ! p ; who = ip.s ! Acc in table { QDir => who ++ cls ! Inv ; @@ -38,7 +36,7 @@ concrete IdiomGer of Idiom' = CatGer ** ExistNPAdv np adv= mkClause "es" (agrP3 Sg) -- (insertAdv adv.s (insertObj (\\_ => appPrep geben.c2 np.s ++ bigNP np) - (insertAdv adv.s (insertObj (\\_ => appPrep2' geben.c2 np.s ++ bigNP' np) + (insertAdv adv.s (insertObj (\\_ => appPrep' geben.c2 (np.s ! False) ++ bigNP' np) (predV geben))) ; ExistIPAdv ip adv = { @@ -68,7 +66,7 @@ concrete IdiomGer of Idiom' = CatGer ** SelfAdvVP vp = insertAdv "selbst" vp ; SelfAdVVP vp = insertAdv "selbst" vp ; SelfNP np = np ** { - s = \\c => <(np.s ! c).p1, (np.s ! c).p2 ++ "selbst" ++ bigNP' np> ; + s = \\_,c => np.s ! False ! c ++ "selbst" ++ bigNP' np ; isPron = False ; } ; diff --git a/src/german/LangGer.gf b/src/german/LangGer.gf index 7a44c4ed..2fc7921c 100644 --- a/src/german/LangGer.gf +++ b/src/german/LangGer.gf @@ -5,7 +5,7 @@ concrete LangGer of Lang' = LexiconGer -- ,ConstructionGer -- ,DocumentationGer --# notpresent - ,MarkupGer - [stringMark] +-- ,MarkupGer - [stringMark] ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/german/LexiconGer.gf b/src/german/LexiconGer.gf index 7499b5cc..7d168480 100644 --- a/src/german/LexiconGer.gf +++ b/src/german/LexiconGer.gf @@ -214,7 +214,8 @@ lin university_N = reg2N "Universität" "Universitäten" feminine ; village_N = reg2N "Dorf" "Dörfer" neuter ; -- wait_V2 = prepV2 (regV "warten") (mkPrep "auf" accusative) ; - wait_V2 = prepV2 (regV "warten") (mkPrep "auf" "auf den" "auf die" "aufs" accusative) ; +-- wait_V2 = prepV2 (regV "warten") ((mkPrep "auf" "auf den" "auf die" "aufs" accusative) | (mkPrep "auf" accusative)); + wait_V2 = prepV2 (regV "warten") (mkPrep "auf" "auf den" "auf die" ("aufs" | "auf das") accusative); walk_V = seinV Irreg.gehen_V ; warm_A = mk3A "warm" "wärmer" "wärmste" ; war_N = mkN "Krieg" ; diff --git a/src/german/MakeStructuralGer.gf b/src/german/MakeStructuralGer.gf index 6b2482a0..47460102 100644 --- a/src/german/MakeStructuralGer.gf +++ b/src/german/MakeStructuralGer.gf @@ -5,33 +5,33 @@ resource MakeStructuralGer = open CatGer, (P = ParadigmsGer), MorphoGer, Prelude oper mkConj : Str -> Str -> Number -> Conj = \x,y,n -> {s1 = x ; s2 = y ; n = n ; lock_Conj = <>} ; - mkSubj : Str -> Subj = \x -> + mkSubj : Str -> Subj = \x -> {s = x ; lock_Subj = <>} ; mkIQuant : Str -> IQuant = \s -> {s = \\_,_,_ => s ; lock_IQuant = <>} ; mkPredet = overload { - mkPredet : A -> Predet = \a -> - lin Predet { - s = appAdj a ; - c = noCase ; + mkPredet : A -> Predet' = \a -> + lin Predet' { + s = appAdj' a ; + c = noCase' ; a = PAgNone - } ; - mkPredet : A -> Str -> PCase -> Bool -> Number -> Predet = \a,p,c,b,n -> - lin Predet { - s = appAdj a ; - c = {p = p ; k = PredCase c} ; + } ; + mkPredet : A -> Str -> Case -> Bool -> Number -> Predet' = \a,p,c,b,n -> + lin Predet' { + s = appAdj' a ; + c = {p = p ; k = PredCase' c} ; a = case b of {True => PAg n ; _ => PAgNone} - } + } } ; -- e.g. das selbe - mmkQuant : Quant -> A -> Quant = \q,a -> q ** { - s,sp = \\x,n,g,c => q.s ! x ! n ! g ! c ++ a.s ! Posit ! agrAdj g q.a n ((prepC c).c) + mmkQuant : Quant' -> A -> Quant' = \q,a -> q ** { + s,sp = \\b,x,n,g,c => q.s ! b ! x ! n ! g ! c ++ a.s ! Posit ! agrAdj g q.a n c } ; -- e.g. derjenige - mmbQuant : Quant -> A -> Quant = \q,a -> q ** { - s,sp = \\x,n,g,c => q.s ! x ! n ! g ! c + a.s ! Posit ! agrAdj g q.a n ((prepC c).c) + mmbQuant : Quant' -> A -> Quant' = \q,a -> q ** { + s,sp = \\b,x,n,g,c => q.s ! b ! x ! n ! g ! c + a.s ! Posit ! agrAdj g q.a n c } ; } diff --git a/src/german/MarkupGer.gf b/src/german/MarkupGer.gf index 3aac5cda..79fe7c95 100644 --- a/src/german/MarkupGer.gf +++ b/src/german/MarkupGer.gf @@ -1,11 +1,10 @@ --# -path=.:../abstract:../common -concrete MarkupGer of Markup' = CatGer, MarkHTMLX ** { +concrete MarkupGer of Markup = CatGer, MarkHTMLX ** { lin MarkupCN m cn = cn ** {s = \\a,n,c => appMark m (cn.s ! a ! n ! c)} ; --- other fields e.g ext intact MarkupNP m np = np ** {s = \\c => appMark m (np.s ! c)} ; - MarkupNP' m np = np ** {s = \\c => appMark2 m (np.s ! c)} ; MarkupAP m ap = ap ** {s = \\a => appMark m (ap.s ! a)} ; MarkupAdv m adv = {s = appMark m adv.s} ; MarkupS m s = {s = \\o => appMark m (s.s ! o)} ; @@ -13,8 +12,5 @@ lin MarkupPhr m phr = {s = appMark m phr.s} ; MarkupText m txt = {s = appMark m txt.s} ; -oper - appMark2 : {begin,end : Str} -> Str * Str -> Str * Str - = \m,s -> ; } diff --git a/src/german/MorphoGer.gf b/src/german/MorphoGer.gf index e0c15155..c685de06 100644 --- a/src/german/MorphoGer.gf +++ b/src/german/MorphoGer.gf @@ -18,35 +18,19 @@ oper -- For $StructuralGer$. mkPrep : Str -> Case -> Preposition' = \s,c -> - {s = s ; s2 = [] ; c = c ; sg = \\_ => [] ; isPrep = isPrep} ; + {s = \\_ => s ; s2 = [] ; c = c ; isPrep = isPrep} ; - nameNounPhrase : {s : Case => Str} -> {s : PCase => Str ; a : Agr ; - -- isLight, isPron : Bool ; - w : Weight ; - ext,rc : Str} = \name -> heavyNP { - s = \\c => usePrepC c (\k -> name.s ! k) ; - a = agrP3 Sg - } ; - nameNounPhrase' : Gender -> {s : Case => Str} -> {s : Case => Str * Str; + nameNounPhrase' : Gender -> {s : Case => Str} -> {s : Bool => Case => Str ; a : Agr ; w : Weight' ; ext,rc : Str} = \g,name -> { - s = \\c => <[],name.s ! c> ; + s = \\_,c => name.s ! c ; a = agrgP3 g Sg ; ext,rc = [] ; w = WHeavy' -- ok? } ; - detLikeAdj : Bool -> Number -> Str -> - {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> - {s,sp = appAdj (regA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; - - detUnlikeAdj : Bool -> Number -> Str -> - {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> - {s,sp = appAdj (regDetA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; - - -- HL: to reduce PCase to Case: detLikeAdj' : Bool -> Number -> Str -> {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> {s,sp = appAdj' (regA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index 4e7b91ae..d4190da5 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -7,8 +7,7 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { lin DetCN det cn = { - s = \\c => <(det.s ! cn.g ! c).quant, - (det.s ! cn.g ! c).num ++ cn.s ! (adjfCase det.a c) ! det.n ! c ++ cn.adv> ; + s = \\b,c => det.s ! b ! cn.g ! c ++ cn.s ! (adjfCase det.a c) ! det.n ! c ++ cn.adv ; a = agrgP3 cn.g det.n ; -- isLight = det.isDef ; -- ich sehe den Mann nicht vs. ich sehe nicht einen Mann -- isPron = False ; -- HL 6/2019 (but:) sehe (die|einige) Männer nicht @@ -24,7 +23,7 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { } ; DetNP det = { -- more genders in ExtraGer -- HL: der+er,den+en ; der drei,den drei+en - s = \\c => <(det.sp ! Neutr ! c).quant, (det.sp ! Neutr ! c).num> ; + s = \\b,c => det.sp ! b ! Neutr ! c ; a = agrP3 det.n ; -- isLight = det.isDef ; -- isPron = False ; -- HL 6/2019: don't apply pronoun switch: ich gebe ihr das vs. ich gebe es ihr @@ -33,14 +32,14 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { } ; UsePN pn = { - s = \\c => <[], pn.s ! c> ; + s = \\_,c => pn.s ! c ; a = agrgP3 pn.g Sg ; w = WLight' ; -- means: this is not a heavy NP, but comes before negation rc, ext = [] -- Pron => Light HL 6/2019: to regulate Pron/NonPronNP order } ; UsePron pron = { - s = \\c => <[], pron.s ! NPCase c> ; + s = \\_,c => pron.s ! NPCase c ; a = pron.a ; w = WPron' ; rc, ext = [] @@ -48,28 +47,27 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { PredetNP pred np = let ag = case pred.a of {PAg n => agrP3 n ; _ => np.a} in np ** { - s = \\c0 => + s = \\b,c0 => let c = case pred.c.k of {NoCase' => c0 ; PredCase' k => k} in - ; + pred.s ! numberAgr ag ! genderAgr np.a ! c0 ++ pred.c.p ++ np.s ! b ! c ; a = ag ; - w = WHeavy' + w = WHeavy' } ; PPartNP np v2 = np ** { - s = incr2 np.s (embedInCommas (v2.s ! VPastPart APred)) ; --- invar part + s = \\b,c => np.s ! b ! c ++ (embedInCommas (v2.s ! VPastPart APred)) ; --- invar part w = WHeavy' } ; - {- "eine erfolgreiche Frau, geliebt von vielen," but only with v2 not possible in German? - HL: PPartNP np vps|vp: "der Autor, heute vergessen" , "der Mond, gerade aufgegangen," - -} + -- SS: "eine erfolgreiche Frau, geliebt von vielen," but only with v2 not possible in German? + -- HL: PPartNP np vps|vp: "der Autor, heute vergessen" , "der Mond, gerade aufgegangen," AdvNP np adv = np ** { - s = incr2 np.s adv.s ; + s = \\b,c => np.s ! b ! c ++ adv.s ; w = WHeavy' } ; ExtAdvNP np adv = np ** { - s = incr2 np.s (embedInCommas adv.s) ; + s = \\b,c => np.s ! b ! c ++ (embedInCommas adv.s) ; w = WHeavy' } ; @@ -80,17 +78,17 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { -- But parsing "im warmen Meer" results in a -- PrepNP in_Prep (DetCN (DetQuant ? NumSg) (AdjCN ... )) -- because (DetQuant.s!g!c).quant is ignored, but the .num is part of (np.s!c).p2. - -- To avoid the metavariable ?, we have to make Det.s and NP.s depend on t:PrepType = isPrep. + -- To avoid the metavariable ?, we have to made Det.s and NP.s depend on t:PrepType = isPrep. DetQuantOrd quant num ord = - let -- does not work, since here DefArt is combined with ord - n = num.n ; -- + let + n = num.n ; a = quant.a in { - s = \\g,c => {quant = quant.s ! num.isNum ! n ! g ! c; - num = num.s!g!c ++ ord.s ! agrAdj g (adjfCase a c) n c} ; - sp = \\g,c => {quant = quant.sp ! num.isNum ! n ! g ! c; - num = num.s!g!c ++ ord.s ! agrAdj g (adjfCase quant.aPl c) n c} ; + s = \\b,g,c => quant.s ! b ! num.isNum ! n ! g ! c ++ num.s!g!c ++ + ord.s ! agrAdj g (adjfCase a c) n c ; + sp = \\b,g,c => quant.sp ! b ! num.isNum ! n ! g ! c ++ num.s!g!c ++ + ord.s ! agrAdj g (adjfCase quant.aPl c) n c ; n = n ; a = case n of {Sg => a ; Pl => quant.aPl} ; isDef = case of { => False ; _ => True} ; @@ -100,10 +98,11 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { DetQuant quant num = let n = num.n ; - a = quant.a + a = quant.a ; + b = andB quant.hasDefArt (case num.n of {Sg => True ; _ => False}) ; in { - s = \\g,c => {quant = quant.s ! num.isNum ! n ! g ! c ; num = num.s!g!c} ; - sp = \\g,c => {quant = quant.sp ! num.isNum ! n ! g ! c ; num = num.s!g!c} ; + s = \\b,g,c => quant.s ! b ! num.isNum ! n ! g ! c ++ num.s ! g ! c ; + sp = \\_,g,c => quant.sp ! False ! num.isNum ! n ! g ! c ++ num.s!g!c ; -- HL: der+er,den+en ; der drei,den drei+en n = n ; a = case n of {Sg => a ; Pl => quant.aPl} ; @@ -112,8 +111,8 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { } ; PossPron p = { - s = \\_,n,g,c => p.s ! NPPoss (gennum g n) c ; - sp = \\_,n,g,c => p.s ! NPPoss (gennum g n) c ; + s = \\_,_,n,g,c => p.s ! NPPoss (gennum g n) c ; + sp = \\_,_,n,g,c => p.s ! NPPoss (gennum g n) c ; a = Strong ; aPl = Weak ; hasDefArt = False ; @@ -137,8 +136,9 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { OrdNumeralSuperl n a = {s = \\af => n.s ! NOrd APred ++ Predef.BIND ++ a.s ! Superl ! af} ; -- drittbeste DefArt = { - s = \\_,n,g,c => artDef ! (gennum g n) ! c ; - sp = \\_,n,g,c => case of { + s = table{True => \\_,n,g,c => [] ; -- defart dropped + False => \\_,n,g,c => artDef ! (gennum g n) ! c} ; + sp = \\_,_,n,g,c => case of { => "denen" ; -- HL 6/2019 => "derer" ; -- HL 6/2019 _ => artDef ! (gennum g n) ! c } ; @@ -146,14 +146,14 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { hasDefArt = True } ; IndefArt = { - s = table { + s = \\_ => table { True => \\_,_,c => [] ; False => table { Sg => \\g,c => "ein" + pronEnding ! GSg g ! c ; Pl => \\_,c => [] } } ; - sp = table { + sp = \\_ => table { True => \\_,_,c => [] ; False => table { Sg => \\g,c => (detUnlikeAdj' False Sg "ein").s ! g ! c ; @@ -165,7 +165,7 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { } ; MassNP cn = { - s = \\c => <[], cn.s ! Strong ! Sg ! c ++ cn.adv> ; + s = \\_,c => cn.s ! Strong ! Sg ! c ++ cn.adv ; a = agrgP3 cn.g Sg ; -- isLight = True ; -- ich trinke Bier nicht vs. ich trinke kein Bier -- isPron = False ; @@ -231,33 +231,36 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { AdvCN cn a = cn ** {adv = cn.adv ++ a.s} ; ApposCN cn np = let g = cn.g in cn ** { - s = \\a,n,c => cn.s ! a ! n ! c ++ (np.s ! c).p1 ++ (np.s ! c).p2 ++ bigNP' np } ; + s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! False ! c ++ bigNP' np } ; -- PossNP cn np = cn ** { -- s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! NPP CVonDat ++ bigNP np } ; PossNP cn np = cn ** { - s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep2' vonDat' np.s ++ bigNP' np } ; -- HL, ad hoc + s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep' vonDat' (np.s ! False) ++ bigNP' np } ; -- HL, ad hoc - -- PartNP cn np = todo -- glass of wine + PartNP cn np = case np.w of { + WPron' => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep' vonDat' (np.s ! False) ++ np.rc} ; + _ => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! False ! Gen} -- HL 7/2022, ad hoc + }; -- glass of wine - CountNP det np = -- drei der Kinder | drei von den Kindern -- HL 7/22, ad-hoc + CountNP det np = -- drei der Kinder | drei von den Kindern -- HL 7/22, ad-hoc TODO -- det or numeral? np or rather (DefArt +) cn? drei (einiger Kinder) ? let g = genderAgr np.a in { - s = \\c => det.s ! g ! c ++ np.s ! NPP CVonDat ++ bigNP np ; + s = \\b,c => det.s ! b ! g ! c ++ appPrepNP' vonDat' np ++ bigNP' np ; a = agrgP3 g det.n ; - w = case det.isDef of { True => WLight ; _ => WHeavy } ; + w = case det.isDef of { True => WLight' ; _ => WHeavy' } ; rc = np.rc ; ext = np.ext } ; --- AdjDAP dap adj = ?? TODO -- the large (one) - - DetDAP det = {s = \\g,c => (det.s ! g ! c).quant ++ (det.s ! g ! c).num ; -- HL 7/22 - sp = \\g,c => (det.sp ! g ! c).quant ++ (det.sp ! g ! c).num ; + AdjDAP dap ap = -- the large (one) -- HL 8/22 der auf dich stolze; die ihm treue; der so dumme, infzu + {s, sp = \\g,c => dap.s ! g ! c ++ ap.c.p1 ++ ap.c.p2 ++ ap.s ! (AMod (gennum g dap.n) c) ++ ap.ext ; + a = dap.a ; n = dap.n ; isDef = dap.isDef ; hasDefArt = dap.hasDefArt } ; + + DetDAP det = {s = \\g,c => det.s ! False ! g ! c ; -- HL 7/22 todo: check + sp = \\g,c => det.sp ! False ! g ! c ; n = det.n ; a = det.a ; isDef = det.isDef ; hasDefArt = det.hasDefArt} ; - oper - incr2 : (Case => Str * Str) -> Str -> (Case => Str * Str) = \tab,str -> - \\c => <(tab ! c).p1, (tab ! c).p2 ++ str> ; + } diff --git a/src/german/ParadigmsGer.gf b/src/german/ParadigmsGer.gf index 1dd08c1a..70b920ce 100644 --- a/src/german/ParadigmsGer.gf +++ b/src/german/ParadigmsGer.gf @@ -188,6 +188,7 @@ mkN : overload { -- for preposition glued with DefArt in singular: -- e.g. "auf" "auf den" "auf die" "aufs" + accusative mkPrep : Str -> Str -> Str -> Str-> Case -> Prep' ; + mkPrep : Case -> Prep' ; -- convert case to preposition } ; -- Often just a case with the empty string is enough. @@ -501,31 +502,30 @@ mkV2 : overload { mkAdv s = {s = s ; lock_Adv = <>} ; mkPrep = overload { - mkPrep : Str -> Case -> Prep' = \s,c -> {s = s ; s2 = [] ; sg = \\_ => [] ; - c = c ; isPrep = isPrep ; lock_Prep' = <>} ; - mkPrep : Case -> Str -> Prep' = \c,s -> {s = [] ; s2 = s ; sg = \\_ => [] ; - c = c ; isPrep = isPrep ; lock_Prep' = <>} ; - mkPrep : Str -> Case -> Str -> Prep' = \s,c,t -> {s = s ; s2 = t ; sg = \\_ => [] ; - c = c ; isPrep = isPrep ; lock_Prep' = <>} ; + mkPrep : Str -> Case -> Prep' = \s,c -> + {s = \\_ => s ; s2 = [] ; c = c ; isPrep = isPrep ; lock_Prep' = <>} ; + mkPrep : Case -> Str -> Prep' = \c,s -> + {s = \\_ => [] ; s2 = s ; c = c ; isPrep = isPrep ; lock_Prep' = <>} ; + mkPrep : Str -> Case -> Str -> Prep' = \s,c,t -> + {s = \\_ => s ; s2 = t ; c = c ; isPrep = isPrep ; lock_Prep' = <>} ; mkPrep : Str -> Str -> Str -> Str-> Case -> Prep' = \s,masc,fem,neutr, c -> - {s = s ; s2 = [] ; sg = table{Masc => masc ; Fem => fem ; Neutr => neutr} ; - c = c ; isPrep = isPrepDefArt ; lock_Prep' = <>} ; + {s = table{GPl => s ; GSg Masc => masc ; GSg Fem => fem ; GSg Neutr => neutr} ; + s2 = [] ; c = c ; isPrep = isPrepDefArt ; lock_Prep' = <>} ; + mkPrep : Case -> Prep' = \c -> + {s = \\_ => [] ; s2 = [] ; c = c ; isPrep = isCase ; lock_Prep' = <>} ; } ; - accPrep = {s,s2 = [] ; sg = \\_ => [] ; c = accusative ; isPrep = isCase ; lock_Prep' = <>} ; - datPrep = {s,s2 = [] ; sg = \\_ => [] ; c = dative ; isPrep = isCase ; lock_Prep' = <>} ; - genPrep = {s,s2 = [] ; sg = \\_ => [] ; c = genitive ; isPrep = isCase ; lock_Prep' = <>} ; + + accPrep = mkPrep accusative ; + datPrep = mkPrep dative ; + genPrep = mkPrep genitive ; --von_Prep = mkPrep "von" dative ; - von_Prep = {s = "von"; s2=[]; sg = table{ Masc|Neutr => "vom" ; Fem => "von der" } ; - c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ; - zu_Prep = {s = "zu"; s2=[]; sg = table{ Masc|Neutr => "zum" ; Fem => "zur" } ; - c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ; - anDat_Prep = {s = "an"; s2=[]; sg = table{ Masc|Neutr => "am" ; Fem => "an der" } ; - c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ; - inDat_Prep = {s = "in"; s2=[]; sg = table{ Masc|Neutr => "im" ; Fem => "in der" } ; - c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ; - inAcc_Prep = {s = "in"; s2=[]; sg = table{ Masc => "in den" ; Fem => "in die" ; Neutr => "ins" } ; - c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ; + von_Prep = mkPrep "von" "vom" "von der" "vom" dative ; + zu_Prep = mkPrep "zu" "zum" "zur" "zum" dative ; + inDat_Prep = mkPrep "in" "im" "in der" "im" dative ; + inAcc_Prep = mkPrep "in" "in den" "in die" "ins" accusative ; + anDat_Prep = mkPrep "an" "am" "an der" "am" dative ; + anAcc_Prep = mkPrep "an" "an den" "an die" "ans" accusative ; mk6V geben gibt gib gab gaebe gegeben = let @@ -594,7 +594,7 @@ mkV2 : overload { = \v,c,d -> lin V3 (v ** {c2 = c ; c3 = d}) ; } ; - dirV3 v p = mkV3 v accPrep p ; -- accPrep sets isPrep=False + dirV3 v p = mkV3 v accPrep p ; accdatV3 v = mkV3 v datPrep accPrep ; -- to fit to Eng ditransitives (no preposition): -- give sb(indir) sth(dir) = geben jmdm(dat) etwas(acc) mkVS v = v ** {lock_VS = <>} ; @@ -723,8 +723,7 @@ mkV2 : overload { mkV2 : Str -> V2 = \s -> dirV2 (regV s) ; mkV2 : V -> V2 = dirV2 ; mkV2 : V -> Prep' -> V2 = prepV2; - mkV2 : V -> Case -> V2 = \v,c -> - prepV2 v (lin Prep' {s,s2 = [] ; sg = \\_ => [] ; c = c ; isPrep = isCase}) ; + mkV2 : V -> Case -> V2 = \v,c -> prepV2 v (mkPrep c) ; } ; } diff --git a/src/german/PhraseGer.gf b/src/german/PhraseGer.gf index 46442bd5..8a0512c3 100644 --- a/src/german/PhraseGer.gf +++ b/src/german/PhraseGer.gf @@ -14,7 +14,7 @@ concrete PhraseGer of Phrase' = CatGer ** open Prelude, ResGer in { UttIP ip = {s = ip.s ! Nom} ; --- Acc also UttIAdv iadv = iadv ; - UttNP np = {s = (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ bigNP' np} ; + UttNP np = {s = np.s ! False ! Nom ++ bigNP' np} ; UttVP vp = {s = useInfVP True vp} ; -- without zu UttAdv adv = adv ; UttCN n = {s = n.s ! Strong ! Sg ! Nom ++ n.adv ++ n.ext ++ n.rc ! Sg} ; @@ -26,6 +26,6 @@ concrete PhraseGer of Phrase' = CatGer ** open Prelude, ResGer in { PConjConj conj = ss (conj.s2) ; NoVoc = {s = []} ; - VocNP np = {s = "," ++ (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ bigNP' np} ; + VocNP np = {s = "," ++ np.s ! False ! Nom ++ bigNP' np} ; } diff --git a/src/german/QuestionGer.gf b/src/german/QuestionGer.gf index 4edf7887..86b7bf7c 100644 --- a/src/german/QuestionGer.gf +++ b/src/german/QuestionGer.gf @@ -61,7 +61,7 @@ concrete QuestionGer of Question' = CatGer ** open ResGer in { } ; PrepIP p ip = { - s = appPrep p (\\k => usePrepC k (\c -> ip.s ! c)) ; + s = appPrep' p ip.s ; } ; AdvIP ip adv = { diff --git a/src/german/RelativeGer.gf b/src/german/RelativeGer.gf index b0643c45..a992e769 100644 --- a/src/german/RelativeGer.gf +++ b/src/german/RelativeGer.gf @@ -1,4 +1,4 @@ -concrete RelativeGer of Relative' = CatGer ** open ResGer in { +concrete RelativeGer of Relative' = CatGer ** open Prelude, ResGer in { flags optimize=all_subs ; @@ -37,7 +37,7 @@ concrete RelativeGer of Relative' = CatGer ** open ResGer in { FunRP p np rp = { -- s = \\gn,c => np.s ! NPC c ++ appPrep p (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ; - s = \\gn,c => (np.s ! c).p1 ++ (np.s !c).p2 ++ appPrep' p (rp.s ! gn) ; + s = \\gn,c => np.s ! False ! c ++ appPrep' p (rp.s ! gn) ; a = RAg (numberAgr np.a) (personAgr np.a) } ; diff --git a/src/german/ResGer.gf b/src/german/ResGer.gf index 5b115c8d..d9ac934c 100644 --- a/src/german/ResGer.gf +++ b/src/german/ResGer.gf @@ -39,27 +39,6 @@ resource ResGer = ParamX ** open Prelude in { Agr = Ag Gender Number Person ; --- Case of $NP$ extended to deal with contractions like "zur", "im". - - PCase = NPC Case | NPP CPrep ; - CPrep = CAnDat | CInAcc | CInDat | CZuDat | CVonDat ; - - oper - NPNom : PCase = NPC Nom ; - PrepNom : Preposition = {s,s2 = "" ; isPrep = False ; c = NPNom} ; - prepC : PCase -> {s : Str ; c : Case} = \cp -> case cp of { - NPC c => {s = [] ; c = c} ; - NPP CAnDat => {s = "an" ; c = Dat} ; - NPP CInAcc => {s = "in" ; c = Acc} ; - NPP CInDat => {s = "in" ; c = Dat} ; - NPP CZuDat => {s = "zu" ; c = Dat} ; - NPP CVonDat => {s = "von" ; c = Dat} - - } ; - - usePrepC : PCase -> (Case -> Str) -> Str = \c,fs -> - let sc = prepC c in sc.s ++ fs sc.c ; - oper mkAgr : {g : Gender ; n : Number ; p : Person} -> Agr = \r -> Ag r.g r.n r.p ; @@ -73,35 +52,22 @@ resource ResGer = ParamX ** open Prelude in { param NPForm = NPCase Case | NPPoss GenNum Case ; -- Predeterminers sometimes require a case ("ausser mir"), sometimes not ("nur ich"). --- A number is sometimes inherited ("alle Menschen"), --- sometimes forced ("jeder von den Menschen"). - - param - PredetCase = NoCase | PredCase PCase ; - PredetAgr = PAg Number | PAgNone ; - oper - noCase : {p : Str ; k : PredetCase} = {p = [] ; k = NoCase} ; +-- A number is sometimes inherited ("alle Menschen"), sometimes forced ("jeder von +-- den Menschen"). param PredetCase' = NoCase' | PredCase' Case ; --- PredetAgr = PAg Number | PAgNone ; + PredetAgr = PAg Number | PAgNone ; + oper noCase' : {p : Str ; k : PredetCase'} = {p = [] ; k = NoCase'} ; -- Pronominal nps are ordered differently, and light nps come before negation in clauses. -- (To save space, reduce isPron * isLight = 4 values to the following three.) HL 9/19 - param - Weight = WPron | WLight | WHeavy ; - oper - isPron : {w : Weight} -> Bool = \np -> - case np.w of {WPron => True ; _ => False} ; - isLight : {w : Weight} -> Bool = \np -> - case np.w of {WHeavy => False ; _ => True} ; - -- To reduce c:PCase to c:Case in Preposition' and NP.s:PCase => Str to NP'.s:Case => Str*Str: param - Weight' = WPron' | WLight' | WHeavy' | WDefArt ; - oper + Weight' = WPron' | WLight' | WHeavy' | WDefArt ; -- HL: may need WIndefArt for nicht+ein => kein + oper -- to handle clause negation properly isPron' : {w : Weight'} -> Bool = \np -> case np.w of {WPron' => True ; _ => False} ; isLight' : {w : Weight'} -> Bool = \np -> @@ -262,22 +228,12 @@ resource ResGer = ParamX ** open Prelude in { g : Gender } ; - NP : Type = { - s : PCase => Str ; - rc : Str ; -- die Frage , [rc die ich gestellt habe] - ext : Str ; -- die Frage , [sc wo sie schläft] ; die Regel , [vp kein Fleisch zu essen] | [s dass ...] - -- adv : Str ; -- die Frage [a von Max] -- HL: cannot be extracted - a : Agr ; - -- isLight : Bool ; -- light NPs come before negation in simple clauses (expensive) - -- isPron : Bool ; -- needed to put accPron before datPron - w : Weight } ; - - NP' : Type = { - s : Case => Str * Str ; + NP' : Type = { -- HL 7/22: Bool = True if DefArt is dropped to combine with prep of type isPrepDefArt + s : Bool => Case => Str ; rc : Str ; -- die Frage , [rc die ich gestellt habe] ext : Str ; -- die Frage , [sc wo sie schläft] ; die Regel , [vp kein Fleisch zu essen] | [s dass ...] a : Agr ; - w : Weight' } ; + w : Weight' } ; -- light NPs come before negation in simple clauses mkN : (x1,_,_,_,_,x6,x7 : Str) -> Gender -> Noun = \Mann, Mannen, Manne, Mannes, Maenner, Maennern, Mann_, g -> { @@ -441,94 +397,59 @@ resource ResGer = ParamX ** open Prelude in { legte ("ge" + legt) [] VHaben ; --- Prepositions for complements indicate the complement case. +-- Prepositions are of three types: (i) cases, (ii) pure pre-, post- and circum-positions, +-- and (iii) prepositions glued with definite article in singular (using s!(GSg g)). +-- Prepositions indicate the case of their complement noun phrase. - Preposition : Type = {s : Str ; s2 : Str ; c : PCase ; isPrep : Bool} ; + param + PrepType = isCase | isPrep | isPrepDefArt ; - -- HL 7/19: German has very few circumpositions: um (Gen) Willen, von (Adv) an|ab|aus - -- ? bis (Adv) hin|her. So maybe we should skip s2 (and save readings with empty preps). + oper + Preposition' : Type = {s : GenNum => Str ; s2:Str ; c : Case ; isPrep : PrepType} ; + + isaCase : Preposition' -> Bool = \p -> case p.isPrep of {isCase => True ; _ => False} ; + isaPrep : Preposition' -> Bool = \p -> case p.isPrep of {isPrep => True ; _ => False} ; + isaPrepDefArt : Preposition' -> Bool = \p -> case p.isPrep of {isPrepDefArt => True ; _ => False} ; -- To apply a preposition to a complement. - appPrep : Preposition -> (PCase => Str) -> Str = \prep,arg -> - prep.s ++ arg ! prep.c ++ prep.s2 ; - - appPrepNP : Preposition -> NP -> Str = \prep,np -> - prep.s ++ np.s ! prep.c ++ bigNP np ++ prep.s2 ; - -- revised appPrep for discontinuous NPs - - bigNP : NP -> Str = \np -> np.ext ++ np.rc ; - bigNP' : NP' -> Str = \np -> np.ext ++ np.rc ; - --- To build a preposition from just a case. -- HL 9/19: no longer used in RGL - - noPreposition : Case -> Preposition = \c -> - {s,s2 = [] ; c = NPC c ; isPrep = False} ; - noPreposition' : Case -> Preposition' = \c -> - {s,s2 = [] ; c = c ; isPrep = isCase ; sg = \\_ => []} ; - PrepNom' : Preposition' = {s,s2 = "" ; sg = \\_ => []; isPrep = isCase ; c = Nom} ; - --- New version of Prepositions to reduce c:PCase to c:Case. - - param PrepType = isCase | isPrep | isPrepDefArt ; - oper - Preposition' : Type = {s : Str ; s2 : Str ; sg : Gender => Str; - c : Case ; isPrep : PrepType} ; - appPrep' : Preposition' -> (Case => Str) -> Str = \prep,arg -> - prep.s ++ arg ! prep.c ++ prep.s2 ; -- todo - appPrep2' : Preposition' -> (Case => Str * Str) -> Str = \prep,arg -> - let det : Str = (arg ! prep.c).p1 ; - cn : Str = (arg ! prep.c).p2 ; - in prep.s ++ det ++ cn ++ prep.s2 ; + prep.s ! GPl ++ arg ! prep.c ++ prep.s2 ; appPrepNP' : Preposition' -> NP' -> Str = \prep,np -> - let n = numberAgr np.a ; - g = genderAgr np.a ; - w = np.w ; - det = (np.s ! prep.c).p1 ; - cn = (np.s ! prep.c).p2 ; + let + g = (genderAgr np.a) ; + n = (numberAgr np.a) ; + glues = case of { => True ; _ => False} ; + nps = np.s ! glues ! prep.c in - case prep.isPrep of { - isCase => det ++ cn ++ np.ext ++ np.rc; - isPrep => prep.s ++ det ++ cn ++ prep.s2 ++ np.ext ++ np.rc; - isPrepDefArt => case of { - => -- e.g. "zum Hof|zur Tür|zum Fenster herein" - prep.sg!g ++ cn ++ prep.s2 ++ np.ext ++ np.rc ; - _ => - prep.s ++ det ++ cn ++ prep.s2 ++ np.ext ++ np.rc - } } ; + case of { + => -- e.g. "zum Hof|zur Tür|zum Fenster herein" + prep.s ! (GSg g) ++ nps ++ np.ext ++ prep.s2 ++ np.rc ; + _ => prep.s ! GPl ++ nps ++ np.ext ++ prep.s2 ++ np.rc + } ; - npM' : NP' = {s = table Case {Nom => <"der","Hund">; Acc => <"den","Hund">; - Dat => <"dem","Hund">; Gen => <"des","Hundes">}; - rc = []; ext=[]; a = (Ag Masc Sg P3); w = WDefArt}; - npN' : NP' = {s = table Case {Nom => <"das","Haus">; Acc => <"das","Haus">; - Dat => <"dem","Haus">; Gen => <"des","Hauses">}; - rc = []; ext=[]; a = (Ag Neutr Sg P3); w = WDefArt}; - npInDefM' : NP' = {s = table Case {Nom => <"ein","Hund">; Acc => <"einen","Hund">; - Dat => <"einem","Hund">; Gen => <"eines","Hundes">}; - rc = []; ext=[]; a = (Ag Masc Sg P3); w = WLight'}; - npInDefN' : NP' = {s = table Case {Nom => <"ein","Haus">; Acc => <"ein","Haus">; - Dat => <"einem","Haus">; Gen => <"eines","Hauses">}; - rc = []; ext=[]; a = (Ag Neutr Sg P3); w = WLight'}; -- WHeavy' ? - npF' : NP' = {s = table Case {Nom => <"die","Frau">; Acc => <"die","Frau">; - Dat => <"der","Frau">; Gen => <"der","Frau">}; - rc = []; ext=[]; a = (Ag Fem Sg P3); w = WDefArt}; + bigNP' : NP' -> Str = \np -> np.ext ++ np.rc ; + +-- To build a preposition from just a case. -- HL 9/19: moved to mkPrep in ParadigmsGer - Dat' : Preposition' = {s=""; s2=""; sg = \\c => []; c=Dat; isPrep=isCase} ; - mit' : Preposition' = {s="zusammen mit"; s2=""; sg = \\_ => []; c=Dat; isPrep=isPrep} ; + PrepNom' : Preposition' = {s = \\_ => []; isPrep = isCase ; c = Nom ; s2 = []} ; - vonDat' : Preposition' = {s="von"; s2=""; sg = table{Fem => "von der"; _ => "vom"}; c=Dat; isPrep=isPrep} ; + vonDat' : Preposition' = {s=table{GPl => "von" ; GSg Fem => "von der"; _ => "vom"}; + s2=[]; c=Dat; isPrep=isPrepDefArt} ; + -- for testing: + Dat' : Preposition' = {s = \\_ => []; s2 = []; c=Dat; isPrep=isCase} ; + mit' : Preposition' = {s = \\_ => "zusammen mit"; s2 = []; c=Dat; isPrep=isPrep} ; - zuDat' : Preposition' = {s="zu"; s2="herein"; sg = \\_ => ""; c=Dat; isPrep=isPrep} ; - zum' : Preposition' = {s="zu"; s2="herein"; sg = table{Masc=>"zum"; Fem=>"zur"; Neutr=>"zum"}; - c=Dat; isPrep=isPrepDefArt} ; - inDat' : Preposition' = {s="in"; s2="drin"; sg = \\_ => ""; c=Dat; isPrep=isPrep} ; - im' : Preposition' = {s="in"; s2="drin"; sg = table{Masc=>"im"; Fem=>"in der"; Neutr=>"im"}; - c=Dat; isPrep=isPrepDefArt} ; - inAcc' : Preposition' = {s="in"; s2="hinein"; sg = \\_ => ""; c=Acc; isPrep=isPrep} ; - ins' : Preposition' = {s="in"; s2="hinein"; sg = table{Masc=>"in den"; Fem=>"in die"; Neutr=>"ins"}; - c=Acc; isPrep=isPrepDefArt} ; + zuDat' : Preposition' = {s=\\_ => "zu"; s2="herein"; c=Dat; isPrep=isPrep} ; + zum' : Preposition' = {s= table{GPl => "zu"; GSg Fem =>"zur"; _ => "zum"}; + s2="herein"; c=Dat; isPrep=isPrepDefArt} ; + inDat' : Preposition' = {s= \\_ => "in" ; s2="drin"; c=Dat; isPrep=isPrep} ; + im' : Preposition' = {s= table{GPl => "in"; GSg Fem=>"in der"; _ =>"im"}; + s2="drin"; c=Dat; isPrep=isPrepDefArt} ; + inAcc' : Preposition' = {s=\\_ => "in"; s2="hinein"; c=Acc; isPrep=isPrep} ; + ins' : Preposition' = {s=table{GPl => "in"; GSg Masc=>"in den"; GSg Fem=>"in die"; GSg Neutr=>"ins"}; + s2="hinein"; c=Acc; isPrep=isPrepDefArt} ; -- Pronouns and articles -- Here we define personal and relative pronouns. @@ -565,6 +486,7 @@ resource ResGer = ParamX ** open Prelude in { GPl => caselist "die" "die" "den" "der" } ; +{- -- used in SymbolGer: artDefContr : GenNum -> PCase -> Str = \gn,np -> case np of { NPC c => artDef ! gn ! c ; NPP p => case of { @@ -578,22 +500,10 @@ resource ResGer = ParamX ** open Prelude in { _ => let sp = prepC np in sp.s ++ artDef ! gn ! sp.c } } ; - +-} -- This is used when forming determiners that are like adjectives. - appAdj : Adjective -> Number => Gender => PCase => Str = \adj -> - let - ad : GenNum -> Case -> Str = \gn,c -> - adj.s ! Posit ! AMod gn c - in - \\n,g,c => usePrepC c (\k -> case n of { - Sg => ad (GSg g) k ; - _ => ad GPl k - }) ; - - -- HL: To reduce PCase to Case: todo: check if we can omit the prep-string of a PCase - -- perhaps needed for "am besten"? But the adj is used in Posit only appAdj' : Adjective -> Number => Gender => Case => Str = \adj -> let ad : GenNum -> Case -> Str = \gn,c -> @@ -801,32 +711,6 @@ resource ResGer = ParamX ** open Prelude in { insertObjc : (Agr => Str) -> VPSlash -> VPSlash = \obj,vp -> insertObj obj vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl } ; - insertObjNP : NP -> Preposition -> VPSlash -> VPSlash = \np,prep,vp -> - let c = case prep.c of { NPC cc => cc ; _ => Nom } ; - obj = appPrepNP prep np ; - in vp ** { - nn = \\a => - let vpnn = vp.nn ! a in - -- HL 11/6/19: rough object NP order (expensive): - -- vfin < accPron < refl < (gen|dat)Pron < lightNP < neg < heavyNP|PP < vinf|comp - case of { -- 2 * 3 * 4 = 24 cases - => -- - ; - => -- - ; - => -- - ; - => -- (assuming v.c2=acc) nonPron: dat < acc|gen - -- - ; - => -- - ; - => -- - ; - => -- - } - } ; -- the ordering of objects of v:V3 (and v:V4) is also determined by Slash?V3 (and Slash?V4) - insertObjNP' : NP' -> Preposition' -> VPSlash -> VPSlash = \np,prep,vp -> let c = prep.c ; obj = appPrepNP' prep np ; @@ -846,18 +730,18 @@ resource ResGer = ParamX ** open Prelude in { => -- (assuming v.c2=acc) nonPron: dat < acc|gen -- ; - => -- - ; => -- ; - => -- + -- => -- + -- ; + => -- } } ; -- the ordering of objects of v:V3 (and v:V4) is also determined by Slash?V3 (and Slash?V4) insertObjRefl : VPSlash -> VPSlash = \vp -> -- HL 6/2019, to order reflPron < neg < prep+reflPron let prep = vp.c2 ; -- HL 7/22 reduced to c:Case - obj : Agr => Str = \\a => prep.s ++ reflPron ! a ! prep.c ++ prep.s2 ; + obj : Agr => Str = \\a => prep.s ! GPl ++ reflPron ! a ! prep.c ++ prep.s2 ; in vp ** { nn = \\a => let vpnn = vp.nn ! a in @@ -1099,11 +983,8 @@ resource ResGer = ParamX ** open Prelude in { infPart : Bool -> Str = \b -> if_then_Str b [] "zu" ; - heavyNP : - {s : PCase => Str ; a : Agr} -> {s : PCase => Str ; a : Agr ; w : Weight ; ext,rc : Str} = \np -> - np ** {w = WHeavy ; ext,rc = []} ; -- this could be wrong heavyNP' : - {s : Case => Str ; a : Agr} -> {s : Case => Str ; a : Agr ; w : Weight' ; ext,rc : Str} = \np -> + {s : Bool => Case => Str ; a : Agr} -> {s : Bool => Case => Str ; a : Agr ; w : Weight' ; ext,rc : Str} = \np -> np ** {w = WHeavy' ; ext,rc = []} ; -- this could be wrong relPron : RelGenNum => Case => Str = \\rgn,c => @@ -1120,11 +1001,7 @@ resource ResGer = ParamX ** open Prelude in { } ; -- Function that allows the construction of non-nominative subjects. - mkSubj : NP -> Preposition -> Str * Agr = \np, prep -> - let - agr = case prep.c of { NPC Nom => np.a ; _ => Ag Masc Sg P3 } ; - subj = appPrepNP prep np - in ; + mkSubj' : NP' -> Preposition' -> Str * Agr = \np, prep -> let agr = case prep.c of { Nom => np.a ; _ => Ag Masc Sg P3 } ; diff --git a/src/german/SentenceGer.gf b/src/german/SentenceGer.gf index aeb855c1..9c0aef6a 100644 --- a/src/german/SentenceGer.gf +++ b/src/german/SentenceGer.gf @@ -45,10 +45,9 @@ concrete SentenceGer of Sentence' = CatGer ** open ResGer, Prelude in { SlashPrep cl prep = cl ** {c2 = prep} ; SlashVS np vs slash = - let subj = mkSubj' np PrepNom' - in mkClause subj.p1 subj.p2 - (insertExtrapos (conjThat ++ slash.s ! Sub) (predV vs)) ** - {c2 = slash.c2} ; + let subj = mkSubj' np PrepNom' ; + vp = (insertExtrapos (conjThat ++ slash.s ! Sub) (predV vs)) + in mkClause subj.p1 subj.p2 vp ** {c2 = slash.c2} ; EmbedS s = {s = conjThat ++ s.s ! Sub} ; -- no leading comma, if sentence-initial EmbedQS qs = {s = qs.s ! QIndir} ; diff --git a/src/german/StructuralGer.gf b/src/german/StructuralGer.gf index 128fdbb2..e86fda77 100644 --- a/src/german/StructuralGer.gf +++ b/src/german/StructuralGer.gf @@ -48,7 +48,7 @@ concrete StructuralGer of Structural' = CatGer ** here_Adv = ss "hier" ; how_IAdv = ss "wie" ; how8much_IAdv = ss "wieviel" ; - how8many_IDet = {s = \\g,c => (detUnlikeAdj False Pl "wie viel").s ! g ! NPC c ; n = Pl} ; + how8many_IDet = {s = \\g,c => (detUnlikeAdj' False Pl "wie viel").s ! g ! c ; n = Pl} ; if_Subj = ss "wenn" ; --- no variants in the RGL! | ss "falls" ; in8front_Prep = mkPrep "vor" P.dative ; i_Pron = mkPronPers "ich" "mich" "mir" "meiner" "mein" Masc Sg P1 ; @@ -77,9 +77,9 @@ concrete StructuralGer of Structural' = CatGer ** on_Prep = P.mkPrep "auf" "auf den" "auf die" "aufs" P.accusative ; -- test HL 7/2022 or_Conj = {s1 = [] ; s2 = "oder" ; n = Sg} ; otherwise_PConj = ss "sonst" ; - part_Prep = P.von_Prep ; -- mkPrep "von" P.dative ; + part_Prep = P.von_Prep ; -- obsolete, use PartNP cn np please_Voc = ss "bitte" ; - possess_Prep = P.von_Prep ;-- mkPrep "von" P.dative ; + possess_Prep = P.von_Prep ; -- obsolete, use PossNP cn np quite_Adv = ss "ziemlich" ; she_Pron = mkPronPers "sie" "sie" "ihr" "ihrer" "ihr" Fem Sg P3 ; so_AdA = ss "so" ; @@ -97,7 +97,7 @@ concrete StructuralGer of Structural' = CatGer ** somewhere_Adv = ss "irgendwo" ; that_Quant = let jener : Number => Gender => Case => Str = \\n => (detUnlikeAdj' True n "jen").s in - {s,sp = \\_ => jener ; a,aPl = Weak ; hasDefArt = False} ; + {s,sp = \\_,_ => jener ; a,aPl = Weak ; hasDefArt = False} ; ---b that_NP = nameNounPhrase {s = caselist "das" "das" "denem" "dessen"} ; ---- there_Adv = ss "da" ; --- no variants in the rgl | ss "dort" ; there7to_Adv = ss "dahin" ; @@ -107,7 +107,7 @@ concrete StructuralGer of Structural' = CatGer ** they_Pron = mkPronPers "sie" "sie" "ihnen" "ihrer" "ihr" Fem Pl P3 ; this_Quant = let dieser : Number => Gender => Case => Str = \\n => (detUnlikeAdj' True n "dies").s in - {s,sp = \\_ => dieser ; a,aPl = Weak ; hasDefArt = False} ; + {s,sp = \\_,_ => dieser ; a,aPl = Weak ; hasDefArt = False} ; ---b this_NP = nameNounPhrase {s = caselist "dies" "dies" "diesem" "dieses"} ; ---- ---b those_NP = {s = caselist "jene" "jene" "jenen" "jener" ; a = agrP3 Pl} ; through_Prep = mkPrep "durch" P.accusative ; @@ -148,7 +148,7 @@ concrete StructuralGer of Structural' = CatGer ** Pl => (detUnlikeAdj' False Pl "kein").s } in - {s,sp = \\_ => keiner ; a = Strong ; aPl = Weak ; hasDefArt = False} ; ---- sp + {s,sp = \\_,_ => keiner ; a = Strong ; aPl = Weak ; hasDefArt = False} ; ---- sp if_then_Conj = {s1 = "wenn" ; s2 = "dann" ; n = Sg ; lock_Conj = <>} ; nobody_NP = nameNounPhrase' Masc {s = caselist "niemand" "niemanden" "niemandem" "niemands"} ; @@ -165,8 +165,8 @@ concrete StructuralGer of Structural' = CatGer ** lin language_title_Utt = ss "Deutsch" ; oper - asQuant : (Gender => Case => Str) -> (Gender => Case => {quant,num:Str}) = - \tab -> \\g,c => {quant = tab ! g ! c; num = []} ; + asQuant : (Gender => Case => Str) -> (Bool => Gender => Case => Str) = + \tab -> \\_,g,c => tab ! g ! c ; asNum : (Gender => Case => Str) -> (Gender => Case => {quant,num:Str}) = \tab -> \\g,c => {quant = []; num = tab ! g ! c} ; pairTable : (Gender => Case => Str) -> (Gender => Case => Str) -> (Gender => Case => {quant,num:Str}) diff --git a/src/german/SymbolGer.gf b/src/german/SymbolGer.gf index 190e8e9a..2838f911 100644 --- a/src/german/SymbolGer.gf +++ b/src/german/SymbolGer.gf @@ -26,12 +26,11 @@ lin ext,rc = [] -- added } ; CNNumNP cn i = { - s = \\c => artDefContr (GSg cn.g) c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! (prepC c).c ; +-- s = \\c => artDefContr (GSg cn.g) c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! c ; + s = \\c => artDef (GSg cn.g) c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! c ; a = agrP3 Sg ; - -- isPron = False ; - -- isLight = True ; w = WLight ; - ext,rc = [] -- added + ext,rc = [] } ; SymbS sy = {s = \\_ => sy.s} ; diff --git a/src/german/VerbGer.gf b/src/german/VerbGer.gf index b737badb..ae789227 100644 --- a/src/german/VerbGer.gf +++ b/src/german/VerbGer.gf @@ -94,11 +94,12 @@ concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in { -- SlashV2VNP v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22 -- insertObjNP np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ; -{- + + -- without: 205539 msec -- to save (571098 = 83669 = 487429 msec) compile time (in 58% memory), comment out: - SlashV2VNP' v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22 - insertObjNP' np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ; --} + -- SlashV2VNP v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22 + -- insertObjNP' np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ; + UseComp comp = insertExtrapos comp.ext (insertObj comp.s (predV sein_V)) ; -- agr not used -- adj slot not used here for e.g. "ich bin alt" but same behaviour as NPs? @@ -107,7 +108,7 @@ concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in { UseCopula = predV sein_V ; CompAP ap = {s = \\_ => ap.c.p1 ++ ap.s ! APred ++ ap.c.p2 ; ext = ap.ext} ; - CompNP np = {s = \\_ => (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ np.rc ; ext = np.ext} ; + CompNP np = {s = \\_ => np.s ! False ! Nom ++ np.rc ; ext = np.ext} ; CompAdv a = {s = \\_ => a.s ; ext = []} ; CompCN cn = {s = \\a => case numberAgr a of { From 1cad178ec8707d8f51945078cb42402c37bf5f2d Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Tue, 23 Aug 2022 15:32:17 +0200 Subject: [PATCH 04/16] The glueing of preposition with definite article is now implemented using NP.s : Bool => Case => Str and NP.w = WDefArt np.s ! False : Case => Str is the ordinary paradigm; if the np has a definite article, np.w = WDefArt, and np.s ! True : Case => Str is the paradigm with definite article omitted, if np.a = Ag g Sg p. Prepositions now have type Prep = {s : GenNum => Str ; s2 :Str ; c : Case ; isPrep : PrepType}, and |Prep| = |Case|*|isPrep| = 4 * 3 = 12, independent of |PCase| >= 18. A preposition p with p.isPrep = isPrepDefArt has in p.s ! (GSg g) : Str the preposition glued with definite article of a following np in singular. The modified linearization categories for Prep, NP, Det, DAP, Quant, Predet are no longer Prep', NP' etc., but Prep, NP etc. in CatGer. They are now also used in gf-rgl/tests/german/TestLangGer.gf. The previous auxiliary files abstract/Adjective'.gf etc. are removed. BUT: for complexitiy reasons, - the glueing is omitted in SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash, - SlashVP : NP -> SlashVP -> ClSlash (in SentenceGer and TestLanGer) are commented out. SlashVP causes grammar compilation to crash due to memory limits, probably because mkClause and its modification mkClSlash are too detailed. --- src/abstract/Adjective'.gf | 39 -------- src/abstract/Adverb'.gf | 35 ------- src/abstract/Cat'.gf | 1 - src/abstract/Conjunction'.gf | 82 ---------------- src/abstract/Grammar'.gf | 23 ----- src/abstract/Idiom'.gf | 35 ------- src/abstract/Lang'.gf | 16 ---- src/abstract/Noun'.gf | 158 ------------------------------- src/abstract/NumeralTransfer'.gf | 97 ------------------- src/abstract/Phrase'.gf | 48 ---------- src/abstract/Question'.gf | 55 ----------- src/abstract/Relative'.gf | 26 ----- src/abstract/Sentence'.gf | 107 --------------------- src/abstract/Structural'.gf | 128 ------------------------- src/abstract/Transfer'.gf | 29 ------ src/abstract/Verb'.gf | 84 ---------------- src/api/CombinatorsGer.gf | 6 +- src/api/ConstructorsGer.gf | 2 +- src/api/SyntaxGer.gf | 2 +- src/german/AdjectiveGer.gf | 12 +-- src/german/AdverbGer.gf | 6 +- src/german/AllGer.gf | 2 +- src/german/CatGer.gf | 66 +++++-------- src/german/ConjunctionGer.gf | 23 +++-- src/german/ConstructionGer.gf | 6 +- src/german/ExtraGer.gf | 22 ++--- src/german/GrammarGer.gf | 2 +- src/german/IdiomGer.gf | 13 ++- src/german/LangGer.gf | 2 +- src/german/MakeStructuralGer.gf | 12 +-- src/german/MorphoGer.gf | 2 +- src/german/NounGer.gf | 20 ++-- src/german/ParadigmsGer.gf | 90 +++++++++--------- src/german/PhraseGer.gf | 6 +- src/german/QuestionGer.gf | 9 +- src/german/RelativeGer.gf | 10 +- src/german/ResGer.gf | 83 +++++++++------- src/german/SentenceGer.gf | 12 +-- src/german/StructuralGer.gf | 2 +- src/german/SymbolGer.gf | 15 +-- src/german/VerbGer.gf | 26 ++--- tests/german/TestLangGer.gf | 26 ++--- 42 files changed, 238 insertions(+), 1202 deletions(-) delete mode 100644 src/abstract/Adjective'.gf delete mode 100644 src/abstract/Adverb'.gf delete mode 100644 src/abstract/Cat'.gf delete mode 100644 src/abstract/Conjunction'.gf delete mode 100644 src/abstract/Grammar'.gf delete mode 100644 src/abstract/Idiom'.gf delete mode 100644 src/abstract/Lang'.gf delete mode 100644 src/abstract/Noun'.gf delete mode 100644 src/abstract/NumeralTransfer'.gf delete mode 100644 src/abstract/Phrase'.gf delete mode 100644 src/abstract/Question'.gf delete mode 100644 src/abstract/Relative'.gf delete mode 100644 src/abstract/Sentence'.gf delete mode 100644 src/abstract/Structural'.gf delete mode 100644 src/abstract/Transfer'.gf delete mode 100644 src/abstract/Verb'.gf diff --git a/src/abstract/Adjective'.gf b/src/abstract/Adjective'.gf deleted file mode 100644 index 38eedba0..00000000 --- a/src/abstract/Adjective'.gf +++ /dev/null @@ -1,39 +0,0 @@ ---1 Adjective: Adjectives and Adjectival Phrases - -abstract Adjective' = Cat' ** { - - fun - --- The principal ways of forming an adjectival phrase are --- positive, comparative, relational, reflexive-relational, and --- elliptic-relational. - - 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 -> AP ; -- married - UseComparA : A -> AP ; -- warmer - CAdvAP : CAdv -> AP -> NP' -> AP ; -- as cool as John - --- 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. - - SentAP : AP -> SC -> AP ; -- good that she is here - --- An adjectival phrase can be modified by an *adadjective*, such as "very". - - AdAP : AdA -> AP -> AP ; -- very warm - --- It can also be postmodified by an adverb, typically a prepositional phrase. - - AdvAP : AP -> Adv -> AP ; -- warm by nature - --- The formation of adverbs from adjectives (e.g. "quickly") is covered --- in [Adverb Adverb.html]; the same concerns adadjectives (e.g. "extremely"). - -} diff --git a/src/abstract/Adverb'.gf b/src/abstract/Adverb'.gf deleted file mode 100644 index 99d9c599..00000000 --- a/src/abstract/Adverb'.gf +++ /dev/null @@ -1,35 +0,0 @@ ---1 Adverb: Adverbs and Adverbial Phrases - -abstract Adverb' = Cat' ** { - - fun - --- The two main ways of forming adverbs are from adjectives and by --- prepositions from noun phrases. - - PositAdvAdj : A -> Adv ; -- warmly - PrepNP : Prep' -> NP' -> Adv ; -- in the house - --- Comparative adverbs have a noun phrase or a sentence as object of --- comparison. - - ComparAdvAdj : CAdv -> A -> NP' -> Adv ; -- more warmly than John - ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs - --- Adverbs can be modified by 'adadjectives', just like adjectives. - - AdAdv : AdA -> Adv -> Adv ; -- very quickly - --- Like adverbs, adadjectives can be produced by adjectives. - - PositAdAAdj : A -> AdA ; -- extremely - --- Subordinate clauses can function as adverbs. - - SubjS : Subj -> S -> Adv ; -- when she sleeps - --- Comparison adverbs also work as numeral adverbs. - - AdnCAdv : CAdv -> AdN ; -- less (than five) - -} diff --git a/src/abstract/Cat'.gf b/src/abstract/Cat'.gf deleted file mode 100644 index 18f9f46b..00000000 --- a/src/abstract/Cat'.gf +++ /dev/null @@ -1 +0,0 @@ -abstract Cat' = Cat ** {cat NP'; Det'; Quant'; Predet'; Prep'; DAP' ;} diff --git a/src/abstract/Conjunction'.gf b/src/abstract/Conjunction'.gf deleted file mode 100644 index b15d5d9d..00000000 --- a/src/abstract/Conjunction'.gf +++ /dev/null @@ -1,82 +0,0 @@ ---1 Conjunction: Coordination - --- Coordination is defined for many different categories; here is --- a sample. The rules apply to *lists* of two or more elements, --- and define two general patterns: --- - ordinary conjunction: X,...X and X --- - distributed conjunction: both X,...,X and X --- --- --- $VP$ conjunctions are not covered here, because their applicability --- depends on language. Some special cases are defined in --- [``Extra`` ../abstract/Extra.gf]. - - -abstract Conjunction' = Cat' ** { - ---2 Rules - - fun - ConjS : Conj -> ListS -> S ; -- he walks and she runs - ConjRS : Conj -> ListRS -> RS ; -- who walks and whose mother runs - ConjAP : Conj -> ListAP -> AP ; -- cold and warm - ConjNP : Conj -> ListNP' -> NP' ; -- she or we - ConjAdv : Conj -> ListAdv -> Adv ; -- here or there - ConjAdV : Conj -> ListAdV -> AdV ; -- always or sometimes - ConjIAdv : Conj -> ListIAdv -> IAdv ; -- where and with whom - ConjCN : Conj -> ListCN -> CN ; -- man and woman - ConjDet : Conj -> ListDAP -> Det' ; -- his or her - ---2 Categories - --- These categories are only used in this module. - - cat - [S]{2} ; - [RS]{2} ; - [Adv]{2} ; - [AdV]{2} ; - [NP']{2} ; - [AP]{2} ; - [IAdv]{2} ; - [CN] {2} ; - [DAP] {2} ; - ---2 List constructors - --- The list constructors are derived from the list notation and therefore --- not given explicitly. But here are their type signatures: -{- --- overview - BaseC : C -> C -> [C] ; --- for C = AdV, Adv, AP, CN, Det, IAdv, NP, RS, S - ConsC : C -> [C] -> [C] ; --- for C = AdV, Adv, AP, CN, Det, IAdv, NP, RS, S - --- complete list - - BaseAP : AP -> AP -> ListAP ; -- red, white - ConsAP : AP -> ListAP -> ListAP ; -- red, white, blue - - BaseAdV : AdV -> AdV -> ListAdV ; -- always, sometimes - ConsAdV : AdV -> ListAdV -> ListAdV ; -- always, sometimes, never - - BaseAdv : Adv -> Adv -> ListAdv ; -- here, there - ConsAdv : Adv -> ListAdv -> ListAdv ; -- here, there, everywhere - - BaseCN : CN -> CN -> ListCN ; -- man, woman - ConsCN : CN -> ListCN -> ListCN ; -- man, woman, child - - BaseIAdv : IAdv -> IAdv -> ListIAdv ; -- where, when - ConsIAdv : IAdv -> ListIAdv -> ListIAdv ; -- where, when, why - - BaseNP : NP -> NP -> ListNP ; -- John, Mary - ConsNP : NP -> ListNP -> ListNP ; -- John, Mary, Bill - - BaseRS : RS -> RS -> ListRS ; -- who walks, whom I know - ConsRS : RS -> ListRS -> ListRS ; -- who wals, whom I know, who is here - - BaseS : S -> S -> ListS ; -- John walks, Mary runs - ConsS : S -> ListS -> ListS ; -- John walks, Mary runs, Bill swims - --} -} - diff --git a/src/abstract/Grammar'.gf b/src/abstract/Grammar'.gf deleted file mode 100644 index b90e2e9d..00000000 --- a/src/abstract/Grammar'.gf +++ /dev/null @@ -1,23 +0,0 @@ ---1 Grammar: the Main Module of the Resource Grammar - --- This grammar is a collection of the different grammar modules, --- To test the resource, import [``Lang`` Lang.html], which also contains --- a lexicon. - -abstract Grammar' = - Noun', - Verb', - Adjective', - Adverb', - Numeral, - Sentence', - Question', - Relative', - Conjunction', - Phrase', - Text, - Structural', - Idiom', - Tense, - Transfer' - ; diff --git a/src/abstract/Idiom'.gf b/src/abstract/Idiom'.gf deleted file mode 100644 index 5fa876ce..00000000 --- a/src/abstract/Idiom'.gf +++ /dev/null @@ -1,35 +0,0 @@ ---1 Idiom: Idiomatic Expressions - -abstract Idiom' = Cat' ** { - --- This module defines constructions that are formed in fixed ways, --- often different even in closely related languages. - - fun - ImpersCl : VP -> Cl ; -- it is hot - GenericCl : VP -> Cl ; -- one sleeps - - CleftNP : NP' -> RS -> Cl ; -- it is I who did it - CleftAdv : Adv -> S -> Cl ; -- it is here she slept - - ExistNP : NP' -> Cl ; -- there is a house - ExistIP : IP -> QCl ; -- which houses are there - --- 7/12/2012 generalizations of these - - ExistNPAdv : NP' -> Adv -> Cl ; -- there is a house in Paris - ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris - - ProgrVP : VP -> VP ; -- be sleeping - - ImpPl1 : VP -> Utt ; -- let's go - - ImpP3 : NP' -> VP -> Utt ; -- let John walk - --- 3/12/2013 non-reflexive uses of "self" - - SelfAdvVP : VP -> VP ; -- is at home himself - SelfAdVVP : VP -> VP ; -- is himself at home - SelfNP : NP' -> NP' ; -- the president himself (is at home) - -} diff --git a/src/abstract/Lang'.gf b/src/abstract/Lang'.gf deleted file mode 100644 index ad859414..00000000 --- a/src/abstract/Lang'.gf +++ /dev/null @@ -1,16 +0,0 @@ ---1 Lang: a Test Module for the Resource Grammar - --- This grammar is for testing the resource as included in the --- language-independent API, consisting of a grammar and a lexicon. --- The grammar without a lexicon is [``Grammar`` Grammar.html], --- which may be more suitable to open in applications. - -abstract Lang' = - Grammar', - Lexicon --- ,Construction --- could be compiled here, but not in concretes, as they call Syntax and Grammar --- ,Documentation --# notpresent --- ,Markup' - [stringMark] - ** { - flags startcat=Phr ; - } ; diff --git a/src/abstract/Noun'.gf b/src/abstract/Noun'.gf deleted file mode 100644 index b56b92dd..00000000 --- a/src/abstract/Noun'.gf +++ /dev/null @@ -1,158 +0,0 @@ ---1 Noun: Nouns, noun phrases, and determiners - -abstract Noun' = Cat' ** { - - ---2 Noun phrases - --- The three main types of noun phrases are --- - common nouns with determiners --- - proper names --- - pronouns --- --- - fun - DetCN : Det' -> CN -> NP' ; -- the man - UsePN : PN -> NP' ; -- John - UsePron : Pron -> NP' ; -- he - --- Pronouns are defined in the module [``Structural`` Structural.html]. - --- A noun phrase already formed can be modified by a $Predet$erminer. - - PredetNP : Predet' -> NP' -> NP' ; -- only the man - --- A noun phrase can also be postmodified by the past participle of a --- verb, by an adverb, or by a relative clause - - PPartNP : NP' -> V2 -> NP' ; -- the man seen - AdvNP : NP' -> Adv -> NP' ; -- Paris today - ExtAdvNP: NP' -> Adv -> NP' ; -- boys, such as .. - RelNP : NP' -> RS -> NP' ; -- Paris, which is here - --- Determiners can form noun phrases directly. - - DetNP : Det' -> NP' ; -- these five - - ---2 Determiners - --- The determiner has a fine-grained structure, in which a 'nucleus' --- quantifier and an optional numeral can be discerned. - - DetQuant : Quant' -> Num -> Det' ; -- these five - DetQuantOrd : Quant' -> Num -> Ord -> Det' ; -- these five best - --- Whether the resulting determiner is singular or plural depends on the --- cardinal. - --- All parts of the determiner can be empty, except $Quant$, which is --- the "kernel" of a determiner. It is, however, the $Num$ that determines --- the inherent number. - - NumSg : Num ; -- [no numeral, but marked as singular] - NumPl : Num ; -- [no numeral, but marked as plural] - NumCard : Card -> Num ; -- one/five [explicit numeral] - --- $Card$ consists of either digits or numeral words. - - data - NumDigits : Digits -> Card ; -- 51 - NumNumeral : Numeral -> Card ; -- fifty-one - --- The construction of numerals is defined in [Numeral Numeral.html]. - --- A $Card$ can be modified by certain adverbs. - - fun - AdNum : AdN -> Card -> Card ; -- almost 51 - --- An $Ord$ consists of either digits or numeral words. --- Also superlative forms of adjectives behave syntactically like ordinals. - - OrdDigits : Digits -> Ord ; -- 51st - OrdNumeral : Numeral -> Ord ; -- fifty-first - OrdSuperl : A -> Ord ; -- warmest - --- One can combine a numeral and a superlative. - - OrdNumeralSuperl : Numeral -> A -> Ord ; -- third largest - --- Definite and indefinite noun phrases are sometimes realized as --- neatly distinct words (Spanish "un, unos ; el, los") but also without --- any particular word (Finnish; Swedish definites). - - DefArt : Quant'; -- the - IndefArt : Quant' ; -- a/an - --- Nouns can be used without an article as mass nouns. The resource does --- not distinguish mass nouns from other common nouns, which can result --- in semantically odd expressions. - - MassNP : CN -> NP' ; -- (beer) - --- Pronouns have possessive forms. Genitives of other kinds --- of noun phrases are not given here, since they are not possible --- in e.g. Romance languages. They can be found in $Extra$ modules. - - PossPron : Pron -> Quant' ; -- my (house) - --- Other determiners are defined in [Structural Structural.html]. - - - ---2 Common nouns - --- Simple nouns can be used as nouns outright. - - UseN : N -> CN ; -- house - --- Relational nouns take one or two arguments. - - ComplN2 : N2 -> NP' -> CN ; -- mother of the king - ComplN3 : N3 -> NP' -> N2 ; -- distance from this city (to Paris) - --- Relational nouns can also be used without their arguments. --- The semantics is typically derivative of the relational meaning. - - UseN2 : N2 -> CN ; -- mother - Use2N3 : N3 -> N2 ; -- distance (from this city) - Use3N3 : N3 -> N2 ; -- distance (to Paris) - --- Nouns can be modified by adjectives, relative clauses, and adverbs --- (the last rule will give rise to many 'PP attachment' ambiguities --- when used in connection with verb phrases). - - AdjCN : AP -> CN -> CN ; -- big house - RelCN : CN -> RS -> CN ; -- house that John bought - AdvCN : CN -> Adv -> CN ; -- house on the hill - --- Nouns can also be modified by embedded sentences and questions. --- For some nouns this makes little sense, but we leave this for applications --- to decide. Sentential complements are defined in [Verb Verb.html]. - - SentCN : CN -> SC -> CN ; -- question where she sleeps - ---2 Apposition - --- This is certainly overgenerating. - - ApposCN : CN -> NP' -> CN ; -- city Paris (, numbers x and y) - ---2 Possessive and partitive constructs - --- (New 13/3/2013 AR; Structural.possess_Prep and part_Prep should be deprecated in favour of these.) - - PossNP : CN -> NP' -> CN ; -- house of Paris, house of mine - PartNP : CN -> NP' -> CN ; -- glass of wine - --- This is different from the partitive, as shown by many languages. - - CountNP : Det' -> NP' -> NP' ; -- three of them, some of the boys - ---3 Conjoinable determiners and ones with adjectives - - AdjDAP : DAP' -> AP -> DAP' ; -- the large (one) - DetDAP : Det' -> DAP' ; -- this (or that) - -} diff --git a/src/abstract/NumeralTransfer'.gf b/src/abstract/NumeralTransfer'.gf deleted file mode 100644 index 639524e5..00000000 --- a/src/abstract/NumeralTransfer'.gf +++ /dev/null @@ -1,97 +0,0 @@ -abstract NumeralTransfer' = Numeral, Noun' ** { - -fun digits2numeral : Card -> Card ; -def - digits2numeral (NumDigits d) = NumNumeral (digits2num d) ; - digits2numeral n = n ; - -fun digits2num : Digits -> Numeral ; -def digits2num (IDig d1) = num (pot2as3 (pot1as2 (pot0as1 (dn10 d1)))) ; - digits2num (IIDig d2 (IDig d1)) = num (pot2as3 (pot1as2 (dn100 d2 d1))) ; - digits2num (IIDig d3 (IIDig d2 (IDig d1))) = num (pot2as3 (dn1000 d3 d2 d1)) ; - digits2num (IIDig d4 (IIDig d3 (IIDig d2 (IDig d1)))) = num (dn1000000a d4 d3 d2 d1) ; - digits2num (IIDig d5 (IIDig d4 (IIDig d3 (IIDig d2 (IDig d1))))) = num (dn1000000b d5 d4 d3 d2 d1) ; - digits2num (IIDig d6 ((IIDig d5 (IIDig d4 (IIDig d3 (IIDig d2 (IDig d1))))))) = num (dn1000000c d6 d5 d4 d3 d2 d1) ; - -fun num2digits : Numeral -> Digits ; -def num2digits (num x) = nd1000000 x ; - -fun dn10 : Dig -> Sub10 ; -def dn10 D_1 = pot01 ; - dn10 d1 = pot0 (dn d1) ; - -fun dn100 : Dig -> Dig -> Sub100 ; -def dn100 D_0 d1 = pot0as1 (dn10 d1) ; - dn100 D_1 D_0 = pot110 ; - dn100 D_1 D_1 = pot111 ; - dn100 D_1 d1 = pot1to19 (dn d1) ; - dn100 d2 D_0 = pot1 (dn d2) ; - dn100 d2 d1 = pot1plus (dn d2) (dn10 d1) ; - -fun dn1000 : Dig -> Dig -> Dig -> Sub1000 ; -def dn1000 D_0 d2 d1 = pot1as2 (dn100 d2 d1) ; - dn1000 d3 D_0 D_0 = pot2 (dn10 d3) ; - dn1000 d3 d2 d1 = pot2plus (dn10 d3) (dn100 d2 d1) ; - -fun dn1000000a : Dig -> Dig -> Dig -> Dig -> Sub1000000 ; -def dn1000000a D_0 d3 d2 d1 = pot2as3 (dn1000 d3 d2 d1) ; - dn1000000a d4 D_0 D_0 D_0 = pot3 (pot1as2 (pot0as1 (dn10 d4))) ; - dn1000000a d4 d3 d2 d1 = pot3plus (pot1as2 (pot0as1 (dn10 d4))) (dn1000 d3 d2 d1) ; - -fun dn1000000b : Dig -> Dig -> Dig -> Dig -> Dig -> Sub1000000 ; -def dn1000000b D_0 d4 d3 d2 d1 = dn1000000a d4 d3 d2 d1 ; - dn1000000b d5 d4 D_0 D_0 D_0 = pot3 (pot1as2 (dn100 d5 d4)) ; - dn1000000b d5 d4 d3 d2 d1 = pot3plus (pot1as2 (dn100 d5 d4)) (dn1000 d3 d2 d1) ; - -fun dn1000000c : Dig -> Dig -> Dig -> Dig -> Dig -> Dig -> Sub1000000 ; -def dn1000000c D_0 d5 d4 d3 d2 d1 = dn1000000b d5 d4 d3 d2 d1 ; - dn1000000c d6 d5 d4 D_0 D_0 D_0 = pot3 (dn1000 d6 d5 d4) ; - dn1000000c d6 d5 d4 d3 d2 d1 = pot3plus (dn1000 d6 d5 d4) (dn1000 d3 d2 d1) ; - -fun dn : Dig -> Digit ; -def dn D_2 = n2 ; - dn D_3 = n3 ; - dn D_4 = n4 ; - dn D_5 = n5 ; - dn D_6 = n6 ; - dn D_7 = n7 ; - dn D_8 = n8 ; - dn D_9 = n9 ; - -fun nd10 : Sub10 -> Digits ; -def nd10 pot01 = IDig D_1 ; - nd10 (pot0 d1) = IDig (nd d1) ; - -fun nd100 : Sub100 -> Digits ; -def nd100 (pot0as1 d) = nd10 d ; - nd100 pot110 = IIDig D_1 (IDig D_0) ; - nd100 pot111 = IIDig D_1 (IDig D_1) ; - nd100 (pot1to19 d) = IIDig D_1 (IDig (nd d)) ; - nd100 (pot1 d) = IIDig (nd d) (IDig D_0) ; - nd100 (pot1plus d x) = IIDig (nd d) (nd10 x) ; - -fun nd1000 : Sub1000 -> Digits ; -def nd1000 (pot1as2 x) = nd100 x ; - nd1000 (pot2 x) = dconcat (nd10 x) (IIDig D_0 (IDig D_0)) ; - nd1000 (pot2plus x y) = dconcat (nd10 x) (nd100 y) ; - -fun nd1000000 : Sub1000000 -> Digits ; -def nd1000000 (pot2as3 x) = nd1000 x ; - nd1000000 (pot3 x) = dconcat (nd1000 x) (IIDig D_0 (IIDig D_0 (IDig D_0))) ; - nd1000000 (pot3plus x y) = dconcat (nd1000 x) (nd1000 y) ; - -fun dconcat : Digits -> Digits -> Digits ; -def dconcat (IDig d) ys = IIDig d ys ; - dconcat (IIDig d xs) ys = IIDig d (dconcat xs ys) ; - -fun nd : Digit -> Dig ; -def nd n2 = D_2 ; - nd n3 = D_3 ; - nd n4 = D_4 ; - nd n5 = D_5 ; - nd n6 = D_6 ; - nd n7 = D_7 ; - nd n8 = D_8 ; - nd n9 = D_9 ; - -} diff --git a/src/abstract/Phrase'.gf b/src/abstract/Phrase'.gf deleted file mode 100644 index 35ae77da..00000000 --- a/src/abstract/Phrase'.gf +++ /dev/null @@ -1,48 +0,0 @@ ---1 Phrase: Phrases and Utterances - -abstract Phrase' = Cat' ** { - --- When a phrase is built from an utterance it can be prefixed --- with a phrasal conjunction (such as "but", "therefore") --- and suffixing with a vocative (typically a noun phrase). - - fun - PhrUtt : PConj -> Utt -> Voc -> Phr ; -- but come here, my friend - --- Utterances are formed from sentences, questions, and imperatives. - - UttS : S -> Utt ; -- John walks - UttQS : QS -> Utt ; -- is it good - UttImpSg : Pol -> Imp -> Utt ; -- (don't) love yourself - UttImpPl : Pol -> Imp -> Utt ; -- (don't) love yourselves - UttImpPol : Pol -> Imp -> Utt ; -- (don't) sleep (polite) - --- There are also 'one-word utterances'. A typical use of them is --- as answers to questions. --- *Note*. This list is incomplete. More categories could be covered. --- Moreover, in many languages e.g. noun phrases in different cases --- can be used. - - UttIP : IP -> Utt ; -- who - UttIAdv : IAdv -> Utt ; -- why - UttNP : NP' -> Utt ; -- this man - UttAdv : Adv -> Utt ; -- here - UttVP : VP -> Utt ; -- to sleep - UttCN : CN -> Utt ; -- house - UttCard : Card -> Utt ; -- five - UttAP : AP -> Utt ; -- fine - UttInterj : Interj -> Utt ; -- alas - --- The phrasal conjunction is optional. A sentence conjunction --- can also be used to prefix an utterance. - - NoPConj : PConj ; -- [plain phrase without conjunction in front] - PConjConj : Conj -> PConj ; -- and - --- The vocative is optional. Any noun phrase can be made into vocative, --- which may be overgenerating (e.g. "I"). - - NoVoc : Voc ; -- [plain phrase without vocative] - VocNP : NP' -> Voc ; -- my friend - -} diff --git a/src/abstract/Question'.gf b/src/abstract/Question'.gf deleted file mode 100644 index 139ce4e3..00000000 --- a/src/abstract/Question'.gf +++ /dev/null @@ -1,55 +0,0 @@ ---1 Question: Questions and Interrogative Pronouns - -abstract Question' = Cat' ** { - --- A question can be formed from a clause ('yes-no question') or --- with an interrogative. - - fun - QuestCl : Cl -> QCl ; -- does John walk - QuestVP : IP -> VP -> QCl ; -- who walks - QuestSlash : IP -> ClSlash -> QCl ; -- whom does John love - QuestIAdv : IAdv -> Cl -> QCl ; -- why does John walk - QuestIComp : IComp -> NP' -> QCl ; -- where is John - --- Interrogative pronouns can be formed with interrogative --- determiners, with or without a noun. - - IdetCN : IDet -> CN -> IP ; -- which five songs - IdetIP : IDet -> IP ; -- which five - --- They can be modified with adverbs. - - AdvIP : IP -> Adv -> IP ; -- who in Paris - --- Interrogative quantifiers have number forms and can take number modifiers. - - IdetQuant : IQuant -> Num -> IDet ; -- which (five) - --- Interrogative adverbs can be formed prepositionally. - - PrepIP : Prep' -> IP -> IAdv ; -- with whom - --- They can be modified with other adverbs. - - AdvIAdv : IAdv -> Adv -> IAdv ; -- where in Paris - --- Interrogative complements to copulas can be both adverbs and --- pronouns. - - CompIAdv : IAdv -> IComp ; -- where (is it) - CompIP : IP -> IComp ; -- who (is it) - --- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$. - --- Wh questions with two or more question words require a new, special category. - - cat - QVP ; -- buy what where - fun - ComplSlashIP : VPSlash -> IP -> QVP ; -- buys what - AdvQVP : VP -> IAdv -> QVP ; -- lives where - AddAdvQVP : QVP -> IAdv -> QVP ; -- buys what where - - QuestQVP : IP -> QVP -> QCl ; -- who buys what where -} diff --git a/src/abstract/Relative'.gf b/src/abstract/Relative'.gf deleted file mode 100644 index 3c936a36..00000000 --- a/src/abstract/Relative'.gf +++ /dev/null @@ -1,26 +0,0 @@ ---1 Relative clauses and pronouns - -abstract Relative' = Cat' ** { - - fun - --- The simplest way to form a relative clause is from a clause by --- a pronoun similar to "such that". - - RelCl : Cl -> RCl ; -- such that John loves her - --- The more proper ways are from a verb phrase --- (formed in [``Verb`` Verb.html]) or a sentence --- with a missing noun phrase (formed in [``Sentence`` Sentence.html]). - - RelVP : RP -> VP -> RCl ; -- who loves John - RelSlash : RP -> ClSlash -> RCl ; -- whom John loves - --- Relative pronouns are formed from an 'identity element' by prefixing --- or suffixing (depending on language) prepositional phrases or genitives. - - IdRP : RP ; -- which - FunRP : Prep' -> NP' -> RP -> RP ; -- the mother of whom - -} - diff --git a/src/abstract/Sentence'.gf b/src/abstract/Sentence'.gf deleted file mode 100644 index 821970ed..00000000 --- a/src/abstract/Sentence'.gf +++ /dev/null @@ -1,107 +0,0 @@ ---1 Sentence: Sentences, Clauses, and Imperatives - -abstract Sentence' = Cat' ** { - ---2 Clauses - --- The $NP VP$ predication rule form a clause whose linearization --- gives a table of all tense variants, positive and negative. --- Clauses are converted to $S$ (with fixed tense) with the --- $UseCl$ function below. - - data - PredVP : NP' -> VP -> Cl ; -- John walks - --- Using an embedded sentence as a subject is treated separately. --- This can be overgenerating. E.g. "whether you go" as subject --- is only meaningful for some verb phrases. - - PredSCVP : SC -> VP -> Cl ; -- that she goes is good - ---2 Clauses missing object noun phrases - --- This category is a variant of the 'slash category' $S/NP$ of --- GPSG and categorial grammars, which in turn replaces --- movement transformations in the formation of questions --- and relative clauses. Except $SlashV2$, the construction --- rules can be seen as special cases of function composition, in --- the style of CCG. --- *Note* the set is not complete and lacks e.g. verbs with more than 2 places. - - SlashVP : NP' -> VPSlash -> ClSlash ; -- (whom) he sees - AdvSlash : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today - SlashPrep : Cl -> Prep' -> ClSlash ; -- (with whom) he walks - SlashVS : NP' -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves - ---2 Imperatives - --- An imperative is straightforwardly formed from a verb phrase. --- It has variation over positive and negative, singular and plural. --- To fix these parameters, see [Phrase Phrase.html]. - - ImpVP : VP -> Imp ; -- love yourselves - AdvImp : Adv -> Imp -> Imp ; -- please love yourselves - ---2 Embedded sentences - --- Sentences, questions, and infinitival phrases can be used as --- subjects and (adverbial) complements. - - EmbedS : S -> SC ; -- that she goes - EmbedQS : QS -> SC ; -- who goes - EmbedVP : VP -> SC ; -- to go - ---2 Sentences - --- These are the 2 x 4 x 4 = 16 forms generated by different --- combinations of tense, polarity, and --- anteriority, which are defined in [``Common`` Common.html]. - - fun - UseCl : Temp -> Pol -> Cl -> S ; -- she had not slept - UseQCl : Temp -> Pol -> QCl -> QS ; -- who had not slept - UseRCl : Temp -> Pol -> RCl -> RS ; -- that had not slept - UseSlash : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen - --- An adverb can be added to the beginning of a sentence, either with comma ("externally") --- or without: - - AdvS : Adv -> S -> S ; -- then I will go home - ExtAdvS : Adv -> S -> S ; -- next week, I will go home - --- This covers subjunctive clauses, but they can also be added to the end. - - SSubjS : S -> Subj -> S -> S ; -- I go home, if she comes - --- A sentence can be modified by a relative clause referring to its contents. - - RelS : S -> RS -> S ; -- she sleeps, which is good - ----- A sentence can also be post-modified by a subjunct sentence. - ----- ModSubjS : S -> Subj -> S -> S ; -- she sleeps, because she is old ----- cf. Adverb.SubjS - -} - ---. - --- Examples for English $S$/$Cl$: -{- - Pres Simul Pos ODir : he sleeps - Pres Simul Neg ODir : he doesn't sleep - Pres Anter Pos ODir : he has slept - Pres Anter Neg ODir : he hasn't slept - Past Simul Pos ODir : he slept - Past Simul Neg ODir : he didn't sleep - Past Anter Pos ODir : he had slept - Past Anter Neg ODir : he hadn't slept - Fut Simul Pos ODir : he will sleep - Fut Simul Neg ODir : he won't sleep - Fut Anter Pos ODir : he will have slept - Fut Anter Neg ODir : he won't have slept - Cond Simul Pos ODir : he would sleep - Cond Simul Neg ODir : he wouldn't sleep - Cond Anter Pos ODir : he would have slept - Cond Anter Neg ODir : he wouldn't have slept --} diff --git a/src/abstract/Structural'.gf b/src/abstract/Structural'.gf deleted file mode 100644 index 1db750a2..00000000 --- a/src/abstract/Structural'.gf +++ /dev/null @@ -1,128 +0,0 @@ ---1 Structural: Structural Words --- --- Here we have some words belonging to closed classes and appearing --- in all languages we have considered. --- Sometimes more distinctions are needed, e.g. $we_Pron$ in Spanish --- should be replaced by masculine and feminine variants, found in --- [``ExtendSpa`` ../spanish/ExtendSpa.gf]. - -abstract Structural' = Cat' ** { - - fun - --- This is an alphabetical list of structural words - - above_Prep : Prep' ; - after_Prep : Prep' ; - all_Predet : Predet' ; - almost_AdA : AdA ; - almost_AdN : AdN ; - although_Subj : Subj ; - always_AdV : AdV ; - and_Conj : Conj ; - because_Subj : Subj ; - before_Prep : Prep' ; - behind_Prep : Prep' ; - between_Prep : Prep' ; - both7and_DConj : Conj ; -- both...and ----b both7and_DConj : DConj ; - but_PConj : PConj ; - by8agent_Prep : Prep' ; -- by (agent) - by8means_Prep : Prep' ; -- by (means of) - can8know_VV : VV ; -- can (capacity) - can_VV : VV ; -- can (possibility) - during_Prep : Prep' ; - either7or_DConj : Conj ; -- either...or ----b either7or_DConj : DConj ; - every_Det : Det' ; - everybody_NP : NP' ; -- everybody - everything_NP : NP' ; - everywhere_Adv : Adv ; ---- first_Ord : Ord ; DEPRECATED - few_Det : Det' ; - for_Prep : Prep' ; - from_Prep : Prep' ; - he_Pron : Pron ; - here_Adv : Adv ; - here7to_Adv : Adv ; -- to here - here7from_Adv : Adv ; -- from here - how_IAdv : IAdv ; - how8many_IDet : IDet ; - how8much_IAdv : IAdv ; - i_Pron : Pron ; - if_Subj : Subj ; - in8front_Prep : Prep' ; -- in front of - in_Prep : Prep' ; - it_Pron : Pron ; - less_CAdv : CAdv ; - many_Det : Det' ; - more_CAdv : CAdv ; - most_Predet : Predet' ; - much_Det : Det' ; - must_VV : VV ; ----b no_Phr : Phr ; - no_Utt : Utt ; - on_Prep : Prep' ; ---- one_Quant : QuantSg ; DEPRECATED - only_Predet : Predet' ; - or_Conj : Conj ; - otherwise_PConj : PConj ; - part_Prep : Prep' ; - please_Voc : Voc ; - possess_Prep : Prep' ; -- of (possessive) - quite_Adv : AdA ; - she_Pron : Pron ; - so_AdA : AdA ; - someSg_Det : Det' ; - somePl_Det : Det' ; - somebody_NP : NP' ; - something_NP : NP' ; - somewhere_Adv : Adv ; - that_Quant : Quant' ; - that_Subj : Subj ; - there_Adv : Adv ; - there7to_Adv : Adv ; -- to there - there7from_Adv : Adv ; -- from there - therefore_PConj : PConj ; - they_Pron : Pron ; - this_Quant : Quant' ; - through_Prep : Prep' ; - to_Prep : Prep' ; - too_AdA : AdA ; - under_Prep : Prep' ; - very_AdA : AdA ; - want_VV : VV ; - we_Pron : Pron ; - whatPl_IP : IP ; -- what (plural) - whatSg_IP : IP ; -- what (singular) - when_IAdv : IAdv ; - when_Subj : Subj ; - where_IAdv : IAdv ; - which_IQuant : IQuant ; - whoPl_IP : IP ; -- who (plural) - whoSg_IP : IP ; -- who (singular) - why_IAdv : IAdv ; - with_Prep : Prep' ; - without_Prep : Prep' ; ----b yes_Phr : Phr ; - yes_Utt : Utt ; - youSg_Pron : Pron ; -- you (singular) - youPl_Pron : Pron ; -- you (plural) - youPol_Pron : Pron ; -- you (polite) - - no_Quant : Quant' ; - not_Predet : Predet' ; - if_then_Conj : Conj ; - at_least_AdN : AdN ; - at_most_AdN : AdN ; - nobody_NP : NP' ; - nothing_NP : NP' ; - except_Prep : Prep' ; - - as_CAdv : CAdv ; - - have_V2 : V2 ; - - fun language_title_Utt : Utt ; - -} diff --git a/src/abstract/Transfer'.gf b/src/abstract/Transfer'.gf deleted file mode 100644 index 0c41fa52..00000000 --- a/src/abstract/Transfer'.gf +++ /dev/null @@ -1,29 +0,0 @@ -abstract Transfer' = Sentence', Verb', Adverb', Structural', NumeralTransfer' ** { - -{- --- examples of transfer: to test, - - > i LangEng.gf - - > p "she sees him" | pt -transfer=active2passive | l - he is seen by her - - > p "wouldn't she see him" | pt -transfer=active2passive | l - wouldn't he be seen by her - - > p -cat=NP "3 cats with 4 dogs" | pt -transfer=digits2numeral | l - three cats with four dogs --} - -fun - active2passive : Cl -> Cl ; -def - active2passive (PredVP subj (ComplSlash (SlashV2a v) obj)) = - PredVP obj (AdvVP (PassV2 v) (PrepNP by8agent_Prep subj)) ; - active2passive (PredVP subj (AdvVP (ComplSlash (SlashV2a v) obj) adv)) = - PredVP obj (AdvVP (AdvVP (PassV2 v) (PrepNP by8agent_Prep subj)) adv) ; - active2passive (PredVP subj (AdVVP adv (ComplSlash (SlashV2a v) obj))) = - PredVP obj (AdVVP adv (AdvVP (PassV2 v) (PrepNP by8agent_Prep subj))) ; - active2passive cl = cl ; - -} diff --git a/src/abstract/Verb'.gf b/src/abstract/Verb'.gf deleted file mode 100644 index b3e4c1f5..00000000 --- a/src/abstract/Verb'.gf +++ /dev/null @@ -1,84 +0,0 @@ ---1 The construction of verb phrases - -abstract Verb' = Cat' ** { - - flags coding = utf8 ; - ---2 Complementization rules - --- Verb phrases are constructed from verbs by providing their --- complements. There is one rule for each verb category. - - data - UseV : V -> VP ; -- sleep - - ComplVV : VV -> VP -> VP ; -- want to run - ComplVS : VS -> S -> VP ; -- say that she runs - ComplVQ : VQ -> QS -> VP ; -- wonder who runs - ComplVA : VA -> AP -> VP ; -- they become red - - SlashV2a : V2 -> VPSlash ; -- love (it) - Slash2V3 : V3 -> NP' -> VPSlash ; -- give it (to her) - Slash3V3 : V3 -> NP' -> VPSlash ; -- give (it) to her - - SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go - SlashV2S : V2S -> S -> VPSlash ; -- answer (to him) that it is good - SlashV2Q : V2Q -> QS -> VPSlash ; -- ask (him) who came - SlashV2A : V2A -> AP -> VPSlash ; -- paint (it) red - - ComplSlash : VPSlash -> NP' -> VP ; -- love it - - SlashVV : VV -> VPSlash -> VPSlash ; -- want to buy - SlashV2VNP : V2V -> NP' -> VPSlash -> VPSlash ; -- beg me to buy - ---2 Other ways of forming verb phrases - --- Verb phrases can also be constructed reflexively and from --- copula-preceded complements. - - ReflVP : VPSlash -> VP ; -- love himself - UseComp : Comp -> VP ; -- be warm - --- Passivization of two-place verbs is another way to use --- them. In many languages, the result is a participle that --- is used as complement to a copula ("is used"), but other --- auxiliary verbs are possible (Ger. "wird angewendet", It. --- "viene usato"), as well as special verb forms (Fin. "käytetään", --- Swe. "används"). --- --- *Note*. the rule can be overgenerating, since the $V2$ need not --- take a direct object. - - PassV2 : V2 -> VP ; -- be loved - --- Adverbs can be added to verb phrases. Many languages make --- a distinction between adverbs that are attached in the end --- vs. next to (or before) the verb. - - AdvVP : VP -> Adv -> VP ; -- sleep here - ExtAdvVP : VP -> Adv -> VP ; -- sleep , even though ... - AdVVP : AdV -> VP -> VP ; -- always sleep - - AdvVPSlash : VPSlash -> Adv -> VPSlash ; -- use (it) here - AdVVPSlash : AdV -> VPSlash -> VPSlash ; -- always use (it) - - VPSlashPrep : VP -> Prep' -> VPSlash ; -- live in (it) - - --- *Agents of passives* are constructed as adverbs with the --- preposition [Structural Structural.html]$.8agent_Prep$. - - ---2 Complements to copula - --- Adjectival phrases, noun phrases, and adverbs can be used. - - CompAP : AP -> Comp ; -- (be) small - CompNP : NP' -> Comp ; -- (be) the man - CompAdv : Adv -> Comp ; -- (be) here - CompCN : CN -> Comp ; -- (be) a man/men - --- Copula alone - - UseCopula : VP ; -- be -} diff --git a/src/api/CombinatorsGer.gf b/src/api/CombinatorsGer.gf index 6847da62..2fbed5a4 100644 --- a/src/api/CombinatorsGer.gf +++ b/src/api/CombinatorsGer.gf @@ -7,9 +7,9 @@ resource CombinatorsGer = Combinators - [appCN, appCNc] with (Constructors = ConstructorsGer) ** { oper -appCN : CN -> NP' -> NP' +appCN : CN -> NP -> NP = \cn,x -> mkNP the_Art (PossNP cn x) ; -appCNc : CN -> [NP'] -> NP' - = \cn,xs -> let np : NP' = mkNP and_Conj xs +appCNc : CN -> [NP] -> NP + = \cn,xs -> let np : NP = mkNP and_Conj xs in mkNP the_Art (PossNP cn np) ; } diff --git a/src/api/ConstructorsGer.gf b/src/api/ConstructorsGer.gf index d70f05be..907bf90a 100644 --- a/src/api/ConstructorsGer.gf +++ b/src/api/ConstructorsGer.gf @@ -1,3 +1,3 @@ --# -path=.:alltenses:prelude -resource ConstructorsGer = Constructors' with (Grammar = GrammarGer) ; +resource ConstructorsGer = Constructors with (Grammar = GrammarGer) ; diff --git a/src/api/SyntaxGer.gf b/src/api/SyntaxGer.gf index 206061f9..44170288 100644 --- a/src/api/SyntaxGer.gf +++ b/src/api/SyntaxGer.gf @@ -1,4 +1,4 @@ --# -path=../abstract:.:alltenses:prelude: -instance SyntaxGer of Syntax' = ConstructorsGer, CatGer, StructuralGer, CombinatorsGer ; +instance SyntaxGer of Syntax = ConstructorsGer, CatGer, StructuralGer, CombinatorsGer ; diff --git a/src/german/AdjectiveGer.gf b/src/german/AdjectiveGer.gf index 540edb3c..3504a8f0 100644 --- a/src/german/AdjectiveGer.gf +++ b/src/german/AdjectiveGer.gf @@ -1,4 +1,4 @@ -concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in { +concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in { flags optimize=all_subs ; @@ -11,7 +11,7 @@ concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in { ext = [] } ; ComparA a np = - let nps = np.s ! False ! Nom ++ bigNP' np + let nps = np.s ! False ! Nom ++ bigNP np in { s = \\af => a.s ! Compar ! af ++ conjThan ++ nps ; isPre = True ; @@ -19,7 +19,7 @@ concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in { ext = [] } ; CAdvAP ad ap np = - let nps = np.s ! False ! Nom ++ bigNP' np in + let nps = np.s ! False ! Nom ++ bigNP np in ap ** { s = \\af => ad.s ++ ap.s ! af ++ ad.p ++ nps ; isPre = False @@ -42,8 +42,8 @@ concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in { ComplA2 a np = let CExt = case a.c2.isPrep of { - isCase => ; - _ => <[], appPrepNP' a.c2 np> } -- HL: check 7/22 + isCase => ; + _ => <[], appPrepNP a.c2 np> } -- HL: check 7/22 in { s = a.s ! Posit ; isPre = True ; @@ -53,7 +53,7 @@ concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in { ReflA2 a = let - compl = appPrep' a.c2 (reflPron ! agrP3 Sg) ; + compl = appPrep a.c2 (reflPron ! agrP3 Sg) ; CExt = case a.c2.isPrep of {isCase => ; _ => <[], compl> } in { diff --git a/src/german/AdverbGer.gf b/src/german/AdverbGer.gf index 7f6310b9..29bf0d2b 100644 --- a/src/german/AdverbGer.gf +++ b/src/german/AdverbGer.gf @@ -1,10 +1,10 @@ -concrete AdverbGer of Adverb' = CatGer ** open ResGer, Prelude in { +concrete AdverbGer of Adverb = CatGer ** open ResGer, Prelude in { lin PositAdvAdj a = {s = a.s ! Posit ! APred} ; ComparAdvAdj cadv a np = - let nps = np.s ! False ! Nom ++ bigNP' np in + let nps = np.s ! False ! Nom ++ bigNP np in { s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ nps } ; @@ -12,7 +12,7 @@ concrete AdverbGer of Adverb' = CatGer ** open ResGer, Prelude in { s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ s.s ! Sub } ; - PrepNP prep np = {s = appPrepNP' prep np} ; + PrepNP prep np = {s = appPrepNP prep np} ; AdAdv = cc2 ; diff --git a/src/german/AllGer.gf b/src/german/AllGer.gf index 3788cab2..ad643b20 100644 --- a/src/german/AllGer.gf +++ b/src/german/AllGer.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../api:../prelude -concrete AllGer of AllGerAbs' = +concrete AllGer of AllGerAbs = LangGer, IrregGer, ---- ExtendGer, ---- to replace ExtraGer diff --git a/src/german/CatGer.gf b/src/german/CatGer.gf index 76feb458..b0a5f533 100644 --- a/src/german/CatGer.gf +++ b/src/german/CatGer.gf @@ -1,5 +1,5 @@ --# -path=.:../abstract:../common:../prelude -concrete CatGer of Cat' = +concrete CatGer of Cat = CommonX - [Tense,Temp] ** open ResGer, Prelude in { @@ -12,14 +12,14 @@ concrete CatGer of Cat' = S = {s : Order => Str} ; QS = {s : QForm => Str} ; RS = {s : RelGenNum => Str ; c : Case} ; - SSlash = {s : Order => Str} ** {c2 : Preposition'} ; + SSlash = {s : Order => Str} ** {c2 : Preposition} ; -- Sentence Cl = {s : Mood => ResGer.Tense => Anteriority => Polarity => Order => Str} ; ClSlash = { s : Mood => ResGer.Tense => Anteriority => Polarity => Order => Str ; - c2 : Preposition' + c2 : Preposition } ; Imp = {s : Polarity => ImpForm => Str} ; @@ -58,35 +58,23 @@ concrete CatGer of Cat' = adv : Str ; -- Haus [adv auf dem Hügel] g : Gender } ; --- NP = ResGer.NP ; Pron = {s : NPForm => Str ; a : Agr} ; -{- - Det, DAP = {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} ; - Quant = { - s : Bool => Number => Gender => PCase => Str ; -- Bool is True if a cardinal number is present - sp : Bool => Number => Gender => PCase => Str ; - a : Adjf ; - aPl : Adjf ; --- to distinguish "meine guten Freunde" / "gute Freunde" - } ; - Predet = { - s : Number => Gender => PCase => Str ; - c : {p : Str ; k : PredetCase} ; - a : PredetAgr -- if an agr is forced, e.g. jeder von uns ist ... - } ; --} - -- HL: To reduce PCase to Case: - NP' = ResGer.NP' ; - Det' = {s,sp : Bool => Gender => Case => Str ; -- True if DefArt is dropped - n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ; - DAP' = {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ; - Quant' = { -- HL 7/2022: first Bool = True if used to glue in Sg with preposition - s : Bool => Bool => Number => Gender => Case => Str ; -- second Bool is True if a cardinal number is present - sp : Bool => Bool => Number => Gender => Case => Str ; + + -- simplified PCase to Case in NP, Det, DAP, Quant, Predet HL 8/22 + NP = ResGer.NP ; + Det = {s,sp : Bool => Gender => Case => Str ; -- True if DefArt is dropped HL 8/22 + n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ; + DAP = {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ; + + -- HL 7/2022: first Bool = True if used to glue in Sg with preposition + -- second Bool is True if a cardinal number is present + Quant = { + s, sp : Bool => Bool => Number => Gender => Case => Str ; a : Adjf ; aPl : Adjf ; --- to distinguish "meine guten Freunde" / "gute Freunde" hasDefArt : Bool } ; - Predet' = { + Predet = { s : Number => Gender => Case => Str ; c : {p : Str ; k : PredetCase'} ; a : PredetAgr -- if an agr is forced, e.g. jeder von uns ist ... @@ -105,23 +93,22 @@ concrete CatGer of Cat' = Conj = {s1,s2 : Str ; n : Number} ; Subj = {s : Str} ; --- Prep = Preposition ; - Prep' = Preposition' ; + Prep = Preposition ; -- Open lexical classes, e.g. Lexicon V, VA, VS, VQ = ResGer.Verb ; -- = {s : VForm => Str} ; VV = Verb ** {isAux : Bool} ; - V2, V2A, V2S, V2Q = Verb ** {c2 : Preposition'} ; - V2V = Verb ** {c2 : Preposition' ; isAux : Bool ; objCtrl : Bool} ; - V3 = Verb ** {c2, c3 : Preposition'} ; + V2, V2A, V2S, V2Q = Verb ** {c2 : Preposition} ; + V2V = Verb ** {c2 : Preposition ; isAux : Bool ; objCtrl : Bool} ; + V3 = Verb ** {c2, c3 : Preposition} ; A = {s : Degree => AForm => Str} ; - A2 = {s : Degree => AForm => Str ; c2 : Preposition'} ; + A2 = {s : Degree => AForm => Str ; c2 : Preposition} ; N = ResGer.Noun ; - N2 = ResGer.Noun ** {c2 : Preposition'} ; - N3 = ResGer.Noun ** {c2,c3 : Preposition'} ; + N2 = ResGer.Noun ** {c2 : Preposition} ; + N3 = ResGer.Noun ** {c2,c3 : Preposition} ; PN = {s : Case => Str; g : Gender} ; -- tense with possibility to choose conjunctive forms @@ -130,8 +117,7 @@ concrete CatGer of Cat' = Tense = {s : Str ; t : ResGer.Tense ; m : Mood} ; linref --- NP = \np -> np.s!(NPC Nom) ++ np.ext ++ np.rc ; -- HL 6/2019 - NP' = \np -> np.s ! False ! Nom ++ np.ext ++ np.rc ; -- HL 7/2022 Bool added + NP = \np -> np.s ! False ! Nom ++ np.ext ++ np.rc ; -- HL 7/2022 Bool added CN = \cn -> cn.s ! Strong ! Pl ! Nom ++ cn.adv ++ cn.ext ++ cn.rc ! Pl ; SSlash = \ss -> ss.s ! Main ++ ss.c2.s ! GPl ; @@ -152,7 +138,7 @@ concrete CatGer of Cat' = Conj = \c -> c.s1 ++ c.s2 ; - Det' = \det -> det.s ! False ! Masc ! Nom ; - Prep' = \prep -> case prep.isPrep of {isPrepDefArt => prep.s ! GSg Masc ; - _ => prep.s ! GPl } ; + Det = \det -> det.s ! False ! Masc ! Nom ; + Prep = \prep -> case prep.isPrep of {isPrepDefArt => prep.s ! GSg Masc ; + _ => prep.s ! GPl } ; } diff --git a/src/german/ConjunctionGer.gf b/src/german/ConjunctionGer.gf index 82633718..aaf5fb23 100644 --- a/src/german/ConjunctionGer.gf +++ b/src/german/ConjunctionGer.gf @@ -1,4 +1,4 @@ -concrete ConjunctionGer of Conjunction' = +concrete ConjunctionGer of Conjunction = CatGer ** open ResGer, Coordination, Prelude in { flags optimize=all_subs ; @@ -40,21 +40,21 @@ concrete ConjunctionGer of Conjunction' = BaseAdv = twoSS ; ConsAdv = consrSS comma ; - BaseNP' x y = { - s1 = \\c => x.s ! False ! c ++ bigNP' x ; - s2 = \\c => y.s ! False ! c ++ bigNP' y ; + BaseNP x y = { + s1 = \\c => x.s ! False ! c ++ bigNP x ; + s2 = \\c => y.s ! False ! c ++ bigNP y ; a = conjAgr x.a y.a } ; - ConsNP' xs x = { - s1 = \\c => xs.s ! False ! c ++ bigNP' xs ++ comma ++ x.s1 ! c ; + ConsNP xs x = { + s1 = \\c => xs.s ! False ! c ++ bigNP xs ++ comma ++ x.s1 ! c ; s2 = x.s2 ; a = conjAgr xs.a x.a } ; - BaseAP x y = { + BaseAP x y = lin AP { s1 = bigAP x ; s2 = bigAP y ; isPre = andB x.isPre y.isPre ; c = <[],[]> ; ext = []} ; - ConsAP xs x = { + ConsAP xs x = lin AP { s1 = \\a => (bigAP xs) ! a ++ comma ++ x.s1 ! a ; s2 = x.s2 ; isPre = andB x.isPre xs.isPre ; @@ -62,12 +62,12 @@ concrete ConjunctionGer of Conjunction' = ext = []} ; BaseRS x y = twoTable RelGenNum x y ** {c = y.c} ; ConsRS xs x = consrTable RelGenNum comma xs x ** {c = xs.c} ; - BaseCN x y = { + BaseCN x y = lin CN { s1 = bigCN x ; s2 = bigCN y ; g = x.g ; --- gender of first CN, used e.g. in articles } ; - ConsCN x xs = { + ConsCN x xs = lin CN { s1 = \\a,n,c => bigCN x ! a ! n ! c ++ comma ++ xs.s1 ! a ! n ! c ; s2 = xs.s2 ; g = x.g ; --- gender of first CN, used e.g. in articles @@ -77,8 +77,7 @@ concrete ConjunctionGer of Conjunction' = lincat [S] = {s1,s2 : Order => Str} ; [Adv] = {s1,s2 : Str} ; --- [NP] = {s1,s2 : PCase => Str ; a : Agr} ; - [NP'] = {s1,s2 : Case => Str ; a : Agr} ; + [NP] = {s1,s2 : Case => Str ; a : Agr} ; [AP] = {s1,s2 : AForm => Str ; isPre : Bool; c : Str * Str ; ext : Str} ; [RS] = {s1,s2 : RelGenNum => Str ; c : Case} ; [CN] = {s1,s2 : Adjf => Number => Case => Str ; g : Gender} ; diff --git a/src/german/ConstructionGer.gf b/src/german/ConstructionGer.gf index 72bdf606..9c71d779 100644 --- a/src/german/ConstructionGer.gf +++ b/src/german/ConstructionGer.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract -concrete ConstructionGer of Construction' = CatGer ** +concrete ConstructionGer of Construction = CatGer ** open SyntaxGer, SymbolicGer, ParadigmsGer, (L = LexiconGer), (E = ExtraGer), (G = GrammarGer), (I = IrregGer), (R = ResGer), (N = NounGer), Prelude in { flags coding=utf8 ; @@ -63,9 +63,9 @@ lin monthAdv m = SyntaxGer.mkAdv inDat_Prep (mkNP the_Det m) ; yearAdv y = SyntaxGer.mkAdv (mkPrep "im Jahr" dative) y ; ---- - dayMonthAdv d m = ParadigmsGer.mkAdv ("am" ++ d.s ! dative ++ BIND ++ "." ++ m.s ! R.Sg ! R.Nom) ; -- am 17 Mai + dayMonthAdv d m = ParadigmsGer.mkAdv ("am" ++ d.s ! True ! dative ++ BIND ++ "." ++ m.s ! R.Sg ! R.Nom) ; -- am 17 Mai monthYearAdv m y = SyntaxGer.mkAdv inDat_Prep (mkNP the_Det (mkCN m y)) ; -- im Mai 2012 - dayMonthYearAdv d m y = ParadigmsGer.mkAdv ("am" ++ d.s ! dative ++ BIND ++ "." ++ m.s ! R.Sg ! R.Nom ++ y.s ! accusative) ; -- am 17 Mai 2013 + dayMonthYearAdv d m y = ParadigmsGer.mkAdv ("am" ++ d.s ! True ! dative ++ BIND ++ "." ++ m.s ! R.Sg ! R.Nom ++ y.s ! False ! accusative) ; -- am 17 Mai 2013 intYear = symb ; intMonthday = symb ; diff --git a/src/german/ExtraGer.gf b/src/german/ExtraGer.gf index 7bdfe46d..58e83151 100644 --- a/src/german/ExtraGer.gf +++ b/src/german/ExtraGer.gf @@ -1,4 +1,4 @@ -concrete ExtraGer of ExtraGerAbs' = CatGer ** +concrete ExtraGer of ExtraGerAbs = CatGer ** open ResGer, Coordination, Prelude, IrregGer, (P = ParadigmsGer) in { flags coding=utf8 ; @@ -49,7 +49,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer ** EmptyRelSlash slash = { s = \\m,t,a,p,gn => - appPrep' slash.c2 (relPron ! gn) ++ slash.s ! m ! t ! a ! p ! Sub ; + appPrep slash.c2 (relPron ! gn) ++ slash.s ! m ! t ! a ! p ! Sub ; c = slash.c2.c } ; @@ -67,7 +67,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer ** Pass3V3 v = -- HL 7/19 let bekommenPass : Verb = P.habenV (P.irregV "bekommen" "bekommt" "bekam" "bekäme" "bekommen") in insertObj (\\_ => (v.s ! VPastPart APred)) (predV bekommenPass) ** - { c1 = PrepNom' ; c2 = v.c2 ; objCtrl = False } ; + { c1 = PrepNom ; c2 = v.c2 ; objCtrl = False } ; PastPartAP vp = let a = agrP3 Sg in { @@ -80,7 +80,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer ** PastPartAgentAP vp np = let a = agrP3 Sg ; - agent = appPrepNP' P.von_Prep np + agent = appPrepNP P.von_Prep np in { s = \\af => (vp.nn ! a).p1 ++ (vp.nn ! a).p2 ++ (vp.nn ! a).p3 ++ vp.a2 ++ agent ++ vp.inf.inpl.p2 @@ -101,7 +101,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer ** PredVPS np vpi = let - subj = np.s ! False ! Nom ++ bigNP' np ; + subj = np.s ! False ! Nom ++ bigNP np ; agr = np.a ; in { s = \\o => @@ -175,7 +175,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer ** RNP = {s : Agr => Case => Str} ; lin ReflRNP vps rnp = - insertObj (\\a => appPrep' vps.c2 (rnp.s ! a)) vps ; + insertObj (\\a => appPrep vps.c2 (rnp.s ! a)) vps ; ReflPoss num cn = {s = \\a,c => num.s ! cn.g ! c ++ possPron a num.n cn.g c ++ cn.s ! adjfCase Strong c ! num.n ! c} ; @@ -202,7 +202,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer ** lin FocObj np cl = - let n = appPrepNP' cl.c2 np in mkFoc n cl ; + let n = appPrepNP cl.c2 np in mkFoc n cl ; FocAdv adv cl = mkFoc adv.s cl ; @@ -214,7 +214,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer ** -- "treu ist sie ihm" -- "froh ist sie dass er da ist" -- "stolz ist sie auf ihn" - subj = mkSubj' np vp.c1 ; + subj = mkSubj np vp.c1 ; cl = mkClause subj.p1 subj.p2 vp in mkFoc adj cl ; @@ -239,7 +239,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer ** -- "es wird gelacht"; generating formal sentences lincat - FClause = ResGer.VP ** {subj : ResGer.NP'} ; + FClause = ResGer.VP ** {subj : ResGer.NP} ; lin VPass v = @@ -250,7 +250,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer ** AdvFor adv fcl = fcl ** {a2 = adv.s} ; FtoCl cl = - let subj = mkSubj' cl.subj cl.c1 + let subj = mkSubj cl.subj cl.c1 in DisToCl subj.p1 subj.p2 cl ; @@ -259,7 +259,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer ** mkFoc : Str -> Cl -> Foc = \focus, cl -> lin Foc {s = \\m,t,a,p => focus ++ cl.s ! m ! t ! a ! p ! Inv} ; - esSubj : CatGer.NP' = lin NP' { + esSubj : CatGer.NP = lin NP { s = \\_,_ => "es" ; rc, ext = [] ; a = Ag Neutr Sg P3 ; diff --git a/src/german/GrammarGer.gf b/src/german/GrammarGer.gf index 1c0ed02a..c4651534 100644 --- a/src/german/GrammarGer.gf +++ b/src/german/GrammarGer.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:prelude -concrete GrammarGer of Grammar' = +concrete GrammarGer of Grammar = NounGer, VerbGer, AdjectiveGer, diff --git a/src/german/IdiomGer.gf b/src/german/IdiomGer.gf index 4f69772f..9a531821 100644 --- a/src/german/IdiomGer.gf +++ b/src/german/IdiomGer.gf @@ -1,4 +1,4 @@ -concrete IdiomGer of Idiom' = CatGer ** +concrete IdiomGer of Idiom = CatGer ** open MorphoGer, ParadigmsGer, Prelude in { flags optimize=all_subs ; @@ -10,7 +10,7 @@ concrete IdiomGer of Idiom' = CatGer ** CleftNP np rs = mkClause "es" (agrP3 Sg) (insertExtrapos (rs.s ! RGenNum (gennum (genderAgr np.a) (numberAgr np.a))) ---- - (insertObj (\\_ => (np.s ! False ! rs.c ++ bigNP' np)) (predV MorphoGer.sein_V))) ; --HL + (insertObj (\\_ => (np.s ! False ! rs.c ++ bigNP np)) (predV MorphoGer.sein_V))) ; --HL CleftAdv ad s = mkClause "es" (agrP3 Sg) (insertExtrapos (conjThat ++ s.s ! Sub) @@ -19,7 +19,7 @@ concrete IdiomGer of Idiom' = CatGer ** ExistNP np = mkClause "es" (agrP3 Sg) - (insertObj (\\_ => appPrep' geben.c2 (np.s ! False) ++ bigNP' np) + (insertObj (\\_ => appPrep geben.c2 (np.s ! False) ++ bigNP np) (predV geben)) ; ExistIP ip = { @@ -35,8 +35,7 @@ concrete IdiomGer of Idiom' = CatGer ** ExistNPAdv np adv= mkClause "es" (agrP3 Sg) --- (insertAdv adv.s (insertObj (\\_ => appPrep geben.c2 np.s ++ bigNP np) - (insertAdv adv.s (insertObj (\\_ => appPrep' geben.c2 (np.s ! False) ++ bigNP' np) + (insertAdv adv.s (insertObj (\\_ => appPrep geben.c2 (np.s ! False) ++ bigNP np) (predV geben))) ; ExistIPAdv ip adv = { @@ -59,14 +58,14 @@ concrete IdiomGer of Idiom' = CatGer ** } ; ImpP3 np vp = { - s = (mkClause ((mkSubj' np vp.c1).p1) np.a vp).s ! + s = (mkClause ((mkSubj np vp.c1).p1) np.a vp).s ! MConjunct ! Pres ! Simul ! Pos ! Inv } ; SelfAdvVP vp = insertAdv "selbst" vp ; SelfAdVVP vp = insertAdv "selbst" vp ; SelfNP np = np ** { - s = \\_,c => np.s ! False ! c ++ "selbst" ++ bigNP' np ; + s = \\_,c => np.s ! False ! c ++ "selbst" ++ bigNP np ; isPron = False ; } ; diff --git a/src/german/LangGer.gf b/src/german/LangGer.gf index 2fc7921c..f6358abc 100644 --- a/src/german/LangGer.gf +++ b/src/german/LangGer.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../api:../prelude -concrete LangGer of Lang' = +concrete LangGer of Lang = GrammarGer, LexiconGer -- ,ConstructionGer diff --git a/src/german/MakeStructuralGer.gf b/src/german/MakeStructuralGer.gf index 47460102..caacdb0f 100644 --- a/src/german/MakeStructuralGer.gf +++ b/src/german/MakeStructuralGer.gf @@ -11,14 +11,14 @@ oper {s = \\_,_,_ => s ; lock_IQuant = <>} ; mkPredet = overload { - mkPredet : A -> Predet' = \a -> - lin Predet' { + mkPredet : A -> Predet = \a -> + lin Predet { s = appAdj' a ; c = noCase' ; a = PAgNone } ; - mkPredet : A -> Str -> Case -> Bool -> Number -> Predet' = \a,p,c,b,n -> - lin Predet' { + mkPredet : A -> Str -> Case -> Bool -> Number -> Predet = \a,p,c,b,n -> + lin Predet { s = appAdj' a ; c = {p = p ; k = PredCase' c} ; a = case b of {True => PAg n ; _ => PAgNone} @@ -26,11 +26,11 @@ oper } ; -- e.g. das selbe - mmkQuant : Quant' -> A -> Quant' = \q,a -> q ** { + mmkQuant : Quant -> A -> Quant = \q,a -> q ** { s,sp = \\b,x,n,g,c => q.s ! b ! x ! n ! g ! c ++ a.s ! Posit ! agrAdj g q.a n c } ; -- e.g. derjenige - mmbQuant : Quant' -> A -> Quant' = \q,a -> q ** { + mmbQuant : Quant -> A -> Quant = \q,a -> q ** { s,sp = \\b,x,n,g,c => q.s ! b ! x ! n ! g ! c + a.s ! Posit ! agrAdj g q.a n c } ; diff --git a/src/german/MorphoGer.gf b/src/german/MorphoGer.gf index c685de06..251e9e92 100644 --- a/src/german/MorphoGer.gf +++ b/src/german/MorphoGer.gf @@ -17,7 +17,7 @@ oper -- For $StructuralGer$. - mkPrep : Str -> Case -> Preposition' = \s,c -> + mkPrep : Str -> Case -> Preposition = \s,c -> {s = \\_ => s ; s2 = [] ; c = c ; isPrep = isPrep} ; nameNounPhrase' : Gender -> {s : Case => Str} -> {s : Bool => Case => Str ; diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index d4190da5..47020417 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -1,5 +1,5 @@ --# -path=.:../abstract:../common: -concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { +concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { flags optimize=all_subs ; @@ -183,18 +183,18 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { } ; ComplN2 f x = { - s = \\_,n,c => f.s ! n ! c ++ appPrepNP' f.c2 x ; + s = \\_,n,c => f.s ! n ! c ++ appPrepNP f.c2 x ; g = f.g ; rc = \\_ => [] ; ext,adv = [] } ; ComplN3 f x = { - s = \\n,c => f.s ! n ! c ++ appPrepNP' f.c2 x ; - co = f.co ++ appPrepNP' f.c2 x ; ---- should not occur at all; the abstract syntax is problematic in giving N2 + s = \\n,c => f.s ! n ! c ++ appPrepNP f.c2 x ; + co = f.co ++ appPrepNP f.c2 x ; ---- should not occur at all; the abstract syntax is problematic in giving N2 uncap = { - s = \\n,c => f.uncap.s ! n ! c ++ appPrepNP' f.c2 x ; - co = f.uncap.co ++ appPrepNP' f.c2 x ; ---- should not occur at all; the abstract syntax is problematic in giving N2 + s = \\n,c => f.uncap.s ! n ! c ++ appPrepNP f.c2 x ; + co = f.uncap.co ++ appPrepNP f.c2 x ; ---- should not occur at all; the abstract syntax is problematic in giving N2 } ; g = f.g ; c2 = f.c3 ; @@ -231,15 +231,15 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { AdvCN cn a = cn ** {adv = cn.adv ++ a.s} ; ApposCN cn np = let g = cn.g in cn ** { - s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! False ! c ++ bigNP' np } ; + s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! False ! c ++ bigNP np } ; -- PossNP cn np = cn ** { -- s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! NPP CVonDat ++ bigNP np } ; PossNP cn np = cn ** { - s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep' vonDat' (np.s ! False) ++ bigNP' np } ; -- HL, ad hoc + s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep vonDat (np.s ! False) ++ bigNP np } ; -- HL, ad hoc PartNP cn np = case np.w of { - WPron' => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep' vonDat' (np.s ! False) ++ np.rc} ; + WPron' => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep vonDat (np.s ! False) ++ np.rc} ; _ => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! False ! Gen} -- HL 7/2022, ad hoc }; -- glass of wine @@ -247,7 +247,7 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in { -- det or numeral? np or rather (DefArt +) cn? drei (einiger Kinder) ? let g = genderAgr np.a in { - s = \\b,c => det.s ! b ! g ! c ++ appPrepNP' vonDat' np ++ bigNP' np ; + s = \\b,c => det.s ! b ! g ! c ++ appPrepNP vonDat np ++ bigNP np ; a = agrgP3 g det.n ; w = case det.isDef of { True => WLight' ; _ => WHeavy' } ; rc = np.rc ; diff --git a/src/german/ParadigmsGer.gf b/src/german/ParadigmsGer.gf index 70b920ce..b7b77345 100644 --- a/src/german/ParadigmsGer.gf +++ b/src/german/ParadigmsGer.gf @@ -102,7 +102,7 @@ mkN : overload { mkN2 : overload { mkN2 : Str -> N2 ; --% mkN2 : N -> N2 ; -- noun + von - mkN2 : N -> Prep' -> N2 -- noun + other preposition + mkN2 : N -> Prep -> N2 -- noun + other preposition } ; -- Use the function $mkPrep$ or see the section on prepositions below to @@ -111,7 +111,7 @@ mkN : overload { -- -- Three-place relational nouns ("die Verbindung von x nach y") need two prepositions. - mkN3 : N -> Prep' -> Prep' -> N3 ; -- noun + two prepositions + mkN3 : N -> Prep -> Prep -> N3 ; -- noun + two prepositions --3 Proper names and noun phrases -- @@ -168,7 +168,7 @@ mkN : overload { -- Two-place adjectives are formed by adding a preposition to an adjective. - mkA2 : A -> Prep' -> A2 ; -- e.g. teilbar + durch + mkA2 : A -> Prep -> A2 ; -- e.g. teilbar + durch --2 Adverbs @@ -182,28 +182,28 @@ mkN : overload { -- A preposition is formed from a string and a case. mkPrep : overload { - mkPrep : Str -> Case -> Prep' ; -- e.g. "durch" + accusative - mkPrep : Case -> Str -> Prep' ; -- postposition - mkPrep : Str -> Case -> Str -> Prep' ; -- both sides + mkPrep : Str -> Case -> Prep ; -- e.g. "durch" + accusative + mkPrep : Case -> Str -> Prep ; -- postposition + mkPrep : Str -> Case -> Str -> Prep ; -- both sides -- for preposition glued with DefArt in singular: -- e.g. "auf" "auf den" "auf die" "aufs" + accusative - mkPrep : Str -> Str -> Str -> Str-> Case -> Prep' ; - mkPrep : Case -> Prep' ; -- convert case to preposition + mkPrep : Str -> Str -> Str -> Str-> Case -> Prep ; + mkPrep : Case -> Prep ; -- convert case to preposition } ; -- Often just a case with the empty string is enough. - accPrep : Prep' ; -- no string, just accusative case - datPrep : Prep' ; -- no string, just dative case - genPrep : Prep' ; -- no string, just genitive case + accPrep : Prep ; -- no string, just accusative case + datPrep : Prep ; -- no string, just dative case + genPrep : Prep ; -- no string, just genitive case -- A couple of common prepositions (the first two always with the dative). - von_Prep : Prep' ; -- von + dative, with contraction vom - zu_Prep : Prep' ; -- zu + dative, with contractions zum, zur - anDat_Prep : Prep' ; -- an + dative, with contraction am - inDat_Prep : Prep' ; -- in + dative, with contraction im - inAcc_Prep : Prep' ; -- in + accusative, with contraction ins + von_Prep : Prep ; -- von + dative, with contraction vom + zu_Prep : Prep ; -- zu + dative, with contractions zum, zur + anDat_Prep : Prep ; -- an + dative, with contraction am + inDat_Prep : Prep ; -- in + dative, with contraction im + inAcc_Prep : Prep ; -- in + accusative, with contraction ins --2 Verbs @@ -273,7 +273,7 @@ mkV2 : overload { -- Two-place verbs with a preposition. - mkV2 : V -> Prep' -> V2 ; -- preposition for complement + mkV2 : V -> Prep -> V2 ; -- preposition for complement -- Two-place verbs with object in the given case. @@ -287,11 +287,11 @@ mkV2 : overload { -- the first one or both can be absent. accdatV3 : V -> V3 ; -- geben + dat(c2) + acc(c3) (Eng: no prepositions) - dirV3 : V -> Prep' -> V3 ; -- senden + acc + nach (preposition on second arg) + dirV3 : V -> Prep -> V3 ; -- senden + acc + nach (preposition on second arg) mkV3 : overload { mkV3 : V -> V3 ; -- geben + dat(c3) + acc(c2) (Eng: give sth to-sb) - mkV3 : V -> Prep' -> Prep' -> V3 ; -- sprechen + mit + über + mkV3 : V -> Prep -> Prep -> V3 ; -- sprechen + mit + über } ; --3 Other complement patterns @@ -314,15 +314,15 @@ mkV2 : overload { mkV2A : overload { mkV2A : V -> V2A ; - mkV2A : V -> Prep' -> V2A ; + mkV2A : V -> Prep -> V2A ; } ; mkV2S : overload { mkV2S : V -> V2S ; - mkV2S : V -> Prep' -> V2S ; + mkV2S : V -> Prep -> V2S ; } ; mkV2Q : overload { mkV2Q : V -> V2Q ; - mkV2Q : V -> Prep' -> V2Q ; + mkV2Q : V -> Prep -> V2Q ; } ; @@ -338,9 +338,9 @@ mkV2 : overload { mkAS : A -> AS ; --% - mkA2S : A -> Prep' -> A2S ; --% + mkA2S : A -> Prep -> A2S ; --% mkAV : A -> AV ; --% - mkA2V : A -> Prep' -> A2V ; --% + mkA2V : A -> Prep -> A2V ; --% -- Notice: categories $AS, A2S, AV, A2V$ are just $A$, -- and the second argument is given as an adverb. Likewise @@ -447,11 +447,11 @@ mkV2 : overload { mkN2 = overload { mkN2 : Str -> N2 = \s -> vonN2 (regN s) ; mkN2 : N -> N2 = vonN2 ; - mkN2 : N -> Prep' -> N2 = mmkN2 + mkN2 : N -> Prep -> N2 = mmkN2 } ; - mmkN2 : N -> Prep' -> N2 = \n,p -> n ** {c2 = p ; lock_N2 = <>} ; + mmkN2 : N -> Prep -> N2 = \n,p -> n ** {c2 = p ; lock_N2 = <>} ; vonN2 : N -> N2 = \n -> n ** {c2 = von_Prep ; lock_N2 = <>} ; mkN3 = \n,p,q -> n ** {c2 = p ; c3 = q ; lock_N3 = <>} ; @@ -502,17 +502,17 @@ mkV2 : overload { mkAdv s = {s = s ; lock_Adv = <>} ; mkPrep = overload { - mkPrep : Str -> Case -> Prep' = \s,c -> - {s = \\_ => s ; s2 = [] ; c = c ; isPrep = isPrep ; lock_Prep' = <>} ; - mkPrep : Case -> Str -> Prep' = \c,s -> - {s = \\_ => [] ; s2 = s ; c = c ; isPrep = isPrep ; lock_Prep' = <>} ; - mkPrep : Str -> Case -> Str -> Prep' = \s,c,t -> - {s = \\_ => s ; s2 = t ; c = c ; isPrep = isPrep ; lock_Prep' = <>} ; - mkPrep : Str -> Str -> Str -> Str-> Case -> Prep' = \s,masc,fem,neutr, c -> + mkPrep : Str -> Case -> Prep = \s,c -> + {s = \\_ => s ; s2 = [] ; c = c ; isPrep = isPrep ; lock_Prep = <>} ; + mkPrep : Case -> Str -> Prep = \c,s -> + {s = \\_ => [] ; s2 = s ; c = c ; isPrep = isPrep ; lock_Prep = <>} ; + mkPrep : Str -> Case -> Str -> Prep = \s,c,t -> + {s = \\_ => s ; s2 = t ; c = c ; isPrep = isPrep ; lock_Prep = <>} ; + mkPrep : Str -> Str -> Str -> Str-> Case -> Prep = \s,masc,fem,neutr, c -> {s = table{GPl => s ; GSg Masc => masc ; GSg Fem => fem ; GSg Neutr => neutr} ; - s2 = [] ; c = c ; isPrep = isPrepDefArt ; lock_Prep' = <>} ; - mkPrep : Case -> Prep' = \c -> - {s = \\_ => [] ; s2 = [] ; c = c ; isPrep = isCase ; lock_Prep' = <>} ; + s2 = [] ; c = c ; isPrep = isPrepDefArt ; lock_Prep = <>} ; + mkPrep : Case -> Prep = \c -> + {s = \\_ => [] ; s2 = [] ; c = c ; isPrep = isCase ; lock_Prep = <>} ; } ; accPrep = mkPrep accusative ; @@ -590,7 +590,7 @@ mkV2 : overload { mkV3 = overload { mkV3 : V -> V3 = \v -> lin V3 (v ** {c2 = accPrep ; c3 = datPrep}) ; - mkV3 : V -> Prep' -> Prep' -> V3 + mkV3 : V -> Prep -> Prep -> V3 = \v,c,d -> lin V3 (v ** {c2 = c ; c3 = d}) ; } ; @@ -611,38 +611,38 @@ mkV2 : overload { mkV2V = overload { -- default: object-control mkV2V : V -> V2V = \v -> dirV2 v ** {isAux = False ; objCtrl = True ; lock_V2V = <>} ; -- ermahne jmdn, sich zu waschen - mkV2V : V -> Prep' -> V2V + mkV2V : V -> Prep -> V2V = \v,p -> prepV2 v p ** {isAux = False ; objCtrl = True ; lock_V2V = <>} ; } ; auxV2V = overload { auxV2V : V -> V2V = \v -> dirV2 v ** {isAux = True ; objCtrl = True ; lock_V2V = <>} ; -- lasse jmdn sich waschen - auxV2V : V -> Prep' -> V2V + auxV2V : V -> Prep -> V2V = \v,p -> prepV2 v p ** {isAux = True ; objCtrl = True ; lock_V2V = <>} ; } ; subjV2V v = v ** {objCtrl = False} ; mkV2A = overload { mkV2A : V -> V2A = \v -> dirV2 v ** {isAux = False ; lock_V2A = <>} ; - mkV2A : V -> Prep' -> V2A + mkV2A : V -> Prep -> V2A = \v,p -> prepV2 v p ** {isAux = False ; lock_V2A = <>} ; } ; mkV2S = overload { mkV2S : V -> V2S = \v -> dirV2 v ** {isAux = False ; lock_V2S = <>} ; - mkV2S : V -> Prep' -> V2S + mkV2S : V -> Prep -> V2S = \v,p -> prepV2 v p ** {isAux = False ; lock_V2S = <>} ; } ; mkV2Q = overload { mkV2Q : V -> V2Q = \v -> dirV2 v ** {isAux = False ; lock_V2Q = <>} ; - mkV2Q : V -> Prep' -> V2Q + mkV2Q : V -> Prep -> V2Q = \v,p -> prepV2 v p ** {isAux = False ; lock_V2Q = <>} ; } ; mkVA = overload { mkVA : V -> VA = \v -> lin VA (dirV2 v) ; - mkVA : V -> Prep' -> VA = \v,p -> lin VA (v ** {c2 = p}) ; + mkVA : V -> Prep -> VA = \v,p -> lin VA (v ** {c2 = p}) ; } ; mkAS v = v ** {lock_A = <>} ; @@ -713,7 +713,7 @@ mkV2 : overload { }; - prepV2 : V -> Prep' -> V2 ; + prepV2 : V -> Prep -> V2 ; dirV2 : V -> V2 ; @@ -722,7 +722,7 @@ mkV2 : overload { mkV2 = overload { mkV2 : Str -> V2 = \s -> dirV2 (regV s) ; mkV2 : V -> V2 = dirV2 ; - mkV2 : V -> Prep' -> V2 = prepV2; + mkV2 : V -> Prep -> V2 = prepV2; mkV2 : V -> Case -> V2 = \v,c -> prepV2 v (mkPrep c) ; } ; diff --git a/src/german/PhraseGer.gf b/src/german/PhraseGer.gf index 8a0512c3..36c1d4e3 100644 --- a/src/german/PhraseGer.gf +++ b/src/german/PhraseGer.gf @@ -1,5 +1,5 @@ --# -path=.:../abstract:../common:prelude -- HL -concrete PhraseGer of Phrase' = CatGer ** open Prelude, ResGer in { +concrete PhraseGer of Phrase = CatGer ** open Prelude, ResGer in { flags optimize=all_subs ; @@ -14,7 +14,7 @@ concrete PhraseGer of Phrase' = CatGer ** open Prelude, ResGer in { UttIP ip = {s = ip.s ! Nom} ; --- Acc also UttIAdv iadv = iadv ; - UttNP np = {s = np.s ! False ! Nom ++ bigNP' np} ; + UttNP np = {s = np.s ! False ! Nom ++ bigNP np} ; UttVP vp = {s = useInfVP True vp} ; -- without zu UttAdv adv = adv ; UttCN n = {s = n.s ! Strong ! Sg ! Nom ++ n.adv ++ n.ext ++ n.rc ! Sg} ; @@ -26,6 +26,6 @@ concrete PhraseGer of Phrase' = CatGer ** open Prelude, ResGer in { PConjConj conj = ss (conj.s2) ; NoVoc = {s = []} ; - VocNP np = {s = "," ++ np.s ! False ! Nom ++ bigNP' np} ; + VocNP np = {s = "," ++ np.s ! False ! Nom ++ bigNP np} ; } diff --git a/src/german/QuestionGer.gf b/src/german/QuestionGer.gf index 86b7bf7c..50890db2 100644 --- a/src/german/QuestionGer.gf +++ b/src/german/QuestionGer.gf @@ -1,4 +1,4 @@ -concrete QuestionGer of Question' = CatGer ** open ResGer in { +concrete QuestionGer of Question = CatGer ** open ResGer in { flags optimize=all_subs ; @@ -28,8 +28,7 @@ concrete QuestionGer of Question' = CatGer ** open ResGer in { s = \\m,t,a,p => let cls = slash.s ! m ! t ! a ! p ; --- who = appPrep slash.c2 (\\k => usePrepC k (\c -> ip.s ! c)) ; - who = appPrep' slash.c2 ip.s ; + who = appPrep slash.c2 ip.s ; in table { QDir => who ++ cls ! Inv ; QIndir => who ++ cls ! Sub @@ -51,7 +50,7 @@ concrete QuestionGer of Question' = CatGer ** open ResGer in { s = \\m,t,a,p => let vp = predV sein_V ** {ext = icomp.ext}; - subj = mkSubj' np vp.c1 ; + subj = mkSubj np vp.c1 ; cls = (mkClause subj.p1 subj.p2 vp).s ! m ! t ! a ! p ; why = icomp.s ! np.a in table { @@ -61,7 +60,7 @@ concrete QuestionGer of Question' = CatGer ** open ResGer in { } ; PrepIP p ip = { - s = appPrep' p ip.s ; + s = appPrep p ip.s ; } ; AdvIP ip adv = { diff --git a/src/german/RelativeGer.gf b/src/german/RelativeGer.gf index a992e769..f961cb12 100644 --- a/src/german/RelativeGer.gf +++ b/src/german/RelativeGer.gf @@ -1,4 +1,4 @@ -concrete RelativeGer of Relative' = CatGer ** open Prelude, ResGer in { +concrete RelativeGer of Relative = CatGer ** open Prelude, ResGer in { flags optimize=all_subs ; @@ -28,16 +28,12 @@ concrete RelativeGer of Relative' = CatGer ** open Prelude, ResGer in { RelSlash rp slash = { s = \\m,t,a,p,gn => --- appPrep slash.c2 (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ++ - appPrep' slash.c2 (rp.s ! gn) ++ - slash.s ! m ! t ! a ! p ! Sub ; --- c = (prepC slash.c2.c).c + appPrep slash.c2 (rp.s ! gn) ++ slash.s ! m ! t ! a ! p ! Sub ; c = slash.c2.c } ; FunRP p np rp = { --- s = \\gn,c => np.s ! NPC c ++ appPrep p (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ; - s = \\gn,c => np.s ! False ! c ++ appPrep' p (rp.s ! gn) ; + s = \\gn,c => np.s ! False ! c ++ appPrep p (rp.s ! gn) ; a = RAg (numberAgr np.a) (personAgr np.a) } ; diff --git a/src/german/ResGer.gf b/src/german/ResGer.gf index d9ac934c..e474a689 100644 --- a/src/german/ResGer.gf +++ b/src/german/ResGer.gf @@ -228,7 +228,7 @@ resource ResGer = ParamX ** open Prelude in { g : Gender } ; - NP' : Type = { -- HL 7/22: Bool = True if DefArt is dropped to combine with prep of type isPrepDefArt + NP : Type = { -- HL 7/22: Bool = True if DefArt is dropped to combine with prep of type isPrepDefArt s : Bool => Case => Str ; rc : Str ; -- die Frage , [rc die ich gestellt habe] ext : Str ; -- die Frage , [sc wo sie schläft] ; die Regel , [vp kein Fleisch zu essen] | [s dass ...] @@ -405,18 +405,18 @@ resource ResGer = ParamX ** open Prelude in { PrepType = isCase | isPrep | isPrepDefArt ; oper - Preposition' : Type = {s : GenNum => Str ; s2:Str ; c : Case ; isPrep : PrepType} ; + Preposition : Type = {s : GenNum => Str ; s2:Str ; c : Case ; isPrep : PrepType} ; - isaCase : Preposition' -> Bool = \p -> case p.isPrep of {isCase => True ; _ => False} ; - isaPrep : Preposition' -> Bool = \p -> case p.isPrep of {isPrep => True ; _ => False} ; - isaPrepDefArt : Preposition' -> Bool = \p -> case p.isPrep of {isPrepDefArt => True ; _ => False} ; + isaCase : Preposition -> Bool = \p -> case p.isPrep of {isCase => True ; _ => False} ; + isaPrep : Preposition -> Bool = \p -> case p.isPrep of {isPrep => True ; _ => False} ; + isaPrepDefArt : Preposition -> Bool = \p -> case p.isPrep of {isPrepDefArt => True ; _ => False} ; -- To apply a preposition to a complement. - appPrep' : Preposition' -> (Case => Str) -> Str = \prep,arg -> + appPrep : Preposition -> (Case => Str) -> Str = \prep,arg -> prep.s ! GPl ++ arg ! prep.c ++ prep.s2 ; - appPrepNP' : Preposition' -> NP' -> Str = \prep,np -> + appPrepNP : Preposition -> NP -> Str = \prep,np -> let g = (genderAgr np.a) ; n = (numberAgr np.a) ; @@ -428,27 +428,36 @@ resource ResGer = ParamX ** open Prelude in { prep.s ! (GSg g) ++ nps ++ np.ext ++ prep.s2 ++ np.rc ; _ => prep.s ! GPl ++ nps ++ np.ext ++ prep.s2 ++ np.rc } ; - - bigNP' : NP' -> Str = \np -> np.ext ++ np.rc ; +{- + -- Simplify to test the effect on grammar compilation complexity (without SlashV2VNP): + -- with glues = False: 27096 msec, 3,2M VerbGer.gfo, 854K SentenceGer.gfo + -- and SlashV2VNP:102597 msec, 16 M VerbGer.gfo, 854K SentenceGer.gfo (good!) + appPrepNP : Preposition -> NP -> Str = \prep,np -> + let + glues = False ; + nps = np.s ! glues ! prep.c + in prep.s ! GPl ++ nps ++ np.ext ++ prep.s2 ++ np.rc ; +-} + bigNP : NP -> Str = \np -> np.ext ++ np.rc ; -- To build a preposition from just a case. -- HL 9/19: moved to mkPrep in ParadigmsGer - PrepNom' : Preposition' = {s = \\_ => []; isPrep = isCase ; c = Nom ; s2 = []} ; + PrepNom : Preposition = {s = \\_ => []; isPrep = isCase ; c = Nom ; s2 = []} ; - vonDat' : Preposition' = {s=table{GPl => "von" ; GSg Fem => "von der"; _ => "vom"}; - s2=[]; c=Dat; isPrep=isPrepDefArt} ; + vonDat : Preposition = {s=table{GPl => "von" ; GSg Fem => "von der"; _ => "vom"}; + s2=[]; c=Dat; isPrep=isPrepDefArt} ; -- for testing: - Dat' : Preposition' = {s = \\_ => []; s2 = []; c=Dat; isPrep=isCase} ; - mit' : Preposition' = {s = \\_ => "zusammen mit"; s2 = []; c=Dat; isPrep=isPrep} ; + Dat' : Preposition = {s = \\_ => []; s2 = []; c=Dat; isPrep=isCase} ; + mit' : Preposition = {s = \\_ => "zusammen mit"; s2 = []; c=Dat; isPrep=isPrep} ; - zuDat' : Preposition' = {s=\\_ => "zu"; s2="herein"; c=Dat; isPrep=isPrep} ; - zum' : Preposition' = {s= table{GPl => "zu"; GSg Fem =>"zur"; _ => "zum"}; + zuDat' : Preposition = {s=\\_ => "zu"; s2="herein"; c=Dat; isPrep=isPrep} ; + zum' : Preposition = {s= table{GPl => "zu"; GSg Fem =>"zur"; _ => "zum"}; s2="herein"; c=Dat; isPrep=isPrepDefArt} ; - inDat' : Preposition' = {s= \\_ => "in" ; s2="drin"; c=Dat; isPrep=isPrep} ; - im' : Preposition' = {s= table{GPl => "in"; GSg Fem=>"in der"; _ =>"im"}; + inDat' : Preposition = {s= \\_ => "in" ; s2="drin"; c=Dat; isPrep=isPrep} ; + im' : Preposition = {s= table{GPl => "in"; GSg Fem=>"in der"; _ =>"im"}; s2="drin"; c=Dat; isPrep=isPrepDefArt} ; - inAcc' : Preposition' = {s=\\_ => "in"; s2="hinein"; c=Acc; isPrep=isPrep} ; - ins' : Preposition' = {s=table{GPl => "in"; GSg Masc=>"in den"; GSg Fem=>"in die"; GSg Neutr=>"ins"}; + inAcc' : Preposition = {s=\\_ => "in"; s2="hinein"; c=Acc; isPrep=isPrep} ; + ins' : Preposition = {s=table{GPl => "in"; GSg Masc=>"in den"; GSg Fem=>"in die"; GSg Neutr=>"ins"}; s2="hinein"; c=Acc; isPrep=isPrepDefArt} ; -- Pronouns and articles @@ -558,9 +567,9 @@ resource ResGer = ParamX ** open Prelude in { ext : Str ; -- sentential complement of V(2)S, V(2)Q, e.g. dass|ob sie kommt inf : {inpl: (Agr => Str)*Str ; -- infinitival complement of V(2)V HL 3/2022 extr: (Agr => Str)} ; -- e.g. ihn [] versuchen (lasse) [, ihr zu helfen] - c1 : Preposition' -- case of subject + c1 : Preposition -- case of subject } ; - VPSlash = VP ** {c2 : Preposition' ; objCtrl : Bool} ; -- HL 3/2019 objCtr added + VPSlash = VP ** {c2 : Preposition ; objCtrl : Bool} ; -- HL 3/2019 objCtr added -- objCtrl distinguishes object-control from subject-control verb v:V2V in VP.s: -- if True, reflexives in vp.inf and vp.nn have to agree with c2-object (added @@ -622,7 +631,7 @@ resource ResGer = ParamX ** open Prelude in { predV : Verb -> VP = predVGen False ; - predVc : Verb ** {c2 : Preposition'} -> VPSlash = \v -> + predVc : Verb ** {c2 : Preposition} -> VPSlash = \v -> predV v ** {c2 = v.c2 ; objCtrl = False} ; predVGen : Bool -> Verb -> VP = \isAux, verb -> { @@ -636,7 +645,7 @@ resource ResGer = ParamX ** open Prelude in { -- default infinitival complement: inf = {inpl = <\\_ => [], []>; extr = \\_ => []} ; ext,adj : Str = [] ; - c1 = PrepNom' + c1 = PrepNom } ; auxPerfect : Verb -> VForm => Str = \verb -> @@ -711,16 +720,20 @@ resource ResGer = ParamX ** open Prelude in { insertObjc : (Agr => Str) -> VPSlash -> VPSlash = \obj,vp -> insertObj obj vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl } ; - insertObjNP' : NP' -> Preposition' -> VPSlash -> VPSlash = \np,prep,vp -> - let c = prep.c ; - obj = appPrepNP' prep np ; - isPrep : Bool = case prep.isPrep of {isPrep | isPrepDefArt => True ; _ => False} ; - in vp ** { + insertObjNP : NP -> Preposition -> VPSlash -> VPSlash = \np,prep,vp -> + let obj = appPrepNP prep np ; + b : Bool = case prep.isPrep of {isPrep | isPrepDefArt => True ; _ => False} ; + w = np.w ; + c = prep.c + in insertObj' obj b w c vp ; + + insertObj' : Str -> Bool -> Weight' -> Case -> VPSlash -> VPSlash = \obj,isPrep,w,c,vp -> + vp ** { nn = \\a => let vpnn = vp.nn ! a in -- HL 11/6/19: rough object NP order (expensive): -- vfin < accPron < refl < (gen|dat)Pron < lightNP < neg < heavyNP|PP < vinf|comp - case of { -- 2 * 3 * 4 = 24 cases + case of { -- 2 * 3 * 4 = 24 cases => -- ; => -- @@ -732,8 +745,8 @@ resource ResGer = ParamX ** open Prelude in { ; => -- ; - -- => -- - -- ; + => -- + ; => -- } } ; -- the ordering of objects of v:V3 (and v:V4) is also determined by Slash?V3 (and Slash?V4) @@ -983,7 +996,7 @@ resource ResGer = ParamX ** open Prelude in { infPart : Bool -> Str = \b -> if_then_Str b [] "zu" ; - heavyNP' : + heavyNP : {s : Bool => Case => Str ; a : Agr} -> {s : Bool => Case => Str ; a : Agr ; w : Weight' ; ext,rc : Str} = \np -> np ** {w = WHeavy' ; ext,rc = []} ; -- this could be wrong @@ -1002,10 +1015,10 @@ resource ResGer = ParamX ** open Prelude in { -- Function that allows the construction of non-nominative subjects. - mkSubj' : NP' -> Preposition' -> Str * Agr = \np, prep -> + mkSubj : NP -> Preposition -> Str * Agr = \np, prep -> let agr = case prep.c of { Nom => np.a ; _ => Ag Masc Sg P3 } ; - subj = appPrepNP' prep np + subj = appPrepNP prep np in ; } diff --git a/src/german/SentenceGer.gf b/src/german/SentenceGer.gf index 9c0aef6a..dad96379 100644 --- a/src/german/SentenceGer.gf +++ b/src/german/SentenceGer.gf @@ -1,11 +1,11 @@ -concrete SentenceGer of Sentence' = CatGer ** open ResGer, Prelude in { +concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { flags optimize=all_subs ; lin PredVP np vp = - let subj = mkSubj' np vp.c1 + let subj = mkSubj np vp.c1 in mkClause subj.p1 subj.p2 vp ; {- applies verb's subject case to subject ; @@ -33,10 +33,10 @@ concrete SentenceGer of Sentence' = CatGer ** open ResGer, Prelude in { verb.fin ++ ps.p2 ++ (vp.nn ! agr).p1 ++ vp.a1 ++ negation ! pol ++ obj ++ vp.a2 ++ inf ++ vp.ext } ; -- to save (67299 - 27432 = 39863 msec) compile time: HL 7/22, comment out: - SlashVP np vp = - let subj = mkSubj' np vp.c1 ; -- HL 3/2022: need a mkClSlash to prevent +{- SlashVP np vp = + let subj = mkSubj np vp.c1 ; -- HL 3/2022: need a mkClSlash to prevent in mkClause subj.p1 subj.p2 vp ** { c2 = vp.c2 } ; -- reflexives in vp instantiated to np.a - +-} -- cf. tests/german/TestLangGer.gf AdvSlash slash adv = { s = \\m,t,a,b,o => slash.s ! m ! t ! a ! b ! o ++ adv.s ; c2 = slash.c2 @@ -45,7 +45,7 @@ concrete SentenceGer of Sentence' = CatGer ** open ResGer, Prelude in { SlashPrep cl prep = cl ** {c2 = prep} ; SlashVS np vs slash = - let subj = mkSubj' np PrepNom' ; + let subj = mkSubj np PrepNom ; vp = (insertExtrapos (conjThat ++ slash.s ! Sub) (predV vs)) in mkClause subj.p1 subj.p2 vp ** {c2 = slash.c2} ; diff --git a/src/german/StructuralGer.gf b/src/german/StructuralGer.gf index e86fda77..9acc8251 100644 --- a/src/german/StructuralGer.gf +++ b/src/german/StructuralGer.gf @@ -1,4 +1,4 @@ -concrete StructuralGer of Structural' = CatGer ** +concrete StructuralGer of Structural = CatGer ** open MorphoGer, MakeStructuralGer, (X = ConstructX), (P = ParadigmsGer), IrregGer, Prelude in { diff --git a/src/german/SymbolGer.gf b/src/german/SymbolGer.gf index 2838f911..a8126d05 100644 --- a/src/german/SymbolGer.gf +++ b/src/german/SymbolGer.gf @@ -9,27 +9,28 @@ lin NumPN i = {s = i.s ! Neutr ; g = Neutr} ; --- c CNIntNP cn i = { - s = \\c => cn.s ! Weak ! Sg ! Nom ++ i.s ; + s = \\b,c => cn.s ! Weak ! Sg ! Nom ++ i.s ; a = agrP3 Sg ; -- isPron = False ; -- isLight = True ; - w = WLight ; + w = WLight' ; ext,rc = [] -- added } ; CNSymbNP det cn xs = let g = cn.g in { - s = \\c => det.s ! g ! c ++ - (let k = (prepC c).c in cn.s ! adjfCase det.a k ! det.n ! k) ++ xs.s ; + s = \\b,c => det.s ! b ! g ! c ++ +-- (let k = (prepC c).c in cn.s ! adjfCase det.a k ! det.n ! k) ++ xs.s ; + (let k = c in cn.s ! adjfCase det.a k ! det.n ! k) ++ xs.s ; a = agrP3 det.n ; -- isPron = False ; -- isLight = True ; - w = WLight ; + w = WLight' ; ext,rc = [] -- added } ; CNNumNP cn i = { -- s = \\c => artDefContr (GSg cn.g) c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! c ; - s = \\c => artDef (GSg cn.g) c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! c ; + s = \\_,c => artDef ! (GSg cn.g) ! c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! c ; -- HL 8/22 ad hoc a = agrP3 Sg ; - w = WLight ; + w = WLight' ; ext,rc = [] } ; diff --git a/src/german/VerbGer.gf b/src/german/VerbGer.gf index ae789227..4f418e55 100644 --- a/src/german/VerbGer.gf +++ b/src/german/VerbGer.gf @@ -1,4 +1,4 @@ -concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in { +concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { flags optimize=all_subs ; @@ -21,8 +21,8 @@ concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in { SlashV2a v = (predVc v) ; - Slash2V3 v np = insertObjNP' np v.c2 (predVc v) ** {c2 = v.c3} ; - Slash3V3 v np = insertObjNP' np v.c3 (predVc v) ; + Slash2V3 v np = insertObjNP np v.c2 (predVc v) ** {c2 = v.c3} ; + Slash3V3 v np = insertObjNP np v.c3 (predVc v) ; SlashV2S v s = insertExtrapos (comma ++ conjThat ++ s.s ! Sub) (predV v) ** {c2 = v.c2; objCtrl = False} ; @@ -46,7 +46,7 @@ concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in { -- HL 3/22 better before inserting np, using objCtrl let vp = case vps.objCtrl of { True => objAgr np vps ; _ => vps } ** { c2 = vps.c2 ; objCtrl = vps.objCtrl } ; - in insertObjNP' np vps.c2 vp ; + in insertObjNP np vps.c2 vp ; -- compiler: + ComplSlash' 414720 (199680,352) -- SlashVV v vps is like ComplVV v vp, but infinite vps should not be extracted @@ -92,13 +92,17 @@ concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in { -- expensive: + SlashV2VNP 503.884.800 (2880,540), reaches memory limit with SlashVV -- does not work for nested uses: the nn-levels are confused HL 3/22 - -- SlashV2VNP v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22 - -- insertObjNP np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ; - - -- without: 205539 msec --- to save (571098 = 83669 = 487429 msec) compile time (in 58% memory), comment out: - -- SlashV2VNP v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22 - -- insertObjNP' np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ; + -- to save a lot compile time and memory, avoid insertObjNP with glueing of prep+DefArt: + SlashV2VNP v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22 + -- insertObjNP np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ; + let prep = v.c2 ; + obj = appPrep prep (np.s!False) ; -- simplify: no glueing of prep+DefArt, HL 8/22 + b : Bool = case prep.isPrep of {isPrep | isPrepDefArt => True ; _ => False} ; + c = prep.c ; + w = np.w ; + vps = (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) + in + insertObj' obj b w c vps ; UseComp comp = insertExtrapos comp.ext (insertObj comp.s (predV sein_V)) ; -- agr not used diff --git a/tests/german/TestLangGer.gf b/tests/german/TestLangGer.gf index 4fe2bf14..835977b1 100644 --- a/tests/german/TestLangGer.gf +++ b/tests/german/TestLangGer.gf @@ -4,7 +4,7 @@ concrete TestLangGer of TestLang = GrammarGer - [SlashVP, RelSlash] , TestLexiconGer - , ConstructionGer +-- , ConstructionGer ** open ResGer,Prelude,(P=ParadigmsGer) in { flags startcat = Phr ; unlexer = text ; lexer = text ; @@ -28,15 +28,15 @@ concrete TestLangGer of TestLang = (insertObjRefl (predVc v3) ** {c2 = v3.c3}); PassV2Q v q = - let c = case of { - => NPC Nom ; _ => v.c2.c} ; -- acc;pcase object -> nom;pcase subject + let c = case of { + => Nom ; _ => v.c2.c} ; -- acc;pcase object -> nom;pcase subject vp = insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) ** { c1 = v.c2 ** {c = c} } in insertExtrapos (bindComma ++ q.s ! QIndir) vp ; PassV2S v s = - let c = case of { - => NPC Nom ; _ => v.c2.c} ; -- acc;pcase object -> nom;pcase subject + let c = case of { + => Nom ; _ => v.c2.c} ; -- acc;pcase object -> nom;pcase subject vp = insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) ** { c1 = v.c2 ** {c = c} } in insertExtrapos (bindComma ++ conjThat ++ s.s ! Sub) vp ; @@ -44,15 +44,15 @@ concrete TestLangGer of TestLang = PassV2V v vp = let inf = mkInf v.isAux Simul Pos vp ; -- ok for v.isAux=False, v.c2.c=Acc - c = case of { -- v.objCtrl=True HL 3/22 - => NPC Nom ; _ => v.c2.c} ; -- acc;pcase object -> nom;pcase subject + c = case of { -- v.objCtrl=True HL 3/22 + => Nom ; _ => v.c2.c} ; -- acc;pcase object -> nom;pcase subject vp2 = insertObj (\\_ => v.s ! VPastPart APred) (predV werdenPass) ** { c1 = v.c2 ** {c = c} } ; in insertInf inf vp2 ; -- v=lassen needs in-place inf instead PassVPSlash vp = - let c = case of { - => NPC Nom ; _ => vp.c2.c} ; + let c = case of { + => Nom ; _ => vp.c2.c} ; ctrl = case vp.objCtrl of { True => False ; _ => True } -- always False? in -- insertObj (\\_ => (PastPartAP vp).s ! APred) (predV werdenPass ** {c1 = vp.c2 ** {c = c}}) insertObj (\\_ => vp.s.s ! (VPastPart APred)) @@ -164,15 +164,17 @@ gr -tr (PredVP (UsePron ?) (ComplSlash (SlashV2V lassen_V2V (ReflVP (SlashV2a wa } ; lin +{- too expensive 60% memory, then killed: SlashVP np vp = let subj = mkSubj np vp.c1 in mkClSlash subj.p1 subj.p2 vp ** { c2 = vp.c2 } ; - +-} RelSlash rp cls = lin RCl { s = \\m,t,a,p,gn => - appPrep cls.c2 (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ++ +-- appPrep cls.c2 (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ++ + appPrep cls.c2 (rp.s ! gn) ++ cls.s ! m ! t ! a ! p ! Sub ! gn ; - c = (prepC cls.c2.c).c + c = cls.c2.c } ; {- QuestSlash ip slash = { From 0d5919d511324bfad3d7ca337877a5cfd15a7d42 Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Thu, 3 Aug 2023 16:39:30 +0200 Subject: [PATCH 05/16] Extended the new glueing of prepositions with article to {Construction,Markup,Extra}Ger. Minor edits of param Weight, mkSubject and entries in LexiconGer. --- src/german/CatGer.gf | 4 +- src/german/ConjunctionGer.gf | 2 +- src/german/ConstructionGer.gf | 196 ++++++++++++++++++++++++++------ src/german/ExtraGer.gf | 16 +-- src/german/IdiomGer.gf | 2 +- src/german/LangGer.gf | 6 +- src/german/LexiconGer.gf | 6 +- src/german/MakeStructuralGer.gf | 8 +- src/german/MarkupGer.gf | 6 +- src/german/MorphoGer.gf | 18 +-- src/german/NounGer.gf | 34 +++--- src/german/ParadigmsGer.gf | 2 +- src/german/QuestionGer.gf | 22 ++-- src/german/ResGer.gf | 73 +++++++----- src/german/SentenceGer.gf | 31 +++-- src/german/StructuralGer.gf | 38 +++---- src/german/SymbolGer.gf | 6 +- tests/german/TestLangGer.gf | 6 +- 18 files changed, 311 insertions(+), 165 deletions(-) diff --git a/src/german/CatGer.gf b/src/german/CatGer.gf index b0a5f533..c20725ec 100644 --- a/src/german/CatGer.gf +++ b/src/german/CatGer.gf @@ -42,7 +42,7 @@ concrete CatGer of Cat = VPSlash = ResGer.VPSlash ; Comp = {s : Agr => Str ; ext : Str} ; --- Adjective +-- Adjective (HL 7/23: we need c : Agr => Str * Str to handle reflexive objects, cf ReflA2) AP = {s : AForm => Str ; isPre : Bool ; c: Str * Str ; ext : Str} ; -- ich bin [c1 ihm] treu @@ -76,7 +76,7 @@ concrete CatGer of Cat = } ; Predet = { s : Number => Gender => Case => Str ; - c : {p : Str ; k : PredetCase'} ; + c : {p : Str ; k : PredetCase} ; a : PredetAgr -- if an agr is forced, e.g. jeder von uns ist ... } ; diff --git a/src/german/ConjunctionGer.gf b/src/german/ConjunctionGer.gf index aaf5fb23..9abc56ed 100644 --- a/src/german/ConjunctionGer.gf +++ b/src/german/ConjunctionGer.gf @@ -13,7 +13,7 @@ concrete ConjunctionGer of Conjunction = ConjNP conj ss = { s = \\_ => (conjunctDistrTable Case conj { s1 = ss.s1 ; s2 = ss.s2 }).s } ** { a = Ag Fem (conjNumber conj.n (numberAgr ss.a)) (personAgr ss.a) ; - w = WHeavy' ; ext,rc = [] } ; + w = WHeavy ; ext,rc = [] } ; ConjAP conj ss = conjunctDistrTable AForm conj ss ** { isPre = ss.isPre ; c = ss.c ; ext = ss.ext} ; diff --git a/src/german/ConstructionGer.gf b/src/german/ConstructionGer.gf index 9c71d779..95e5b0c1 100644 --- a/src/german/ConstructionGer.gf +++ b/src/german/ConstructionGer.gf @@ -1,28 +1,42 @@ --# -path=.:../abstract concrete ConstructionGer of Construction = CatGer ** - open SyntaxGer, SymbolicGer, ParadigmsGer, + open SyntaxGer, SymbolicGer, (P = ParadigmsGer), (L = LexiconGer), (E = ExtraGer), (G = GrammarGer), (I = IrregGer), (R = ResGer), (N = NounGer), Prelude in { flags coding=utf8 ; +oper + mkPrep : Str -> P.Case -> Prep = P.mkPrep ; + mkV2 : V -> V2 = P.mkV2 ; + accPrep = P.accPrep ; + datPrep = P.datPrep ; + anDat_Prep = P.anDat_Prep ; + inDat_Prep = P.inDat_Prep ; + dative = P.dative ; + accusative = P.accusative ; + feminine = P.feminine ; + neuter = P.neuter ; + regV = P.regV ; + invarA = P.invarA ; + lin - hungry_VP = mkVP (mkA "hungrig") ; - thirsty_VP = mkVP (mkA "durstig") ; - tired_VP = mkVP (mkA "müde") ; - scared_VP = mkVP have_V2 (mkNP (mkN "Angst" "Ängste" feminine)) ; - ill_VP = mkVP (mkA "krank") ; - ready_VP = mkVP (mkA "bereit") ; + hungry_VP = mkVP (P.mkA "hungrig") ; + thirsty_VP = mkVP (P.mkA "durstig") ; + tired_VP = mkVP (P.mkA "müde") ; + scared_VP = mkVP have_V2 (mkNP (P.mkN "Angst" "Ängste" feminine)) ; + ill_VP = mkVP (P.mkA "krank") ; + ready_VP = mkVP (P.mkA "bereit") ; has_age_VP card = mkVP (lin AP (mkAP (lin AdA (mkUtt (mkNP L.year_N))) L.old_A)) ; have_name_Cl x y = mkCl (lin NP x) (mkV2 I.heißen_V) (lin NP y) ; married_Cl x y = ----mkCl (lin NP x) L.married_A2 (lin NP y) | - mkCl (mkNP and_Conj (lin NP x) (lin NP y)) (mkA "verheiratet") ; + mkCl (mkNP and_Conj (lin NP x) (lin NP y)) (P.mkA "verheiratet") ; what_name_QCl x = mkQCl how_IAdv (mkCl (lin NP x) I.heißen_V) ; ---- how_old_QCl x = mkQCl (E.ICompAP (mkAP L.old_A)) (lin NP x) ; ---- compilation slow - how_old_QCl x = mkQCl (E.IAdvAdv (ParadigmsGer.mkAdv "alt")) (mkCl (lin NP x) G.UseCopula) ; ---- + how_old_QCl x = mkQCl (E.IAdvAdv (P.mkAdv "alt")) (mkCl (lin NP x) G.UseCopula) ; ---- how_far_QCl x = mkQCl (E.IAdvAdv L.far_Adv) (mkCl (mkVP (SyntaxGer.mkAdv to_Prep (lin NP x)))) ; -- some more things @@ -31,12 +45,24 @@ lin is_right_VP = mkVP have_V2 (mkNP (ParadigmsGer.mkN "Recht")) ; is_wrong_VP = mkVP have_V2 (mkNP (ParadigmsGer.mkN "Unrecht")) ; - n_units_AP card cn a = mkAP (lin AdA (mkUtt (mkNP (lin CN cn)))) (lin A a) ; - n_unit_CN card unit cn = mkCN (invarA (mkUtt (mkNP (lin CN unit))).s) cn ; +-- n_units_AP card cn a = mkAP (lin AdA (mkUtt (mkNP (lin CN cn)))) (lin A a) ; + n_units_AP card cn a = mkAP (lin AdA (mkUtt (mkNP card cn))) a ; - bottle_of_CN np = N.ApposCN (mkCN (mkN "Flasche")) np ; - cup_of_CN np = N.ApposCN (mkCN (mkN "Tasse")) np ; - glass_of_CN np = N.ApposCN (mkCN (mkN "Glas")) np ; +-- n_unit_CN card unit cn = mkCN (invarA (mkUtt (mkNP (lin CN unit))).s) cn ; + n_unit_CN card unit cn = mkCN (invarA ((mkUtt card).s ++ (mkUtt unit).s)) cn ; + + bottle_of_CN np = N.ApposCN (mkCN (P.mkN "Flasche")) np ; + cup_of_CN np = N.ApposCN (mkCN (P.mkN "Tasse")) np ; + glass_of_CN np = N.ApposCN (mkCN (P.mkN "Glas" "Gläser" neuter)) np ; + + few_X_short_of_Y np x y = -- np.dat fehlen (wenige x).nom an y + let + xs : NP = (mkNP G.few_Det x) ; + ys : NP = (mkNP G.IndefArt y) ; + fehlen_V3 : V3 = P.mkV3 (regV "fehlen") datPrep (mkPrep "an" dative) ; + vp : VP = mkVP (mkVPSlash fehlen_V3 np) ys + in + mkS (mkCl xs vp) ; -- spatial deixis and motion verbs where_go_QCl np = mkQCl (lin IAdv (ss "wohin")) (mkCl np (mkVP L.go_V)) ; @@ -46,15 +72,103 @@ lin come_here_VP = mkVP (mkVP L.come_V) (ParadigmsGer.mkAdv "her") ; come_from_here_VP = mkVP (mkVP L.come_V) (ParadigmsGer.mkAdv "von hier") ; - go_there_VP = mkVP (mkVP L.go_V) (ParadigmsGer.mkAdv "hin") ; + go_there_VP = SyntaxGer.mkVP (SyntaxGer.mkVP L.go_V) (ParadigmsGer.mkAdv "hin") ; come_there_VP = mkVP (mkVP L.come_V) (ParadigmsGer.mkAdv "hin") ; come_from_there_VP = mkVP (mkVP L.come_V) (ParadigmsGer.mkAdv "von dort") ; lincat + Timeunit = N ; + Hour = {short:Str ; long:Str ; adv:Adv} ; Weekday = N ; Monthday = NP ; Month = N ; Year = NP ; + +-- timeunitAdv : Card -> Timeunit -> Adv ; -- (for) three hours +-- timeunitRange : Card -> Card -> Timeunit -> Adv ; -- (cats live) ten to twenty years +lin + timeunitAdv n time = + let n_hours_NP : NP = mkNP n time + in SyntaxGer.mkAdv (for_Prep | accPrep) n_hours_NP ; + + timeunitRange l u time = + {s = l.s ! R.Masc ! R.Nom ++ "bis" ++ u.s ! R.Masc ! R.Nom ++ time.s ! R.Pl ! R.Nom} ; + + oper + mkHour : Str -> Str -> Str -> Hour + = \n,m,daytime -> + let numeral : Str -> Str = \k -> (SyntaxGer.mkUtt (SyntaxGer.mkCard k)).s + in lin Hour {short = numeral n ; long = numeral m ; adv = P.mkAdv daytime} ; + +lin + oneHour = mkHour "1" "1" "nachts" ; + twoHour = mkHour "2" "2" "nachts" ; + threeHour = mkHour "3" "3" "nachts" ; + fourHour = mkHour "4" "4" "morgens" ; + fiveHour = mkHour "5" "5" "morgens" ; + sixHour = mkHour "6" "6" "morgens" ; + sevenHour = mkHour "7" "7" "morgens" ; + eightHour = mkHour "8" "8" "vormittags" ; + nineHour = mkHour "9" "9" "vormittags" ; + tenHour = mkHour "10" "10" "vormittags" ; + elevenHour = mkHour "11" "11" "vormittags" ; + twelveHour = mkHour "12" "12" "mittags" ; + thirteenHour = mkHour "13" "1" "mittags" ; + fourteenHour = mkHour "14" "2" "mittags" ; + fifteenHour = mkHour "15" "3" "nachmittags" ; + sixteenHour = mkHour "16" "4" "nachmittags" ; + seventeenHour = mkHour "17" "5" "nachmittags" ; + eighteenHour = mkHour "18" "6" "nachmittags" ; + nineteenHour = mkHour "19" "7" "abends" ; + twentyHour = mkHour "20" "8" "abends" ; + twentyOneHour = mkHour "21" "9" "abends" ; + twentyTwoHour = mkHour "22" "10" "abends" ; + twentyThreeHour = mkHour "23" "11" "abends" ; + twentyFourHour = mkHour "24" "12" "nachts" ; + + -- timeHour : Hour -> Adv -- at three a.m./p.m. + -- um drei Uhr nachts/nachmittags + + timeHour h = let ada : AdA = lin AdA {s = "um" ++ h.long ++ "Uhr"} + in SyntaxGer.mkAdv ada h.adv ; + + -- timeHourMinute : Hour -> Card -> Adv ; -- at six forty a.m./p.m. + -- um sechs/achtzehn Uhr vierzig + timeHourMinute h card = + let min : Str = (SyntaxGer.mkUtt card).s + in P.mkAdv ("um" ++ h.short ++ "Uhr" ++ min) ; + +{- -- Remark (HL 7/2023): +-- To avoid massive overgeneration, we'd better replace Card here by + cat + Minute ; + fun + timeHourMinute : Hour -> Minute -> Adv ; -- at six forty a.m./p.m. + min_1 : Minute ; + min_2 : Minute ; -- ... min_60 : Minute ; + lastMinute : Minute ; + + oper + Min : PType = Predef.Ints 3 ; -- short for 60 + minutes : Min => Str = table {0 => "0" ; 1 => "1" ; 2 => "2" ; 3 => "3"} ; + mkMinute : Min -> Minute = \j -> lin Minute {s = minutes ! j ; i = j} ; + + lincat + Minute = { s : Str ; i : Min } ; + lin + min_1 = mkMinute 1 ; + min_2 = mkMinute 2 ; + lastMinute = mkMinute 3 ; + timeHourMinute h m = P.mkAdv ("um" ++ h.short ++ ":" ++ m.s ++ "Uhr") ; + +-- But this definition of timeHourMinute causes a compiler error! In +-- timeHourMinute = \h,m -> mkAdv (... ++ m.s ++ ..) +-- the argument m is not really restricted to Min, but an unbounded Int, so +-- m.s = {s = minutes ! j ; i = j}.s = (table (Ints 3) [...]) ! j +-- cannot be reduced in Compute.ConcreteNew, as *the compiler does not enforce* +-- 0 =< j =< 3. +-} + lin weekdayPunctualAdv w = SyntaxGer.mkAdv anDat_Prep (mkNP the_Det w) ; -- am Montag weekdayHabitualAdv w = SyntaxGer.mkAdv (mkPrep "" accusative) (mkNP every_Det w) ; ---- jeden Montag @@ -78,37 +192,45 @@ lin weekdayN w = w ; monthN m = m ; - weekdayPN w = mkPN w ; - monthPN m = mkPN m ; + weekdayPN w = P.mkPN w ; + monthPN m = P.mkPN m ; languageNP l = mkNP l ; languageCN l = mkCN l ; -oper mkLanguage : Str -> N = \s -> mkN s neuter ; ---- produces Neuter +oper mkLanguage : Str -> N = \s -> P.mkN s neuter ; ---- produces Neuter ---------------------------------------------- ---- lexicon of special names -lin monday_Weekday = mkN "Montag" ; -lin tuesday_Weekday = mkN "Dienstag" ; -lin wednesday_Weekday = mkN "Mittwoch" ; -lin thursday_Weekday = mkN "Donnerstag" ; -lin friday_Weekday = mkN "Freitag" ; -lin saturday_Weekday = mkN "Samstag" ; -lin sunday_Weekday = mkN "Sonntag" ; +lin second_Timeunit = P.mkN "Sekunde" ; +lin minute_Timeunit = P.mkN "Minute" ; +lin hour_Timeunit = P.mkN "Stunde" ; +lin day_Timeunit = P.mkN "Tag" ; +lin week_Timeunit = P.mkN "Woche" ; +lin month_Timeunit = P.mkN "Monat"; +lin year_Timeunit = P.mkN "Jahr" "Jahre" neuter ; -lin january_Month = mkN "Januar" ; -lin february_Month = mkN "Februar" ; -lin march_Month = mkN "März" ; -lin april_Month = mkN "April" ; -lin may_Month = mkN "Mai" ; -lin june_Month = mkN "Juni" ; -lin july_Month = mkN "Juli" ; -lin august_Month = mkN "August" ; -lin september_Month = mkN "September" ; -lin october_Month = mkN "Oktober" ; -lin november_Month = mkN "November" ; -lin december_Month = mkN "Dezember" ; +lin monday_Weekday = P.mkN "Montag" ; +lin tuesday_Weekday = P.mkN "Dienstag" ; +lin wednesday_Weekday = P.mkN "Mittwoch" ; +lin thursday_Weekday = P.mkN "Donnerstag" ; +lin friday_Weekday = P.mkN "Freitag" ; +lin saturday_Weekday = P.mkN "Samstag" ; +lin sunday_Weekday = P.mkN "Sonntag" ; + +lin january_Month = P.mkN "Januar" ; +lin february_Month = P.mkN "Februar" ; +lin march_Month = P.mkN "März" ; +lin april_Month = P.mkN "April" ; +lin may_Month = P.mkN "Mai" ; +lin june_Month = P.mkN "Juni" ; +lin july_Month = P.mkN "Juli" ; +lin august_Month = P.mkN "August" ; +lin september_Month = P.mkN "September" ; +lin october_Month = P.mkN "Oktober" ; +lin november_Month = P.mkN "November" ; +lin december_Month = P.mkN "Dezember" ; lin afrikaans_Language = mkLanguage "Afrikaans" ; lin amharic_Language = mkLanguage "Amharisch" ; diff --git a/src/german/ExtraGer.gf b/src/german/ExtraGer.gf index 58e83151..6a60af21 100644 --- a/src/german/ExtraGer.gf +++ b/src/german/ExtraGer.gf @@ -36,14 +36,14 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** DetNPMasc det = { s = \\b,c => det.sp ! b ! Masc ! c ; a = agrgP3 Masc det.n ; - w = case det.isDef of { True => WLight' ; _ => WHeavy' } ; + w = case det.isDef of { True => WLight ; _ => WHeavy } ; ext, rc = [] } ; DetNPFem det = { s = \\b,c => det.sp ! b ! Fem ! c ; a = agrgP3 Fem det.n ; - w = case det.isDef of { True => WLight' ; _ => WHeavy' } ; + w = case det.isDef of { True => WLight ; _ => WHeavy } ; ext, rc = [] } ; @@ -214,8 +214,8 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** -- "treu ist sie ihm" -- "froh ist sie dass er da ist" -- "stolz ist sie auf ihn" - subj = mkSubj np vp.c1 ; - cl = mkClause subj.p1 subj.p2 vp + subj = mkSubject np vp.c1 ; + cl = mkClause subj.s subj.a vp in mkFoc adj cl ; UseFoc t p f = {s = t.s ++ p.s ++ f.s ! t.m ! t.t ! t.a ! p.p} ; @@ -239,7 +239,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** -- "es wird gelacht"; generating formal sentences lincat - FClause = ResGer.VP ** {subj : ResGer.NP} ; + FClause = ResGer.VP ** {subj : ResGer.NP ; lock_FClause : {}} ; lin VPass v = @@ -250,8 +250,8 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** AdvFor adv fcl = fcl ** {a2 = adv.s} ; FtoCl cl = - let subj = mkSubj cl.subj cl.c1 - in DisToCl subj.p1 subj.p2 cl ; + let subj = mkSubject cl.subj cl.c1 + in DisToCl subj.s subj.a cl ; oper -- extra operations for ExtraGer @@ -263,7 +263,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** s = \\_,_ => "es" ; rc, ext = [] ; a = Ag Neutr Sg P3 ; - w = WPron' + w = WPron } ; DisToCl : Str -> Agr -> FClause -> Clause = \subj,agr,vp -> diff --git a/src/german/IdiomGer.gf b/src/german/IdiomGer.gf index 9a531821..fd39f1c7 100644 --- a/src/german/IdiomGer.gf +++ b/src/german/IdiomGer.gf @@ -58,7 +58,7 @@ concrete IdiomGer of Idiom = CatGer ** } ; ImpP3 np vp = { - s = (mkClause ((mkSubj np vp.c1).p1) np.a vp).s ! + s = (mkClause ((mkSubject np vp.c1).s) np.a vp).s ! MConjunct ! Pres ! Simul ! Pos ! Inv } ; diff --git a/src/german/LangGer.gf b/src/german/LangGer.gf index f6358abc..640144ba 100644 --- a/src/german/LangGer.gf +++ b/src/german/LangGer.gf @@ -3,9 +3,9 @@ concrete LangGer of Lang = GrammarGer, LexiconGer --- ,ConstructionGer --- ,DocumentationGer --# notpresent --- ,MarkupGer - [stringMark] + ,ConstructionGer + ,DocumentationGer --# notpresent + ,MarkupGer - [stringMark] ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/german/LexiconGer.gf b/src/german/LexiconGer.gf index 7d168480..e0e5f03f 100644 --- a/src/german/LexiconGer.gf +++ b/src/german/LexiconGer.gf @@ -59,7 +59,7 @@ lin clever_A = mk3A "klug" "klüger" "klügste" ; close_V2 = dirV2 Irreg.schließen_V ; coat_N = mkN "Jacke" | mkN "Mantel" "Mantel" masculine; - cold_A = regA "kalt" ; + cold_A = mk3A "kalt" "kälter" "kälteste" ; come_V = seinV (mk6V "kommen" "kommt" "komm" "kam" "käme" "gekommen") ; computer_N = reg2N "Rechner" "Rechner" masculine ; country_N = reg2N "Land" "Länder" neuter ; @@ -239,14 +239,14 @@ lin dry_A = regA "trocken" ; dull_A = regA "stumpf" ; full_A = regA "voll" ; - heavy_A = mkA "schwer" "schwere" "schwerer" "schwerste" ; + heavy_A = mkA "schwer" "schwerer" "schwerste" ; near_A = mk3A "nahe" "näher" "nächste" ; rotten_A = regA "verdorben" ; round_A = regA "rund" ; sharp_A = mk3A "scharf" "schärfer" "schärfste" ; smooth_A = regA "glatt" ; straight_A = regA "gerade" ; - wet_A = regA "naß" ; + wet_A = mk4A "naß" "nass" "nasser" "nasseste" ; wide_A = regA "breit" ; animal_N = reg2N "Tier" "Tiere" neuter ; ashes_N = mkN "Asche" ; diff --git a/src/german/MakeStructuralGer.gf b/src/german/MakeStructuralGer.gf index caacdb0f..ff2ec97d 100644 --- a/src/german/MakeStructuralGer.gf +++ b/src/german/MakeStructuralGer.gf @@ -13,14 +13,14 @@ oper mkPredet = overload { mkPredet : A -> Predet = \a -> lin Predet { - s = appAdj' a ; - c = noCase' ; + s = appAdj a ; + c = noCase ; a = PAgNone } ; mkPredet : A -> Str -> Case -> Bool -> Number -> Predet = \a,p,c,b,n -> lin Predet { - s = appAdj' a ; - c = {p = p ; k = PredCase' c} ; + s = appAdj a ; + c = {p = p ; k = PredCase c} ; a = case b of {True => PAg n ; _ => PAgNone} } } ; diff --git a/src/german/MarkupGer.gf b/src/german/MarkupGer.gf index 79fe7c95..b3e410cd 100644 --- a/src/german/MarkupGer.gf +++ b/src/german/MarkupGer.gf @@ -1,10 +1,10 @@ ---# -path=.:../abstract:../common +--# -path=.:../abstract:../common:../prelude: -concrete MarkupGer of Markup = CatGer, MarkHTMLX ** { +concrete MarkupGer of Markup = CatGer, MarkHTMLX ** open Prelude in { lin MarkupCN m cn = cn ** {s = \\a,n,c => appMark m (cn.s ! a ! n ! c)} ; --- other fields e.g ext intact - MarkupNP m np = np ** {s = \\c => appMark m (np.s ! c)} ; + MarkupNP m np = np ** {s = \\b,c => appMark m (np.s ! b ! c)} ; MarkupAP m ap = ap ** {s = \\a => appMark m (ap.s ! a)} ; MarkupAdv m adv = {s = appMark m adv.s} ; MarkupS m s = {s = \\o => appMark m (s.s ! o)} ; diff --git a/src/german/MorphoGer.gf b/src/german/MorphoGer.gf index 251e9e92..dc46adc7 100644 --- a/src/german/MorphoGer.gf +++ b/src/german/MorphoGer.gf @@ -20,23 +20,23 @@ oper mkPrep : Str -> Case -> Preposition = \s,c -> {s = \\_ => s ; s2 = [] ; c = c ; isPrep = isPrep} ; - nameNounPhrase' : Gender -> {s : Case => Str} -> {s : Bool => Case => Str ; - a : Agr ; - w : Weight' ; - ext,rc : Str} = + nameNounPhrase : Gender -> {s : Case => Str} -> {s : Bool => Case => Str ; + a : Agr ; + w : Weight ; + ext,rc : Str} = \g,name -> { s = \\_,c => name.s ! c ; a = agrgP3 g Sg ; ext,rc = [] ; - w = WHeavy' -- ok? + w = WHeavy -- ok? } ; - detLikeAdj' : Bool -> Number -> Str -> + detLikeAdj : Bool -> Number -> Str -> {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> - {s,sp = appAdj' (regA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; - detUnlikeAdj' : Bool -> Number -> Str -> + {s,sp = appAdj (regA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; + detUnlikeAdj : Bool -> Number -> Str -> {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> - {s,sp = appAdj' (regDetA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; + {s,sp = appAdj (regDetA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; mkOrd : {s : Degree => AForm => Str} -> {s : AForm => Str} = \a -> {s = a.s ! Posit} ; diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index 47020417..b3785fe2 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -12,12 +12,12 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { -- isLight = det.isDef ; -- ich sehe den Mann nicht vs. ich sehe nicht einen Mann -- isPron = False ; -- HL 6/2019 (but:) sehe (die|einige) Männer nicht -- don't see a|no man = sehe keinen Mann - -- w = case det.isDef of { True => WLight' ; _ => WHeavy' } ; + -- w = case det.isDef of { True => WLight ; _ => WHeavy } ; -- Would be clearer with w:Weight and hasDefArt:Bool with |NP|=|Agr|*3*2 = 108 -- instead of the more efficient w:Weigth' with |NP|=|Agr|*4 = 18*4 = 54 w = case det.isDef of { True => case det.hasDefArt of { True => WDefArt ; - _ => WLight' } ; - _ => WHeavy' } ; + _ => WLight } ; + _ => WHeavy } ; rc = cn.rc ! det.n ; ext = cn.ext } ; @@ -27,48 +27,48 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { a = agrP3 det.n ; -- isLight = det.isDef ; -- isPron = False ; -- HL 6/2019: don't apply pronoun switch: ich gebe ihr das vs. ich gebe es ihr - w = case det.isDef of { True => WLight' ; _ => WHeavy' } ; + w = case det.isDef of { True => WLight ; _ => WHeavy } ; rc, ext = [] } ; UsePN pn = { s = \\_,c => pn.s ! c ; a = agrgP3 pn.g Sg ; - w = WLight' ; -- means: this is not a heavy NP, but comes before negation + w = WLight ; -- means: this is not a heavy NP, but comes before negation rc, ext = [] -- Pron => Light HL 6/2019: to regulate Pron/NonPronNP order } ; UsePron pron = { s = \\_,c => pron.s ! NPCase c ; a = pron.a ; - w = WPron' ; + w = WPron ; rc, ext = [] } ; PredetNP pred np = let ag = case pred.a of {PAg n => agrP3 n ; _ => np.a} in np ** { s = \\b,c0 => - let c = case pred.c.k of {NoCase' => c0 ; PredCase' k => k} in + let c = case pred.c.k of {NoCase => c0 ; PredCase k => k} in pred.s ! numberAgr ag ! genderAgr np.a ! c0 ++ pred.c.p ++ np.s ! b ! c ; a = ag ; - w = WHeavy' + w = WHeavy } ; PPartNP np v2 = np ** { s = \\b,c => np.s ! b ! c ++ (embedInCommas (v2.s ! VPastPart APred)) ; --- invar part - w = WHeavy' + w = WHeavy } ; -- SS: "eine erfolgreiche Frau, geliebt von vielen," but only with v2 not possible in German? -- HL: PPartNP np vps|vp: "der Autor, heute vergessen" , "der Mond, gerade aufgegangen," AdvNP np adv = np ** { s = \\b,c => np.s ! b ! c ++ adv.s ; - w = WHeavy' + w = WHeavy } ; ExtAdvNP np adv = np ** { s = \\b,c => np.s ! b ! c ++ (embedInCommas adv.s) ; - w = WHeavy' + w = WHeavy } ; -- HL 21.7.2022: the dropping of DefArt in Prep+DefArt via hasDefArt works by splitting the @@ -156,7 +156,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { sp = \\_ => table { True => \\_,_,c => [] ; False => table { - Sg => \\g,c => (detUnlikeAdj' False Sg "ein").s ! g ! c ; + Sg => \\g,c => (detUnlikeAdj False Sg "ein").s ! g ! c ; Pl => \\_,c => caselist "einige" "einige" "einigen" "einiger" ! c } } ; @@ -169,7 +169,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { a = agrgP3 cn.g Sg ; -- isLight = True ; -- ich trinke Bier nicht vs. ich trinke kein Bier -- isPron = False ; - w = WLight' ; + w = WLight ; rc = cn.rc ! Sg ; ext = cn.ext ; hasDefArt = False @@ -223,7 +223,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { RelNP np rs = np ** { rc = np.rc ++ embedInCommas (rs.s ! RGenNum (gennum (genderAgr np.a) (numberAgr np.a))) ; - w = case isPron' np of { True => WLight' ; _ => np.w } + w = case isPron np of { True => WLight ; _ => np.w } } ; SentCN cn s = cn ** {ext = cn.ext ++ embedInCommas s.s} ; @@ -239,8 +239,8 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep vonDat (np.s ! False) ++ bigNP np } ; -- HL, ad hoc PartNP cn np = case np.w of { - WPron' => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep vonDat (np.s ! False) ++ np.rc} ; - _ => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! False ! Gen} -- HL 7/2022, ad hoc + WPron => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep vonDat (np.s ! False) ++ np.rc} ; + _ => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! False ! Gen} -- HL 7/2022, ad hoc }; -- glass of wine CountNP det np = -- drei der Kinder | drei von den Kindern -- HL 7/22, ad-hoc TODO @@ -249,7 +249,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { in { s = \\b,c => det.s ! b ! g ! c ++ appPrepNP vonDat np ++ bigNP np ; a = agrgP3 g det.n ; - w = case det.isDef of { True => WLight' ; _ => WHeavy' } ; + w = case det.isDef of { True => WLight ; _ => WHeavy } ; rc = np.rc ; ext = np.ext } ; diff --git a/src/german/ParadigmsGer.gf b/src/german/ParadigmsGer.gf index b7b77345..05de970a 100644 --- a/src/german/ParadigmsGer.gf +++ b/src/german/ParadigmsGer.gf @@ -491,7 +491,7 @@ mkV2 : overload { dunk + "el" => mk3A a (dunk + "ler") (dunk + "leste") ; te + "uer" => mk3A a (te + "urer") (te + "ureste") ; _ + "e" => mk3A a (a + "r") (a + "ste") ; - _ + ("t" | "d" | "s" | "sch" | "z") => mk3A a (a + "er") (a + "este") ; + _ + ("t" | "d" | "s" | "ß" | "sch" | "z" | "au" | "eu") => mk3A a (a + "er") (a + "este") ; _ => mk3A a (a + "er") (a + "ste") } ; diff --git a/src/german/QuestionGer.gf b/src/german/QuestionGer.gf index 50890db2..e5d660fb 100644 --- a/src/german/QuestionGer.gf +++ b/src/german/QuestionGer.gf @@ -13,15 +13,15 @@ concrete QuestionGer of Question = CatGer ** open ResGer in { } } ; - QuestVP qp vp = { - s = \\m,t,a,b,q => - let - cl = (mkClause (qp.s ! Nom) (agrP3 qp.n) vp).s ! m ! t ! a ! b - in - case q of { - QIndir => cl ! Sub ; - _ => cl ! Main - } + QuestVP ip vp = { + s = \\m,t,a,p => + let + who = appPrep vp.c1 ip.s ; + cl = (mkClause who (agrP3 ip.n) vp).s ! m ! t ! a ! p + in table { + QDir => cl ! Main ; + QIndir => cl ! Sub + } } ; QuestSlash ip slash = { @@ -50,8 +50,8 @@ concrete QuestionGer of Question = CatGer ** open ResGer in { s = \\m,t,a,p => let vp = predV sein_V ** {ext = icomp.ext}; - subj = mkSubj np vp.c1 ; - cls = (mkClause subj.p1 subj.p2 vp).s ! m ! t ! a ! p ; + subj = mkSubject np vp.c1 ; + cls = (mkClause subj.s subj.a vp).s ! m ! t ! a ! p ; why = icomp.s ! np.a in table { QDir => why ++ cls ! Inv ; diff --git a/src/german/ResGer.gf b/src/german/ResGer.gf index e474a689..f64e1211 100644 --- a/src/german/ResGer.gf +++ b/src/german/ResGer.gf @@ -56,22 +56,22 @@ resource ResGer = ParamX ** open Prelude in { -- den Menschen"). param - PredetCase' = NoCase' | PredCase' Case ; + PredetCase = NoCase | PredCase Case ; PredetAgr = PAg Number | PAgNone ; oper - noCase' : {p : Str ; k : PredetCase'} = {p = [] ; k = NoCase'} ; + noCase : {p : Str ; k : PredetCase} = {p = [] ; k = NoCase} ; -- Pronominal nps are ordered differently, and light nps come before negation in clauses. -- (To save space, reduce isPron * isLight = 4 values to the following three.) HL 9/19 param - Weight' = WPron' | WLight' | WHeavy' | WDefArt ; -- HL: may need WIndefArt for nicht+ein => kein - oper -- to handle clause negation properly - isPron' : {w : Weight'} -> Bool = \np -> - case np.w of {WPron' => True ; _ => False} ; - isLight' : {w : Weight'} -> Bool = \np -> - case np.w of {WHeavy' => False ; _ => True} ; + Weight = WPron | WLight | WHeavy | WDefArt ; -- HL: may need WIndefArt for nicht+ein => kein + oper -- to handle clause negation properly + isPron : {w : Weight} -> Bool = \np -> + case np.w of {WPron => True ; _ => False} ; + isLight : {w : Weight} -> Bool = \np -> + case np.w of {WHeavy => False ; _ => True} ; --2 For $Adjective$ @@ -233,7 +233,7 @@ resource ResGer = ParamX ** open Prelude in { rc : Str ; -- die Frage , [rc die ich gestellt habe] ext : Str ; -- die Frage , [sc wo sie schläft] ; die Regel , [vp kein Fleisch zu essen] | [s dass ...] a : Agr ; - w : Weight' } ; -- light NPs come before negation in simple clauses + w : Weight } ; -- light NPs come before negation in simple clauses mkN : (x1,_,_,_,_,x6,x7 : Str) -> Gender -> Noun = \Mann, Mannen, Manne, Mannes, Maenner, Maennern, Mann_, g -> { @@ -367,7 +367,7 @@ resource ResGer = ParamX ** open Prelude in { regA : Str -> Adjective = \blau -> let blauest : Str = case blau of { - _ + ("t" | "d" | "s" | "sch" | "z") => blau + "est" ; + _ + ("t" | "d" | "s" | "ß" | "sch" | "z" | "au" | "eu") => blau + "est" ; _ => blau + "st" } in @@ -397,12 +397,13 @@ resource ResGer = ParamX ** open Prelude in { legte ("ge" + legt) [] VHaben ; --- Prepositions are of three types: (i) cases, (ii) pure pre-, post- and circum-positions, --- and (iii) prepositions glued with definite article in singular (using s!(GSg g)). -- Prepositions indicate the case of their complement noun phrase. +-- There are three types: (i) cases, (ii) pure pre-, post- and circum-positions, +-- and (iii) prepositions glued with definite article in singular (using s!(GSg g)). + param - PrepType = isCase | isPrep | isPrepDefArt ; + PrepType = isCase | isPrep | isPrepDefArt ; -- HL 7/2022 oper Preposition : Type = {s : GenNum => Str ; s2:Str ; c : Case ; isPrep : PrepType} ; @@ -462,8 +463,7 @@ resource ResGer = ParamX ** open Prelude in { -- Pronouns and articles -- Here we define personal and relative pronouns. --- All personal pronouns, except "ihr", conform to the simple --- pattern $mkPronPers$. +-- All personal pronouns, except "ihr", conform to the simple pattern $mkPronPers$. mkPronPers : (x1,_,_,_,x5 : Str) -> Gender -> Number -> Person -> {s : NPForm => Str ; a : Agr} = @@ -513,7 +513,7 @@ resource ResGer = ParamX ** open Prelude in { -- This is used when forming determiners that are like adjectives. - appAdj' : Adjective -> Number => Gender => Case => Str = \adj -> + appAdj : Adjective -> Number => Gender => Case => Str = \adj -> let ad : GenNum -> Case -> Str = \gn,c -> adj.s ! Posit ! AMod gn c @@ -727,7 +727,7 @@ resource ResGer = ParamX ** open Prelude in { c = prep.c in insertObj' obj b w c vp ; - insertObj' : Str -> Bool -> Weight' -> Case -> VPSlash -> VPSlash = \obj,isPrep,w,c,vp -> + insertObj' : Str -> Bool -> Weight -> Case -> VPSlash -> VPSlash = \obj,isPrep,w,c,vp -> vp ** { nn = \\a => let vpnn = vp.nn ! a in @@ -736,18 +736,18 @@ resource ResGer = ParamX ** open Prelude in { case of { -- 2 * 3 * 4 = 24 cases => -- ; - => -- + => -- ; - => -- + => -- ; - => -- (assuming v.c2=acc) nonPron: dat < acc|gen + => -- (assuming v.c2=acc) nonPron: dat < acc|gen -- ; - => -- + => -- ; - => -- + => -- ; - => -- + => -- } } ; -- the ordering of objects of v:V3 (and v:V4) is also determined by Slash?V3 (and Slash?V4) @@ -997,8 +997,8 @@ resource ResGer = ParamX ** open Prelude in { infPart : Bool -> Str = \b -> if_then_Str b [] "zu" ; heavyNP : - {s : Bool => Case => Str ; a : Agr} -> {s : Bool => Case => Str ; a : Agr ; w : Weight' ; ext,rc : Str} = \np -> - np ** {w = WHeavy' ; ext,rc = []} ; -- this could be wrong + {s : Bool => Case => Str ; a : Agr} -> {s : Bool => Case => Str ; a : Agr ; w : Weight ; ext,rc : Str} = \np -> + np ** {w = WHeavy ; ext,rc = []} ; -- this could be wrong relPron : RelGenNum => Case => Str = \\rgn,c => case rgn of { @@ -1015,10 +1015,25 @@ resource ResGer = ParamX ** open Prelude in { -- Function that allows the construction of non-nominative subjects. - mkSubj : NP -> Preposition -> Str * Agr = \np, prep -> + mkSubject : NP -> Preposition -> {s:Str ; a:Agr} = \np, prep -> let - agr = case prep.c of { Nom => np.a ; _ => Ag Masc Sg P3 } ; - subj = appPrepNP prep np - in ; + subj = appPrepNP prep np ; + agr = case prep.c of { Nom => np.a ; _ => Ag Masc Sg P3 } + in {s = subj ; a = agr} ; +-- Function to construct a glued Prep+RelPron or a IAdv from a preposition. HL 7/23 + + woStr : Str -> Case -> Str = \prep,c -> case prep of { + "in" => case c of {Acc => "wohin" ; _ => "worin" } ; -- wohin, worin + ("a"|"u") + _ => "wor" + prep ; -- e.g. woran, worauf, woraus, worum + _ => case c of {Gen => "wes"+ prep; -- e.g. weshalb(er), weswegen + _ => "wo" + prep } -- e.g. wodurch, wofür, womit, wozu + } ; + + mkIAdv : Preposition -> {s:Str} = \prep -> case isaPrep prep of { + False => { s = "Bug mkIAdv" } ; + _ => { s = woStr (prep.s ! GPl) prep.c } + }; + + -- Todo: construct relative clauses like (das Haus) [worin ich wohne | woran ich denke] } diff --git a/src/german/SentenceGer.gf b/src/german/SentenceGer.gf index dad96379..8fa423ec 100644 --- a/src/german/SentenceGer.gf +++ b/src/german/SentenceGer.gf @@ -5,8 +5,8 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { lin PredVP np vp = - let subj = mkSubj np vp.c1 - in mkClause subj.p1 subj.p2 vp ; + let subj = mkSubject np vp.c1 + in mkClause subj.s subj.a vp ; {- applies verb's subject case to subject ; forces 3rd person sg agreement for any non-nom subjects --> @@ -26,17 +26,26 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { } ; agr = Ag Fem (numImp n) ps.p1 ; --- g does not matter verb = vps.s ! False ! agr ! VPImperat ps.p3 ; + neg = negation ! pol ; inf = vp.inf.inpl.p2 ++ verb.inf ; -- HL .s/.inpl.p2 - obj = (vp.nn ! agr).p2 ++ (vp.nn ! agr).p3 ++ (vp.nn ! agr).p4 + obj = (vp.nn ! agr).p2 ++ (vp.nn ! agr).p3 ++ (vp.nn ! agr).p4 ++ vp.adj in --- verb.fin ++ ps.p2 ++ (vp.nn ! agr).p1 ++ vp.a1 ! pol ++ obj ++ vp.a2 ++ inf ++ vp.ext - verb.fin ++ ps.p2 ++ (vp.nn ! agr).p1 ++ vp.a1 ++ negation ! pol ++ obj ++ vp.a2 ++ inf ++ vp.ext + verb.fin ++ ps.p2 ++ (vp.nn ! agr).p1 ++ vp.a1 ++ neg ++ obj ++ vp.a2 ++ inf ++ vp.ext } ; + + AdvImp adv imp = { + s = \\pol,impform => adv.s ++ imp.s ! pol ! impform + } ; + -- to save (67299 - 27432 = 39863 msec) compile time: HL 7/22, comment out: -{- SlashVP np vp = - let subj = mkSubj np vp.c1 ; -- HL 3/2022: need a mkClSlash to prevent - in mkClause subj.p1 subj.p2 vp ** { c2 = vp.c2 } ; -- reflexives in vp instantiated to np.a --} -- cf. tests/german/TestLangGer.gf +-- resp. 167061 msec without, 159037 msec with this SlashVP, 53 % memory +-- + SlashV2VNP 199065600 (46080,240) +-- + SlashVP 414720 (28224,204) + + SlashVP np vp = + let subj = mkSubject np vp.c1 ; -- HL 3/2022: need a mkClSlash to prevent + in mkClause subj.s subj.a vp ** { c2 = vp.c2 } ; -- reflexives in vp instantiated to np.a + -- cf. tests/german/TestLangGer.gf AdvSlash slash adv = { s = \\m,t,a,b,o => slash.s ! m ! t ! a ! b ! o ++ adv.s ; c2 = slash.c2 @@ -45,9 +54,9 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { SlashPrep cl prep = cl ** {c2 = prep} ; SlashVS np vs slash = - let subj = mkSubj np PrepNom ; + let subj = mkSubject np PrepNom ; vp = (insertExtrapos (conjThat ++ slash.s ! Sub) (predV vs)) - in mkClause subj.p1 subj.p2 vp ** {c2 = slash.c2} ; + in mkClause subj.s subj.a vp ** {c2 = slash.c2} ; EmbedS s = {s = conjThat ++ s.s ! Sub} ; -- no leading comma, if sentence-initial EmbedQS qs = {s = qs.s ! QIndir} ; diff --git a/src/german/StructuralGer.gf b/src/german/StructuralGer.gf index 9acc8251..d62ee06e 100644 --- a/src/german/StructuralGer.gf +++ b/src/german/StructuralGer.gf @@ -10,7 +10,7 @@ concrete StructuralGer of Structural = CatGer ** above_Prep = mkPrep "über" P.dative ; after_Prep = mkPrep "nach" P.dative ; - all_Predet = {s = appAdj' (regA "all") ; c = noCase' ; a = PAgNone} ; + all_Predet = {s = appAdj (regA "all") ; c = noCase ; a = PAgNone} ; almost_AdA, almost_AdN = ss "fast" ; although_Subj = ss "obwohl" ; always_AdV = ss "immer" ; @@ -31,13 +31,13 @@ concrete StructuralGer of Structural = CatGer ** VHaben) ; during_Prep = mkPrep "während" P.genitive ; --- no variants in the rgl | P.mkPrep P.accusative "über" ; either7or_DConj = sd2 "entweder" "oder" ** {n = Sg} ; - everybody_NP = nameNounPhrase' Masc {s = caselist "jeder" "jeden" "jedem" "jedes"} ; + everybody_NP = nameNounPhrase Masc {s = caselist "jeder" "jeden" "jedem" "jedes"} ; -- every_Det = detUnlikeAdj False Sg "jed" ; - every_Det = let tab = (detUnlikeAdj' False Sg "jed").s + every_Det = let tab = (detUnlikeAdj False Sg "jed").s in {s,sp = asQuant tab ; n = Sg ; a = Weak ; isDef = False ; hasDefArt = False} ; - everything_NP = nameNounPhrase' Neutr {s = caselist "alles" "alles" "allem" "alles"} ; + everything_NP = nameNounPhrase Neutr {s = caselist "alles" "alles" "allem" "alles"} ; everywhere_Adv = ss "überall" ; - few_Det = let tab = (detLikeAdj' False Pl "wenig").s + few_Det = let tab = (detLikeAdj False Pl "wenig").s in {s,sp = asQuant tab ; n = Pl ; a = Weak ; isDef = False ; hasDefArt = False} ; ---- first_Ord = {s = (regA "erst").s ! Posit} ; for_Prep = mkPrep "für" P.accusative ; @@ -48,7 +48,7 @@ concrete StructuralGer of Structural = CatGer ** here_Adv = ss "hier" ; how_IAdv = ss "wie" ; how8much_IAdv = ss "wieviel" ; - how8many_IDet = {s = \\g,c => (detUnlikeAdj' False Pl "wie viel").s ! g ! c ; n = Pl} ; + how8many_IDet = {s = \\g,c => (detUnlikeAdj False Pl "wie viel").s ! g ! c ; n = Pl} ; if_Subj = ss "wenn" ; --- no variants in the RGL! | ss "falls" ; in8front_Prep = mkPrep "vor" P.dative ; i_Pron = mkPronPers "ich" "mich" "mir" "meiner" "mein" Masc Sg P1 ; @@ -56,10 +56,10 @@ concrete StructuralGer of Structural = CatGer ** in_Prep = P.inDat_Prep ; -- HL 7/2022 it_Pron = mkPronPers "es" "es" "ihm" "seiner" "sein" Neutr Sg P3 ; less_CAdv = X.mkCAdv "weniger" "als" ; - many_Det = let tab = (detLikeAdj' False Pl "viel").s + many_Det = let tab = (detLikeAdj False Pl "viel").s in {s,sp = asQuant tab ; n = Pl ; a = Weak ; isDef = False ; hasDefArt = False} ; more_CAdv = X.mkCAdv "mehr" "als" ; - most_Predet = {s = appAdj' (regA "meist") ; c = noCase' ; a = PAgNone} ; + most_Predet = {s = appAdj (regA "meist") ; c = noCase ; a = PAgNone} ; -- much_Det = {s = \\_,_ => "viel" ; sp = \\_,_ => "vieles" ; n = Sg ; a = Weak ; isDef = False} ; much_Det = {s = asQuant (\\_,_ => "viel") ; sp = asQuant (\\_,_ => "vieles") ; n = Sg ; a = Weak ; isDef = False ; hasDefArt = False} ; @@ -70,7 +70,7 @@ concrete StructuralGer of Structural = CatGer ** "müsste" "gemusst" [] VHaben) ; --- one_Quant = DEPREC - only_Predet = {s = \\_,_,_ => "nur" ; c = noCase' ; a = PAgNone} ; + only_Predet = {s = \\_,_,_ => "nur" ; c = noCase ; a = PAgNone} ; no_Utt = ss "nein" ; ---b no_Phr = ss "nein" ; -- on_Prep = mkPrep "auf" P.dative ; @@ -83,8 +83,8 @@ concrete StructuralGer of Structural = CatGer ** quite_Adv = ss "ziemlich" ; she_Pron = mkPronPers "sie" "sie" "ihr" "ihrer" "ihr" Fem Sg P3 ; so_AdA = ss "so" ; - somebody_NP = nameNounPhrase' Masc {s = caselist "jemand" "jemanden" "jemandem" "jemands"} ; - somePl_Det = let tab = (detLikeAdj' True Pl "einig").s + somebody_NP = nameNounPhrase Masc {s = caselist "jemand" "jemanden" "jemandem" "jemands"} ; + somePl_Det = let tab = (detLikeAdj True Pl "einig").s in {s,sp = asQuant tab ; isDef = True ; n = Pl ; a = Weak ; hasDefArt = False} ; someSg_Det = { s,sp = asQuant (\\g,c => "ein" + pronEnding ! GSg g ! c) ; ---- einer,eines @@ -93,10 +93,10 @@ concrete StructuralGer of Structural = CatGer ** hasNum = True ; isDef = False ; hasDefArt = False } ; - something_NP = nameNounPhrase' Neutr {s = \\_ => "etwas"} ; + something_NP = nameNounPhrase Neutr {s = \\_ => "etwas"} ; somewhere_Adv = ss "irgendwo" ; that_Quant = let - jener : Number => Gender => Case => Str = \\n => (detUnlikeAdj' True n "jen").s in + jener : Number => Gender => Case => Str = \\n => (detUnlikeAdj True n "jen").s in {s,sp = \\_,_ => jener ; a,aPl = Weak ; hasDefArt = False} ; ---b that_NP = nameNounPhrase {s = caselist "das" "das" "denem" "dessen"} ; ---- there_Adv = ss "da" ; --- no variants in the rgl | ss "dort" ; @@ -106,7 +106,7 @@ concrete StructuralGer of Structural = CatGer ** ---b these_NP = {s = caselist "diese" "diese" "diesen" "dieser" ; a = agrP3 Pl} ; they_Pron = mkPronPers "sie" "sie" "ihnen" "ihrer" "ihr" Fem Pl P3 ; this_Quant = let - dieser : Number => Gender => Case => Str = \\n => (detUnlikeAdj' True n "dies").s in + dieser : Number => Gender => Case => Str = \\n => (detUnlikeAdj True n "dies").s in {s,sp = \\_,_ => dieser ; a,aPl = Weak ; hasDefArt = False} ; ---b this_NP = nameNounPhrase {s = caselist "dies" "dies" "diesem" "dieses"} ; ---- ---b those_NP = {s = caselist "jene" "jene" "jenen" "jener" ; a = agrP3 Pl} ; @@ -129,7 +129,7 @@ concrete StructuralGer of Structural = CatGer ** when_IAdv = ss "wann" ; when_Subj = ss "wenn" ; where_IAdv = ss "wo" ; - which_IQuant = {s = \\n,g,c => (detUnlikeAdj' True n "welch").s ! g ! c} ; + which_IQuant = {s = \\n,g,c => (detUnlikeAdj True n "welch").s ! g ! c} ; whoSg_IP = {s = caselist "wer" "wen" "wem" "wessen" ; n = Sg} ; whoPl_IP = {s = caselist "wer" "wen" "wem" "wessen" ; n = Sg} ; -- HL 6/2016 @@ -141,19 +141,19 @@ concrete StructuralGer of Structural = CatGer ** youPol_Pron = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Fem Pl P3 ; yes_Utt = ss "ja" ; - not_Predet = {s = \\_,_,_ => "nicht" ; c = noCase' ; a = PAgNone} ; + not_Predet = {s = \\_,_,_ => "nicht" ; c = noCase ; a = PAgNone} ; no_Quant = let keiner : Number => Gender => Case => Str = table { Sg => \\g,c => "kein" + pronEnding ! GSg g ! c ; - Pl => (detUnlikeAdj' False Pl "kein").s + Pl => (detUnlikeAdj False Pl "kein").s } in {s,sp = \\_,_ => keiner ; a = Strong ; aPl = Weak ; hasDefArt = False} ; ---- sp if_then_Conj = {s1 = "wenn" ; s2 = "dann" ; n = Sg ; lock_Conj = <>} ; nobody_NP = - nameNounPhrase' Masc {s = caselist "niemand" "niemanden" "niemandem" "niemands"} ; + nameNounPhrase Masc {s = caselist "niemand" "niemanden" "niemandem" "niemands"} ; nothing_NP = - nameNounPhrase' Neutr {s = \\_ => "nichts"} ; --maybe add: nameNounPhrase {s = \\_ => "garnichts"} + nameNounPhrase Neutr {s = \\_ => "nichts"} ; --maybe add: nameNounPhrase {s = \\_ => "garnichts"} at_least_AdN = ss "wenigstens" ; at_most_AdN = ss "höchstens" ; except_Prep = mkPrep "außer" P.dative ; diff --git a/src/german/SymbolGer.gf b/src/german/SymbolGer.gf index a8126d05..b6a840b4 100644 --- a/src/german/SymbolGer.gf +++ b/src/german/SymbolGer.gf @@ -13,7 +13,7 @@ lin a = agrP3 Sg ; -- isPron = False ; -- isLight = True ; - w = WLight' ; + w = WLight ; ext,rc = [] -- added } ; CNSymbNP det cn xs = let g = cn.g in { @@ -23,14 +23,14 @@ lin a = agrP3 det.n ; -- isPron = False ; -- isLight = True ; - w = WLight' ; + w = WLight ; ext,rc = [] -- added } ; CNNumNP cn i = { -- s = \\c => artDefContr (GSg cn.g) c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! c ; s = \\_,c => artDef ! (GSg cn.g) ! c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! c ; -- HL 8/22 ad hoc a = agrP3 Sg ; - w = WLight' ; + w = WLight ; ext,rc = [] } ; diff --git a/tests/german/TestLangGer.gf b/tests/german/TestLangGer.gf index 835977b1..5a5268d8 100644 --- a/tests/german/TestLangGer.gf +++ b/tests/german/TestLangGer.gf @@ -166,8 +166,8 @@ gr -tr (PredVP (UsePron ?) (ComplSlash (SlashV2V lassen_V2V (ReflVP (SlashV2a wa lin {- too expensive 60% memory, then killed: SlashVP np vp = - let subj = mkSubj np vp.c1 - in mkClSlash subj.p1 subj.p2 vp ** { c2 = vp.c2 } ; + let subj = mkSubject np vp.c1 + in mkClSlash subj.s subj.a vp ** { c2 = vp.c2 } ; -} RelSlash rp cls = lin RCl { s = \\m,t,a,p,gn => @@ -214,7 +214,7 @@ gr -tr (PredVP (UsePron ?) (ComplSlash (SlashV2V lassen_V2V (ReflVP (SlashV2a wa obj2 = (vp.nn ! ag).p3 ; -- pp-objects and heavy nps obj3 = (vp.nn ! ag).p4 ++ vp.adj ++ vp.a2 ; -- pred.AP|CN|Adv, via useComp HL 6/2019 compl : Str = obj1 ++ obj2 ++ neg ++ obj3 ; - infObjs = (vp.inf.inpl.p1) ! ag ; + infObjs = vp.inf.inpl.p1 ! ag ; infPred = vp.inf.inpl.p2 ; infCompl : Str = case of { => [] ; _ => infObjs ++ infPred } ; From c8a424c0237d39c21200664fa8a2312656f7d352 Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Fri, 4 Aug 2023 20:34:02 +0200 Subject: [PATCH 06/16] Implementation of prep+DefArt-gluing independent of |PCase| finished --- src/german/AllGer.gf | 2 +- src/german/ExtendGer.gf | 24 ++++++++++++------------ src/german/NounGer.gf | 25 +++++++------------------ src/german/ParadigmsGer.gf | 16 ++++++++++------ src/german/StructuralGer.gf | 3 +-- src/german/SymbolGer.gf | 8 +------- 6 files changed, 32 insertions(+), 46 deletions(-) diff --git a/src/german/AllGer.gf b/src/german/AllGer.gf index ad643b20..83e6751f 100644 --- a/src/german/AllGer.gf +++ b/src/german/AllGer.gf @@ -5,5 +5,5 @@ concrete AllGer of AllGerAbs = IrregGer, ---- ExtendGer, ---- to replace ExtraGer ExtraGer - -- ** open ExtendGer in {} ---- to force compilation HL 7/22 todo: ListNP' in ExtendGer + ** open ExtendGer in {} ---- to force compilation ; diff --git a/src/german/ExtendGer.gf b/src/german/ExtendGer.gf index bf6757c7..bf925555 100644 --- a/src/german/ExtendGer.gf +++ b/src/german/ExtendGer.gf @@ -7,6 +7,7 @@ concrete ExtendGer of Extend = VPS, ListVPS, VPI, ListVPI, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, + GenModNP, CardCNCard ] with @@ -24,9 +25,9 @@ concrete ExtendGer of Extend = VPS = {s : Order => Agr => Str} ; [VPS] = {s1,s2 : Order => Agr => Str} ; -lin + lin - InOrderToVP vp = {s = "um" ++ useInfVP False vp} ; + InOrderToVP vp = {s = "um" ++ useInfVP False vp} ; BaseVPI = twoTable Bool ; ConsVPI = consrTable Bool comma ; @@ -43,7 +44,7 @@ lin PredVPS np vpi = let - subj = np.s ! NPC Nom ++ bigNP np ; + subj = np.s ! False ! Nom ++ bigNP np ; agr = np.a ; in { s = \\o => @@ -114,31 +115,30 @@ lin ConjVPS = conjunctDistrTable2 Order Agr ; UseDAP det = { - s = \\c => det.sp ! Neutr ! c ; + s = \\b,c => det.sp ! Neutr ! c ; a = agrP3 det.n ; w = case det.isDef of { True => WLight ; _ => WHeavy } ; rc, ext = [] } ; UseDAPMasc det = { - s = \\c => det.sp ! Masc ! c ; + s = \\_,c => det.sp ! Masc ! c ; a = agrP3 det.n ; w = WLight ; rc, ext = [] } ; UseDAPFem det = { - s = \\c => det.sp ! Fem ! c ; + s = \\_,c => det.sp ! Fem ! c ; a = agrP3 det.n ; w = WLight ; rc, ext = [] } ; -lin - CardCNCard card cn = { - s = \\g,c => - (Grammar.DetCN (Grammar.DetQuant Grammar.IndefArt (Grammar.NumCard card)) cn).s ! NPC c ; - n = Pl - } ; + CardCNCard card cn = { + s = \\g,c => + (Grammar.DetCN (Grammar.DetQuant Grammar.IndefArt (Grammar.NumCard card)) cn).s ! False ! c ; + n = Pl + } ; } diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index b3785fe2..c70f19f0 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -4,17 +4,18 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { flags optimize=all_subs ; -- Remark: np.isLight makes ResGer.insertObjNP expensive, for ComplSlash, SlashVP +-- np.isLight = True and np.isPron = True are now part of np.w + + -- HL 21.7.2022: the dropping of DefArt in Prep+DefArt works by selecting from + -- np.s via b = det.hasDefArt = True the forms without det.s and from prep.s + -- the preposition glued with definite article singular, depending on gender, case. lin DetCN det cn = { s = \\b,c => det.s ! b ! cn.g ! c ++ cn.s ! (adjfCase det.a c) ! det.n ! c ++ cn.adv ; a = agrgP3 cn.g det.n ; -- isLight = det.isDef ; -- ich sehe den Mann nicht vs. ich sehe nicht einen Mann - -- isPron = False ; -- HL 6/2019 (but:) sehe (die|einige) Männer nicht - -- don't see a|no man = sehe keinen Mann - -- w = case det.isDef of { True => WLight ; _ => WHeavy } ; - -- Would be clearer with w:Weight and hasDefArt:Bool with |NP|=|Agr|*3*2 = 108 - -- instead of the more efficient w:Weigth' with |NP|=|Agr|*4 = 18*4 = 54 + -- HL 6/2019 (but:) sehe (die|einige) Männer nicht; don't see a|no man = sehe keinen Mann w = case det.isDef of { True => case det.hasDefArt of { True => WDefArt ; _ => WLight } ; _ => WHeavy } ; @@ -25,7 +26,6 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { DetNP det = { -- more genders in ExtraGer -- HL: der+er,den+en ; der drei,den drei+en s = \\b,c => det.sp ! b ! Neutr ! c ; a = agrP3 det.n ; - -- isLight = det.isDef ; -- isPron = False ; -- HL 6/2019: don't apply pronoun switch: ich gebe ihr das vs. ich gebe es ihr w = case det.isDef of { True => WLight ; _ => WHeavy } ; rc, ext = [] @@ -71,15 +71,6 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { w = WHeavy } ; - -- HL 21.7.2022: the dropping of DefArt in Prep+DefArt via hasDefArt works by splitting the - -- np.s into det':Str and cn:Str and (det.s ! g ! n) into {quant:Str; num:Str}, so that in - -- PrepNP in_Prep np we can replace "in" + "das" by "im" to get - -- PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (warme Meer)) => im warmen Meer - -- But parsing "im warmen Meer" results in a - -- PrepNP in_Prep (DetCN (DetQuant ? NumSg) (AdjCN ... )) - -- because (DetQuant.s!g!c).quant is ignored, but the .num is part of (np.s!c).p2. - -- To avoid the metavariable ?, we have to made Det.s and NP.s depend on t:PrepType = isPrep. - DetQuantOrd quant num ord = let n = num.n ; @@ -167,9 +158,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { MassNP cn = { s = \\_,c => cn.s ! Strong ! Sg ! c ++ cn.adv ; a = agrgP3 cn.g Sg ; - -- isLight = True ; -- ich trinke Bier nicht vs. ich trinke kein Bier - -- isPron = False ; - w = WLight ; + w = WLight ; -- ich trinke Bier nicht vs. ich trinke kein Bier rc = cn.rc ! Sg ; ext = cn.ext ; hasDefArt = False diff --git a/src/german/ParadigmsGer.gf b/src/german/ParadigmsGer.gf index 05de970a..3f03c400 100644 --- a/src/german/ParadigmsGer.gf +++ b/src/german/ParadigmsGer.gf @@ -197,13 +197,15 @@ mkN : overload { datPrep : Prep ; -- no string, just dative case genPrep : Prep ; -- no string, just genitive case --- A couple of common prepositions (the first two always with the dative). +-- A couple of common prepositions (the first three always with the dative). - von_Prep : Prep ; -- von + dative, with contraction vom - zu_Prep : Prep ; -- zu + dative, with contractions zum, zur - anDat_Prep : Prep ; -- an + dative, with contraction am - inDat_Prep : Prep ; -- in + dative, with contraction im - inAcc_Prep : Prep ; -- in + accusative, with contraction ins + von_Prep : Prep ; -- von + dative, with contraction vom + zu_Prep : Prep ; -- zu + dative, with contractions zum, zur + bei_Prep : Prep ; -- bei + dative, with contraction beim + anDat_Prep : Prep ; -- an + dative, with contraction am + inDat_Prep : Prep ; -- in + dative, with contraction im + inAcc_Prep : Prep ; -- in + accusative, with contraction ins + aufAcc_Prep : Prep ; -- auf + accusative, with contraction aufs --2 Verbs @@ -522,10 +524,12 @@ mkV2 : overload { --von_Prep = mkPrep "von" dative ; von_Prep = mkPrep "von" "vom" "von der" "vom" dative ; zu_Prep = mkPrep "zu" "zum" "zur" "zum" dative ; + bei_Prep = mkPrep "bei" "beim" "bei der" "beim" dative ; inDat_Prep = mkPrep "in" "im" "in der" "im" dative ; inAcc_Prep = mkPrep "in" "in den" "in die" "ins" accusative ; anDat_Prep = mkPrep "an" "am" "an der" "am" dative ; anAcc_Prep = mkPrep "an" "an den" "an die" "ans" accusative ; + aufAcc_Prep = mkPrep "auf" "auf den" "auf die" "aufs" accusative ; mk6V geben gibt gib gab gaebe gegeben = let diff --git a/src/german/StructuralGer.gf b/src/german/StructuralGer.gf index d62ee06e..b45077a5 100644 --- a/src/german/StructuralGer.gf +++ b/src/german/StructuralGer.gf @@ -73,8 +73,7 @@ concrete StructuralGer of Structural = CatGer ** only_Predet = {s = \\_,_,_ => "nur" ; c = noCase ; a = PAgNone} ; no_Utt = ss "nein" ; ---b no_Phr = ss "nein" ; --- on_Prep = mkPrep "auf" P.dative ; - on_Prep = P.mkPrep "auf" "auf den" "auf die" "aufs" P.accusative ; -- test HL 7/2022 + on_Prep = mkPrep "auf" P.dative ; or_Conj = {s1 = [] ; s2 = "oder" ; n = Sg} ; otherwise_PConj = ss "sonst" ; part_Prep = P.von_Prep ; -- obsolete, use PartNP cn np diff --git a/src/german/SymbolGer.gf b/src/german/SymbolGer.gf index b6a840b4..49b31cde 100644 --- a/src/german/SymbolGer.gf +++ b/src/german/SymbolGer.gf @@ -11,18 +11,12 @@ lin CNIntNP cn i = { s = \\b,c => cn.s ! Weak ! Sg ! Nom ++ i.s ; a = agrP3 Sg ; - -- isPron = False ; - -- isLight = True ; w = WLight ; ext,rc = [] -- added } ; CNSymbNP det cn xs = let g = cn.g in { - s = \\b,c => det.s ! b ! g ! c ++ --- (let k = (prepC c).c in cn.s ! adjfCase det.a k ! det.n ! k) ++ xs.s ; - (let k = c in cn.s ! adjfCase det.a k ! det.n ! k) ++ xs.s ; + s = \\b,c => det.s ! b ! g ! c ++ cn.s ! adjfCase det.a c ! det.n ! c ++ xs.s ; a = agrP3 det.n ; - -- isPron = False ; - -- isLight = True ; w = WLight ; ext,rc = [] -- added } ; From e2ce9de5039c2dedfe6e1ce7dd63fdb5fea490bd Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Sat, 5 Aug 2023 18:01:03 +0200 Subject: [PATCH 07/16] Conflicts with preposition and defart resolved --- src/german/DocumentationGerFunctor.gf | 2 +- src/german/ExtraGer.gf | 36 +++++++++++++-------------- src/german/NamesGer.gf | 10 ++++---- src/german/NounGer.gf | 4 +-- src/german/ParadigmsGer.gf | 14 +++++++---- src/german/ResGer.gf | 4 +-- src/german/StructuralGer.gf | 9 +++---- 7 files changed, 41 insertions(+), 38 deletions(-) diff --git a/src/german/DocumentationGerFunctor.gf b/src/german/DocumentationGerFunctor.gf index eedea374..3ba7ff38 100644 --- a/src/german/DocumentationGerFunctor.gf +++ b/src/german/DocumentationGerFunctor.gf @@ -163,7 +163,7 @@ oper let vfin : VForm -> Str = \f -> verb.s ! f ++ verb.prefix ; - gforms : Number -> Person -> Str = \n,p -> + gforms : ParadigmsGer.Number -> Person -> Str = \n,p -> td (vfin (VFin False (VPresInd n p))) ++ td (vfin (VFin False (VPresSubj n p))) ++ td (vfin (VFin False (VImpfInd n p))) --# notpresent diff --git a/src/german/ExtraGer.gf b/src/german/ExtraGer.gf index 4994c87a..c884dd8b 100644 --- a/src/german/ExtraGer.gf +++ b/src/german/ExtraGer.gf @@ -210,36 +210,36 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** PredetRNP pred rnp = rnp ** { -- HL 5/2022 s = \\a,c => let n = case pred.a of {PAg n => n ; _ => numberAgr a} ; g = genderAgr a ; - d = case pred.c.k of {NoCase => c ; PredCase k => (prepC k).c} ; + d = case pred.c.k of {NoCase => c ; PredCase k => k} ; in case rnp.isPron of { - True => pred.s ! Pl ! Masc ! (NPC c) ++ "von" ++ rnp.s ! a ! Dat ; - _ => pred.s ! n ! genderAgr a ! (NPC c) ++ pred.c.p ++ rnp.s ! a ! d} ; + True => pred.s ! Pl ! Masc ! c ++ "von" ++ rnp.s ! a ! Dat ; + _ => pred.s ! n ! genderAgr a ! c ++ pred.c.p ++ rnp.s ! a ! d} ; ext = rnp.ext ; rc = rnp.rc ; isPron = False} ; -- ok: alle von uns; die meisten von uns ; wrong: *nur von uns =/= nur wir - AdvRNP np prep rnp = {s = \\a,c => np.s ! (NPC c) - ++ appPrepC prep (rnp.s ! a) ++ rnp.ext ++ rnp.rc ; + AdvRNP np prep rnp = {s = \\a,c => np.s ! False ! c + ++ appPrep prep (rnp.s ! a) ++ rnp.ext ++ rnp.rc ; ext = np.ext ; rc = np.rc ; isPron = False} ; AdvRAP ap prep rnp = let -- ? adv ++ ap.s ! af - adv = appPrepC prep (rnp.s ! agrP3 Sg) ; -- bug: fixed agreement + adv = appPrep prep (rnp.s ! agrP3 Sg) ; -- bug: fixed agreement in ap ** { s = \\af => ap.s ! af ++ adv } ; -- e.g. unknown in one's youth ReflA2RNP adj rnp = -- would need AP.c : Agr => Str*Str, not AP.c : Str*Str let -- as we have no reflexive AP, - compl = appPrepC adj.c2 (rnp.s ! agrP3 Sg) ; -- we use a fixed agreement + compl = appPrep adj.c2 (rnp.s ! agrP3 Sg) ; -- we use a fixed agreement in { s = adj.s ! Posit ; isPre = True ; - c = case adj.c2.isPrep of {False => ; True => <[], compl>} ; + c = case adj.c2.isPrep of {isCase => ; _ => <[], compl>} ; ext = rnp.ext ++ rnp.rc } ; PossPronRNP pron num cn rnp = N.DetCN (N.DetQuant (N.PossPron pron) num) - (N.PossNP cn (lin NP {s = \\pc => usePrepC pc (\c -> rnp.s ! pron.a ! c) ; + (N.PossNP cn (lin NP {s = \\_,c => rnp.s ! pron.a ! c ; a = pron.a ; w = WLight ; ext = rnp.ext ; @@ -253,11 +253,11 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** ** {isPron = False ; ext,rc = []} ; Base_rr_RNP x y = twoTable2 Agr Case x y ; - Base_nr_RNP x y = twoTable2 Agr Case {s = \\_,c => x.s ! (NPC c) ++ x.ext ++ x.rc} y ; - Base_rn_RNP x y = twoTable2 Agr Case x {s = \\_,c => y.s ! (NPC c) ++ y.ext ++ y.rc} ; + Base_nr_RNP x y = twoTable2 Agr Case {s = \\_,c => x.s ! False ! c ++ x.ext ++ x.rc} y ; + Base_rn_RNP x y = twoTable2 Agr Case x {s = \\_,c => y.s ! False ! c ++ y.ext ++ y.rc} ; Cons_rr_RNP x xs = consrTable2 Agr Case comma x xs ; - Cons_nr_RNP x xs = consrTable2 Agr Case comma {s = \\_,c => x.s ! (NPC c) ++ x.ext ++ x.rc} xs ; + Cons_nr_RNP x xs = consrTable2 Agr Case comma {s = \\_,c => x.s ! False ! c ++ x.ext ++ x.rc} xs ; oper reflPronSelf : Agr => Case => Str = \\a => \\c => reflPron ! a ! c ++ "selbst" ; @@ -269,16 +269,16 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** insertObjReflNP : ResGer.VPSlash -> RNP -> ResGer.VP = -- HL 5/2022 \vp,rnp -> -- generalize ResGer.insertObjRefl let prep = vp.c2 ; - c = case prep.c of { NPC cc => cc ; _ => Acc } ; -- put rnp.ext ++ rnp.rc to vp.ext ? - obj : Agr => Str = \\a => prep.s ++ rnp.s ! a ! c ++ rnp.ext ++ rnp.rc + c = case prep.isPrep of { isCase => prep.c ; _ => Acc } ; -- put rnp.ext ++ rnp.rc to vp.ext ? + obj : Agr => Str = \\a => prep.s ! GPl ++ rnp.s ! a ! c ++ rnp.ext ++ rnp.rc in vp ** { nn = \\a => let vpnn = vp.nn ! a in case of { -- consider non-pron rnp as light, add to vpnn.p2 - => ; -- pronoun switch: - => ; -- accPron < pron - => ; -- < non-pron nominal - => } -- or prepositional + => ; -- pronoun switch: + => ; -- accPron < pron + => ; -- < non-pron nominal + <_,_,_> => } -- or prepositional } ; -- SS: implementation of some of the relevant Foc rules from Extra diff --git a/src/german/NamesGer.gf b/src/german/NamesGer.gf index d7d35f2f..8572e01b 100644 --- a/src/german/NamesGer.gf +++ b/src/german/NamesGer.gf @@ -1,35 +1,35 @@ concrete NamesGer of Names = CatGer ** open ResGer in { lin GivenName gn = { - s = \\c => usePrepC c (\k -> gn.s ! k) ; + s = \\_,c => gn.s ! c ; a = agrgP3 (sex2gender gn.g) Sg ; w = WLight ; rc, ext = [] } ; lin MaleSurname sn = { - s = \\c => usePrepC c (\k -> sn.s ! Male ! k) ; + s = \\_,c => sn.s ! Male ! c ; a = agrgP3 Masc Sg ; w = WLight ; rc, ext = [] } ; lin FemaleSurname sn = { - s = \\c => usePrepC c (\k -> sn.s ! Female ! k) ; + s = \\_,c => sn.s ! Female ! c ; a = agrgP3 Fem Sg ; w = WLight ; rc, ext = [] } ; lin PlSurname sn = { - s = \\c => usePrepC c (\k -> sn.s ! Male ! k) ; + s = \\_,c => sn.s ! Male ! c ; a = agrgP3 Masc Pl ; w = WLight ; rc, ext = [] } ; lin FullName gn sn = { - s = \\c => usePrepC c (\k -> gn.s ! Nom ++ sn.s ! gn.g ! k) ; + s = \\_,c => gn.s ! Nom ++ sn.s ! gn.g ! c ; a = agrgP3 (sex2gender gn.g) Sg ; w = WLight ; rc, ext = [] diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index 7a83fb32..1c23b66a 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -266,7 +266,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { QuantityNP dig m = { - s = \\c => preOrPost m.isPre m.s (dig.s ! invNum) ; + s = \\_,c => preOrPost m.isPre m.s (dig.s ! invNum) ; a = agrP3 Pl ; w = WLight ; rc = "" ; @@ -274,7 +274,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { } ; QuantityFloatNP dig1 dig2 m = { - s = \\c => preOrPost m.isPre m.s (dig1.s ! invNum ++ BIND ++ "." ++ BIND ++ dig2.s ! invNum) ; + s = \\_,c => preOrPost m.isPre m.s (dig1.s ! invNum ++ BIND ++ "." ++ BIND ++ dig2.s ! invNum) ; a = agrP3 Pl ; w = WLight ; rc = "" ; diff --git a/src/german/ParadigmsGer.gf b/src/german/ParadigmsGer.gf index 7a7da650..2190f3ab 100644 --- a/src/german/ParadigmsGer.gf +++ b/src/german/ParadigmsGer.gf @@ -382,16 +382,20 @@ mkV2 : overload { -- The definitions should not bother the user of the API. So they are -- hidden from the document. - - Gender = MorphoGer.Gender ; Case = MorphoGer.Case ; Number = MorphoGer.Number ; + masculine = Masc ; feminine = Fem ; - neuter = Neutr ; - male = Male ; - female = Female ; + neuter = Neutr ; + male = Male ; + female = Female ; + + nominative = Nom ; + accusative = Acc ; + dative = Dat ; + genitive = Gen ; singular = Sg ; plural = Pl ; diff --git a/src/german/ResGer.gf b/src/german/ResGer.gf index 76dea3ba..32e1f9de 100644 --- a/src/german/ResGer.gf +++ b/src/german/ResGer.gf @@ -234,7 +234,7 @@ resource ResGer = ParamX ** open Prelude in { rc : Str ; -- die Frage , [rc die ich gestellt habe] ext : Str ; -- die Frage , [sc wo sie schläft] ; die Regel , [vp kein Fleisch zu essen] | [s dass ...] a : Agr ; - w : Weight } ; -- light NPs come before negation in simple clauses (expensive) + w : Weight } ; -- light NPs come before negation in simple clauses mkN : (x1,_,_,_,_,x6,x7 : Str) -> Gender -> Noun = \Mann, Mannen, Manne, Mannes, Maenner, Maennern, Mann_, g -> { @@ -466,7 +466,7 @@ resource ResGer = ParamX ** open Prelude in { subjPrep : Preposition -> Preposition = \prep -> case of { - => prep ** {c = NPC Nom} ; + => prep ** {c = Nom} ; _ => prep } ; diff --git a/src/german/StructuralGer.gf b/src/german/StructuralGer.gf index fcb8e24e..85be4baa 100644 --- a/src/german/StructuralGer.gf +++ b/src/german/StructuralGer.gf @@ -61,11 +61,10 @@ concrete StructuralGer of Structural = CatGer ** more_CAdv = X.mkCAdv "mehr" "als" ; most_Predet = { -- HL 5/2022 s = \\n,g,c => let gn = R.gennum g n ; - k = (R.prepC c).c ; adj = (P.mkA "viel" "mehr" "meiste").s ! Superl in - R.usePrepC c (\k -> R.artDef ! gn ! k ++ adj ! (agrAdj g Weak n k)) ; - c = {p = [] ; k = PredCase (NPC Gen)} ; + R.artDef ! gn ! c ++ adj ! (agrAdj g Weak n c) ; + c = {p = [] ; k = PredCase Gen} ; a = PAg Pl} ; much_Det = {s = asQuant (\\_,_ => "viel") ; sp = asQuant (\\_,_ => "vieles") ; n = Sg ; a = Weak ; isDef = False ; hasDefArt = False} ; @@ -178,7 +177,7 @@ concrete StructuralGer of Structural = CatGer ** pairTable : (Gender => Case => Str) -> (Gender => Case => Str) -> (Gender => Case => {quant,num:Str}) = \qt,nt -> \\g,c => {quant = qt ! g ! c; num = nt ! g ! c} ; - appAdjDegAdjf : Adjective -> Degree -> Adjf -> Number => Gender => PCase => Str = - \adj,deg,adjf -> \\n,g,c => R.usePrepC c (\k -> adj.s ! deg ! (agrAdj g adjf n k)) ; + appAdjDegAdjf : Adjective -> Degree -> Adjf -> Number => Gender => Case => Str = + \adj,deg,adjf -> \\n,g,c => adj.s ! deg ! (agrAdj g adjf n c) ; } From 1f728c31a06d4b4fde83bbaa493c7a7b25b7b5a2 Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Sat, 5 Aug 2023 19:11:21 +0200 Subject: [PATCH 08/16] Conflict marker in ExtendGer removed --- src/german/ExtendGer.gf | 1 - 1 file changed, 1 deletion(-) diff --git a/src/german/ExtendGer.gf b/src/german/ExtendGer.gf index 1e7d7f3c..e33ec17f 100644 --- a/src/german/ExtendGer.gf +++ b/src/german/ExtendGer.gf @@ -186,5 +186,4 @@ lin CompoundN a x = g = x.g } ; ->>>>>>> master } From e07c9ee044cc888e9eef3a6ea8d722a36c801f8b Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Sat, 5 Aug 2023 19:42:33 +0200 Subject: [PATCH 09/16] Missing application of vp.c2.s to GPl in ExtendGer added --- src/german/ExtendGer.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/german/ExtendGer.gf b/src/german/ExtendGer.gf index e33ec17f..b600ecdc 100644 --- a/src/german/ExtendGer.gf +++ b/src/german/ExtendGer.gf @@ -167,7 +167,7 @@ lin PastPartAgentAP vp np = in { s = \\af => (vp.nn ! a).p1 ++ (vp.nn ! a).p2 ++ (vp.nn ! a).p3 ++ vp.a2 ++ agent ++ vp.adj ++ vp.inf.inpl.p2 - ++ vp.c2.s -- junk if not TV + ++ vp.c2.s ! GPl -- junk if not TV ++ vp.ext ++ (vp.inf.extr ! a) ++ vp.s.s ! VPastPart af ; isPre = True ; c = <[],[]> ; From 7a75cf3fb3fecb1025ad99a10275c4149cdf39a2 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Thu, 17 Aug 2023 17:08:33 +0300 Subject: [PATCH 10/16] interpreting infinitives --- .../infinitives/InterpretInfinitives.hs | 70 +++++++++++++++++++ src/finnish/infinitives/Makefile | 2 + 2 files changed, 72 insertions(+) create mode 100644 src/finnish/infinitives/InterpretInfinitives.hs create mode 100644 src/finnish/infinitives/Makefile diff --git a/src/finnish/infinitives/InterpretInfinitives.hs b/src/finnish/infinitives/InterpretInfinitives.hs new file mode 100644 index 00000000..a7d2c054 --- /dev/null +++ b/src/finnish/infinitives/InterpretInfinitives.hs @@ -0,0 +1,70 @@ +{-# LANGUAGE GADTs #-} + +module Main where + +import Infinitive +import PGF +import Data.List + +data Fact = Fact { + content :: Maybe Fact, + tense :: Maybe GTemp, + polarity :: Maybe GPol, + source :: Maybe GNP, + attitude :: Maybe GVS, + agent :: Maybe GNP, + action :: Maybe GVP + } + +initFact = Fact Nothing Nothing Nothing Nothing Nothing Nothing Nothing + +factTree fact = case (agent fact, action fact) of + (Just np, Just vp) -> + GUttS $ GUseCl + (maybe presentTense id (tense fact)) + (maybe positivePol id (polarity fact)) + (GPredVP np vp) + _ -> GUttNP Gnothing_NP + +presentTense = GTTAnt GTPres GASimul +pastTense = GTTAnt GTPast GASimul +perfectTense = GTTAnt GTPres GAAnter +pluperfectTense = GTTAnt GTPast GAAnter +positivePol = GPPos + + +facts :: Infinitive.Tree a -> [Fact] +facts t = case t of + GComplPresPartActVS vs np vp -> + [initFact{attitude = Just vs, agent = Just np, action = Just vp}] + GComplPastPartActVS vs np vp -> + [initFact{tense = Just perfectTense, attitude = Just vs, agent = Just np, action = Just vp}] + _ -> composOpMPlus facts t + + +shortest = take 1 . sortOn treesize + +treesize t = case unApp t of + Just (f, xs) -> 1 + sum (map treesize xs) + _ -> 1 + + +treat gr fin cat s = [ + (showExpr [] t ++ "\t" ++ linearize gr fin t) + | pt <- shortest (parse gr fin cat s), + let gt = map (gf . factTree) (facts (fg pt :: GUtt)), + t <- gt + ] + + +main = do + gr <- readPGF "Infinitive.pgf" + putStrLn "gr" + let Just fin = readLanguage "InfinitiveFin" + let typ = startCat gr + flip mapM_ [0..] $ \_ -> do + putStr "> " + s <- getLine + let ss = treat gr fin typ s + putStrLn $ unlines ss + diff --git a/src/finnish/infinitives/Makefile b/src/finnish/infinitives/Makefile new file mode 100644 index 00000000..66a92f27 --- /dev/null +++ b/src/finnish/infinitives/Makefile @@ -0,0 +1,2 @@ +pgf: + gf --make -output-format=haskell -haskell=lexical -lexical=N,A,Adv,V,V2,VS,VV,PN --haskell=gadt InfinitiveFin.gf From fccc0428fd176adce500a13af9328b9a485ba2a7 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Thu, 17 Aug 2023 23:04:41 +0300 Subject: [PATCH 11/16] a couple more infinitives interpreted --- src/finnish/infinitives/InfinitiveFin.gf | 2 +- .../infinitives/InterpretInfinitives.hs | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/finnish/infinitives/InfinitiveFin.gf b/src/finnish/infinitives/InfinitiveFin.gf index 8ace5786..220825b7 100644 --- a/src/finnish/infinitives/InfinitiveFin.gf +++ b/src/finnish/infinitives/InfinitiveFin.gf @@ -159,7 +159,7 @@ oper -- hänen syövän, häntä syödyn, häntä syötävän subjPartVP : ResFin.NP -> StemFin.VP -> NPForm -> VForm -> Str = \np, vp, npform, vform -> - np.s ! NPCase Gen ++ + np.s ! npform ++ vp.s.s ! vform ++ vp.s2 ! True ! Pos ! np.a ++ vp.adv ! Pos ++ diff --git a/src/finnish/infinitives/InterpretInfinitives.hs b/src/finnish/infinitives/InterpretInfinitives.hs index a7d2c054..1b32f6fb 100644 --- a/src/finnish/infinitives/InterpretInfinitives.hs +++ b/src/finnish/infinitives/InterpretInfinitives.hs @@ -18,12 +18,14 @@ data Fact = Fact { initFact = Fact Nothing Nothing Nothing Nothing Nothing Nothing Nothing -factTree fact = case (agent fact, action fact) of - (Just np, Just vp) -> +factTree fact = case action fact of + (Just vp) -> GUttS $ GUseCl (maybe presentTense id (tense fact)) (maybe positivePol id (polarity fact)) - (GPredVP np vp) + (GPredVP + (maybe Gsomebody_NP id (agent fact)) + vp) _ -> GUttNP Gnothing_NP presentTense = GTTAnt GTPres GASimul @@ -31,6 +33,7 @@ pastTense = GTTAnt GTPast GASimul perfectTense = GTTAnt GTPres GAAnter pluperfectTense = GTTAnt GTPast GAAnter positivePol = GPPos +negativePol = GPNeg facts :: Infinitive.Tree a -> [Fact] @@ -38,7 +41,15 @@ facts t = case t of GComplPresPartActVS vs np vp -> [initFact{attitude = Just vs, agent = Just np, action = Just vp}] GComplPastPartActVS vs np vp -> - [initFact{tense = Just perfectTense, attitude = Just vs, agent = Just np, action = Just vp}] + [initFact{tense = Just perfectTense, attitude = Just vs, + agent = Just np, action = Just vp}] + GInf3AbessAdv vp -> + [initFact{polarity = Just negativePol, action = Just vp}] + GComplPresPartPassVS vs np vpslash -> + [initFact{attitude = Just vs, action = Just (GComplSlash vpslash np)}] + GComplPastPartPassVS vs np vpslash -> + [initFact{tense = Just perfectTense, attitude = Just vs, + action = Just (GComplSlash vpslash np)}] _ -> composOpMPlus facts t From e729e4e707a862c7ea07be9ea9479553f234667b Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Fri, 18 Aug 2023 08:40:33 +0300 Subject: [PATCH 12/16] Fin: some more infinitives interpreted --- .../infinitives/InterpretInfinitives.hs | 51 ++++++++++++++++--- src/finnish/infinitives/Makefile | 5 ++ 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/src/finnish/infinitives/InterpretInfinitives.hs b/src/finnish/infinitives/InterpretInfinitives.hs index 1b32f6fb..70c20f2e 100644 --- a/src/finnish/infinitives/InterpretInfinitives.hs +++ b/src/finnish/infinitives/InterpretInfinitives.hs @@ -24,7 +24,7 @@ factTree fact = case action fact of (maybe presentTense id (tense fact)) (maybe positivePol id (polarity fact)) (GPredVP - (maybe Gsomebody_NP id (agent fact)) + (maybe (maybe Gsomebody_NP id (source fact)) id (agent fact)) vp) _ -> GUttNP Gnothing_NP @@ -38,18 +38,53 @@ negativePol = GPNeg facts :: Infinitive.Tree a -> [Fact] facts t = case t of + GAdjCN (GAgentPartAP np vpslash) cn -> + [initFact{ + tense = Just perfectTense, + agent = Just np, + action = Just (GComplSlash vpslash (GMassNP cn))}] + GPredVP np (GComplPresPartActAgrVS vs vp) -> + [initFact{ + attitude = Just vs, + source = Just np, + action = Just vp}] + GPredVP np (GComplPastPartActAgrVS vs vp) -> + [initFact{tense = Just perfectTense, + attitude = Just vs, + source = Just np, + action = Just vp}] + GPredVP np (GAdvVP vp adv) -> + [f{source = Just np} | f <- facts vp ++ facts adv] + GPredVP np vp -> + [f{source = Just np} | f <- facts vp] + GUseV v -> + [initFact{ + action = Just t}] GComplPresPartActVS vs np vp -> - [initFact{attitude = Just vs, agent = Just np, action = Just vp}] + [initFact{ + attitude = + Just vs, + agent = Just np, + action = Just vp}] GComplPastPartActVS vs np vp -> - [initFact{tense = Just perfectTense, attitude = Just vs, - agent = Just np, action = Just vp}] + [initFact{ + tense = Just perfectTense, + attitude = Just vs, + agent = Just np, + action = Just vp}] GInf3AbessAdv vp -> - [initFact{polarity = Just negativePol, action = Just vp}] + [initFact{ + polarity = Just negativePol, + action = Just vp}] GComplPresPartPassVS vs np vpslash -> - [initFact{attitude = Just vs, action = Just (GComplSlash vpslash np)}] + [initFact{ + attitude = Just vs, + action = Just (GComplSlash vpslash np)}] GComplPastPartPassVS vs np vpslash -> - [initFact{tense = Just perfectTense, attitude = Just vs, - action = Just (GComplSlash vpslash np)}] + [initFact{ + tense = Just perfectTense, + attitude = Just vs, + action = Just (GComplSlash vpslash np)}] _ -> composOpMPlus facts t diff --git a/src/finnish/infinitives/Makefile b/src/finnish/infinitives/Makefile index 66a92f27..a87f4df2 100644 --- a/src/finnish/infinitives/Makefile +++ b/src/finnish/infinitives/Makefile @@ -1,2 +1,7 @@ +all: pgf hs + pgf: gf --make -output-format=haskell -haskell=lexical -lexical=N,A,Adv,V,V2,VS,VV,PN --haskell=gadt InfinitiveFin.gf + +hs: + ghc --make InterpretInfinitives.hs From 42f64725f25a088a6e9b38be5f1900474cc60382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Mon, 21 Aug 2023 16:27:20 +0800 Subject: [PATCH 13/16] Run tests on pull requests as well --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b48c6dbc..251055ec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,8 @@ name: Check that the RGL can successfully build on: - push + - push + - pull_request jobs: build: From 98128cedd70821d0ed0960f17be4812284b84e08 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 21 Aug 2023 11:44:49 +0300 Subject: [PATCH 14/16] (Ger) Comment out lins that don't compile --- src/german/NamesGer.gf | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/german/NamesGer.gf b/src/german/NamesGer.gf index 0d9c1774..9b4ecc31 100644 --- a/src/german/NamesGer.gf +++ b/src/german/NamesGer.gf @@ -3,28 +3,28 @@ concrete NamesGer of Names = CatGer ** open ResGer, Prelude in { lin GivenName gn = { s = \\_,c => gn.s ! c ; a = agrgP3 (sex2gender gn.g) Sg ; - w = WLight ; + w = WLight ; rc, ext = [] } ; lin MaleSurname sn = { s = \\_,c => sn.s ! Male ! c ; a = agrgP3 Masc Sg ; - w = WLight ; + w = WLight ; rc, ext = [] } ; - + lin FemaleSurname sn = { s = \\_,c => sn.s ! Female ! c ; a = agrgP3 Fem Sg ; - w = WLight ; + w = WLight ; rc, ext = [] } ; lin PlSurname sn = { s = \\_,c => sn.s ! Male ! c ; a = agrgP3 Masc Pl ; - w = WLight ; + w = WLight ; rc, ext = [] } ; @@ -35,33 +35,43 @@ lin FullName gn sn = { rc, ext = [] } ; -lin UseLN ln = { +-- UseLN : LN -> NP ; +lin UseLN ln = notYet "UseLN" ; +{- Old version by Krasimir: { s = \\c => case ln.hasArt of { True => artDefContr (gennum ln.g ln.n) c ++ usePrepC c (\k -> ln.s ! Weak ! k) ; False => usePrepC c (\k -> ln.s ! adjfCase Strong k ! k) } ; a = agrgP3 ln.g ln.n ; - w = WLight ; + w = WLight ; rc, ext = [] } ; +-} -lin PlainLN ln = { +-- PlainLN : LN -> NP ; +lin PlainLN ln = notYet "PlainLN" ; +{- { s = \\c => usePrepC c (\k -> ln.s ! adjfCase Strong k ! k) ; a = agrgP3 ln.g ln.n ; - w = WLight ; + w = WLight ; rc, ext = [] } ; +-} -lin InLN ln = { +-- InLN : LN -> Adv ; +lin InLN ln = notYet "InLN" ; +{- { s = let c = NPP CInDat in case ln.hasArt of { True => artDefContr (gennum ln.g ln.n) c ++ usePrepC c (\k -> ln.s ! Weak ! k) ; False => usePrepC c (\k -> ln.s ! adjfCase Strong k ! k) } ; } ; +-} +-- AdjLN : AP -> LN -> LN ; lin AdjLN ap ln = ln ** { - s = \\a,c => + s = \\a,c => preOrPost ap.isPre (ap.c.p1 ++ ap.c.p2 ++ ap.s ! agrAdj ln.g a ln.n c ++ ap.ext) (ln.s ! a ! c) ; From f08c9c0c93b33d22f75c649dd826c5d0f48ff3bb Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Mon, 21 Aug 2023 15:58:57 +0300 Subject: [PATCH 15/16] 1st infinitive long --- src/finnish/infinitives/Infinitive.gf | 21 +++++++++++++---- src/finnish/infinitives/InfinitiveFin.gf | 23 +++++++++++++++++-- .../infinitives/InterpretInfinitives.hs | 4 ++-- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/src/finnish/infinitives/Infinitive.gf b/src/finnish/infinitives/Infinitive.gf index c94cd6df..d029d19d 100644 --- a/src/finnish/infinitives/Infinitive.gf +++ b/src/finnish/infinitives/Infinitive.gf @@ -1,12 +1,24 @@ abstract Infinitive = - Grammar - [VPSlashPrep], ---- to avoid certain spurious ambiguities, to be fixed + Grammar - [ + VPSlashPrep, --- to avoid certain spurious ambiguities, to be fixed + PassV2 ---- temporarily disabled, to be fixed + ], Lexicon ** { flags startcat = Utt ; -data +cat + RAdv ; -- reflexive adverbs, e.g. mennäkse (ni/si/...) + +fun + UseV2 : V2 -> VP ; -- to use V2 intransitively, suppressing object + RAdvVP : VP -> RAdv -> VP ; -- syödä elääkseni + + X_NP, Y_NP, Z_NP : NP ; -- unknown subjects and objects + tulla_VV : VV ; -- tulla (tekemään), explicit future tense + PresPartPassSubjVP : VP -> VP ; -- (minun) on mentävä PresPartPassObjVP : VPSlash -> VP ; -- (oluesta) on pidettävä @@ -19,13 +31,12 @@ data AgentPartAP : NP -> VPSlash -> AP ; -- koiran syömä - + Inf1LongRAdv : VP -> RAdv ; -- mennäkse (ni/si/...) + Inf2InessAdv : NP -> VP -> Adv ; -- junan mennessä Inf2InessPassAdv : VP -> Adv ; -- odotettaessa (junaa), touhuttaessa (junan kanssa) Inf2InessPassInvAdv : NP -> VPSlash -> Adv ; -- junaa odotettaessa, junan kanssa touhutessa - Inf2InstrAdv : VP -> Adv ; -- odottaen (junaa) - Inf2InstrInvAdv : NP -> VPSlash -> Adv ; -- junaa odottaen Inf2InstrAdv : VP -> Adv ; -- odottaen (junaa) Inf2InstrInvAdv : NP -> VPSlash -> Adv ; -- junaa odottaen diff --git a/src/finnish/infinitives/InfinitiveFin.gf b/src/finnish/infinitives/InfinitiveFin.gf index 220825b7..322f1645 100644 --- a/src/finnish/infinitives/InfinitiveFin.gf +++ b/src/finnish/infinitives/InfinitiveFin.gf @@ -1,15 +1,28 @@ --# -path=..:alltenses concrete InfinitiveFin of Infinitive = - GrammarFin - [VPSlashPrep], + GrammarFin - [ + VPSlashPrep, + PassV2], LexiconFin ** open ResFin, StemFin, - Prelude + Prelude, + ParadigmsFin in { +lincat + RAdv = {s : Agr => Str} ; + lin + UseV2 v2 = predSV v2 ; + RAdvVP vp radv = insertObj (\\_,_ => radv.s) vp ; ---- can be wrong word order + + X_NP = MassNP (UseN (mkN "X" "X:n")) ; + Y_NP = MassNP (UseN (mkN "Y" "Z:n")) ; + Z_NP = MassNP (UseN (mkN "Z" "Z:n")) ; + PresPartPassSubjVP vp = vp ** { s = vpVerbOlla ** {sc = SCGen} ; s2 = \\b,p,a => vp.s.s ! PresPartPass (AN (NCase Sg Nom)) ++ vp.s2 ! b ! p ! a ; @@ -64,6 +77,12 @@ lin p = [] } ; + Inf1LongRAdv vp = { + s = \\a => + infVP SCNom Pos infAdvAgr vp Inf1Long ++ BIND ++ + case vp.s.h of {Back => possSuffix a ; Front => possSuffixFront a} + } ; + Inf2InessAdv np vp = { s = np.s ! NPCase Gen ++ infVP SCNom Pos np.a vp Inf2Iness diff --git a/src/finnish/infinitives/InterpretInfinitives.hs b/src/finnish/infinitives/InterpretInfinitives.hs index 70c20f2e..4057e072 100644 --- a/src/finnish/infinitives/InterpretInfinitives.hs +++ b/src/finnish/infinitives/InterpretInfinitives.hs @@ -7,7 +7,7 @@ import PGF import Data.List data Fact = Fact { - content :: Maybe Fact, + content :: [Fact], tense :: Maybe GTemp, polarity :: Maybe GPol, source :: Maybe GNP, @@ -16,7 +16,7 @@ data Fact = Fact { action :: Maybe GVP } -initFact = Fact Nothing Nothing Nothing Nothing Nothing Nothing Nothing +initFact = Fact [] Nothing Nothing Nothing Nothing Nothing Nothing factTree fact = case action fact of (Just vp) -> From 0cbae9883d80b1b4feaf754cadaa51e78997409a Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Mon, 21 Aug 2023 15:59:33 +0300 Subject: [PATCH 16/16] commented out Names from Grammar temporarily to avoid failure with notYet --- src/german/GrammarGer.gf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/german/GrammarGer.gf b/src/german/GrammarGer.gf index 7614d286..bb679ff7 100644 --- a/src/german/GrammarGer.gf +++ b/src/german/GrammarGer.gf @@ -14,8 +14,8 @@ concrete GrammarGer of Grammar = TextX - [Tense,Temp], IdiomGer, StructuralGer - [part_Prep,possess_Prep], -- use PartNP, PossNP instead - TenseGer, - NamesGer + TenseGer +---- NamesGer -- notYet! ** { flags startcat = Phr ; unlexer = text ; lexer = text ;