From 8eee3df7396b0d6929d79b99cf88f923a01acf77 Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Tue, 19 Jul 2022 18:27:56 +0200 Subject: [PATCH 001/129] 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 002/129] 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 003/129] 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 004/129] 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 645de9955ab50e2e206177aa4ef7b975018a62f1 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 24 Jul 2023 17:24:13 +0200 Subject: [PATCH 005/129] started a separate module for names --- src/abstract/Cat.gf | 3 ++- src/abstract/Extend.gf | 6 ----- src/abstract/Grammar.gf | 2 +- src/abstract/Names.gf | 14 ++++++++++ src/afrikaans/CatAfr.gf | 2 +- src/afrikaans/ExtendAfr.gf | 5 ---- src/afrikaans/GrammarAfr.gf | 3 ++- src/afrikaans/NamesAfr.gf | 6 +++++ src/bantu/CatBantu.gf | 2 +- src/bulgarian/CatBul.gf | 2 +- src/bulgarian/ExtendBul.gf | 21 --------------- src/bulgarian/GrammarBul.gf | 3 ++- src/bulgarian/NamesBul.gf | 39 +++++++++++++++++++++++++++ src/catalan/ExtendCat.gf | 6 ----- src/catalan/GrammarCat.gf | 3 ++- src/catalan/NamesCat.gf | 9 +++++++ src/chinese/CatChi.gf | 2 +- src/chinese/ExtendChi.gf | 10 +++---- src/chinese/GrammarChi.gf | 3 ++- src/chinese/NamesChi.gf | 8 ++++++ src/dutch/CatDut.gf | 2 +- src/dutch/ExtendDut.gf | 5 ---- src/dutch/GrammarDut.gf | 3 ++- src/dutch/NamesDut.gf | 7 +++++ src/english/CatEng.gf | 5 ++++ src/english/ExtendEng.gf | 7 ----- src/english/GrammarEng.gf | 3 ++- src/english/NamesEng.gf | 31 +++++++++++++++++++++ src/english/ParadigmsEng.gf | 18 +++++++++++++ src/estonian/CatEst.gf | 2 +- src/estonian/ExtendEst.gf | 6 ----- src/estonian/GrammarEst.gf | 3 ++- src/estonian/NamesEst.gf | 14 ++++++++++ src/finnish/CatFin.gf | 2 +- src/finnish/ExtendFin.gf | 6 ----- src/finnish/GrammarFin.gf | 3 ++- src/finnish/NamesFin.gf | 14 ++++++++++ src/french/DiffFre.gf | 3 +++ src/french/ExtendFre.gf | 6 ----- src/french/GrammarFre.gf | 3 ++- src/french/NamesFre.gf | 36 +++++++++++++++++++++++++ src/french/ParadigmsFre.gf | 21 +++++++++++++++ src/german/CatGer.gf | 2 +- src/german/ExtendGer.gf | 10 ------- src/german/GrammarGer.gf | 3 ++- src/german/NamesGer.gf | 38 ++++++++++++++++++++++++++ src/italian/ExtendIta.gf | 6 ----- src/italian/GrammarIta.gf | 3 ++- src/italian/NamesIta.gf | 9 +++++++ src/korean/CatKor.gf | 2 +- src/korean/ExtendKor.gf | 6 ----- src/korean/GrammarKor.gf | 3 ++- src/korean/NamesKor.gf | 9 +++++++ src/maltese/CatMlt.gf | 2 +- src/maltese/ExtraMlt.gf | 6 ----- src/maltese/GrammarMlt.gf | 3 ++- src/maltese/NamesMlt.gf | 16 +++++++++++ src/polish/CatPol.gf | 2 +- src/polish/ExtendPol.gf | 9 ------- src/polish/GrammarPol.gf | 1 + src/polish/NamesPol.gf | 12 +++++++++ src/portuguese/ExtendPor.gf | 6 ----- src/portuguese/GrammarPor.gf | 3 ++- src/portuguese/NamesPor.gf | 9 +++++++ src/romance/CatRomance.gf | 7 +++++ src/romance/DiffRomance.gf | 2 ++ src/romanian/CatRon.gf | 2 +- src/romanian/ExtendRon.gf | 10 +------ src/romanian/GrammarRon.gf | 3 ++- src/romanian/NamesRon.gf | 34 +++++++++++++++++++++++ src/russian/CatRus.gf | 2 +- src/russian/ExtendRus.gf | 22 --------------- src/russian/GrammarRus.gf | 5 ++-- src/russian/NamesRus.gf | 25 +++++++++++++++++ src/scandinavian/CatScand.gf | 2 +- src/slovenian/CatSlv.gf | 2 +- src/slovenian/ExtendSlv.gf | 9 ------- src/slovenian/GrammarSlv.gf | 3 ++- src/slovenian/NamesSlv.gf | 24 +++++++++++++++++ src/somali/CatSom.gf | 2 +- src/somali/ExtendSom.gf | 6 ----- src/somali/GrammarSom.gf | 3 ++- src/somali/NamesSom.gf | 18 +++++++++++++ src/spanish/DiffSpa.gf | 3 +++ src/spanish/ExtendSpa.gf | 6 ----- src/spanish/GrammarSpa.gf | 3 ++- src/spanish/NamesSpa.gf | 52 ++++++++++++++++++++++++++++++++++++ src/spanish/ParadigmsSpa.gf | 19 +++++++++++++ src/swahili/GrammarSwa.gf | 3 ++- src/swahili/NamesSwa.gf | 1 + src/swedish/ExtendSwe.gf | 6 ----- src/swedish/GrammarSwe.gf | 3 ++- src/swedish/NamesSwe.gf | 14 ++++++++++ src/thai/CatTha.gf | 2 +- src/thai/GrammarTha.gf | 3 ++- src/thai/NamesTha.gf | 1 + src/turkish/CatTur.gf | 2 +- src/turkish/ExtendTur.gf | 8 ------ src/turkish/GrammarTur.gf | 3 ++- src/turkish/NamesTur.gf | 19 +++++++++++++ 100 files changed, 611 insertions(+), 227 deletions(-) create mode 100644 src/abstract/Names.gf create mode 100644 src/afrikaans/NamesAfr.gf create mode 100644 src/bulgarian/NamesBul.gf create mode 100644 src/catalan/NamesCat.gf create mode 100644 src/chinese/NamesChi.gf create mode 100644 src/dutch/NamesDut.gf create mode 100644 src/english/NamesEng.gf create mode 100644 src/estonian/NamesEst.gf create mode 100644 src/finnish/NamesFin.gf create mode 100644 src/french/NamesFre.gf create mode 100644 src/german/NamesGer.gf create mode 100644 src/italian/NamesIta.gf create mode 100644 src/korean/NamesKor.gf create mode 100644 src/maltese/NamesMlt.gf create mode 100644 src/polish/NamesPol.gf create mode 100644 src/portuguese/NamesPor.gf create mode 100644 src/romanian/NamesRon.gf create mode 100644 src/russian/NamesRus.gf create mode 100644 src/slovenian/NamesSlv.gf create mode 100644 src/somali/NamesSom.gf create mode 100644 src/spanish/NamesSpa.gf create mode 100644 src/swahili/NamesSwa.gf create mode 100644 src/swedish/NamesSwe.gf create mode 100644 src/thai/NamesTha.gf create mode 100644 src/turkish/NamesTur.gf diff --git a/src/abstract/Cat.gf b/src/abstract/Cat.gf index 20c19f20..93b7fa75 100644 --- a/src/abstract/Cat.gf +++ b/src/abstract/Cat.gf @@ -128,7 +128,8 @@ abstract Cat = Common ** { N3 ; -- three-place relational noun e.g. "connection" GN ; -- given name e.g. "George" SN ; -- second name e.g. "Washington" - PN ; -- proper name e.g. "Paris" + LN ; -- location name e.g. "Sweden" + PN ; -- proper name -- DEPRECATED: QuantSg, QuantPl --- QuantSg ;-- quantifier ('nucleus' of sing. Det) e.g. "every" diff --git a/src/abstract/Extend.gf b/src/abstract/Extend.gf index c35e3617..2781e92a 100644 --- a/src/abstract/Extend.gf +++ b/src/abstract/Extend.gf @@ -297,12 +297,6 @@ fun fun CardCNCard : Card -> CN -> Card ; -- three million, four lakh, six dozen etc - GivenName : GN -> PN ; - MaleSurname : SN -> PN ; - FemaleSurname : SN -> PN ; - PlSurname : SN -> PN ; - FullName : GN -> SN -> PN ; - fun AnaphPron : NP -> Pron ; diff --git a/src/abstract/Grammar.gf b/src/abstract/Grammar.gf index 25ded602..8bb5ac42 100644 --- a/src/abstract/Grammar.gf +++ b/src/abstract/Grammar.gf @@ -19,6 +19,6 @@ abstract Grammar = Structural, Idiom, Tense, + Names, Transfer ; - diff --git a/src/abstract/Names.gf b/src/abstract/Names.gf new file mode 100644 index 00000000..0c469f9b --- /dev/null +++ b/src/abstract/Names.gf @@ -0,0 +1,14 @@ +abstract Names = Cat ** { + +fun GivenName : GN -> NP ; + MaleSurname : SN -> NP ; + FemaleSurname : SN -> NP ; + PlSurname : SN -> NP ; + FullName : GN -> SN -> NP ; + +fun UseLN : LN -> NP ; + PlainLN : LN -> NP ; + InLN : LN -> Adv ; + AdjLN : AP -> LN -> LN ; + +} diff --git a/src/afrikaans/CatAfr.gf b/src/afrikaans/CatAfr.gf index 09293f06..e2f230c2 100644 --- a/src/afrikaans/CatAfr.gf +++ b/src/afrikaans/CatAfr.gf @@ -83,6 +83,6 @@ concrete CatAfr of Cat = N = Noun ; N2 = {s : NForm => Str ; g : Gender} ** {c2 : Preposition} ; N3 = {s : NForm => Str ; g : Gender} ** {c2,c3 : Preposition} ; - GN, SN, PN = {s : NPCase => Str} ; + GN, SN, LN, PN = {s : NPCase => Str} ; } diff --git a/src/afrikaans/ExtendAfr.gf b/src/afrikaans/ExtendAfr.gf index 5becbada..603378da 100644 --- a/src/afrikaans/ExtendAfr.gf +++ b/src/afrikaans/ExtendAfr.gf @@ -12,9 +12,4 @@ lin PassVPSlash vps = PassAgentVPSlash vps np = insertAdv (appPrep "door" np.s) (insertInf (vps.s.s ! VPerf) (predV word_V)) ; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = \\c => gn.s ! NPNom ++ sn.s ! c ; - } ; - } diff --git a/src/afrikaans/GrammarAfr.gf b/src/afrikaans/GrammarAfr.gf index af0d853e..15b02426 100644 --- a/src/afrikaans/GrammarAfr.gf +++ b/src/afrikaans/GrammarAfr.gf @@ -14,4 +14,5 @@ concrete GrammarAfr of Grammar = TextX, IdiomAfr, StructuralAfr, - TenseX ; + TenseX, + NamesAfr ; diff --git a/src/afrikaans/NamesAfr.gf b/src/afrikaans/NamesAfr.gf new file mode 100644 index 00000000..a85481be --- /dev/null +++ b/src/afrikaans/NamesAfr.gf @@ -0,0 +1,6 @@ +concrete NamesAfr of Names = CatAfr ** open ResAfr, Prelude in { + +lin GivenName, MaleSurname, FemaleSurname = \n -> {s = n.s ; a = agrP3 Sg ; isPron = False} ; +lin FullName gn sn = + {s = \\c => gn.s ! NPNom ++ sn.s ! c ; a = agrP3 Sg ; isPron = False} ; +} diff --git a/src/bantu/CatBantu.gf b/src/bantu/CatBantu.gf index a9d3acf2..0f810524 100644 --- a/src/bantu/CatBantu.gf +++ b/src/bantu/CatBantu.gf @@ -81,7 +81,7 @@ incomplete concrete CatBantu of Cat = -- N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Str} ; N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Prep} ; N3 = {s : Number => Case => Str ; g : Gender} ** {c2,c3 : Prep} ; - GN, SN, PN = {s : Case => Str ; g : Gender} ; + GN, SN, LN, PN = {s : Case => Str ; g : Gender} ; --Tense = {s : Str ; t : ResKam.Tense} ; linref diff --git a/src/bulgarian/CatBul.gf b/src/bulgarian/CatBul.gf index 656713c6..5ec3bd64 100644 --- a/src/bulgarian/CatBul.gf +++ b/src/bulgarian/CatBul.gf @@ -88,7 +88,7 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, ( N3 = {s : NForm => Str; rel : AForm => Str; relType : NRelType; g : AGender} ** {c2,c3 : Preposition} ; GN = {s : Str; g : Sex} ; SN = {s : Sex => Str; pl : Str} ; - PN = {s : Str; gn : GenNum} ; + LN, PN = {s : Str; gn : GenNum} ; lindef SSlash = \s -> {s = \\_ => s; c2 = {s=""; c=Acc}}; diff --git a/src/bulgarian/ExtendBul.gf b/src/bulgarian/ExtendBul.gf index 0ca1aa0b..bae3834d 100644 --- a/src/bulgarian/ExtendBul.gf +++ b/src/bulgarian/ExtendBul.gf @@ -303,27 +303,6 @@ lin UseDAP dap = { lin UseComp_estar = UseComp ; UseComp_ser = UseComp ; -lin GivenName = \n -> { - s = n.s ; - gn = GSg (sex2gender n.g) - } ; -lin MaleSurname = \n -> { - s = n.s ! Male ; - gn = GSg Masc - } ; -lin FemaleSurname = \n -> { - s = n.s ! Female; - gn = GSg Fem - } ; -lin PlSurname = \n -> { - s = n.pl ; - gn = GPl - } ; -lin FullName gn sn = { - s = gn.s ++ sn.s ! gn.g ; - gn = GSg (sex2gender gn.g) - } ; - lin ProDrop pro = pro ; lin AnaphPron np = diff --git a/src/bulgarian/GrammarBul.gf b/src/bulgarian/GrammarBul.gf index f9a05a99..39adaefe 100644 --- a/src/bulgarian/GrammarBul.gf +++ b/src/bulgarian/GrammarBul.gf @@ -15,7 +15,8 @@ concrete GrammarBul of Grammar = TextBul, StructuralBul, IdiomBul, - TenseX - [CAdv,IAdv,AdV,SC] + TenseX - [CAdv,IAdv,AdV,SC], + NamesBul ** { flags coding=utf8 ; diff --git a/src/bulgarian/NamesBul.gf b/src/bulgarian/NamesBul.gf new file mode 100644 index 00000000..7391ba29 --- /dev/null +++ b/src/bulgarian/NamesBul.gf @@ -0,0 +1,39 @@ +concrete NamesBul of Names = CatBul ** open ResBul in { + +lin GivenName = \n -> { + s = table { RObj c => linCase c Pos ++ n.s; + _ => n.s + } ; + gn = GSg (sex2gender n.g) ; + p = NounP3 Pos + } ; +lin MaleSurname = \n -> { + s = table { RObj c => linCase c Pos ++ n.s ! Male; + _ => n.s ! Male + } ; + gn = GSg Masc ; + p = NounP3 Pos + } ; +lin FemaleSurname = \n -> { + s = table { RObj c => linCase c Pos ++ n.s ! Female; + _ => n.s ! Female + } ; + gn = GSg Fem ; + p = NounP3 Pos + } ; +lin PlSurname = \n -> { + s = table { RObj c => linCase c Pos ++ n.pl ; + _ => n.pl + } ; + gn = GPl ; + p = NounP3 Pos + } ; +lin FullName gn sn = { + s = table { RObj c => linCase c Pos ++ gn.s ++ sn.s ! gn.g ; + _ => gn.s ++ sn.s ! gn.g + } ; + gn = GSg (sex2gender gn.g) ; + p = NounP3 Pos + } ; + +} diff --git a/src/catalan/ExtendCat.gf b/src/catalan/ExtendCat.gf index b157182b..c0de2ffd 100644 --- a/src/catalan/ExtendCat.gf +++ b/src/catalan/ExtendCat.gf @@ -15,10 +15,4 @@ concrete ExtendCat of Extend = CatCat ** ExtendRomanceFunctor-- - ParadigmsCat in { -- put your own definitions here -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s ; - g = gn.g - } ; - } ; diff --git a/src/catalan/GrammarCat.gf b/src/catalan/GrammarCat.gf index a1a4fda2..afd7472e 100644 --- a/src/catalan/GrammarCat.gf +++ b/src/catalan/GrammarCat.gf @@ -14,7 +14,8 @@ concrete GrammarCat of Grammar = TextX - [SC,Temp,Tense,Pol,PPos,PNeg], IdiomCat, StructuralCat, - TenseCat + TenseCat, + NamesCat ** { diff --git a/src/catalan/NamesCat.gf b/src/catalan/NamesCat.gf new file mode 100644 index 00000000..52d69dba --- /dev/null +++ b/src/catalan/NamesCat.gf @@ -0,0 +1,9 @@ +concrete NamesCat of Names = CatCat ** open ResCat in { + +lin GivenName, MaleSurname, FemaleSurname = \n -> pn2np n ; +lin FullName gn sn = pn2np { + s = gn.s ++ sn.s ; + g = gn.g + } ; + +} diff --git a/src/chinese/CatChi.gf b/src/chinese/CatChi.gf index ff996643..4ff35566 100644 --- a/src/chinese/CatChi.gf +++ b/src/chinese/CatChi.gf @@ -79,7 +79,7 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu N = ResChi.Noun ; N2 = ResChi.Noun ** {c2 : Preposition} ; N3 = ResChi.Noun ** {c2,c3 : Preposition} ; - GN, SN, PN = ResChi.NP ; + GN, SN, LN, PN = ResChi.NP ; -- overridden diff --git a/src/chinese/ExtendChi.gf b/src/chinese/ExtendChi.gf index dfcabd29..866f1b4a 100644 --- a/src/chinese/ExtendChi.gf +++ b/src/chinese/ExtendChi.gf @@ -11,7 +11,7 @@ concrete ExtendChi of Extend = CatChi ** , MkVPI2, BaseVPI2, ConsVPI2, ConjVPI2, ComplVPI2 , ProDrop, ComplDirectVS, ComplDirectVQ , PassVPSlash, PassAgentVPSlash - , GerundAdv, GerundNP ] + , GerundAdv, GerundNP, ApposNP ] with (Grammar=GrammarChi) ** open Prelude , Coordination @@ -79,13 +79,11 @@ concrete ExtendChi of Extend = CatChi ** AdvVP (UseV ) (mkAdv (":" ++ quoted utt.s)) ; -- DEFAULT complement added as Adv in quotes + lin + ApposNP np1 np2 = {s = np1.s ++ np2.s} ; + oper mkAdv : Str -> CatChi.Adv ; mkAdv str = lin Adv {s = str ; advType = ATManner ; hasDe = False} ; -lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s - } ; - }; diff --git a/src/chinese/GrammarChi.gf b/src/chinese/GrammarChi.gf index a57c24ab..7b8af2c8 100644 --- a/src/chinese/GrammarChi.gf +++ b/src/chinese/GrammarChi.gf @@ -14,7 +14,8 @@ concrete GrammarChi of Grammar = TextChi, StructuralChi, IdiomChi, - TenseChi + TenseChi, + NamesChi ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/chinese/NamesChi.gf b/src/chinese/NamesChi.gf new file mode 100644 index 00000000..ccb35fa8 --- /dev/null +++ b/src/chinese/NamesChi.gf @@ -0,0 +1,8 @@ +concrete NamesChi of Names = CatChi ** { + +lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ; +lin FullName gn sn = { + s = gn.s ++ sn.s + } ; + +} diff --git a/src/dutch/CatDut.gf b/src/dutch/CatDut.gf index 382aa282..80763f90 100644 --- a/src/dutch/CatDut.gf +++ b/src/dutch/CatDut.gf @@ -81,6 +81,6 @@ concrete CatDut of Cat = N = Noun ; N2 = {s : NForm => Str ; g : Gender} ** {c2 : Preposition} ; N3 = {s : NForm => Str ; g : Gender} ** {c2,c3 : Preposition} ; - GN, SN, PN = {s : NPCase => Str} ; + GN, SN, LN, PN = {s : NPCase => Str} ; } diff --git a/src/dutch/ExtendDut.gf b/src/dutch/ExtendDut.gf index f1ed70fd..6769eda5 100644 --- a/src/dutch/ExtendDut.gf +++ b/src/dutch/ExtendDut.gf @@ -121,9 +121,4 @@ lin isPron = False } ; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = \\c => gn.s ! NPNom ++ sn.s ! c - } ; - } diff --git a/src/dutch/GrammarDut.gf b/src/dutch/GrammarDut.gf index 14084207..4144ee76 100644 --- a/src/dutch/GrammarDut.gf +++ b/src/dutch/GrammarDut.gf @@ -14,4 +14,5 @@ concrete GrammarDut of Grammar = TextX, IdiomDut, StructuralDut, - TenseX ; + TenseX, + NamesDut ; diff --git a/src/dutch/NamesDut.gf b/src/dutch/NamesDut.gf new file mode 100644 index 00000000..c28a38e8 --- /dev/null +++ b/src/dutch/NamesDut.gf @@ -0,0 +1,7 @@ +concrete NamesDut of Names = CatDut ** open Prelude, ResDut in { + +lin GivenName, MaleSurname, FemaleSurname = \n -> noMerge ** {s = n.s ; a = agrP3 Sg ; isPron = False} ; +lin FullName gn sn = + noMerge ** {s = \\c => gn.s ! NPNom ++ sn.s ! c ; a = agrP3 Sg ; isPron = False} ; + +} diff --git a/src/english/CatEng.gf b/src/english/CatEng.gf index 7731e26c..7bb08abd 100644 --- a/src/english/CatEng.gf +++ b/src/english/CatEng.gf @@ -107,6 +107,11 @@ concrete CatEng of Cat = CommonX - [Pol,CAdv] ** open ResEng, Prelude in { N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Str} ; N3 = {s : Number => Case => Str ; g : Gender} ** {c2,c3 : Str} ; GN, SN, PN = {s : Case => Str ; g : Gender} ; + LN = {s : Case => Str; + p : Str; -- preposition "in Scandinavia", "on the Balkans" + art : Bool; -- plain name "United States" vs "the United States" + a : Agr; + } ; lindef SSlash = \s -> {s = s; c2 = ""} ; diff --git a/src/english/ExtendEng.gf b/src/english/ExtendEng.gf index 94e87a49..c43e535a 100644 --- a/src/english/ExtendEng.gf +++ b/src/english/ExtendEng.gf @@ -474,13 +474,6 @@ lin CardCNCard card cn = lin theyFem_Pron = mkPron "they" "them" "their" "theirs" plural P3 feminine ; lin theyNeutr_Pron = mkPron "they" "them" "their" "theirs" plural P3 nonhuman ; -lin GivenName gn = gn ; -lin MaleSurname, FemaleSurname = \sn -> sn ; -lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! c ; - g = gn.g - } ; - lin AnaphPron np = case np.a of { AgP1 Sg => i_Pron ; diff --git a/src/english/GrammarEng.gf b/src/english/GrammarEng.gf index c2600a7b..7280125c 100644 --- a/src/english/GrammarEng.gf +++ b/src/english/GrammarEng.gf @@ -14,7 +14,8 @@ concrete GrammarEng of Grammar = TextX - [Pol,PPos,PNeg,SC,CAdv], StructuralEng, IdiomEng, - TenseX - [Pol,PPos,PNeg,SC,CAdv] + TenseX - [Pol,PPos,PNeg,SC,CAdv], + NamesEng ** open ResEng, Prelude in { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/english/NamesEng.gf b/src/english/NamesEng.gf new file mode 100644 index 00000000..f02bf38e --- /dev/null +++ b/src/english/NamesEng.gf @@ -0,0 +1,31 @@ +concrete NamesEng of Names = CatEng ** open Prelude, ResEng in { + +lin GivenName gn = {s = \\c => gn.s ! npcase2case c ; a = agrgP3 Sg gn.g} ; +lin MaleSurname, FemaleSurname = \sn -> {s = \\c => sn.s ! npcase2case c ; a = agrgP3 Sg sn.g} ; +lin FullName gn sn = {s = \\c => gn.s ! Nom ++ sn.s ! npcase2case c ; a = agrgP3 Sg gn.g} ; + +lin UseLN n = { + s = \\c => case n.art of { + True => "the" ++ n.s ! npcase2case c ; + False => n.s ! npcase2case c + } ; + a = n.a + } ; + +lin PlainLN n = { + s = \\c => n.s ! npcase2case c ; + a = n.a + } ; + +lin InLN n = { + s = n.p ++ case n.art of { + True => "the" ++ n.s ! Nom ; + False => n.s ! Nom + } ; + } ; + +lin AdjLN ap n = n ** { + s = \\c => preOrPost ap.isPre (ap.s ! n.a) (n.s ! c) ; + } ; + +} diff --git a/src/english/ParadigmsEng.gf b/src/english/ParadigmsEng.gf index 0d331c9f..01f73acf 100644 --- a/src/english/ParadigmsEng.gf +++ b/src/english/ParadigmsEng.gf @@ -129,6 +129,24 @@ oper -- -- Proper names, with a regular genitive, are formed from strings. +oper + mkLN = overload { + mkLN : Str -> LN = \s -> + lin LN {s = table {Gen => s + "'s" ; _ => s} ; + p = "in" ; + art = False ; + a = agrP3 Sg} ; + + mkLN : Str -> Number -> LN = \s,n -> + lin LN {s = table {Gen => s + "'s" ; _ => s} ; + p = "in" ; + art = False ; + a = agrP3 n} ; + } ; + + defLN : LN -> LN = \n -> n ** {art = True} ; + prepLN : LN -> Str -> LN = \n,s -> n ** {p = s} ; + mkPN : overload { mkPN : Str -> PN ; diff --git a/src/estonian/CatEst.gf b/src/estonian/CatEst.gf index 28fdd42f..2c49380d 100644 --- a/src/estonian/CatEst.gf +++ b/src/estonian/CatEst.gf @@ -91,7 +91,7 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { c2,c3 : Compl ; isPre,isPre2 : Bool } ; - GN, SN, PN = {s : Case => Str} ; + GN, SN, LN, PN = {s : Case => Str} ; linref VP = \vp -> linV vp.v ; diff --git a/src/estonian/ExtendEst.gf b/src/estonian/ExtendEst.gf index aaaf8ff5..3700bb36 100644 --- a/src/estonian/ExtendEst.gf +++ b/src/estonian/ExtendEst.gf @@ -436,10 +436,4 @@ concrete ExtendEst of Extend = -- : VP -> Adv ; -- ilma raamatut nägemata WithoutVP vp = {s = "ilma" ++ infVPdefault vp InfMata} ; - -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! c - } ; - } diff --git a/src/estonian/GrammarEst.gf b/src/estonian/GrammarEst.gf index 1daf4bd4..01339dc7 100644 --- a/src/estonian/GrammarEst.gf +++ b/src/estonian/GrammarEst.gf @@ -12,7 +12,8 @@ concrete GrammarEst of Grammar = TextX, IdiomEst, StructuralEst, - TenseX + TenseX, + NamesEst ** { flags startcat = Phr ; unlexer = finnish ; lexer = text ; diff --git a/src/estonian/NamesEst.gf b/src/estonian/NamesEst.gf new file mode 100644 index 00000000..694021ec --- /dev/null +++ b/src/estonian/NamesEst.gf @@ -0,0 +1,14 @@ +concrete NamesEst of Names = CatEst ** open ResEst, Prelude in { + +lin GivenName, MaleSurname, FemaleSurname = \n -> emptyNP ** { + s = \\c => n.s ! npform2case Sg c ; + a = agrP3 Sg ; + isPron = False + } ; +lin FullName gn sn = emptyNP ** { + s = \\c => gn.s ! Nom ++ sn.s ! npform2case Sg c ; + a = agrP3 Sg ; + isPron = False + } ; + +} diff --git a/src/finnish/CatFin.gf b/src/finnish/CatFin.gf index 08b07efe..14778ba6 100644 --- a/src/finnish/CatFin.gf +++ b/src/finnish/CatFin.gf @@ -95,7 +95,7 @@ concrete CatFin of Cat = CommonX ** open ResFin, StemFin, Prelude in { N = SNoun ; N2 = SNoun ** {c2 : Compl ; isPre : Bool ; postmod : Number => Str} ; N3 = SNoun ** {c2,c3 : Compl ; isPre,isPre2 : Bool} ; - GN, SN, PN = SPN ; + GN, SN, LN, PN = SPN ; linref SSlash = \ss -> ss.s ++ ss.c2.s.p1 ; diff --git a/src/finnish/ExtendFin.gf b/src/finnish/ExtendFin.gf index 093956e1..fe7d41b0 100644 --- a/src/finnish/ExtendFin.gf +++ b/src/finnish/ExtendFin.gf @@ -241,10 +241,4 @@ lin UttAccNP np = {s = P.addNegation np.isNeg ++ np.s ! NPAcc} ; lin AdjAsCN ap = {s = ap.s ! True ; postmod = \\_ => ap.p ; h = Back} ; ---- Harmony just a guess lin AdjAsNP ap = MassNP (AdjAsCN ap) ; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! c - } ; - - } diff --git a/src/finnish/GrammarFin.gf b/src/finnish/GrammarFin.gf index 297a4f2d..c4397163 100644 --- a/src/finnish/GrammarFin.gf +++ b/src/finnish/GrammarFin.gf @@ -14,7 +14,8 @@ concrete GrammarFin of Grammar = TextX, IdiomFin, StructuralFin, - TenseX + TenseX, + NamesFin ** { flags startcat = Phr ; unlexer = finnish ; lexer = text ; diff --git a/src/finnish/NamesFin.gf b/src/finnish/NamesFin.gf new file mode 100644 index 00000000..2ffe811b --- /dev/null +++ b/src/finnish/NamesFin.gf @@ -0,0 +1,14 @@ +concrete NamesFin of Names = CatFin ** open ResFin, StemFin, Prelude in { + +lin GivenName, MaleSurname, FemaleSurname = \n -> { + s = snoun2np Sg n ; + a = agrP3 Sg ; + isPron = False ; isNeg = False + } ; +lin FullName gn sn = { + s = snoun2np Sg {s = \\c => gn.s ! Nom ++ sn.s ! c} ; + a = agrP3 Sg ; + isPron = False ; isNeg = False + } ; + +} diff --git a/src/french/DiffFre.gf b/src/french/DiffFre.gf index bafd709f..303bb731 100644 --- a/src/french/DiffFre.gf +++ b/src/french/DiffFre.gf @@ -338,4 +338,7 @@ instance DiffFre of DiffRomance - [ verbHyphen : Verb -> Str = \v -> v.s ! (VInfin True) ; --- kluge: use this field to store - or -t- +param + HasArt = NoArt | UseArt | AlwaysArt ; + } ; diff --git a/src/french/ExtendFre.gf b/src/french/ExtendFre.gf index 12d88f0d..3c3f209d 100644 --- a/src/french/ExtendFre.gf +++ b/src/french/ExtendFre.gf @@ -59,10 +59,4 @@ lin ApposNP np1 np2 = np1 ** { -- guessed by KA } ; } ; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s ; - g = gn.g - } ; - } diff --git a/src/french/GrammarFre.gf b/src/french/GrammarFre.gf index 97cd5e43..7fc42bd6 100644 --- a/src/french/GrammarFre.gf +++ b/src/french/GrammarFre.gf @@ -14,7 +14,8 @@ concrete GrammarFre of Grammar = TextX - [SC,Temp,Tense,Pol,PPos,PNeg], IdiomFre, StructuralFre, - TenseFre + TenseFre, + NamesFre ** { flags startcat = Phr ; diff --git a/src/french/NamesFre.gf b/src/french/NamesFre.gf new file mode 100644 index 00000000..821f7969 --- /dev/null +++ b/src/french/NamesFre.gf @@ -0,0 +1,36 @@ +concrete NamesFre of Names = CatFre ** open Prelude, ResFre, CommonRomance, PhonoFre in { + +lin GivenName, MaleSurname, FemaleSurname = \n -> pn2np n ; +lin FullName gn sn = pn2np { + s = gn.s ++ sn.s ; + g = gn.g + } ; + +lin PlainLN n = heavyNP { + s = \\c => n.s; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin UseLN n = heavyNP { + s = \\c => case n.art of { + AlwaysArt | UseArt => artDef True n.g n.num c ++ n.s ; + _ => n.s + } ; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin InLN n = { + s = n.p.s ++ case n.art of { + AlwaysArt => artDef True n.g n.num n.p.c ++ n.s; + _ => prepCase n.p.c ++ n.s + } ; + } ; + + +lin AdjLN ap n = n ** { + s = preOrPost ap.isPre (ap.s ! AF n.g n.num) n.s ; + } ; + +} diff --git a/src/french/ParadigmsFre.gf b/src/french/ParadigmsFre.gf index e87fcd92..e4d97828 100644 --- a/src/french/ParadigmsFre.gf +++ b/src/french/ParadigmsFre.gf @@ -132,6 +132,27 @@ oper -- Proper names need a string and a gender. If no gender is given, the -- feminine is used for strings ending with "e", the masculine for other strings. + mkLN = overload { + mkLN : Str -> Gender -> LN = \s,g -> + lin LN {s = s ; + p = {s=""; c=CPrep P_a; isDir=True} ; + art = NoArt ; + g = g ; + num = Sg} ; + + mkLN : Str -> Gender -> Number -> LN = \s,g,num -> + lin LN {s = s ; + p = {s=""; c=CPrep P_a; isDir=True} ; + art = NoArt ; + g = g ; + num = num} ; + } ; + + + defLN : LN -> LN = \n -> n ** {art = AlwaysArt} ; + useDefLN : LN -> LN = \n -> n ** {art = UseArt} ; + prepLN : LN -> Compl -> LN = \n,s -> n ** {p = s} ; + mkPN : overload { mkPN : Str -> PN ; -- feminine if ends with "e", otherwise masculine mkPN : Str -> Gender -> PN ; -- gender deviant from the simple rule diff --git a/src/german/CatGer.gf b/src/german/CatGer.gf index 48016759..8130ea6f 100644 --- a/src/german/CatGer.gf +++ b/src/german/CatGer.gf @@ -102,7 +102,7 @@ concrete CatGer of Cat = N3 = ResGer.Noun ** {c2,c3 : Preposition} ; GN = {s : Case => Str; g : Sex} ; SN = {s : Sex => Case => Str} ; - PN = {s : Case => Str; g : Gender; n : Number} ; + LN, PN = {s : Case => Str; g : Gender; n : Number} ; -- tense with possibility to choose conjunctive forms diff --git a/src/german/ExtendGer.gf b/src/german/ExtendGer.gf index 4c60590d..db9c75b1 100644 --- a/src/german/ExtendGer.gf +++ b/src/german/ExtendGer.gf @@ -142,16 +142,6 @@ lin n = Pl } ; -lin GivenName = \n -> { s = n.s; g = sex2gender n.g; n = Sg } ; -lin MaleSurname = \n -> { s = n.s ! Male ; g = Masc; n = Sg } ; -lin FemaleSurname = \n -> { s = n.s ! Female ; g = Fem; n = Sg } ; -lin PlSurname = \n -> { s = n.s ! Male ; g = Masc; n = Pl } ; -lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! gn.g ! c ; - g = sex2gender gn.g ; - n = Sg - } ; - lin PassVPSlash vp = insertObj (\\_ => (PastPartAP vp).s ! APred) (predV werdenPass) ** { c1 = subjPrep vp.c2 } ; diff --git a/src/german/GrammarGer.gf b/src/german/GrammarGer.gf index ea79032a..781ecb6e 100644 --- a/src/german/GrammarGer.gf +++ b/src/german/GrammarGer.gf @@ -14,7 +14,8 @@ concrete GrammarGer of Grammar = TextX - [Tense,Temp], IdiomGer, StructuralGer, - TenseGer + TenseGer, + NamesGer ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/german/NamesGer.gf b/src/german/NamesGer.gf new file mode 100644 index 00000000..d7d35f2f --- /dev/null +++ b/src/german/NamesGer.gf @@ -0,0 +1,38 @@ +concrete NamesGer of Names = CatGer ** open ResGer in { + +lin GivenName gn = { + s = \\c => usePrepC c (\k -> gn.s ! k) ; + a = agrgP3 (sex2gender gn.g) Sg ; + w = WLight ; + rc, ext = [] + } ; + +lin MaleSurname sn = { + s = \\c => usePrepC c (\k -> sn.s ! Male ! k) ; + a = agrgP3 Masc Sg ; + w = WLight ; + rc, ext = [] + } ; + +lin FemaleSurname sn = { + s = \\c => usePrepC c (\k -> sn.s ! Female ! k) ; + a = agrgP3 Fem Sg ; + w = WLight ; + rc, ext = [] + } ; + +lin PlSurname sn = { + s = \\c => usePrepC c (\k -> sn.s ! Male ! k) ; + 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) ; + a = agrgP3 (sex2gender gn.g) Sg ; + w = WLight ; + rc, ext = [] + } ; + +} diff --git a/src/italian/ExtendIta.gf b/src/italian/ExtendIta.gf index 45da3060..b50ae1e1 100644 --- a/src/italian/ExtendIta.gf +++ b/src/italian/ExtendIta.gf @@ -16,12 +16,6 @@ concrete ExtendIta of Extend = CatIta ** ExtendRomanceFunctor - ParadigmsIta in { -- put your own definitions here -lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s ; - g = gn.g - } ; - lin PassVPSlash vps = passVPSlash vps [] ; PassAgentVPSlash vps np = passVPSlash diff --git a/src/italian/GrammarIta.gf b/src/italian/GrammarIta.gf index 7204cbcd..773a2a17 100644 --- a/src/italian/GrammarIta.gf +++ b/src/italian/GrammarIta.gf @@ -14,7 +14,8 @@ concrete GrammarIta of Grammar = TextX - [SC,Temp,Tense,Pol,PPos,PNeg,TPres,TPast,TFut,TCond], IdiomIta, StructuralIta, - TenseIta + TenseIta, + NamesIta ** { diff --git a/src/italian/NamesIta.gf b/src/italian/NamesIta.gf new file mode 100644 index 00000000..9dde301b --- /dev/null +++ b/src/italian/NamesIta.gf @@ -0,0 +1,9 @@ +concrete NamesIta of Names = CatIta ** open ResIta in { + +lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> pn2np n ; +lin FullName gn sn = pn2np { + s = gn.s ++ sn.s ; + g = gn.g + } ; + +} diff --git a/src/korean/CatKor.gf b/src/korean/CatKor.gf index 05a56da1..8f6a076b 100644 --- a/src/korean/CatKor.gf +++ b/src/korean/CatKor.gf @@ -115,7 +115,7 @@ concrete CatKor of Cat = CommonX ** open ResKor, Prelude in { N = ResKor.Noun ; N2 = ResKor.Noun2 ; N3 = ResKor.Noun3 ; - GN, SN, PN = ResKor.NounPhrase ; + GN, SN, LN, PN = ResKor.NounPhrase ; linref V, V2, V3 = linVerb ; diff --git a/src/korean/ExtendKor.gf b/src/korean/ExtendKor.gf index 560f6bce..9e318518 100644 --- a/src/korean/ExtendKor.gf +++ b/src/korean/ExtendKor.gf @@ -9,10 +9,4 @@ concrete ExtendKor of Extend = CatKor -- : NP -> NP -> NP ApposNP np1 np2 = np1 ** {s = \\nf => np1.s ! nf ++ np2.s ! nf} ; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = \\nf => gn.s ! nf ++ sn.s ! nf ; - p = gn.p - } ; - } ; diff --git a/src/korean/GrammarKor.gf b/src/korean/GrammarKor.gf index 55550ada..e0fd1c01 100644 --- a/src/korean/GrammarKor.gf +++ b/src/korean/GrammarKor.gf @@ -12,7 +12,8 @@ concrete GrammarKor of Grammar = TextX, StructuralKor, IdiomKor, - TenseX + TenseX, + NamesKor ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/korean/NamesKor.gf b/src/korean/NamesKor.gf new file mode 100644 index 00000000..5f0f3ad0 --- /dev/null +++ b/src/korean/NamesKor.gf @@ -0,0 +1,9 @@ +concrete NamesKor of Names = CatKor ** open ResKor in { + +lin GivenName, MaleSurname, FemaleSurname = \n -> n ; +lin FullName gn sn = { + s = \\nf => gn.s ! nf ++ sn.s ! nf ; + p = gn.p + } ; + +} diff --git a/src/maltese/CatMlt.gf b/src/maltese/CatMlt.gf index aa800934..a091c831 100644 --- a/src/maltese/CatMlt.gf +++ b/src/maltese/CatMlt.gf @@ -118,7 +118,7 @@ concrete CatMlt of Cat = CommonX - [Adv] ** open ResMlt, Prelude in { N = Noun ; N2 = Noun ** {c2 : Compl} ; N3 = Noun ** {c2, c3 : Compl} ; - GN, SN, PN = ProperNoun ; + GN, SN, LN, PN = ProperNoun ; -- Overridden from CommonX diff --git a/src/maltese/ExtraMlt.gf b/src/maltese/ExtraMlt.gf index 7b9dab47..8a9a9c88 100644 --- a/src/maltese/ExtraMlt.gf +++ b/src/maltese/ExtraMlt.gf @@ -24,10 +24,4 @@ concrete ExtraMlt of ExtraMltAbs = CatMlt ** a = p.a ; } ; -lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s ; - a = gn.a - } ; - } diff --git a/src/maltese/GrammarMlt.gf b/src/maltese/GrammarMlt.gf index 885e7208..4dbf5e94 100644 --- a/src/maltese/GrammarMlt.gf +++ b/src/maltese/GrammarMlt.gf @@ -20,7 +20,8 @@ concrete GrammarMlt of Grammar = TextX - [Adv], StructuralMlt, IdiomMlt, - TenseX - [Adv] + TenseX - [Adv], + NamesMlt ** { flags coding=utf8 ; diff --git a/src/maltese/NamesMlt.gf b/src/maltese/NamesMlt.gf new file mode 100644 index 00000000..c470fbe4 --- /dev/null +++ b/src/maltese/NamesMlt.gf @@ -0,0 +1,16 @@ +concrete NamesMlt of Names = CatMlt ** open ResMlt, Prelude in { + +lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> { + s = \\c => n.s ; + a = n.a ; + isPron = False ; + isDefn = False + } ; +lin FullName gn sn = { + s = \\c => gn.s ++ sn.s ; + a = gn.a ; + isPron = False ; + isDefn = False + } ; + +} diff --git a/src/polish/CatPol.gf b/src/polish/CatPol.gf index 702952fe..877432ca 100644 --- a/src/polish/CatPol.gf +++ b/src/polish/CatPol.gf @@ -119,7 +119,7 @@ concrete CatPol of Cat = CommonX - [CAdv] ** open ResPol, Prelude, (R = ParamX) N3 = Noun ** { c1, c2 : Complement } ; - GN, SN, PN = NounPhrase; + GN, SN, LN, PN = NounPhrase; CAdv = {s,p,sn,pn : Str} ; diff --git a/src/polish/ExtendPol.gf b/src/polish/ExtendPol.gf index f787007f..afa4f84c 100644 --- a/src/polish/ExtendPol.gf +++ b/src/polish/ExtendPol.gf @@ -40,13 +40,4 @@ oper -- KA: PassVPSlash is derived from PassV2. Objects might be ignored lin PassVPSlash vps = setImienne vps True; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - nom = gn.nom ++ sn.nom ; - voc = gn.nom ++ sn.voc ; - dep = \\c => gn.nom ++ sn.dep ! c ; - gn = gn.gn ; - p = gn.p - } ; - } diff --git a/src/polish/GrammarPol.gf b/src/polish/GrammarPol.gf index 6393ceee..85172e1d 100644 --- a/src/polish/GrammarPol.gf +++ b/src/polish/GrammarPol.gf @@ -15,6 +15,7 @@ concrete GrammarPol of Grammar = PhrasePol, TenseX - [CAdv], TextX - [CAdv], + NamesPol, StructuralPol, IdiomPol ** { flags startcat = Phr ; unlexer = text ; lexer = text ;} ; diff --git a/src/polish/NamesPol.gf b/src/polish/NamesPol.gf new file mode 100644 index 00000000..e5cc8225 --- /dev/null +++ b/src/polish/NamesPol.gf @@ -0,0 +1,12 @@ +concrete NamesPol of Names = CatPol ** { + +lin GivenName, MaleSurname, FemaleSurname = \n -> n ; +lin FullName gn sn = { + nom = gn.nom ++ sn.nom ; + voc = gn.nom ++ sn.voc ; + dep = \\c => gn.nom ++ sn.dep ! c ; + gn = gn.gn ; + p = gn.p + } ; + +} diff --git a/src/portuguese/ExtendPor.gf b/src/portuguese/ExtendPor.gf index 68ba4f96..c91b169a 100644 --- a/src/portuguese/ExtendPor.gf +++ b/src/portuguese/ExtendPor.gf @@ -116,10 +116,4 @@ concrete ExtendPor of Extend = CatPor ** ExtendRomanceFunctor - youPolPlFem_Pron = pronAgr youPolPl_Pron Fem Pl P2 ; theyFem_Pron = mkPronFrom S.they_Pron "elas" "as" "lhes" "elas" Fem Pl P3 ; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s ; - g = gn.g - } ; - } ; diff --git a/src/portuguese/GrammarPor.gf b/src/portuguese/GrammarPor.gf index 4f28e1ec..7e41abd2 100644 --- a/src/portuguese/GrammarPor.gf +++ b/src/portuguese/GrammarPor.gf @@ -14,7 +14,8 @@ concrete GrammarPor of Grammar = TextPor - [SC,Temp,Tense,Pol,PPos,PNeg], -- special punctuation IdiomPor, StructuralPor, - TensePor + TensePor, + NamesPor ** { diff --git a/src/portuguese/NamesPor.gf b/src/portuguese/NamesPor.gf new file mode 100644 index 00000000..1d185325 --- /dev/null +++ b/src/portuguese/NamesPor.gf @@ -0,0 +1,9 @@ +concrete NamesPor of Names = CatPor ** open ResPor in { + +lin GivenName, MaleSurname, FemaleSurname = \n -> pn2np n ; +lin FullName gn sn = pn2np { + s = gn.s ++ sn.s ; + g = gn.g + } ; + +} diff --git a/src/romance/CatRomance.gf b/src/romance/CatRomance.gf index 3b52a103..06cd7d87 100644 --- a/src/romance/CatRomance.gf +++ b/src/romance/CatRomance.gf @@ -111,6 +111,13 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol] N2 = Noun ** {c2 : Compl} ; N3 = Noun ** {c2,c3 : Compl} ; GN, SN, PN = {s : Str ; g : Gender} ; + + lincat LN = {s : Str; + p : Compl; + art : HasArt; + g : Gender; + num : Number; + } ; -- tense augmented with passé simple lincat diff --git a/src/romance/DiffRomance.gf b/src/romance/DiffRomance.gf index 93fd0eef..acb5237d 100644 --- a/src/romance/DiffRomance.gf +++ b/src/romance/DiffRomance.gf @@ -218,4 +218,6 @@ oper stare_V : Verb ; stare_V = essere_V ; + param HasArt ; + } ; diff --git a/src/romanian/CatRon.gf b/src/romanian/CatRon.gf index 094a6ed9..9cb5bb4f 100644 --- a/src/romanian/CatRon.gf +++ b/src/romanian/CatRon.gf @@ -131,7 +131,7 @@ concrete CatRon of Cat = N3 = Noun ** {c2,c3 : Compl} ; - GN, SN, PN = {s : NCase => Str ; g : Gender ; n : Number; a : Animacy} ; + GN, SN, LN, PN = {s : NCase => Str ; g : Gender ; n : Number; a : Animacy} ; Comp = {s : Agr => Str} ; diff --git a/src/romanian/ExtendRon.gf b/src/romanian/ExtendRon.gf index 340538bf..a70d332b 100644 --- a/src/romanian/ExtendRon.gf +++ b/src/romanian/ExtendRon.gf @@ -1,7 +1,7 @@ --# -path=.:../common:../abstract concrete ExtendRon of Extend = - CatRon ** ExtendFunctor - [PassVPSlash, GivenName, MaleSurname, FemaleSurname, FullName] + CatRon ** ExtendFunctor - [PassVPSlash] with (Grammar = GrammarRon) ** open ResRon in { @@ -17,12 +17,4 @@ lin iFem_Pron = mkPronoun "eu" "mine" "mie" [] [] "meu" "mea" "mei" "mele" Fem S -- KA: derived from PassV2, objects are ignored lin PassVPSlash vps = insertSimpObj (\\a => vps.s ! PPasse a.g a.n Indef ANomAcc) auxPassive ** {lock_VP = <>}; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { -- KA: guessed - s = \\c => gn.s ! No ++ sn.s ! c ; - g = gn.g ; - n = gn.n ; - a = gn.a - } ; - } diff --git a/src/romanian/GrammarRon.gf b/src/romanian/GrammarRon.gf index f929ac57..8b488332 100644 --- a/src/romanian/GrammarRon.gf +++ b/src/romanian/GrammarRon.gf @@ -15,7 +15,8 @@ concrete GrammarRon of Grammar = TextX - [CAdv,Temp,Tense], -- Prelude, MorphoRon, Coordination, StructuralRon, - TenseRon + TenseRon, + NamesRon ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/romanian/NamesRon.gf b/src/romanian/NamesRon.gf new file mode 100644 index 00000000..6784ba91 --- /dev/null +++ b/src/romanian/NamesRon.gf @@ -0,0 +1,34 @@ +concrete NamesRon of Names = CatRon ** open ResRon, Prelude in { + +lin GivenName, MaleSurname, FemaleSurname = \pn -> -- KA: guessed + let + g = pn.g ; + n = pn.n ; + ag = agrP3 g n ; + hc = getClit pn.a + in { + s = \\c => {comp = pn.s ! c ; + clit = \\cs => if_then_Str hc ((genCliticsCase ag c).s ! cs) [] } ; + + a = ag; + nForm = if_then_else NForm hc HasClit (HasRef False) ; + isPronoun = False ; isPol = False; + indForm = pn.s ! No + } ; + +lin FullName gn sn = -- KA: guessed + let + g = gn.g ; + n = gn.n ; + ag = agrP3 g n ; + hc = getClit gn.a + in { + s = \\c => {comp = gn.s ! No ++ sn.s ! c ; + clit = \\cs => if_then_Str hc ((genCliticsCase ag c).s ! cs) [] } ; + a = ag; + nForm = if_then_else NForm hc HasClit (HasRef False) ; + isPronoun = False ; isPol = False; + indForm = gn.s ! No ++ sn.s ! No + } ; + +} diff --git a/src/russian/CatRus.gf b/src/russian/CatRus.gf index 0c0a0148..76c8d14d 100644 --- a/src/russian/CatRus.gf +++ b/src/russian/CatRus.gf @@ -1,7 +1,7 @@ concrete CatRus of Cat = CommonX ** open ResRus, Prelude in { flags coding=utf8 ; optimize=all ; lincat - N, GN, SN, PN = ResRus.NounForms ; + N, GN, SN, LN, PN = ResRus.NounForms ; N2 = ResRus.Noun2Forms ; N3 = ResRus.Noun3Forms ; diff --git a/src/russian/ExtendRus.gf b/src/russian/ExtendRus.gf index 4d9692cc..04060d9b 100644 --- a/src/russian/ExtendRus.gf +++ b/src/russian/ExtendRus.gf @@ -217,26 +217,4 @@ lin oper rus_quoted : Str -> Str = \s -> "«" ++ s ++ "»" ; ---- TODO bind ; move to Prelude? -lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ; -lin FullName gn sn = { - snom = gn.snom ++ sn.snom ; - sgen = gn.snom ++ sn.sgen ; - sdat = gn.snom ++ sn.sdat ; - sacc = gn.snom ++ sn.sacc ; - sins = gn.snom ++ sn.sins ; - sprep = gn.snom ++ sn.sprep ; - sloc = gn.snom ++ sn.sloc ; - sptv = gn.snom ++ sn.sptv ; - svoc = gn.snom ++ sn.svoc ; - pnom = gn.snom ++ sn.pnom ; - pgen = gn.snom ++ sn.pgen ; - pdat = gn.snom ++ sn.pdat ; - pacc = gn.snom ++ sn.pacc ; - pins = gn.snom ++ sn.pins ; - pprep = gn.snom ++ sn.pprep ; - g = gn.g ; - mayben = gn.mayben ; - anim = gn.anim - } ; - } ; diff --git a/src/russian/GrammarRus.gf b/src/russian/GrammarRus.gf index 2973754c..1090a301 100644 --- a/src/russian/GrammarRus.gf +++ b/src/russian/GrammarRus.gf @@ -14,5 +14,6 @@ concrete GrammarRus of Grammar = TextX, StructuralRus, IdiomRus, - TenseRus - ** { flags startcat = Phr ; unlexer = text ; lexer = text ; coding=utf8 ;} ; \ No newline at end of file + TenseRus, + NamesRus + ** { flags startcat = Phr ; unlexer = text ; lexer = text ; coding=utf8 ;} ; diff --git a/src/russian/NamesRus.gf b/src/russian/NamesRus.gf new file mode 100644 index 00000000..1a31cd93 --- /dev/null +++ b/src/russian/NamesRus.gf @@ -0,0 +1,25 @@ +concrete NamesRus of Names = CatRus ** open ResRus, Prelude in { + +lin GivenName, MaleSurname, FemaleSurname, PlSurname = \pn -> + { s=\\cas => (nounFormsNoun pn).s ! Sg ! cas ; + pron=False; + a=Ag (gennum pn.g Sg) P3 + } ; -- Does NP need animacy? + +lin FullName gn sn = + { s= table { + Nom => gn.snom ++ sn.snom ; + Gen => gn.snom ++ sn.sgen ; + Dat => gn.snom ++ sn.sdat ; + Acc => gn.snom ++ sn.sacc ; + Ins => gn.snom ++ sn.sins ; + Pre => gn.snom ++ sn.sprep ; + Loc => gn.snom ++ sn.sloc ; + Ptv => gn.snom ++ sn.sptv ; + VocRus => gn.snom ++ sn.svoc + } ; + pron=False; + a=Ag (gennum gn.g Sg) P3 + } ; + +} diff --git a/src/scandinavian/CatScand.gf b/src/scandinavian/CatScand.gf index 454d6e76..737ae6ee 100644 --- a/src/scandinavian/CatScand.gf +++ b/src/scandinavian/CatScand.gf @@ -108,7 +108,7 @@ incomplete concrete CatScand of Cat = -- {s : Number => Species => Case => Str ; g : Gender} ; N2 = Noun ** {c2 : Complement} ; N3 = Noun ** {c2,c3 : Complement} ; - GN, SN, PN = {s : Case => Str ; g : Gender} ; + GN, SN, LN, PN = {s : Case => Str ; g : Gender} ; diff --git a/src/slovenian/CatSlv.gf b/src/slovenian/CatSlv.gf index c5994727..7c069fb7 100644 --- a/src/slovenian/CatSlv.gf +++ b/src/slovenian/CatSlv.gf @@ -58,7 +58,7 @@ lincat GN = {s : Case => Str; g : Sex}; SN = {s : Sex => Case => Str}; - PN = {s : Case => Str; g : AGender; n : Number}; + LN, PN = {s : Case => Str; g : AGender; n : Number}; linref V, VA, VS, V2, V3, V2A, V2S, V2Q, V2V = \v -> v.s ! VInf ++ v.refl ++ v.p; diff --git a/src/slovenian/ExtendSlv.gf b/src/slovenian/ExtendSlv.gf index 0e95985f..c03f7ae1 100644 --- a/src/slovenian/ExtendSlv.gf +++ b/src/slovenian/ExtendSlv.gf @@ -57,14 +57,5 @@ lin youPolPl_Pron = youPol_Pron ; youPolPlFem_Pron = youPlFem_Pron ; -lin GivenName = \n -> {s = n.s; g = sex2agender n.g; n = Sg} ; -lin MaleSurname = \n -> {s = n.s ! Male; g = AMasc Animate; n = Sg} ; -lin FemaleSurname = \n -> {s = n.s ! Female; g = AFem; n = Sg} ; -lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! gn.g ! c ; - g = sex2agender gn.g ; - n = Sg - } ; - } diff --git a/src/slovenian/GrammarSlv.gf b/src/slovenian/GrammarSlv.gf index f8650ba2..660891af 100644 --- a/src/slovenian/GrammarSlv.gf +++ b/src/slovenian/GrammarSlv.gf @@ -14,7 +14,8 @@ concrete GrammarSlv of Grammar = TextX - [Pol,PPos,PNeg], StructuralSlv, IdiomSlv, ----AR - TenseX + TenseX, + NamesSlv ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/slovenian/NamesSlv.gf b/src/slovenian/NamesSlv.gf new file mode 100644 index 00000000..85e7fa59 --- /dev/null +++ b/src/slovenian/NamesSlv.gf @@ -0,0 +1,24 @@ +concrete NamesSlv of Names = CatSlv ** open ResSlv, Prelude in { + +lin GivenName = \n -> { + s = n.s; + a = {g=agender2gender (sex2agender n.g); n=Sg; p=P3}; + isPron = False + } ; +lin MaleSurname = \n -> { + s = n.s ! Male; + a = {g=Masc; n=Sg; p=P3}; + isPron = False + } ; +lin FemaleSurname = \n -> { + s = n.s ! Female; + a = {g=Fem; n=Sg; p=P3}; + isPron = False + } ; +lin FullName gn sn = { + s = \\c => gn.s ! Nom ++ sn.s ! gn.g ! c ; + a = {g=agender2gender (sex2agender gn.g); n=Sg; p=P3}; + isPron = False + } ; + +} diff --git a/src/somali/CatSom.gf b/src/somali/CatSom.gf index adc4d2a4..f6f84ad6 100644 --- a/src/somali/CatSom.gf +++ b/src/somali/CatSom.gf @@ -118,7 +118,7 @@ concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in { N = ResSom.Noun ; N2 = ResSom.Noun2 ; N3 = ResSom.Noun3 ; - GN, SN, PN = ResSom.PNoun ; + GN, SN, LN, PN = ResSom.PNoun ; Adv = ResSom.Adverb ; -- Preposition of an adverbial can merge with obligatory complements of the verb. diff --git a/src/somali/ExtendSom.gf b/src/somali/ExtendSom.gf index dd21115b..ef59243d 100644 --- a/src/somali/ExtendSom.gf +++ b/src/somali/ExtendSom.gf @@ -17,10 +17,4 @@ lin -- FocusAdV : AdV -> S -> Utt ; -- never will I sleep -- FocusAP : AP -> NP -> Utt ; -- green was the tree -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s ; - a = gn.a - } ; - } ; diff --git a/src/somali/GrammarSom.gf b/src/somali/GrammarSom.gf index 1b32f79a..b7b935e0 100644 --- a/src/somali/GrammarSom.gf +++ b/src/somali/GrammarSom.gf @@ -12,7 +12,8 @@ concrete GrammarSom of Grammar = TextX - [Adv,IAdv], StructuralSom, IdiomSom, - TenseX - [Adv,IAdv] + TenseX - [Adv,IAdv], + NamesSom ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/somali/NamesSom.gf b/src/somali/NamesSom.gf new file mode 100644 index 00000000..b560613e --- /dev/null +++ b/src/somali/NamesSom.gf @@ -0,0 +1,18 @@ +concrete NamesSom of Names = CatSom ** open ResSom, Prelude in { + +lin GivenName, MaleSurname, FemaleSurname = \n -> n ** { + s = \\c => n.s ; + isPron = False ; + st = Definite ; + empty = [] ; + }; + +lin FullName gn sn = { + s = \\c => gn.s ++ sn.s ; + a = gn.a ; + isPron = False ; + st = Definite ; + empty = [] ; + } ; + +} diff --git a/src/spanish/DiffSpa.gf b/src/spanish/DiffSpa.gf index f86ac962..d36d8232 100644 --- a/src/spanish/DiffSpa.gf +++ b/src/spanish/DiffSpa.gf @@ -237,4 +237,7 @@ instance DiffSpa of DiffRomance - [iAdvQuestionInv,otherInv,partAgr,stare_V,vpAg polNegDirSubj = RPos ; +param + HasArt = NoArt | UseArt ; + } diff --git a/src/spanish/ExtendSpa.gf b/src/spanish/ExtendSpa.gf index 75292f0c..c853586b 100644 --- a/src/spanish/ExtendSpa.gf +++ b/src/spanish/ExtendSpa.gf @@ -106,12 +106,6 @@ concrete ExtendSpa of Extend = CatSpa ** ExtendRomanceFunctor - lin UseComp_estar comp = insertComplement comp.s (predV I.estar_V) ; UseComp_ser comp = insertComplement comp.s (predV copula) ; -lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ; -lin FullName gn sn = { - s = gn.s ++ sn.s ; - g = gn.g - } ; - lin PassVPSlash vps = passVPSlash vps [] ; PassAgentVPSlash vps np = passVPSlash vps (let by = in by.s ++ (np.s ! by.c).ton) ; diff --git a/src/spanish/GrammarSpa.gf b/src/spanish/GrammarSpa.gf index f3451571..01944052 100644 --- a/src/spanish/GrammarSpa.gf +++ b/src/spanish/GrammarSpa.gf @@ -14,7 +14,8 @@ concrete GrammarSpa of Grammar = TextSpa - [SC,Temp,Tense,Pol,PPos,PNeg], -- special punctuation IdiomSpa, StructuralSpa, - TenseSpa + TenseSpa, + NamesSpa ** { diff --git a/src/spanish/NamesSpa.gf b/src/spanish/NamesSpa.gf new file mode 100644 index 00000000..8164d81d --- /dev/null +++ b/src/spanish/NamesSpa.gf @@ -0,0 +1,52 @@ +concrete NamesSpa of Names = CatSpa ** open Prelude, ResSpa, CommonRomance in { + +lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> pn2np n ; +lin FullName gn sn = pn2np { + s = gn.s ++ sn.s ; + g = gn.g + } ; + +lin PlainLN n = heavyNP { + s = \\c => n.s; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin UseLN n = heavyNP { + s = \\c => case n.art of { + UseArt => case n.g of { + Fem => case n.num of { + Sg => "la" ++ n.s; + Pl => "las" ++ n.s} ; + Masc => case n.num of { + Sg => "el" ++ n.s; + Pl => "los" ++ n.s + } + } ; + NoArt => n.s + } ; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin InLN n = { + s = n.p.s ++ case n.art of { + UseArt => case n.g of { + Fem => case n.num of { + Sg => "la" ++ n.s; + Pl => "las" ++ n.s} ; + Masc => case n.num of { + Sg => "el" ++ n.s; + Pl => "los" ++ n.s + } + } ; + NoArt => n.s + } ; + } ; + + +lin AdjLN ap n = n ** { + s = preOrPost ap.isPre (ap.s ! AF n.g n.num) n.s ; + } ; + +} diff --git a/src/spanish/ParadigmsSpa.gf b/src/spanish/ParadigmsSpa.gf index 56ead98f..a0080fb5 100644 --- a/src/spanish/ParadigmsSpa.gf +++ b/src/spanish/ParadigmsSpa.gf @@ -137,6 +137,25 @@ oper -- Proper names need a string and a gender. -- The default gender is feminine for names ending with "a", otherwise masculine. + mkLN = overload { + mkLN : Str -> Gender -> LN = \s,g -> + lin LN {s = s ; + p = {s = "en"; c = Nom; isDir = True} ; + art = NoArt ; + g = g ; + num = Sg} ; + + mkLN : Str -> Gender -> Number -> LN = \s,g,num -> + lin LN {s = s ; + p = {s = "en"; c = Nom; isDir = True} ; + art = NoArt ; + g = g ; + num = num} ; + } ; + + + defLN : LN -> LN = \n -> n ** {art = UseArt} ; + mkPN : overload { mkPN : (Anna : Str) -> PN ; -- feminine for "-a" mkPN : (Pilar : Str) -> Gender -> PN ; -- force gender diff --git a/src/swahili/GrammarSwa.gf b/src/swahili/GrammarSwa.gf index 023714da..5e7230e9 100644 --- a/src/swahili/GrammarSwa.gf +++ b/src/swahili/GrammarSwa.gf @@ -14,7 +14,8 @@ concrete GrammarSwa of Grammar = TextX, StructuralSwa, IdiomSwa, - TenseX + TenseX, + NamesSwa ** { flags startcat = Phr ; diff --git a/src/swahili/NamesSwa.gf b/src/swahili/NamesSwa.gf new file mode 100644 index 00000000..580f416a --- /dev/null +++ b/src/swahili/NamesSwa.gf @@ -0,0 +1 @@ +concrete NamesSwa of Names = CatSwa ** { } diff --git a/src/swedish/ExtendSwe.gf b/src/swedish/ExtendSwe.gf index f895b7a4..c1689845 100644 --- a/src/swedish/ExtendSwe.gf +++ b/src/swedish/ExtendSwe.gf @@ -392,11 +392,5 @@ lin UseDAPMasc, UseDAPFem = \dap -> lin CardCNCard card cn = {s = \\g => card.s ! cn.g ++ cn.s ! card.n ! DIndef ! Nom ; n = Pl} ; - -lin GivenName, MaleSurname, FemaleSurname = \n -> n ; -lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! c ; - g = gn.g - } ; } diff --git a/src/swedish/GrammarSwe.gf b/src/swedish/GrammarSwe.gf index 2bfe758a..6a917261 100644 --- a/src/swedish/GrammarSwe.gf +++ b/src/swedish/GrammarSwe.gf @@ -14,7 +14,8 @@ concrete GrammarSwe of Grammar = TextX -[Tense,Temp], IdiomSwe, StructuralSwe, - TenseSwe + TenseSwe, + NamesSwe ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/swedish/NamesSwe.gf b/src/swedish/NamesSwe.gf new file mode 100644 index 00000000..6f0791e1 --- /dev/null +++ b/src/swedish/NamesSwe.gf @@ -0,0 +1,14 @@ +concrete NamesSwe of Names = CatSwe ** open CommonScand, ResSwe, Prelude in { + +lin GivenName, MaleSurname, FemaleSurname = \pn -> { + s = \\c => pn.s ! caseNP c ; + a = agrP3 pn.g Sg ; + isPron = False + } ; +lin FullName gn sn = { + s = \\c => gn.s ! Nom ++ sn.s ! caseNP c ; + a = agrP3 gn.g Sg ; + isPron = False + } ; + +} diff --git a/src/thai/CatTha.gf b/src/thai/CatTha.gf index ecab4fbd..398c19f1 100644 --- a/src/thai/CatTha.gf +++ b/src/thai/CatTha.gf @@ -71,6 +71,6 @@ concrete CatTha of Cat = CommonX ** open ResTha, Prelude in { N = ResTha.Noun ; N2 = ResTha.Noun ** {c2 : Str} ; N3 = ResTha.Noun ** {c2,c3 : Str} ; - GN, SN, PN = ResTha.NP ; + GN, SN, LN, PN = ResTha.NP ; } diff --git a/src/thai/GrammarTha.gf b/src/thai/GrammarTha.gf index a338635c..3ed12b02 100644 --- a/src/thai/GrammarTha.gf +++ b/src/thai/GrammarTha.gf @@ -14,7 +14,8 @@ concrete GrammarTha of Grammar = TextTha, StructuralTha, IdiomTha, - TenseX + TenseX, + NamesTha ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/thai/NamesTha.gf b/src/thai/NamesTha.gf new file mode 100644 index 00000000..3d009d95 --- /dev/null +++ b/src/thai/NamesTha.gf @@ -0,0 +1 @@ +concrete NamesTha of Names = CatTha ** { } diff --git a/src/turkish/CatTur.gf b/src/turkish/CatTur.gf index 83199fbb..ec30fa20 100644 --- a/src/turkish/CatTur.gf +++ b/src/turkish/CatTur.gf @@ -49,7 +49,7 @@ concrete CatTur of Cat = CommonX - [CAdv,AdN] ** open ResTur, HarmonyTur, Prelud N = Noun ; N2 = Noun ** {c : Prep} ; N3 = Noun ** {c1,c2 : Prep} ; - GN, SN, PN = { + GN, SN, LN, PN = { s : Case => Str ; h : Harmony ; n : Number diff --git a/src/turkish/ExtendTur.gf b/src/turkish/ExtendTur.gf index dc45b9e7..775457b7 100644 --- a/src/turkish/ExtendTur.gf +++ b/src/turkish/ExtendTur.gf @@ -7,12 +7,4 @@ concrete ExtendTur of Extend = CatTur ** open ResTur in { a = {n=num.n; p=P3} ; } ; -lin GivenName, MaleSurname, FemaleSurname = \n -> n ** {n = Sg}; -lin PlSurname = \n -> n ** {n = Pl}; -lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! c ; - h = sn.h ; - n = Sg - } ; - } diff --git a/src/turkish/GrammarTur.gf b/src/turkish/GrammarTur.gf index 72c0c357..c1f3322a 100644 --- a/src/turkish/GrammarTur.gf +++ b/src/turkish/GrammarTur.gf @@ -14,7 +14,8 @@ concrete GrammarTur of Grammar = StructuralTur, PhraseTur, IdiomTur, - TenseX - [CAdv, AdN] + TenseX - [CAdv, AdN], + NamesTur ** { flags startcat = Phr ; diff --git a/src/turkish/NamesTur.gf b/src/turkish/NamesTur.gf new file mode 100644 index 00000000..df4c4c6a --- /dev/null +++ b/src/turkish/NamesTur.gf @@ -0,0 +1,19 @@ +concrete NamesTur of Names = CatTur ** open ResTur in { + +lin GivenName, MaleSurname, FemaleSurname = \n -> { + s = \\c => n.s ! c; + h = n.h; + a = {n = Sg; p = P3} + } ; +lin PlSurname = \n -> { + s = \\c => n.s ! c; + h = n.h; + a = {n = Pl; p = P3} + } ; +lin FullName gn sn = { + s = \\c => gn.s ! Nom ++ sn.s ! c; + h = sn.h; + a = {n = Sg; p = P3} + } ; + +} From cb26429655561036f419e43e76dfe1f5c49fa54d Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 24 Jul 2023 20:01:56 +0200 Subject: [PATCH 006/129] added missing param --- src/catalan/DiffCat.gf | 3 +++ src/italian/DiffIta.gf | 3 +++ src/portuguese/DiffPor.gf | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/catalan/DiffCat.gf b/src/catalan/DiffCat.gf index b157d3cd..f4e7c1e8 100644 --- a/src/catalan/DiffCat.gf +++ b/src/catalan/DiffCat.gf @@ -225,4 +225,7 @@ oper polNegDirSubj = RPos ; +param + HasArt = NoArt | UseArt ; + } diff --git a/src/italian/DiffIta.gf b/src/italian/DiffIta.gf index 32988d71..215bd6c5 100644 --- a/src/italian/DiffIta.gf +++ b/src/italian/DiffIta.gf @@ -251,4 +251,7 @@ instance DiffIta of DiffRomance - [contractInf] = open CommonRomance, PhonoIta, polNegDirSubj = RPos ; +param + HasArt = NoArt | UseArt ; + } diff --git a/src/portuguese/DiffPor.gf b/src/portuguese/DiffPor.gf index 04185d2d..1a7085eb 100644 --- a/src/portuguese/DiffPor.gf +++ b/src/portuguese/DiffPor.gf @@ -291,4 +291,7 @@ instance DiffPor of DiffRomance - [iAdvQuestionInv,chooseTA,otherInv,partAgr,sta -- make a verb of type haver verboV v = verbBesch v ** {vtyp = VTer ; p = [] } ; +param + HasArt = NoArt | UseArt ; + } ; From 5d912f78a48f9ff42f9977e3f65c3193f198f7e3 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 24 Jul 2023 20:06:01 +0200 Subject: [PATCH 007/129] floating point numerals --- src/abstract/Noun.gf | 1 + src/afrikaans/NounAfr.gf | 2 ++ src/bulgarian/NounBul.gf | 2 ++ src/chinese/NamesChi.gf | 5 +++-- src/dutch/NounDut.gf | 2 ++ src/english/NounEng.gf | 2 ++ src/estonian/NounEst.gf | 5 +++++ src/finnish/NounFin.gf | 5 +++++ src/german/NounGer.gf | 2 ++ src/korean/NounKor.gf | 6 ++++++ src/maltese/NounMlt.gf | 4 ++++ src/polish/NounPol.gf | 2 ++ src/romance/NounRomance.gf | 2 ++ src/romanian/NounRon.gf | 5 ++++- src/russian/NounRus.gf | 2 ++ src/scandinavian/NounScand.gf | 2 ++ src/turkish/NounTur.gf | 4 ++++ 17 files changed, 50 insertions(+), 3 deletions(-) diff --git a/src/abstract/Noun.gf b/src/abstract/Noun.gf index 31cfdf59..e6298dbc 100644 --- a/src/abstract/Noun.gf +++ b/src/abstract/Noun.gf @@ -58,6 +58,7 @@ abstract Noun = Cat ** { data NumDigits : Digits -> Card ; -- 51 + NumFloat : Digits -> Digits -> Card ; -- 3.14 NumNumeral : Numeral -> Card ; -- fifty-one -- The construction of numerals is defined in [Numeral Numeral.html]. diff --git a/src/afrikaans/NounAfr.gf b/src/afrikaans/NounAfr.gf index 84c73d22..147672be 100644 --- a/src/afrikaans/NounAfr.gf +++ b/src/afrikaans/NounAfr.gf @@ -77,6 +77,8 @@ concrete NounAfr of Noun = CatAfr ** open ResAfr, Prelude in { NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; + NumFloat n1 n2 = {s = \\g,c => n1.s ! NCard Neutr Nom ++ BIND ++ "." ++ BIND ++ n1.s ! NCard g c; n = Pl } ; + NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdNumeral numeral = {s = \\af => numeral.s ! NOrd af} ; diff --git a/src/bulgarian/NounBul.gf b/src/bulgarian/NounBul.gf index 2fd91ca1..99476be6 100644 --- a/src/bulgarian/NounBul.gf +++ b/src/bulgarian/NounBul.gf @@ -118,6 +118,8 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in { NumDigits n = {s = \\gspec => n.s ! NCard gspec; nn = case n.n of {Sg => NNum Sg; Pl => NCountable}} ; OrdDigits n = {s = \\aform => n.s ! NOrd aform} ; + NumFloat n1 n2 = {s = \\gspec => n1.s ! NCard (CFMasc Indef NonHuman) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard gspec ; nn = NCountable} ; + NumNumeral numeral = {s = \\gspec => numeral.s ! NCard gspec; nn = case numeral.n of {Sg => NNum Sg; Pl => NCountable}} ; OrdNumeral numeral = {s = \\aform => numeral.s ! NOrd aform} ; diff --git a/src/chinese/NamesChi.gf b/src/chinese/NamesChi.gf index ccb35fa8..f0dc95b9 100644 --- a/src/chinese/NamesChi.gf +++ b/src/chinese/NamesChi.gf @@ -1,8 +1,9 @@ concrete NamesChi of Names = CatChi ** { -lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ; +lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ** {det = []} ; lin FullName gn sn = { - s = gn.s ++ sn.s + s = gn.s ++ sn.s ; + det = [] } ; } diff --git a/src/dutch/NounDut.gf b/src/dutch/NounDut.gf index 18e52291..3abcab0e 100644 --- a/src/dutch/NounDut.gf +++ b/src/dutch/NounDut.gf @@ -85,6 +85,8 @@ concrete NounDut of Noun = CatDut ** open ResDut, Prelude in { NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; + NumFloat n1 n2 = {s = \\g,c => n1.s ! NCard Utr Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard g c; n = Pl } ; + NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdNumeral numeral = {s = let tiende : AForm => Str = \\af => numeral.s ! NOrd af in table {APred => tiende ! AAttr Utr ; diff --git a/src/english/NounEng.gf b/src/english/NounEng.gf index af3cd446..2e0b03fe 100644 --- a/src/english/NounEng.gf +++ b/src/english/NounEng.gf @@ -77,6 +77,8 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in { NumDigits n = {s,sp = \\_ => n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd} ; + NumFloat n1 n2 = {s,sp = \\_,c => n1.s ! NCard ! Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard ! c ; n = Pl} ; + NumNumeral numeral = {s,sp = \\d => numeral.s ! d ! NCard; n = numeral.n} ; OrdNumeral numeral = {s = numeral.s ! True ! NOrd} ; diff --git a/src/estonian/NounEst.gf b/src/estonian/NounEst.gf index 290a798a..fc1219e6 100644 --- a/src/estonian/NounEst.gf +++ b/src/estonian/NounEst.gf @@ -120,6 +120,11 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in } ; OrdDigits numeral = {s = \\nc => numeral.s ! NOrd nc} ; + NumFloat n1 n2 = { + s = \\n,c => n1.s ! NCard (NCase Sg Nom) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (NCase n c) ; + n = Pl + } ; + NumNumeral numeral = { s = \\n,c => numeral.s ! NCard (NCase n c) ; n = numeral.n diff --git a/src/finnish/NounFin.gf b/src/finnish/NounFin.gf index fa9857fb..bbb9bf0d 100644 --- a/src/finnish/NounFin.gf +++ b/src/finnish/NounFin.gf @@ -143,6 +143,11 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in } ; OrdDigits numeral = {s = \\f => numeral.s ! NOrd f} ; + NumFloat n1 n2 = { + s = \\n,c => n1.s ! NCard (NCase Sg Nom) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (NCase n c) ; + n = Pl + } ; + NumNumeral numeral = { s = \\n,c => numeral.s ! NCard (NCase n c) ; n = numeral.n diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index 848fd6de..a29cafbb 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -122,6 +122,8 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; + NumFloat dig1 dig2 = {s = \\g,c => dig1.s ! invNum ++ BIND ++ "." ++ BIND ++ dig2.s ! NCard g c ; n = Pl } ; + NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdNumeral numeral = {s = \\af => numeral.s ! NOrd af} ; diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf index 327cc8de..4fdb8787 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -107,6 +107,12 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { numtype = IsDig } ; + NumFloat dig1 dig2 = baseNum ** { + s = \\_,_ => dig1.s ! NCard ++ BIND ++ "." ++ BIND ++ dig2.s ! NCard ; + n = Pl ; + numtype = IsDig + } ; + -- : Numeral -> Card ; NumNumeral num = num ; diff --git a/src/maltese/NounMlt.gf b/src/maltese/NounMlt.gf index c4b38866..5ca05370 100644 --- a/src/maltese/NounMlt.gf +++ b/src/maltese/NounMlt.gf @@ -189,6 +189,10 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude, Maybe in { -- 51 NumDigits d = {s = d.s ; n = d.n} ; + -- Digits -> Digits -> Card + -- 3.14 + NumFloat d1 d2 = {s = \\c => d1.s ! NumNom ++ BIND ++ "." ++ BIND ++ d2.s ! c ; n = d1.n} ; + -- Digits -> Ord -- 51st OrdDigits d = {s = d.s} ; diff --git a/src/polish/NounPol.gf b/src/polish/NounPol.gf index e6678b23..edeeed02 100644 --- a/src/polish/NounPol.gf +++ b/src/polish/NounPol.gf @@ -163,6 +163,8 @@ concrete NounPol of Noun = CatPol ** open ResPol, Prelude, PronounMorphoPol, Mor -- NumDigits : Digits -> Card ; -- 51 NumDigits n = { s=\\_,_ => n.s; a=n.a; n=n.n }; + + NumFloat n1 n2 = { s=\\_,_ => n1.s ++ BIND ++ "." ++ BIND ++ n2.s; a=n1.a; n=Pl }; -- NumCard : Card -> Num ; NumCard c = c ** { hasCard = True }; diff --git a/src/romance/NounRomance.gf b/src/romance/NounRomance.gf index 5b2c3cc1..e70a5a20 100644 --- a/src/romance/NounRomance.gf +++ b/src/romance/NounRomance.gf @@ -96,6 +96,8 @@ incomplete concrete NounRomance of Noun = NumDigits nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdDigits nu = {s = \\a => nu.s ! NOrd a.g a.n} ; + NumFloat n1 n2 = {s = \\g => n1.s ! NCard Masc ++ BIND ++ "." ++ BIND ++ n2.s ! NCard g ; n = Pl} ; + NumNumeral nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdNumeral nu = {s = \\a => nu.s ! NOrd a.g a.n} ; diff --git a/src/romanian/NounRon.gf b/src/romanian/NounRon.gf index c812610d..67a59e84 100644 --- a/src/romanian/NounRon.gf +++ b/src/romanian/NounRon.gf @@ -172,6 +172,9 @@ in { isPre = True }; + NumFloat n1 n2 = {s,sp = \\g => n1.s ! NCard g ++ BIND ++ "." ++ BIND ++ n2.s ! NCard g ; + size = n1.n; n = Pl }; + NumNumeral nu = {s = \\g => nu.s ! ANomAcc ! (NCard g) ! Formal ; sp = \\g => nu.sp ! ANomAcc ! (NCard g) ! Formal ; n = getNumber nu.size ; size = nu.size }; @@ -306,4 +309,4 @@ in { } ; -}; \ No newline at end of file +}; diff --git a/src/russian/NounRus.gf b/src/russian/NounRus.gf index a704a0d3..2e00e4a1 100644 --- a/src/russian/NounRus.gf +++ b/src/russian/NounRus.gf @@ -87,6 +87,8 @@ lin -- : Digits -> Card ; -- 51 NumDigits n = {s = \\_,_,_ => n.s ; size = n.size } ; + NumFloat n1 n2 = {s = \\_,_,_ => n1.s ++ BIND ++ "." ++ BIND ++ n2.s ; size = n1.size } ; + -- : Quant -> Num -> Det ; -- these five DetQuant quant num = { s=\\g,anim,cas => quant.s ! (gennum g (numSizeNumber num.size)) ! anim ! cas ++ num.s ! g ! anim ! cas ; diff --git a/src/scandinavian/NounScand.gf b/src/scandinavian/NounScand.gf index 450afbbc..ace0b282 100644 --- a/src/scandinavian/NounScand.gf +++ b/src/scandinavian/NounScand.gf @@ -110,6 +110,8 @@ incomplete concrete NounScand of Noun = NumDigits nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdDigits nu = {s = nu.s ! NOrd SupWeak} ; + NumFloat n1 n2 = {s = \\g => n1.s ! NCard neutrum ++ BIND ++ "." ++ BIND ++ n2.s ! NCard g ; n = Pl} ; + NumNumeral nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdNumeral nu = {s = nu.s ! NOrd SupWeak} ; diff --git a/src/turkish/NounTur.gf b/src/turkish/NounTur.gf index 92ce1db8..7aba93fe 100644 --- a/src/turkish/NounTur.gf +++ b/src/turkish/NounTur.gf @@ -176,6 +176,10 @@ concrete NounTur of Noun = CatTur ** open ResTur, SuffixTur, HarmonyTur, Prelude s = n.s ! NCard ; n = n.n } ; + NumFloat n1 n2 = { + s = \\n,c => n1.s ! NCard ! Sg ! Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard ! n ! c ; n = Pl + } ; + OrdNumeralSuperl n a = { s = \\num,cs => (n.s ! NOrd ! Sg ! cs) ++ a.s ! Sg ! cs } ; From 22a168198b433ab7c8eb15f4e044fed13efd8bf8 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 25 Jul 2023 19:38:43 +0200 Subject: [PATCH 008/129] support for measurement units --- src/abstract/Common.gf | 4 ++++ src/abstract/Noun.gf | 5 +++++ src/afrikaans/NounAfr.gf | 12 ++++++++++++ src/afrikaans/ParadigmsAfr.gf | 2 ++ src/bulgarian/NounBul.gf | 13 +++++++++++++ src/bulgarian/ParadigmsBul.gf | 3 +++ src/catalan/ParadigmsCat.gf | 2 +- src/chinese/ParadigmsChi.gf | 2 ++ src/common/CommonX.gf | 4 +++- src/dutch/NounDut.gf | 12 ++++++++++++ src/dutch/ParadigmsDut.gf | 2 ++ src/english/NounEng.gf | 10 ++++++++++ src/english/ParadigmsEng.gf | 2 ++ src/estonian/NounEst.gf | 12 ++++++++++++ src/estonian/ParadigmsEst.gf | 2 ++ src/finnish/NounFin.gf | 14 ++++++++++++++ src/finnish/ParadigmsFin.gf | 2 ++ src/french/ParadigmsFre.gf | 1 + src/german/NounGer.gf | 16 ++++++++++++++++ src/german/ParadigmsGer.gf | 2 ++ src/italian/ParadigmsIta.gf | 2 ++ src/korean/ParadigmsKor.gf | 2 ++ src/maltese/ParadigmsMlt.gf | 2 ++ src/polish/NounPol.gf | 14 ++++++++++++++ src/polish/ParadigmsPol.gf | 4 +++- src/portuguese/ParadigmsPor.gf | 2 ++ src/romance/NounRomance.gf | 12 ++++++++++++ src/romanian/NounRon.gf | 1 - src/romanian/ParadigmsRon.gf | 1 + src/russian/NounRus.gf | 12 ++++++++++++ src/russian/ParadigmsRus.gf | 3 +++ src/scandinavian/NounScand.gf | 12 ++++++++++++ src/slovenian/ParadigmsSlv.gf | 3 +++ src/somali/ParadigmsSom.gf | 2 ++ src/spanish/ParadigmsSpa.gf | 2 ++ src/swahili/ParadigmsSwa.gf | 1 + src/swedish/ParadigmsSwe.gf | 1 + src/thai/ParadigmsTha.gf | 1 + src/turkish/ParadigmsTur.gf | 3 +++ 39 files changed, 198 insertions(+), 4 deletions(-) diff --git a/src/abstract/Common.gf b/src/abstract/Common.gf index 3e852978..c56f73bf 100644 --- a/src/abstract/Common.gf +++ b/src/abstract/Common.gf @@ -44,4 +44,8 @@ abstract Common = { Pol ; -- polarity e.g. positive, negative Ant ; -- anteriority e.g. simultaneous, anterior +--2 Measures + + MU ; -- unit of measurement e.g. "km", "cm", "%" + } diff --git a/src/abstract/Noun.gf b/src/abstract/Noun.gf index e6298dbc..ee4fc0cb 100644 --- a/src/abstract/Noun.gf +++ b/src/abstract/Noun.gf @@ -156,4 +156,9 @@ abstract Noun = Cat ** { AdjDAP : DAP -> AP -> DAP ; -- the large (one) DetDAP : Det -> DAP ; -- this (or that) +--2 Quantities + + QuantityNP : Digits -> MU -> NP ; + QuantityFloatNP : Digits -> Digits -> MU -> NP ; + } diff --git a/src/afrikaans/NounAfr.gf b/src/afrikaans/NounAfr.gf index 147672be..a1667f70 100644 --- a/src/afrikaans/NounAfr.gf +++ b/src/afrikaans/NounAfr.gf @@ -179,4 +179,16 @@ concrete NounAfr of Noun = CatAfr ** open ResAfr, Prelude in { isMod = cn.isMod } ; + QuantityNP n m = { + s = \\c => preOrPost m.isPre m.s (n.s ! NCard Neutr Nom) ; + a = agrP3 n.n ; + isPron = False + } ; + + QuantityFloatNP n1 n2 m = { + s = \\c => preOrPost m.isPre m.s (n1.s ! NCard Neutr Nom ++ BIND ++ "." ++ BIND ++ n1.s ! NCard Neutr Nom) ; + a = agrP3 Pl ; + isPron = False + } ; + } diff --git a/src/afrikaans/ParadigmsAfr.gf b/src/afrikaans/ParadigmsAfr.gf index 49f52b4c..c7ae8b33 100644 --- a/src/afrikaans/ParadigmsAfr.gf +++ b/src/afrikaans/ParadigmsAfr.gf @@ -494,4 +494,6 @@ oper -- --} + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/bulgarian/NounBul.gf b/src/bulgarian/NounBul.gf index 99476be6..bab08547 100644 --- a/src/bulgarian/NounBul.gf +++ b/src/bulgarian/NounBul.gf @@ -240,4 +240,17 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in { p = dap.p } ; DetDAP det = det ; + + QuantityNP n m = { + s = \\role => preOrPost m.isPre m.s (n.s ! NCard (CFMasc Indef NonHuman)) ; + gn = gennum (AMasc NonHuman) n.n ; + p = NounP3 Pos + } ; + + QuantityFloatNP n1 n2 m = { + s = \\role => preOrPost m.isPre m.s (n1.s ! NCard (CFMasc Indef NonHuman) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (CFMasc Indef NonHuman)) ; + gn = gennum (AMasc NonHuman) Pl ; + p = NounP3 Pos + } ; + } diff --git a/src/bulgarian/ParadigmsBul.gf b/src/bulgarian/ParadigmsBul.gf index 1c6d19ec..47449410 100644 --- a/src/bulgarian/ParadigmsBul.gf +++ b/src/bulgarian/ParadigmsBul.gf @@ -2116,4 +2116,7 @@ oper adjAdv : A -> Str -> A = \a,adv -> a ** {adv = adv} ; + + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/catalan/ParadigmsCat.gf b/src/catalan/ParadigmsCat.gf index da148872..eb662765 100644 --- a/src/catalan/ParadigmsCat.gf +++ b/src/catalan/ParadigmsCat.gf @@ -553,6 +553,6 @@ oper mk2V2 : V -> Prep -> V2 ; dirV2 : V -> V2 ; - + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; } ; diff --git a/src/chinese/ParadigmsChi.gf b/src/chinese/ParadigmsChi.gf index a130bd08..ec0568d0 100644 --- a/src/chinese/ParadigmsChi.gf +++ b/src/chinese/ParadigmsChi.gf @@ -215,6 +215,8 @@ oper = \s -> lin RP {s = table {True => [] ; False => word s}} ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + --. auxiliary oper diff --git a/src/common/CommonX.gf b/src/common/CommonX.gf index 3052a064..bc1fd23b 100644 --- a/src/common/CommonX.gf +++ b/src/common/CommonX.gf @@ -1,4 +1,4 @@ -concrete CommonX of Common = open (R = ParamX) in { +concrete CommonX of Common = open (R = ParamX), Prelude in { lincat Text = {s : Str} ; @@ -20,4 +20,6 @@ concrete CommonX of Common = open (R = ParamX) in { Ant = {s : Str ; a : R.Anteriority} ; Pol = {s : Str ; p : R.Polarity} ; + MU = {s : Str ; isPre : Bool} ; + } diff --git a/src/dutch/NounDut.gf b/src/dutch/NounDut.gf index 3abcab0e..c8242b4c 100644 --- a/src/dutch/NounDut.gf +++ b/src/dutch/NounDut.gf @@ -201,4 +201,16 @@ concrete NounDut of Noun = CatDut ** open ResDut, Prelude in { DetDAP det = det ; + QuantityNP n m = noMerge ** { + s = \\c => preOrPost m.isPre m.s (n.s ! NCard Utr Nom) ; + a = agrP3 n.n ; + isPron = False + } ; + + QuantityFloatNP n1 n2 m = noMerge ** { + s = \\role => preOrPost m.isPre m.s (n1.s ! NCard Utr Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard Utr Nom) ; + a = agrP3 Pl ; + isPron = False + } ; + } diff --git a/src/dutch/ParadigmsDut.gf b/src/dutch/ParadigmsDut.gf index f5e3b84e..a797b65b 100644 --- a/src/dutch/ParadigmsDut.gf +++ b/src/dutch/ParadigmsDut.gf @@ -439,4 +439,6 @@ oper -- --} + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/english/NounEng.gf b/src/english/NounEng.gf index 2e0b03fe..c95f9a85 100644 --- a/src/english/NounEng.gf +++ b/src/english/NounEng.gf @@ -176,4 +176,14 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in { DetDAP d = d ; + QuantityNP n m = { + s = \\c => preOrPost m.isPre m.s (n.s ! NCard ! Nom) ; + a = agrgP3 n.n Neutr + } ; + + QuantityFloatNP n1 n2 m = { + s = \\c => preOrPost m.isPre m.s (n1.s ! NCard ! Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard ! Nom) ; + a = agrgP3 Pl Neutr + } ; + } diff --git a/src/english/ParadigmsEng.gf b/src/english/ParadigmsEng.gf index 01f73acf..ff601155 100644 --- a/src/english/ParadigmsEng.gf +++ b/src/english/ParadigmsEng.gf @@ -795,6 +795,8 @@ mkVoc s = lin Voc (ss s) ; mk2Conj : Str -> Str -> Number -> Conj = \x,y,n -> lin Conj (sd2 x y ** {n = n}) ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + ---- obsolete -- Comparison adjectives may two more forms. diff --git a/src/estonian/NounEst.gf b/src/estonian/NounEst.gf index fc1219e6..68bff0c8 100644 --- a/src/estonian/NounEst.gf +++ b/src/estonian/NounEst.gf @@ -219,6 +219,18 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in ApposCN cn np = cn ** {postmod = cn.postmod ++ linNP (NPCase Nom) np} ; --- luvun x + QuantityNP n m = emptyNP ** { + s = \\c => preOrPost m.isPre m.s (n.s ! NCard (NCase Sg Nom)) ; + a = agrP3 n.n ; + isPron = False + } ; + + QuantityFloatNP n1 n2 m = emptyNP ** { + s = \\role => preOrPost m.isPre m.s (n1.s ! NCard (NCase Sg Nom) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (NCase Sg Nom)) ; + a = agrP3 Pl ; + isPron = False + } ; + oper numN : NForm -> Number = \nf -> case nf of { NCase n _ => n diff --git a/src/estonian/ParadigmsEst.gf b/src/estonian/ParadigmsEst.gf index 8a2369b9..6d0b7620 100644 --- a/src/estonian/ParadigmsEst.gf +++ b/src/estonian/ParadigmsEst.gf @@ -922,4 +922,6 @@ oper mkAV a = a ; mkA2V a p = mkA2 a p ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } ; diff --git a/src/finnish/NounFin.gf b/src/finnish/NounFin.gf index bbb9bf0d..3aeb46d1 100644 --- a/src/finnish/NounFin.gf +++ b/src/finnish/NounFin.gf @@ -296,6 +296,20 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in DetDAP d = d ; + QuantityNP n m = { + s = \\c => preOrPost m.isPre m.s (n.s ! NCard (NCase Sg Nom)) ; + a = agrP3 n.n ; + isPron = False ; + isNeg = False + } ; + + QuantityFloatNP n1 n2 m = { + s = \\role => preOrPost m.isPre m.s (n1.s ! NCard (NCase Sg Nom) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (NCase Sg Nom)) ; + a = agrP3 Pl ; + isPron = False ; + isNeg = False + } ; + oper numN : NForm -> Number = \nf -> case nf of { NCase n _ => n ; diff --git a/src/finnish/ParadigmsFin.gf b/src/finnish/ParadigmsFin.gf index 5555b015..53e921da 100644 --- a/src/finnish/ParadigmsFin.gf +++ b/src/finnish/ParadigmsFin.gf @@ -1050,4 +1050,6 @@ mkVS = overload { mkAV v = v ** {lock_A = <>} ; --- mkA2V v p = mkA2 p ** {lock_A2 = <>} ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } ; diff --git a/src/french/ParadigmsFre.gf b/src/french/ParadigmsFre.gf index e4d97828..c0ead4dc 100644 --- a/src/french/ParadigmsFre.gf +++ b/src/french/ParadigmsFre.gf @@ -574,5 +574,6 @@ oper _ => VFalse -- prend-il } ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; } ; diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index a29cafbb..8f4bcabc 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -240,4 +240,20 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { DetDAP det = det ; + QuantityNP dig m = { + s = \\c => preOrPost m.isPre m.s (dig.s ! invNum) ; + a = agrP3 Pl ; + w = WLight ; + rc = "" ; + ext = "" ; + } ; + + QuantityFloatNP dig1 dig2 m = { + s = \\c => preOrPost m.isPre m.s (dig1.s ! invNum ++ BIND ++ "." ++ BIND ++ dig2.s ! invNum) ; + a = agrP3 Pl ; + w = WLight ; + rc = "" ; + ext = "" ; + } ; + } diff --git a/src/german/ParadigmsGer.gf b/src/german/ParadigmsGer.gf index 098e44a7..65a87d85 100644 --- a/src/german/ParadigmsGer.gf +++ b/src/german/ParadigmsGer.gf @@ -771,4 +771,6 @@ mkV2 : overload { mkV2 : V -> Case -> V2 = \v,c -> prepV2 v (lin Prep {s,s2 = [] ; c = c ; isPrep = False}) ; } ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/italian/ParadigmsIta.gf b/src/italian/ParadigmsIta.gf index 78b09a54..759f10ad 100644 --- a/src/italian/ParadigmsIta.gf +++ b/src/italian/ParadigmsIta.gf @@ -558,4 +558,6 @@ oper mk2V2 : V -> Prep -> V2 ; dirV2 : V -> V2 ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } ; diff --git a/src/korean/ParadigmsKor.gf b/src/korean/ParadigmsKor.gf index aab5f2a5..e3ffd334 100644 --- a/src/korean/ParadigmsKor.gf +++ b/src/korean/ParadigmsKor.gf @@ -198,4 +198,6 @@ oper } ; -------------------------------------------------------------------------------- + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/maltese/ParadigmsMlt.gf b/src/maltese/ParadigmsMlt.gf index 78afebc9..88d13a44 100644 --- a/src/maltese/ParadigmsMlt.gf +++ b/src/maltese/ParadigmsMlt.gf @@ -1423,4 +1423,6 @@ resource ParadigmsMlt = open mkOrd : Str -> Ord = \x -> lin Ord { s = \\c => x }; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/polish/NounPol.gf b/src/polish/NounPol.gf index edeeed02..f0138063 100644 --- a/src/polish/NounPol.gf +++ b/src/polish/NounPol.gf @@ -210,4 +210,18 @@ concrete NounPol of Noun = CatPol ** open ResPol, Prelude, PronounMorphoPol, Mor DetDAP d = d ; + QuantityNP n m = { + nom,voc = preOrPost m.isPre m.s n.s; + dep = \\cc => preOrPost m.isPre m.s n.s ; + gn = OthersPl; + p = P3 + } ; + + QuantityFloatNP n1 n2 m = { + nom,voc = preOrPost m.isPre m.s (n1.s ++ BIND ++ "." ++ BIND ++ n2.s) ; + dep = \\cc => preOrPost m.isPre m.s (n1.s ++ BIND ++ "." ++ BIND ++ n2.s) ; + gn = OthersPl; + p = P3 + } ; + } diff --git a/src/polish/ParadigmsPol.gf b/src/polish/ParadigmsPol.gf index daea8a45..062ff07d 100644 --- a/src/polish/ParadigmsPol.gf +++ b/src/polish/ParadigmsPol.gf @@ -4,7 +4,7 @@ -- Inari Listenmaa, 2020 resource ParadigmsPol = open - CatPol, MorphoPol, ResPol, (NM=NounMorphoPol) + CatPol, MorphoPol, ResPol, (NM=NounMorphoPol), Prelude in { flags coding=utf8; @@ -383,4 +383,6 @@ _ => NM.mkNTable0171 sgnom -- Alternatives: mkNTable0000,mkNTable0001,mkNTable0002,mkNTable0003,mkNTable0010,mkNTable0015,mkNTable0028,mkNTable0037,mkNTable0043,mkNTable0044,mkNTable0053,mkNTable0064,mkNTable0067,mkNTable0075,mkNTable0091,mkNTable0096,mkNTable0111,mkNTable0117,mkNTable0118,mkNTable0129,mkNTable0131,mkNTable0168,mkNTable0171,mkNTable0173,mkNTable0176,mkNTable0181,mkNTable0191,mkNTable0197,mkNTable0213,mkNTable0243,mkNTable0244,mkNTable0247,mkNTable0248,mkNTable0271,mkNTable0281,mkNTable0282,mkNTable0286,mkNTable0304,mkNTable0309,mkNTable0312,mkNTable0315,mkNTable0324,mkNTable0333,mkNTable0338,mkNTable0348,mkNTable0350,mkNTable0365,mkNTable0373,mkNTable0375,mkNTable0428,mkNTable0444,mkNTable0467,mkNTable0495,mkNTable0497,mkNTable0500,mkNTable0503,mkNTable0514,mkNTable0516,mkNTable0518,mkNTable0519,mkNTable0523,mkNTable0539,mkNTable0542,mkNTable0550,mkNTable0552,mkNTable0570,mkNTable0578,mkNTable0583,mkNTable0589,mkNTable0648,mkNTable0662,mkNTable0691,mkNTable0696,mkNTable0717,mkNTable0773,mkNTable0803,mkNTable0826,mkNTable0828,mkNTable0859,mkNTable0868,mkNTable0869,mkNTable0944,mkNTable0964,mkNTable0965,mkNTable0966,mkNTable0970,mkNTable0981,mkNTable0991,mkNTable0995 } ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/portuguese/ParadigmsPor.gf b/src/portuguese/ParadigmsPor.gf index a3472920..e46ad496 100644 --- a/src/portuguese/ParadigmsPor.gf +++ b/src/portuguese/ParadigmsPor.gf @@ -564,5 +564,7 @@ oper reflVerboV : Verbum -> V = \ve -> reflV (lin V (verboV ve)) ; --% + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } ; diff --git a/src/romance/NounRomance.gf b/src/romance/NounRomance.gf index e70a5a20..56bc6776 100644 --- a/src/romance/NounRomance.gf +++ b/src/romance/NounRomance.gf @@ -207,4 +207,16 @@ incomplete concrete NounRomance of Noun = DetDAP det = det ; + QuantityNP n m = heavyNPpol False { + s = \\c => preOrPost m.isPre m.s (n.s ! NCard Masc); + a = agrP3 Masc n.n ; + hasClit = False + } ; + + QuantityFloatNP n1 n2 m = heavyNPpol False { + s = \\c => preOrPost m.isPre m.s (n1.s ! NCard Masc ++ BIND ++ "." ++ BIND ++ n2.s ! NCard Masc) ; + a = agrP3 Masc Pl ; + hasClit = False + } ; + } diff --git a/src/romanian/NounRon.gf b/src/romanian/NounRon.gf index 67a59e84..13af4df6 100644 --- a/src/romanian/NounRon.gf +++ b/src/romanian/NounRon.gf @@ -308,5 +308,4 @@ in { isComp = True } ; - }; diff --git a/src/romanian/ParadigmsRon.gf b/src/romanian/ParadigmsRon.gf index ad1407db..186671d5 100644 --- a/src/romanian/ParadigmsRon.gf +++ b/src/romanian/ParadigmsRon.gf @@ -559,6 +559,7 @@ mkPronoun :(_,_,_,_,_,_,_,_,_ : Str) -> Gender -> Number -> Person -> Pron =\eu, -- in this case we add a case to the complement, so that the right gender is chosen. + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; } ; diff --git a/src/russian/NounRus.gf b/src/russian/NounRus.gf index 2e00e4a1..6ea0cd48 100644 --- a/src/russian/NounRus.gf +++ b/src/russian/NounRus.gf @@ -241,4 +241,16 @@ lin preferShort=PreferFull } ; + QuantityNP n m = { + s = \\cas => preOrPost m.isPre m.s n.s; + pron=False ; + a=Ag (gennum Masc (numSizeNumber n.size)) P3 + } ; + + QuantityFloatNP n1 n2 m = { + s = \\cas => preOrPost m.isPre m.s (n1.s ++ BIND ++ "." ++ BIND ++ n2.s) ; + pron=False ; + a=Ag GPl P3 + } ; + } diff --git a/src/russian/ParadigmsRus.gf b/src/russian/ParadigmsRus.gf index 92241016..044f8e49 100644 --- a/src/russian/ParadigmsRus.gf +++ b/src/russian/ParadigmsRus.gf @@ -597,4 +597,7 @@ oper Second | SecondA => (Z.sg1StemFromVerb sg1) + "ит" ; _ => (Z.sg1StemFromVerb sg1) + "ет" } in (guessVerbForms asp Transitive inf sg1 sg3) ** {lock_V=<>} ; + + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/scandinavian/NounScand.gf b/src/scandinavian/NounScand.gf index ace0b282..b6cfa775 100644 --- a/src/scandinavian/NounScand.gf +++ b/src/scandinavian/NounScand.gf @@ -263,4 +263,16 @@ incomplete concrete NounScand of Noun = DetDAP d = d ; + QuantityNP n m = { + s = \\c => preOrPost m.isPre m.s (n.s ! NCard neutrum); + a = agrP3 Utr n.n ; + isPron = False + } ; + + QuantityFloatNP n1 n2 m = { + s = \\c => preOrPost m.isPre m.s (n1.s ! NCard neutrum ++ BIND ++ "." ++ BIND ++ n2.s ! NCard neutrum) ; + a = agrP3 Utr Pl ; + isPron = False + } ; + } diff --git a/src/slovenian/ParadigmsSlv.gf b/src/slovenian/ParadigmsSlv.gf index 6773b767..db45033e 100644 --- a/src/slovenian/ParadigmsSlv.gf +++ b/src/slovenian/ParadigmsSlv.gf @@ -850,4 +850,7 @@ oper vowel : pattern Str = #("a"|"e"|"i"|"o"|"u") ; consonant : pattern Str = #("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"r"|"s"|"t"|"v"|"x"|"z") ; + + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/somali/ParadigmsSom.gf b/src/somali/ParadigmsSom.gf index 490e582b..deed7226 100644 --- a/src/somali/ParadigmsSom.gf +++ b/src/somali/ParadigmsSom.gf @@ -286,4 +286,6 @@ oper } ; -------------------------------------------------------------------------------- + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } diff --git a/src/spanish/ParadigmsSpa.gf b/src/spanish/ParadigmsSpa.gf index a0080fb5..7ecba539 100644 --- a/src/spanish/ParadigmsSpa.gf +++ b/src/spanish/ParadigmsSpa.gf @@ -604,4 +604,6 @@ oper mk2V2 : V -> Prep -> V2 ; dirV2 : V -> V2 ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } ; diff --git a/src/swahili/ParadigmsSwa.gf b/src/swahili/ParadigmsSwa.gf index e1b780de..0e53099f 100644 --- a/src/swahili/ParadigmsSwa.gf +++ b/src/swahili/ParadigmsSwa.gf @@ -431,6 +431,7 @@ mkN2 = overload { regPN : Str ->Gender -> PN ; nounPN : N -> PN ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; } diff --git a/src/swedish/ParadigmsSwe.gf b/src/swedish/ParadigmsSwe.gf index 5528442e..4436915d 100644 --- a/src/swedish/ParadigmsSwe.gf +++ b/src/swedish/ParadigmsSwe.gf @@ -821,5 +821,6 @@ oper dirV2 : V -> V2 ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; } ; diff --git a/src/thai/ParadigmsTha.gf b/src/thai/ParadigmsTha.gf index be48d67e..a5d0cd9b 100644 --- a/src/thai/ParadigmsTha.gf +++ b/src/thai/ParadigmsTha.gf @@ -100,5 +100,6 @@ oper mkPrep : Str -> Prep = \s -> lin Prep (ss s) ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; } diff --git a/src/turkish/ParadigmsTur.gf b/src/turkish/ParadigmsTur.gf index 9b9ad2c8..b8dd6ba8 100644 --- a/src/turkish/ParadigmsTur.gf +++ b/src/turkish/ParadigmsTur.gf @@ -632,4 +632,7 @@ resource ParadigmsTur = open -- kal-, ol-, öl-, var-, ver-, vur-, san- ) | SgSylConReg ; -- one syllable ending with consonant, takes -er + oper + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + } From 0d5919d511324bfad3d7ca337877a5cfd15a7d42 Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Thu, 3 Aug 2023 16:39:30 +0200 Subject: [PATCH 009/129] 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 f7e9357ed460d0dcdce336a0a1882ae5fe512ecd Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 4 Aug 2023 16:29:01 +0800 Subject: [PATCH 010/129] (Eng) ize~ise variants in us_britishV --- src/english/ParadigmsEng.gf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/english/ParadigmsEng.gf b/src/english/ParadigmsEng.gf index ff601155..38cefe1f 100644 --- a/src/english/ParadigmsEng.gf +++ b/src/english/ParadigmsEng.gf @@ -616,6 +616,8 @@ mkVoc s = lin Voc (ss s) ; us_britishV : Str -> V = \s -> case s of { _ + ("el" | "al" | "ol") => regV s | mkV s (s + "s") (s + "led") (s + "led") (s + "ling") ; _ + "or" => regV s | regV (Predef.tk 2 s + "our") ; + _ + "ise" => regV (Predef.tk 2 s + "ze") | regV s ; + _ + "ize" => regV s | regV (Predef.tk 2 s + "se") ; _ => regV s } ; From e91b613e1a31b1ba419ef7544bcfa8c26f56fcef Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 4 Aug 2023 17:19:14 +0800 Subject: [PATCH 011/129] (May) Misc new words and funs --- src/malay/ConstructionMay.gf | 11 +++++++++-- src/malay/NounMay.gf | 4 ++-- src/malay/StructuralMay.gf | 6 +++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/malay/ConstructionMay.gf b/src/malay/ConstructionMay.gf index 7bd5489f..0da60668 100644 --- a/src/malay/ConstructionMay.gf +++ b/src/malay/ConstructionMay.gf @@ -1,4 +1,4 @@ -concrete ConstructionMay of Construction = CatMay ** open ParadigmsMay in { +concrete ConstructionMay of Construction = CatMay ** open ParadigmsMay, (L=LexiconMay), SyntaxMay in { lincat Timeunit = N ; @@ -6,9 +6,16 @@ lincat Monthday = NP ; Month = N ; Year = NP ; -{- + lin + has_age_VP card = mkVP umur_V2 (mkNP L.year_N) ; + +oper + umur_V2 : V2 = mkV2 (mkV "umur") noPrep ; + +{- + timeunitAdv n time = let n_card : Card = n ; n_hours_NP : NP = mkNP n_card time ; diff --git a/src/malay/NounMay.gf b/src/malay/NounMay.gf index 90f0b7d5..48c8854f 100644 --- a/src/malay/NounMay.gf +++ b/src/malay/NounMay.gf @@ -104,13 +104,13 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { -- : Numeral -> Card ; NumNumeral num = num ; -{- + -- : AdN -> Card -> Card ; AdNum adn card = card ** { s = adn.s ++ card.s } ; -- : Digits -> Ord ; OrdDigits digs = digs ** { s = digs.s ! NOrd } ; --} + -- : Numeral -> Ord ; OrdNumeral num = { s = num.ord diff --git a/src/malay/StructuralMay.gf b/src/malay/StructuralMay.gf index 9dea3715..14a10dea 100644 --- a/src/malay/StructuralMay.gf +++ b/src/malay/StructuralMay.gf @@ -3,11 +3,11 @@ concrete StructuralMay of Structural = CatMay ** ------- -- Ad* +lin at_least_AdN = ss "sekurangnya" ; +lin at_most_AdN = ss "paling tua" ; {- lin almost_AdA = mkAdA "" ; lin almost_AdN = ss "" ; -lin at_least_AdN = ss "" ; -lin at_most_AdN = ss "" ; lin so_AdA = ss "" ; lin too_AdA = ss "" ; lin very_AdA = mkAdA "" ; @@ -154,7 +154,7 @@ lin whoSg_IP = mkIP "siapa"; -- Subj -- lin although_Subj = --- lin because_Subj = +lin because_Subj = ss "kerana" ; lin if_Subj = ss "sekiranya" ; lin that_Subj = ss "yang" ; lin when_Subj = ss "kalau" ; From dc8da4a2126653da2ea68a61ac263f2651fe1bfa Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 4 Aug 2023 17:19:40 +0800 Subject: [PATCH 012/129] (May) remove new lins from MissingMay --- src/malay/MissingMay.gf | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/malay/MissingMay.gf b/src/malay/MissingMay.gf index 63c9936a..ddd653bd 100644 --- a/src/malay/MissingMay.gf +++ b/src/malay/MissingMay.gf @@ -1,7 +1,6 @@ resource MissingMay = open GrammarMay, Prelude in { oper AdAP : AdA -> AP -> AP = notYet "AdAP" ; oper AdAdv : AdA -> Adv -> Adv = notYet "AdAdv" ; -oper AdNum : AdN -> Card -> Card = notYet "AdNum" ; oper AdVVP : AdV -> VP -> VP = notYet "AdVVP" ; oper AdVVPSlash : AdV -> VPSlash -> VPSlash = notYet "AdVVPSlash" ; oper AddAdvQVP : QVP -> IAdv -> QVP = notYet "AddAdvQVP" ; @@ -54,7 +53,6 @@ oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ; oper ImpP3 : NP -> VP -> Utt = notYet "ImpP3" ; oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ; oper ImpVP : VP -> Imp = notYet "ImpVP" ; -oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ; oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ; oper OrdNumeralSuperl : Numeral -> A -> Ord = notYet "OrdNumeralSuperl" ; oper OrdSuperl : A -> Ord = notYet "OrdSuperl" ; @@ -113,14 +111,11 @@ oper art_N : N = notYet "art_N" ; oper as_CAdv : CAdv = notYet "as_CAdv" ; oper ashes_N : N = notYet "ashes_N" ; oper ask_V2Q : V2Q = notYet "ask_V2Q" ; -oper at_least_AdN : AdN = notYet "at_least_AdN" ; -oper at_most_AdN : AdN = notYet "at_most_AdN" ; oper baby_N : N = notYet "baby_N" ; oper back_N : N = notYet "back_N" ; oper bad_A : A = notYet "bad_A" ; oper bank_N : N = notYet "bank_N" ; oper bark_N : N = notYet "bark_N" ; -oper because_Subj : Subj = notYet "because_Subj" ; oper become_VA : VA = notYet "become_VA" ; oper beer_N : N = notYet "beer_N" ; oper before_Prep : Prep = notYet "before_Prep" ; From c8a424c0237d39c21200664fa8a2312656f7d352 Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Fri, 4 Aug 2023 20:34:02 +0200 Subject: [PATCH 013/129] 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 014/129] 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 015/129] 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 016/129] 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 fb48791d6ada31f24a254d7c39c1d0c085151ad3 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sun, 6 Aug 2023 21:30:30 +0200 Subject: [PATCH 017/129] fix definite articles --- src/bulgarian/MorphoBul.gf | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bulgarian/MorphoBul.gf b/src/bulgarian/MorphoBul.gf index 1e34262e..612d85f7 100644 --- a/src/bulgarian/MorphoBul.gf +++ b/src/bulgarian/MorphoBul.gf @@ -165,6 +165,7 @@ oper NF Sg Indef => sg ; NF Sg Def => case sg of { _+"а"=>sg+"та" ; + _+"ю"=>sg+"та" ; _+"я"=>sg+"та" ; _+"о"=>sg+"то" ; _+"у"=>sg+"то" ; From 1b696739be55df9c5242837490c45de784a9f1fd Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 7 Aug 2023 15:59:19 +0200 Subject: [PATCH 018/129] mkLN in Catalan, Italian and Portuguese --- src/catalan/ParadigmsCat.gf | 6 ++++++ src/italian/ParadigmsIta.gf | 6 ++++++ src/portuguese/ParadigmsPor.gf | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/src/catalan/ParadigmsCat.gf b/src/catalan/ParadigmsCat.gf index eb662765..ada9ec08 100644 --- a/src/catalan/ParadigmsCat.gf +++ b/src/catalan/ParadigmsCat.gf @@ -139,6 +139,12 @@ oper mkPN : N -> PN ; } ; + mkLN : Str -> LN = \s -> + lin LN {s = s ; + p = {s=""; c=CPrep P_a; isDir=True} ; + art = NoArt ; + g = Masc ; + num = Sg} ; --2 Adjectives diff --git a/src/italian/ParadigmsIta.gf b/src/italian/ParadigmsIta.gf index 759f10ad..bfd39385 100644 --- a/src/italian/ParadigmsIta.gf +++ b/src/italian/ParadigmsIta.gf @@ -145,6 +145,12 @@ oper mkPN : N -> PN ; -- get gender from noun } ; + mkLN : Str -> LN = \s -> + lin LN {s = s ; + p = {s=""; c=CPrep P_a; isDir=True} ; + art = NoArt ; + g = Masc ; + num = Sg} ; --2 Adjectives diff --git a/src/portuguese/ParadigmsPor.gf b/src/portuguese/ParadigmsPor.gf index e46ad496..f183220d 100644 --- a/src/portuguese/ParadigmsPor.gf +++ b/src/portuguese/ParadigmsPor.gf @@ -206,6 +206,13 @@ oper = \n -> lin PN {s = n.s ! Sg ; g = n.g} ; } ; + mkLN : Str -> LN = \s -> + lin LN {s = s ; + p = {s=""; c=CPrep P_a; isDir=True} ; + art = NoArt ; + g = Masc ; + num = Sg} ; + --2 Adjectives compADeg : Adj -> A ; --% compADeg a = lin A From 531e2c2dd22713c1c0b00305fb16844d308dd53a Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 7 Aug 2023 21:15:48 +0200 Subject: [PATCH 019/129] progress on the Names API --- src/abstract/Documentation.gf | 1 + src/afrikaans/DocumentationAfr.gf | 6 ++++++ src/afrikaans/NamesAfr.gf | 3 +++ src/bulgarian/CatBul.gf | 3 ++- src/bulgarian/DocumentationBul.gf | 15 +++++++++++++++ src/bulgarian/MorphoFunsBul.gf | 11 +++++++++++ src/bulgarian/NamesBul.gf | 17 +++++++++++++++++ src/bulgarian/ResBul.gf | 5 +++++ src/bulgarian/StructuralBul.gf | 4 +--- src/chinese/DocumentationChi.gf | 6 ++++++ src/chinese/NamesChi.gf | 2 ++ src/dutch/NamesDut.gf | 2 ++ src/english/CatEng.gf | 2 +- src/english/DocumentationEng.gf | 17 +++++++++++++++++ src/english/NamesEng.gf | 6 +++--- src/english/ParadigmsEng.gf | 4 ++-- src/estonian/NamesEst.gf | 6 ++++++ src/finnish/DocumentationFinFunctor.gf | 6 ++++++ src/finnish/NamesFin.gf | 6 ++++++ src/french/NamesFre.gf | 3 +-- src/french/ParadigmsFre.gf | 2 +- src/german/NamesGer.gf | 7 +++++++ src/korean/NamesKor.gf | 2 ++ src/maltese/NamesMlt.gf | 7 +++++++ src/polish/DocumentationPol.gf | 19 +++++++++++++++++++ src/polish/NamesPol.gf | 2 ++ src/romanian/NamesRon.gf | 15 +++++++++++++++ src/russian/NamesRus.gf | 6 ++++++ src/scandinavian/CatScand.gf | 3 ++- src/slovenian/NamesSlv.gf | 6 ++++++ src/somali/NamesSom.gf | 7 +++++++ src/spanish/ParadigmsSpa.gf | 1 + src/swedish/DocumentationSwe.gf | 18 ++++++++++-------- src/swedish/NamesSwe.gf | 8 ++++++++ src/swedish/ParadigmsSwe.gf | 8 ++++++++ src/turkish/NamesTur.gf | 6 ++++++ 36 files changed, 220 insertions(+), 22 deletions(-) diff --git a/src/abstract/Documentation.gf b/src/abstract/Documentation.gf index b5afc4ea..c8c3389d 100644 --- a/src/abstract/Documentation.gf +++ b/src/abstract/Documentation.gf @@ -14,6 +14,7 @@ fun InflectionN2 : N2 -> Inflection ; InflectionN3 : N3 -> Inflection ; InflectionPN : PN -> Inflection ; + InflectionLN : LN -> Inflection ; InflectionGN : GN -> Inflection ; InflectionSN : SN -> Inflection ; InflectionA : A -> Inflection ; diff --git a/src/afrikaans/DocumentationAfr.gf b/src/afrikaans/DocumentationAfr.gf index b58c51af..ebaf00e8 100644 --- a/src/afrikaans/DocumentationAfr.gf +++ b/src/afrikaans/DocumentationAfr.gf @@ -28,6 +28,12 @@ lin s2 = paragraph (pn.s ! NPNom) } ; + InflectionLN = \ln -> { + t = "ln" ; + s1 = heading1 "Naam" ; + s2 = paragraph (ln.s ! NPNom) + } ; + InflectionGN = \pn -> { t = "vnm" ; s1 = heading1 "Voornaam" ; diff --git a/src/afrikaans/NamesAfr.gf b/src/afrikaans/NamesAfr.gf index a85481be..15d12e89 100644 --- a/src/afrikaans/NamesAfr.gf +++ b/src/afrikaans/NamesAfr.gf @@ -3,4 +3,7 @@ concrete NamesAfr of Names = CatAfr ** open ResAfr, Prelude in { lin GivenName, MaleSurname, FemaleSurname = \n -> {s = n.s ; a = agrP3 Sg ; isPron = False} ; lin FullName gn sn = {s = \\c => gn.s ! NPNom ++ sn.s ! c ; a = agrP3 Sg ; isPron = False} ; + +lin UseLN pn = {s = pn.s ; a = agrP3 Sg ; isPron = False} ; + } diff --git a/src/bulgarian/CatBul.gf b/src/bulgarian/CatBul.gf index 5ec3bd64..c4bbfe3e 100644 --- a/src/bulgarian/CatBul.gf +++ b/src/bulgarian/CatBul.gf @@ -88,7 +88,8 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, ( N3 = {s : NForm => Str; rel : AForm => Str; relType : NRelType; g : AGender} ** {c2,c3 : Preposition} ; GN = {s : Str; g : Sex} ; SN = {s : Sex => Str; pl : Str} ; - LN, PN = {s : Str; gn : GenNum} ; + LN = {s : Species => Str; c : Preposition; gn : GenNum} ; + PN = {s : Str; gn : GenNum} ; lindef SSlash = \s -> {s = \\_ => s; c2 = {s=""; c=Acc}}; diff --git a/src/bulgarian/DocumentationBul.gf b/src/bulgarian/DocumentationBul.gf index 30c4f76c..b047edda 100644 --- a/src/bulgarian/DocumentationBul.gf +++ b/src/bulgarian/DocumentationBul.gf @@ -92,6 +92,21 @@ lin s3 = "" } ; + InflectionLN = \n -> { + t = "същ.с." ; + s1= heading1 ("Име за Място"++ + case n.gn of { + GSg Masc => "(м.р.)" ; + GSg Fem => "(ж.р.)" ; + GSg Neut => "(ср.р.)" ; + GPl => "(мн.ч.)" + }) ; + s2 = paragraph (n.s ! Indef) ++ + heading1 ("Наречие") ++ + paragraph (n.c.s ++ linCase n.c.c Pos ++ n.s ! Def) ; + s3 = "" + } ; + InflectionGN = \gn -> { t = "същ.с.л." ; s1= heading1 (case gn.g of { diff --git a/src/bulgarian/MorphoFunsBul.gf b/src/bulgarian/MorphoFunsBul.gf index 903a9961..6fa19478 100644 --- a/src/bulgarian/MorphoFunsBul.gf +++ b/src/bulgarian/MorphoFunsBul.gf @@ -291,6 +291,17 @@ oper \s,gn -> {s = s; gn = gn ; lock_PN = <>} ; } ; + mkLN = overload { + mkLN : Str -> LN = \s -> lin LN {s = \\_ => s; c = {s = vyv_Str; c = CPrep}; gn = GSg Masc} ; + mkLN : Str -> Gender -> LN = + \s,g -> lin LN {s = \\_ => s; c = {s = vyv_Str; c = CPrep}; gn = GSg g} ; + mkLN : Str -> GenNum -> LN = + \s,gn -> lin LN {s = \\_ => s; c = {s = vyv_Str; c = CPrep}; gn = gn} ; + mkLN : Str -> Str -> GenNum -> LN = + \s1,s2,gn -> lin LN {s = table Species [s2; s1]; c = {s = vyv_Str; c = CPrep}; gn = gn} ; + } ; + + prepLN : LN -> Prep -> LN = \n,p -> n ** {c = p} ; --2 IAdv -- diff --git a/src/bulgarian/NamesBul.gf b/src/bulgarian/NamesBul.gf index 7391ba29..97f0307a 100644 --- a/src/bulgarian/NamesBul.gf +++ b/src/bulgarian/NamesBul.gf @@ -36,4 +36,21 @@ lin FullName gn sn = { p = NounP3 Pos } ; +lin UseLN, PlainLN = \n -> { + s = table { RObj c => linCase c Pos ++ n.s ! Def ; + _ => n.s ! Def + } ; + gn = n.gn ; + p = NounP3 Pos + } ; + + InLN n = {s = n.c.s ++ linCase n.c.c Pos ++ n.s ! Def} ; + + AdjLN ap n = n ** { + s = \\sp => case ap.isPre of { + True => ap.s ! aform n.gn sp RSubj ! P3 ++ n.s ! Indef ; + False => n.s ! sp ++ ap.s ! aform n.gn sp RSubj ! P3 + } + } ; + } diff --git a/src/bulgarian/ResBul.gf b/src/bulgarian/ResBul.gf index 8be1f534..cde09a47 100644 --- a/src/bulgarian/ResBul.gf +++ b/src/bulgarian/ResBul.gf @@ -859,4 +859,9 @@ resource ResBul = ParamX ** open Prelude, Predef in { Female => Fem } ; + vyv_Str : Str + = pre { "в" ; + "във" / strs {"в" ; "ф" ; "В" ; "Ф"} + } ; + } diff --git a/src/bulgarian/StructuralBul.gf b/src/bulgarian/StructuralBul.gf index 4ee12dba..1dae72ee 100644 --- a/src/bulgarian/StructuralBul.gf +++ b/src/bulgarian/StructuralBul.gf @@ -44,9 +44,7 @@ concrete StructuralBul of Structural = CatBul ** if_Subj = ss "ако" ; in8front_Prep = mkPrep "пред" ; i_Pron = mkPron "аз" "мой" "моя" "моят" "моя" "моята" "мое" "моето" "мои" "моите" (GSg Masc) PronP1 ; - in_Prep = mkPrep (pre { "в" ; - "във" / strs {"в" ; "ф" ; "В" ; "Ф"} - }) ; + in_Prep = mkPrep vyv_Str ; it_Pron = mkPron "то" "негов" "неговия" "неговият" "негова" "неговата" "негово" "неговото" "негови" "неговите" (GSg Neut) PronP3 ; less_CAdv = X.mkCAdv "по-малко" "от" ; many_Det = mkDeterminerPl "много" ; diff --git a/src/chinese/DocumentationChi.gf b/src/chinese/DocumentationChi.gf index 6fb61393..4b3e8678 100644 --- a/src/chinese/DocumentationChi.gf +++ b/src/chinese/DocumentationChi.gf @@ -117,6 +117,12 @@ lin s2 = n.s } ; + InflectionLN = \n -> { + t = "v" ; + s1 = heading1 "Location Name" ; + s2 = n.s + } ; + InflectionGN = \n -> { t = "v" ; s1 = heading1 "Given Name" ; diff --git a/src/chinese/NamesChi.gf b/src/chinese/NamesChi.gf index f0dc95b9..c583a763 100644 --- a/src/chinese/NamesChi.gf +++ b/src/chinese/NamesChi.gf @@ -6,4 +6,6 @@ lin FullName gn sn = { det = [] } ; +lin UseLN pn = pn ** {det = []} ; + } diff --git a/src/dutch/NamesDut.gf b/src/dutch/NamesDut.gf index c28a38e8..c79205aa 100644 --- a/src/dutch/NamesDut.gf +++ b/src/dutch/NamesDut.gf @@ -4,4 +4,6 @@ lin GivenName, MaleSurname, FemaleSurname = \n -> noMerge ** {s = n.s ; a = agrP lin FullName gn sn = noMerge ** {s = \\c => gn.s ! NPNom ++ sn.s ! c ; a = agrP3 Sg ; isPron = False} ; +lin UseLN pn = noMerge ** {s = pn.s ; a = agrP3 Sg ; isPron = False} ; + } diff --git a/src/english/CatEng.gf b/src/english/CatEng.gf index 7bb08abd..8a9482f3 100644 --- a/src/english/CatEng.gf +++ b/src/english/CatEng.gf @@ -110,7 +110,7 @@ concrete CatEng of Cat = CommonX - [Pol,CAdv] ** open ResEng, Prelude in { LN = {s : Case => Str; p : Str; -- preposition "in Scandinavia", "on the Balkans" art : Bool; -- plain name "United States" vs "the United States" - a : Agr; + n : Number; } ; lindef diff --git a/src/english/DocumentationEng.gf b/src/english/DocumentationEng.gf index d5441e74..343e0c24 100644 --- a/src/english/DocumentationEng.gf +++ b/src/english/DocumentationEng.gf @@ -38,6 +38,23 @@ lin ) } ; + InflectionLN = \n -> { + t = "ln" ; + s1 = heading1 ("Location Name" ++ + case n.n of { + Sg => ""; + Pl => "(plural)" + }) ; + s2 = frameTable ( + tr (th "nom" ++ th "gen") ++ + tr (td (n.s ! Nom) ++ td (n.s ! Gen)) + ) ++ + heading1 ("Adverb") ++ + paragraph (n.p ++ case n.art of { + True => "the" ++ n.s ! Nom ; + False => n.s ! Nom}) ; + } ; + InflectionGN = \pn -> { t = "gn" ; s1 = heading1 ("Given Name" ++ diff --git a/src/english/NamesEng.gf b/src/english/NamesEng.gf index f02bf38e..fa341f9c 100644 --- a/src/english/NamesEng.gf +++ b/src/english/NamesEng.gf @@ -9,12 +9,12 @@ lin UseLN n = { True => "the" ++ n.s ! npcase2case c ; False => n.s ! npcase2case c } ; - a = n.a + a = agrP3 n.n } ; lin PlainLN n = { s = \\c => n.s ! npcase2case c ; - a = n.a + a = agrP3 n.n } ; lin InLN n = { @@ -25,7 +25,7 @@ lin InLN n = { } ; lin AdjLN ap n = n ** { - s = \\c => preOrPost ap.isPre (ap.s ! n.a) (n.s ! c) ; + s = \\c => preOrPost ap.isPre (ap.s ! agrP3 n.n) (n.s ! c) ; } ; } diff --git a/src/english/ParadigmsEng.gf b/src/english/ParadigmsEng.gf index 38cefe1f..bf9556c0 100644 --- a/src/english/ParadigmsEng.gf +++ b/src/english/ParadigmsEng.gf @@ -135,13 +135,13 @@ oper lin LN {s = table {Gen => s + "'s" ; _ => s} ; p = "in" ; art = False ; - a = agrP3 Sg} ; + n = Sg} ; mkLN : Str -> Number -> LN = \s,n -> lin LN {s = table {Gen => s + "'s" ; _ => s} ; p = "in" ; art = False ; - a = agrP3 n} ; + n = n} ; } ; defLN : LN -> LN = \n -> n ** {art = True} ; diff --git a/src/estonian/NamesEst.gf b/src/estonian/NamesEst.gf index 694021ec..ee2c5371 100644 --- a/src/estonian/NamesEst.gf +++ b/src/estonian/NamesEst.gf @@ -11,4 +11,10 @@ lin FullName gn sn = emptyNP ** { isPron = False } ; +lin UseLN pn = emptyNP ** { + s = \\c => pn.s ! npform2case Sg c ; + a = agrP3 Sg ; + isPron = False + } ; + } diff --git a/src/finnish/DocumentationFinFunctor.gf b/src/finnish/DocumentationFinFunctor.gf index 47dec43d..65a041fe 100644 --- a/src/finnish/DocumentationFinFunctor.gf +++ b/src/finnish/DocumentationFinFunctor.gf @@ -37,6 +37,12 @@ lin s2 = inflPN (\c -> pn.s ! c) } ; + InflectionLN = \pn -> { + t = "s" ; + s1 = heading1 (heading noun_Category) ; + s2 = inflPN (\c -> pn.s ! c) + } ; + InflectionGN = \pn -> { t = "s" ; s1 = heading1 "Etunimi" ; diff --git a/src/finnish/NamesFin.gf b/src/finnish/NamesFin.gf index 2ffe811b..4039dc02 100644 --- a/src/finnish/NamesFin.gf +++ b/src/finnish/NamesFin.gf @@ -11,4 +11,10 @@ lin FullName gn sn = { isPron = False ; isNeg = False } ; +lin UseLN pn = { + s = snoun2np Sg pn ; + a = agrP3 Sg ; + isPron = False ; isNeg = False + } ; + } diff --git a/src/french/NamesFre.gf b/src/french/NamesFre.gf index 821f7969..b7415da8 100644 --- a/src/french/NamesFre.gf +++ b/src/french/NamesFre.gf @@ -7,11 +7,10 @@ lin FullName gn sn = pn2np { } ; lin PlainLN n = heavyNP { - s = \\c => n.s; + s = \\c => n.s; a = {g = n.g ; n = n.num ; p = P3} } ; - lin UseLN n = heavyNP { s = \\c => case n.art of { AlwaysArt | UseArt => artDef True n.g n.num c ++ n.s ; diff --git a/src/french/ParadigmsFre.gf b/src/french/ParadigmsFre.gf index c0ead4dc..83a7fff2 100644 --- a/src/french/ParadigmsFre.gf +++ b/src/french/ParadigmsFre.gf @@ -151,7 +151,7 @@ oper defLN : LN -> LN = \n -> n ** {art = AlwaysArt} ; useDefLN : LN -> LN = \n -> n ** {art = UseArt} ; - prepLN : LN -> Compl -> LN = \n,s -> n ** {p = s} ; + prepLN : LN -> Prep -> LN = \n,p -> n ** {p = p} ; mkPN : overload { mkPN : Str -> PN ; -- feminine if ends with "e", otherwise masculine diff --git a/src/german/NamesGer.gf b/src/german/NamesGer.gf index d7d35f2f..978b99ca 100644 --- a/src/german/NamesGer.gf +++ b/src/german/NamesGer.gf @@ -35,4 +35,11 @@ lin FullName gn sn = { rc, ext = [] } ; +lin UseLN pn = { + s = \\c => usePrepC c (\k -> pn.s ! k) ; + a = agrgP3 pn.g pn.n ; + w = WLight ; + rc, ext = [] + } ; + } diff --git a/src/korean/NamesKor.gf b/src/korean/NamesKor.gf index 5f0f3ad0..f6c6069a 100644 --- a/src/korean/NamesKor.gf +++ b/src/korean/NamesKor.gf @@ -6,4 +6,6 @@ lin FullName gn sn = { p = gn.p } ; + UseLN pn = pn ; + } diff --git a/src/maltese/NamesMlt.gf b/src/maltese/NamesMlt.gf index c470fbe4..40ad01ef 100644 --- a/src/maltese/NamesMlt.gf +++ b/src/maltese/NamesMlt.gf @@ -13,4 +13,11 @@ lin FullName gn sn = { isDefn = False } ; +lin UseLN pn = { + s = \\c => pn.s ; + a = pn.a ; + isPron = False ; + isDefn = False ; + } ; + } diff --git a/src/polish/DocumentationPol.gf b/src/polish/DocumentationPol.gf index 8eda32b1..9ac7a034 100644 --- a/src/polish/DocumentationPol.gf +++ b/src/polish/DocumentationPol.gf @@ -52,6 +52,25 @@ lin ) } ; + InflectionLN = \pn -> { + t = "im" ; + s1 = heading1 ("Imię" ++ case pn.gn of { + MascPersSg|MascAniSg|MascInaniSg|MascPersPl => "(męskorzeczowy)"; + FemSg => "(żeński)"; + NeutSg => "(nijaki)"; + _ => "" + }) ; + s2 = frameTable ( + tr (th "mianownik" ++ td (pn.nom)) ++ + tr (th "dopełniacz" ++ td (pn.dep ! GenPrep)) ++ + tr (th "celownik" ++ td (pn.dep ! DatPrep)) ++ + tr (th "biernik" ++ td (pn.dep ! AccPrep)) ++ + tr (th "narzędnik" ++ td (pn.dep ! InstrC)) ++ + tr (th "miejscownik" ++ td (pn.dep ! LocPrep)) ++ + tr (th "wołacz" ++ td (pn.voc)) + ) + } ; + InflectionGN = \pn -> { t = "im" ; s1 = heading1 ("Imię" ++ case pn.gn of { diff --git a/src/polish/NamesPol.gf b/src/polish/NamesPol.gf index e5cc8225..a8d060db 100644 --- a/src/polish/NamesPol.gf +++ b/src/polish/NamesPol.gf @@ -9,4 +9,6 @@ lin FullName gn sn = { p = gn.p } ; +lin UseLN n = n; + } diff --git a/src/romanian/NamesRon.gf b/src/romanian/NamesRon.gf index 6784ba91..951d9001 100644 --- a/src/romanian/NamesRon.gf +++ b/src/romanian/NamesRon.gf @@ -31,4 +31,19 @@ lin FullName gn sn = -- KA: guessed indForm = gn.s ! No ++ sn.s ! No } ; +lin UseLN pn = let + g = pn.g ; + n = pn.n ; + ag = agrP3 g n ; + hc = getClit pn.a + in { + s = \\c => {comp = pn.s ! c ; + clit = \\cs => if_then_Str hc ((genCliticsCase ag c).s ! cs) [] } ; + + a = ag; + nForm = if_then_else NForm hc HasClit (HasRef False) ; + isPronoun = False ; isPol = False; + indForm = pn.s ! No + } ; + } diff --git a/src/russian/NamesRus.gf b/src/russian/NamesRus.gf index 1a31cd93..e35bbf6d 100644 --- a/src/russian/NamesRus.gf +++ b/src/russian/NamesRus.gf @@ -22,4 +22,10 @@ lin FullName gn sn = a=Ag (gennum gn.g Sg) P3 } ; + UseLN pn = { + s=\\cas => (nounFormsNoun pn).s ! Sg ! cas ; + pron=False; + a=Ag (gennum pn.g Sg) P3 + } ; -- Does NP need animacy? + } diff --git a/src/scandinavian/CatScand.gf b/src/scandinavian/CatScand.gf index 737ae6ee..e78a312c 100644 --- a/src/scandinavian/CatScand.gf +++ b/src/scandinavian/CatScand.gf @@ -108,7 +108,8 @@ incomplete concrete CatScand of Cat = -- {s : Number => Species => Case => Str ; g : Gender} ; N2 = Noun ** {c2 : Complement} ; N3 = Noun ** {c2,c3 : Complement} ; - GN, SN, LN, PN = {s : Case => Str ; g : Gender} ; + LN = {s : Case => Str ; c : Complement ; g : Gender ; n : Number} ; + GN, SN, PN = {s : Case => Str ; g : Gender} ; diff --git a/src/slovenian/NamesSlv.gf b/src/slovenian/NamesSlv.gf index 85e7fa59..016f7715 100644 --- a/src/slovenian/NamesSlv.gf +++ b/src/slovenian/NamesSlv.gf @@ -21,4 +21,10 @@ lin FullName gn sn = { isPron = False } ; +lin UseLN pn = { + s = pn.s; + a = {g=agender2gender pn.g; n=pn.n; p=P3}; + isPron = False + } ; + } diff --git a/src/somali/NamesSom.gf b/src/somali/NamesSom.gf index b560613e..4cb51d4a 100644 --- a/src/somali/NamesSom.gf +++ b/src/somali/NamesSom.gf @@ -15,4 +15,11 @@ lin FullName gn sn = { empty = [] ; } ; + UseLN pn = pn ** { + s = \\c => pn.s ; + isPron = False ; + st = Definite ; + empty = [] ; + } ; + } diff --git a/src/spanish/ParadigmsSpa.gf b/src/spanish/ParadigmsSpa.gf index 7ecba539..124f3aef 100644 --- a/src/spanish/ParadigmsSpa.gf +++ b/src/spanish/ParadigmsSpa.gf @@ -155,6 +155,7 @@ oper defLN : LN -> LN = \n -> n ** {art = UseArt} ; + prepLN : LN -> Prep -> LN = \n,p -> n ** {p = p} ; mkPN : overload { mkPN : (Anna : Str) -> PN ; -- feminine for "-a" diff --git a/src/swedish/DocumentationSwe.gf b/src/swedish/DocumentationSwe.gf index 3c4b551a..c5e011b8 100644 --- a/src/swedish/DocumentationSwe.gf +++ b/src/swedish/DocumentationSwe.gf @@ -32,16 +32,18 @@ lin ) } ; - InflectionPN = \pn -> { + InflectionLN = \n -> { t = "nm" ; - s1 = heading1 ("Namn" ++ case pn.g of { - Utr => "(utr)" ; - Neutr => "(neutr)" - }) ; + s1 = heading1 ("Platsnamn" ++ case n.g of { + Utr => "(utr)" ; + Neutr => "(neutr)" + }) ; s2 = frameTable ( - tr (th "nom" ++ td (pn.s ! Nom)) ++ - tr (th "gen" ++ td (pn.s ! Gen)) - ) + tr (th "nom" ++ td (n.s ! Nom)) ++ + tr (th "gen" ++ td (n.s ! Gen)) + ) ++ + heading1 ("Adverb") ++ + paragraph (n.c.s ++ n.s ! caseNP accusative) ; } ; InflectionGN = \pn -> { diff --git a/src/swedish/NamesSwe.gf b/src/swedish/NamesSwe.gf index 6f0791e1..a6a99337 100644 --- a/src/swedish/NamesSwe.gf +++ b/src/swedish/NamesSwe.gf @@ -11,4 +11,12 @@ lin FullName gn sn = { isPron = False } ; + UseLN, PlainLN = \n -> { + s = \\c => n.s ! caseNP c ; + a = agrP3 n.g n.n ; + isPron = False + } ; + + InLN n = {s = n.c.s ++ n.s ! caseNP accusative} ; + } diff --git a/src/swedish/ParadigmsSwe.gf b/src/swedish/ParadigmsSwe.gf index 4436915d..2898f1fd 100644 --- a/src/swedish/ParadigmsSwe.gf +++ b/src/swedish/ParadigmsSwe.gf @@ -154,6 +154,14 @@ oper geoPN : Str -> PN ; -- neuter, with identical genitive if ends in a vowel + mkLN = overload { + mkLN : Str -> LN = \s -> lin LN (regPN s) ** {c={s="i";hasPrep=True}; n=Sg}; -- default gender utrum + mkLN : Str -> Gender -> LN = \s,g -> lin LN (regGenPN s g) ** {c={s="i";hasPrep=True}; n=Sg} ; -- set other gender + mkLN : Str -> Gender -> Number -> LN = \s,g,n -> lin LN (regGenPN s g) ** {c={s="i";hasPrep=True}; n=n} ; -- set other gender + } ; + + prepLN : LN -> Prep -> LN = \n,p -> n ** {c = mkComplement p.s} ; + --2 Adjectives -- Adjectives need one to seven forms. diff --git a/src/turkish/NamesTur.gf b/src/turkish/NamesTur.gf index df4c4c6a..a03a12d4 100644 --- a/src/turkish/NamesTur.gf +++ b/src/turkish/NamesTur.gf @@ -16,4 +16,10 @@ lin FullName gn sn = { a = {n = Sg; p = P3} } ; +lin UsePN pn = { + s = \\c => pn.s ! c; + h = pn.h; + a = {n = pn.n; p = P3} + } ; + } From d25d6481346a0e2f9e75371059162089f5205e9b Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Fri, 11 Aug 2023 11:31:00 +0200 Subject: [PATCH 020/129] add linref for LN --- src/russian/CatRus.gf | 1 + 1 file changed, 1 insertion(+) diff --git a/src/russian/CatRus.gf b/src/russian/CatRus.gf index 76c8d14d..b96f6cc8 100644 --- a/src/russian/CatRus.gf +++ b/src/russian/CatRus.gf @@ -105,6 +105,7 @@ lincat linref N = \s -> s.snom ; PN = \s -> s.snom ; + LN = \s -> s.snom ; Pron = \s -> s.nom ; N2 = \s -> s.snom ++ s.c2.s ; N3 = \s -> s.snom ++ s.c2.s ++ s.c3.s ; From 91237f753c80ff433d3b99978e1712c81b392510 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 14 Aug 2023 15:43:27 +0300 Subject: [PATCH 021/129] (May) don't use API due to problem with path --- src/malay/ConstructionMay.gf | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/malay/ConstructionMay.gf b/src/malay/ConstructionMay.gf index 0da60668..eda790f8 100644 --- a/src/malay/ConstructionMay.gf +++ b/src/malay/ConstructionMay.gf @@ -1,4 +1,4 @@ -concrete ConstructionMay of Construction = CatMay ** open ParadigmsMay, (L=LexiconMay), SyntaxMay in { +concrete ConstructionMay of Construction = CatMay ** open ParadigmsMay, (L=LexiconMay), (G=GrammarMay) in { lincat Timeunit = N ; @@ -9,18 +9,13 @@ lincat lin - has_age_VP card = mkVP umur_V2 (mkNP L.year_N) ; + has_age_VP card = G.ComplSlash (G.SlashV2a umur_V2) (G.DetCN (G.DetQuant G.IndefArt (G.NumCard card)) (G.UseN L.year_N)) ; oper umur_V2 : V2 = mkV2 (mkV "umur") noPrep ; {- - timeunitAdv n time = - let n_card : Card = n ; - n_hours_NP : NP = mkNP n_card time ; - in SyntaxMay.mkAdv for_Prep n_hours_NP | mkAdv (n_hours_NP.s ! R.npNom) ; - weekdayPunctualAdv w = ; -- on Sunday weekdayHabitualAdv w = ; -- on Sundays weekdayNextAdv w = -- next Sunday From 9c5b87e1c82821e41f720f21980c3e7356760a40 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Tue, 15 Aug 2023 11:29:25 +0300 Subject: [PATCH 022/129] Lav: comma in please_Voc like in VocNP --- src/latvian/StructuralLav.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/latvian/StructuralLav.gf b/src/latvian/StructuralLav.gf index 61f96dfd..577ff1ef 100644 --- a/src/latvian/StructuralLav.gf +++ b/src/latvian/StructuralLav.gf @@ -266,7 +266,7 @@ lin can8know_VV = mkVV (mkV "varēt" third_conjugation) ; must_VV = mkVV (mkV "vajadzēt" third_conjugation Dat) ; - please_Voc = ss "lūdzu" ; + please_Voc = ss ", lūdzu" ; oper From 9444848069eb84d5484f82dc6021c2b79eb63688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Tue, 15 Aug 2023 20:24:51 +0800 Subject: [PATCH 023/129] Create github actions for building rgl --- .github/workflows/test.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..bcfc74a5 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +name: Check that the RGL can successfully build + +on: + push + +jobs: + build: + runs-on: ubuntu-20.04 + env: + GF_VERSION: 3.11 + DEST: gf-rgl + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Download GF + uses: dsaltares/fetch-gh-release-asset@1.1.1 + with: + repo: 'GrammaticalFramework/gf-core' + version: 'tags/${{ env.GF_VERSION }}' + file: 'gf-${{ env.GF_VERSION }}-ubuntu-20.04.deb' + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install GF + run: | + sudo dpkg -i gf-${GF_VERSION}-ubuntu-20.04.deb' + + - name: Build RGL + run: | + mkdir -p ${DEST} + bash Setup.sh --dest=${DEST} --gf=gf --verbose From e2b6af2ca4a4bab9dca0eb1d3a92a9397aef8deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Tue, 15 Aug 2023 20:26:05 +0800 Subject: [PATCH 024/129] Fix typo --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bcfc74a5..b48c6dbc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: - name: Install GF run: | - sudo dpkg -i gf-${GF_VERSION}-ubuntu-20.04.deb' + sudo dpkg -i gf-${GF_VERSION}-ubuntu-20.04.deb - name: Build RGL run: | From 7d483b1539fc1a990509f18fbb464e13331eec96 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Tue, 15 Aug 2023 22:15:38 +0300 Subject: [PATCH 025/129] uses of Finnish infinitive forms in syntax --- src/finnish/infinitives/Infinitive.gf | 19 +++++++ src/finnish/infinitives/InfinitiveFin.gf | 65 ++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 src/finnish/infinitives/Infinitive.gf create mode 100644 src/finnish/infinitives/InfinitiveFin.gf diff --git a/src/finnish/infinitives/Infinitive.gf b/src/finnish/infinitives/Infinitive.gf new file mode 100644 index 00000000..90289074 --- /dev/null +++ b/src/finnish/infinitives/Infinitive.gf @@ -0,0 +1,19 @@ +abstract Infinitive = + + Grammar, + Lexicon + ** { + +fun + PresPartPassSubjVP : VP -> VP ; -- (minun) on mentävä + PresPartPassObjVP : VPSlash -> VP ; -- (oluesta) on pidettävä + + PastPartPassAdv : NP -> VP -> Adv ; -- junan mentyä + AgentPartAP : NP -> VPSlash -> AP ; -- koiran syömä + + Inf2InessAdv : NP -> VP -> Adv ; -- junan mennessä + Inf2InessPassAdv : NP -> VPSlash -> Adv ; -- junaa odotettaessa + + + +} \ No newline at end of file diff --git a/src/finnish/infinitives/InfinitiveFin.gf b/src/finnish/infinitives/InfinitiveFin.gf new file mode 100644 index 00000000..e5241ed8 --- /dev/null +++ b/src/finnish/infinitives/InfinitiveFin.gf @@ -0,0 +1,65 @@ +--# -path=..:alltenses + +concrete InfinitiveFin of Infinitive = + GrammarFin, + LexiconFin + ** open + ResFin, + StemFin, + Prelude + in { + +lin + PresPartPassSubjVP vp = vp ** { + s = vpVerbOlla ** {sc = SCGen} ; + s2 = \\b,p,a => vp.s.s ! PresPartPass (AN (NCase Sg Nom)) ++ vp.s2 ! b ! p ! a ; + } ; + + PresPartPassObjVP vpslash = vpslash ** { + s = vpVerbOlla ** {sc = npform2subjcase vpslash.c2.c} ; + s2 = \\b,p,a => vpslash.c2.s.p2 ++ vpslash.s.s ! PresPartPass (AN (NCase Sg Nom)) ++ vpslash.s2 ! b ! p ! a ; + } ; + + PastPartPassAdv np vp = { + s = np.s ! NPCase Gen ++ + vp.s.s ! PastPartPass (AN (NCase Sg Part)) ++ + vp.s2 ! True ! Pos ! np.a ++ + vp.adv ! Pos ++ + vp.ext + } ; + + AgentPartAP np vp = { + s = \\_, nf => + np.s ! NPCase Gen ++ + vp.s2 ! True ! Pos ! np.a ++ + vp.adv ! Pos ++ + vp.c2.s.p2 ++ + vp.s.s ! AgentPart (AN nf) ++ + vp.ext ; + hasPrefix = False ; + p = [] + } ; + + Inf2InessAdv np vp = { + s = np.s ! NPCase Gen ++ + infVP SCNom Pos np.a vp Inf2Iness + } ; + + Inf2InessPassAdv np vps = { + s = np.s ! NPCase Part ++ + infVP SCNom Pos np.a Inf2InessPass + } ; + + + +-- {s = vp.s.s ! Inf Inf1Long} ; +-- {s = vp.s.s ! Inf Inf2Instr} ; + +-- {s = vp.s.s ! Inf Inf2InessPass} ; +-- {s = vp.s.s ! Inf Inf2Adess} ; +-- {s = vp.s.s ! Inf InfPresPart} ; + + + + +} \ No newline at end of file From a9408305df37f52195209d97bf2fa75782c0c479 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Tue, 15 Aug 2023 22:16:20 +0300 Subject: [PATCH 026/129] added SCAcc in Finnish and fixed the subject form in passives --- src/finnish/ResFin.gf | 6 ++++-- src/finnish/StemFin.gf | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/finnish/ResFin.gf b/src/finnish/ResFin.gf index 8a39b06e..b236f7ae 100644 --- a/src/finnish/ResFin.gf +++ b/src/finnish/ResFin.gf @@ -30,7 +30,7 @@ resource ResFin = ParamX ** open Prelude in { --- These cases are possible for subjects. - SubjCase = SCNom | SCGen | SCPart | SCIness | SCElat | SCAdess | SCAblat ; + SubjCase = SCNom | SCGen | SCPart | SCIness | SCElat | SCAdess | SCAblat | SCAcc ; oper appSubjCase : SubjCase -> ResFin.NP -> Str = \sc,np -> np.s ! subjcase2npform sc ; @@ -42,7 +42,8 @@ oper SCIness => NPCase Iness ; SCElat => NPCase Elat ; SCAdess => NPCase Adess ; - SCAblat => NPCase Ablat + SCAblat => NPCase Ablat ; + SCAcc => NPAcc } ; npform2subjcase : NPForm -> SubjCase = \sc -> case sc of { @@ -52,6 +53,7 @@ oper NPCase Elat => SCElat ; NPCase Adess => SCAdess ; NPCase Ablat => SCAblat ; + NPAcc => SCAcc ; _ => SCNom } ; diff --git a/src/finnish/StemFin.gf b/src/finnish/StemFin.gf index f0de1ec1..00eb3558 100644 --- a/src/finnish/StemFin.gf +++ b/src/finnish/StemFin.gf @@ -378,7 +378,8 @@ oper s = \\t,a,b => let agrfin = case vp.sc of { - SCNom => ; + SCNom => ; + SCAcc => ; _ => -- minun täytyy, minulla on } ; verb = vp.s ! VIFin t ! a ! b ! agrfin.p1 ; From 31b025bdf1233c75d3ed85742e9decee4b893607 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Wed, 16 Aug 2023 11:32:11 +0300 Subject: [PATCH 027/129] completed infinitive and participle structures of Finnish --- src/finnish/infinitives/Infinitive.gf | 45 +++++++- src/finnish/infinitives/InfinitiveFin.gf | 140 +++++++++++++++++++++-- 2 files changed, 172 insertions(+), 13 deletions(-) diff --git a/src/finnish/infinitives/Infinitive.gf b/src/finnish/infinitives/Infinitive.gf index 90289074..ec1aa285 100644 --- a/src/finnish/infinitives/Infinitive.gf +++ b/src/finnish/infinitives/Infinitive.gf @@ -1,6 +1,6 @@ abstract Infinitive = - Grammar, + Grammar - [VPSlashPrep], ---- to avoid certain spurious ambiguities, to be fixed Lexicon ** { @@ -9,11 +9,50 @@ fun PresPartPassObjVP : VPSlash -> VP ; -- (oluesta) on pidettävä PastPartPassAdv : NP -> VP -> Adv ; -- junan mentyä - AgentPartAP : NP -> VPSlash -> AP ; -- koiran syömä + + PresPartActAP : VP -> AP ; -- (lihaa) syövä + PastPartActAP : VP -> AP ; -- (lihaa) syönyt + PresPartPassAP : VPSlash -> AP ; -- (tänään) syötävä + PastPartPassAP : VPSlash -> AP ; -- (tänään) syöty + + AgentPartAP : NP -> VPSlash -> AP ; -- koiran syömä + Inf2InessAdv : NP -> VP -> Adv ; -- junan mennessä - Inf2InessPassAdv : NP -> VPSlash -> Adv ; -- junaa odotettaessa + + 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 + + Inf3InessAdv : VP -> Adv ; -- odottamassa (junaa) + Inf3InessInvAdv : NP -> VPSlash -> Adv ; -- junaa odottamassa + + Inf3ElatAdv : VP -> Adv ; -- odottamasta (junaa) + Inf3ElatInvAdv : NP -> VPSlash -> Adv ; -- junaa odottamasta + + Inf3IllatAdv : VP -> Adv ; -- odottamaan (junaa) + Inf3IllatInvAdv : NP -> VPSlash -> Adv ; -- junaa odottamaan + + Inf3AdessAdv : VP -> Adv ; -- odottamalla (junaa) + Inf3AdessInvAdv : NP -> VPSlash -> Adv ; -- junaa odottamalla + + Inf3AbessAdv : VP -> Adv ; -- odottamatta (junaa) + Inf3AbessInvAdv : NP -> VPSlash -> Adv ; -- junaa odottamatta + + ComplPresPartActVS : VS -> NP -> VP -> VP ; -- sanoa junan menevän + ComplPastPartActVS : VS -> NP -> VP -> VP ; -- sanoa junan menneen + + ComplPresPartActAgrVS : VS -> VP -> VP ; -- sanoa menevänsä + ComplPastPartActAgrVS : VS -> VP -> VP ; -- sanoa menneensä + + ComplPresPartPassVS : VS -> NP -> VPSlash -> VP ; -- sanoa junaa odotettavan + ComplPastPartPassVS : VS -> NP -> VPSlash -> VP ; -- sanoa junaa odotetun + + } \ No newline at end of file diff --git a/src/finnish/infinitives/InfinitiveFin.gf b/src/finnish/infinitives/InfinitiveFin.gf index e5241ed8..8ace5786 100644 --- a/src/finnish/infinitives/InfinitiveFin.gf +++ b/src/finnish/infinitives/InfinitiveFin.gf @@ -1,7 +1,7 @@ --# -path=..:alltenses concrete InfinitiveFin of Infinitive = - GrammarFin, + GrammarFin - [VPSlashPrep], LexiconFin ** open ResFin, @@ -27,7 +27,31 @@ lin vp.adv ! Pos ++ vp.ext } ; - + + PresPartActAP vp = { + s = \\_, nf => preCompVP vp (PresPartAct (AN nf)) ; + hasPrefix = False ; + p = [] + } ; + + PastPartActAP vp = { + s = \\_, nf => preCompVP vp (PastPartAct (AN nf)) ; + hasPrefix = False ; + p = [] + } ; + + PresPartPassAP vp = { + s = \\_, nf => preCompVP (PresPartPass (AN nf)) ; + hasPrefix = False ; + p = [] + } ; + + PastPartPassAP vp = { + s = \\_, nf => preCompVP (PastPartPass (AN nf)) ; + hasPrefix = False ; + p = [] + } ; + AgentPartAP np vp = { s = \\_, nf => np.s ! NPCase Gen ++ @@ -45,21 +69,117 @@ lin infVP SCNom Pos np.a vp Inf2Iness } ; - Inf2InessPassAdv np vps = { - s = np.s ! NPCase Part ++ + Inf2InessPassAdv vp = { + s = infVP SCNom Pos infAdvAgr vp Inf2InessPass + } ; + + Inf2InessPassInvAdv np vps = { + s = infAppCompl vps.c2 np ++ infVP SCNom Pos np.a Inf2InessPass } ; + Inf2InstrAdv vp = { + s = infVP SCNom Pos infAdvAgr vp Inf2Instr + } ; + + Inf2InstrInvAdv np vps = { + s = infAppCompl vps.c2 np ++ + infVP SCNom Pos np.a Inf2Instr + } ; + + Inf3InessAdv vp = { + s = infVP SCNom Pos infAdvAgr vp Inf3Iness + } ; + + Inf3InessInvAdv np vps = { + s = infAppCompl vps.c2 np ++ + infVP SCNom Pos np.a Inf3Iness + } ; + Inf3ElatAdv vp = { + s = infVP SCNom Pos infAdvAgr vp Inf3Elat + } ; + + Inf3ElatInvAdv np vps = { + s = infAppCompl vps.c2 np ++ + infVP SCNom Pos np.a Inf3Elat + } ; + + Inf3IllatAdv vp = { + s = infVP SCNom Pos infAdvAgr vp Inf3Illat + } ; + + Inf3IllatInvAdv np vps = { + s = infAppCompl vps.c2 np ++ + infVP SCNom Pos np.a Inf3Illat + } ; + + + Inf3AdessAdv vp = { + s = infVP SCNom Pos infAdvAgr vp Inf3Adess + } ; + + Inf3AdessInvAdv np vps = { + s = infAppCompl vps.c2 np ++ + infVP SCNom Pos np.a Inf3Adess + } ; + + + Inf3AbessAdv vp = { + s = infVP SCNom Pos infAdvAgr vp Inf3Abess + } ; + + Inf3AbessInvAdv np vps = { + s = infAppCompl vps.c2 np ++ + infVP SCNom Pos np.a Inf3Abess + } ; + + ComplPresPartActVS vs np vp = + insertExtrapos (subjPartVP np vp (NPCase Gen) (PresPartAct (AN (NCase Sg Gen)))) (predSV vs) ; + ComplPastPartActVS vs np vp = + insertExtrapos (subjPartVP np vp (NPCase Gen) (PastPartAct (AN (NCase Sg Gen)))) (predSV vs) ; + + ComplPresPartActAgrVS vs vp = + insertObj (\\_,_,agr => subjPartAgrVP vp (PresPartAct (AN (NPossGen Sg))) agr) (predSV vs) ; + ComplPastPartActAgrVS vs vp = + insertObj (\\_,_,agr => subjPartAgrVP vp (PastPartAct (AN (NPossGen Sg))) agr) (predSV vs) ; + + ComplPresPartPassVS vs np vps = + insertExtrapos (subjPartVP np (NPCase Part) (PresPartPass (AN (NCase Sg Gen)))) (predSV vs) ; + ComplPastPartPassVS vs np vps = + insertExtrapos (subjPartVP np (NPCase Part) (PastPartPass (AN (NCase Sg Gen)))) (predSV vs) ; --- {s = vp.s.s ! Inf Inf1Long} ; --- {s = vp.s.s ! Inf Inf2Instr} ; - --- {s = vp.s.s ! Inf Inf2InessPass} ; --- {s = vp.s.s ! Inf Inf2Adess} ; --- {s = vp.s.s ! Inf InfPresPart} ; +oper + infAppCompl : Compl -> ResFin.NP -> Str = \co, np -> + appCompl False Neg co np ; -- not fin, Acc becomes Part + + infAdvAgr : Agr = agrP3 Sg ; --- ? + + -- 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 ++ + vp.s.s ! vform ++ + vp.s2 ! True ! Pos ! np.a ++ + vp.adv ! Pos ++ + vp.ext ; + + -- tiedän syöväni, tiedän syöneeni + subjPartAgrVP : StemFin.VP -> VForm -> Agr -> Str = \vp, vform, agr -> + vp.s.s ! vform ++ BIND ++ + case vp.s.h of {Back => possSuffix agr ; Front => possSuffixFront agr} ++ + vp.s2 ! True ! Pos ! agr ++ + vp.adv ! Pos ++ + vp.ext ; + + + -- ruohoa syövä, Ranskassa valmistettu + preCompVP : StemFin.VP -> VForm -> Str = \vp, vform -> + vp.s2 ! True ! Pos ! infAdvAgr ++ + vp.adv ! Pos ++ + vp.s.s ! vform ++ + vp.ext ; } \ No newline at end of file From 146bc71a06442b3eb6255a71748c12aa5098cd1d Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Wed, 16 Aug 2023 16:05:28 +0300 Subject: [PATCH 028/129] clean-up after Fin infinitives --- src/finnish/VerbFin.gf | 3 ++- src/finnish/infinitives/Infinitive.gf | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/finnish/VerbFin.gf b/src/finnish/VerbFin.gf index e70847c3..cee24034 100644 --- a/src/finnish/VerbFin.gf +++ b/src/finnish/VerbFin.gf @@ -79,7 +79,8 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin, StemFin in { ) ** {c2 = vp.c2} ; ---- correct ?? -} - SlashV2VNP = StemFin.slashV2VNP ; ---- compilation to pgf takes too long 6/8/2013 hence a simplified version in stemmed/ +---- + SlashV2VNP = StemFin.slashV2VNP ; ---- compilation to pgf takes too long 6/8/2013 hence a simplified version in stemmed/ AdvVP vp adv = insertAdv (\\_ => adv.s) vp ; ExtAdvVP vp adv = insertAdv (\\_ => embedInCommas adv.s) vp ; diff --git a/src/finnish/infinitives/Infinitive.gf b/src/finnish/infinitives/Infinitive.gf index ec1aa285..c94cd6df 100644 --- a/src/finnish/infinitives/Infinitive.gf +++ b/src/finnish/infinitives/Infinitive.gf @@ -4,21 +4,23 @@ abstract Infinitive = Lexicon ** { -fun +flags startcat = Utt ; + +data PresPartPassSubjVP : VP -> VP ; -- (minun) on mentävä PresPartPassObjVP : VPSlash -> VP ; -- (oluesta) on pidettävä PastPartPassAdv : NP -> VP -> Adv ; -- junan mentyä - PresPartActAP : VP -> AP ; -- (lihaa) syövä - PastPartActAP : VP -> AP ; -- (lihaa) syönyt + PresPartActAP : VP -> AP ; -- (lihaa) syövä + PastPartActAP : VP -> AP ; -- (lihaa) syönyt PresPartPassAP : VPSlash -> AP ; -- (tänään) syötävä PastPartPassAP : VPSlash -> AP ; -- (tänään) syöty AgentPartAP : NP -> VPSlash -> AP ; -- koiran syömä - Inf2InessAdv : NP -> VP -> Adv ; -- junan mennessä + Inf2InessAdv : NP -> VP -> Adv ; -- junan mennessä Inf2InessPassAdv : VP -> Adv ; -- odotettaessa (junaa), touhuttaessa (junan kanssa) Inf2InessPassInvAdv : NP -> VPSlash -> Adv ; -- junaa odotettaessa, junan kanssa touhutessa @@ -53,6 +55,5 @@ fun ComplPastPartPassVS : VS -> NP -> VPSlash -> VP ; -- sanoa junaa odotetun - } \ No newline at end of file From 6bc965f6c2b5266bdb3ddf3cd1a6fe5bebd3e69f Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 16 Aug 2023 19:39:22 +0200 Subject: [PATCH 029/129] the names API in more languages --- src/afrikaans/CatAfr.gf | 5 +- src/afrikaans/DocumentationAfr.gf | 6 +- src/afrikaans/NamesAfr.gf | 39 ++++++- src/afrikaans/ParadigmsAfr.gf | 21 ++++ src/bulgarian/CatBul.gf | 2 +- src/bulgarian/DocumentationBul.gf | 8 +- src/bulgarian/MorphoFunsBul.gf | 10 +- src/bulgarian/NamesBul.gf | 10 +- src/bulgarian/ResBul.gf | 1 - src/catalan/DocumentationCatFunctor.gf | 36 ++++++ src/catalan/NamesCat.gf | 38 ++++++- src/catalan/ParadigmsCat.gf | 41 ++++++- src/chinese/DocumentationChi.gf | 10 +- src/chinese/NamesChi.gf | 8 +- src/common/ParamX.gf | 3 + src/dutch/CatDut.gf | 5 +- src/dutch/DocumentationDutFunctor.gf | 26 ++++- src/dutch/NamesDut.gf | 40 ++++++- src/dutch/ParadigmsDut.gf | 22 ++++ src/english/CatEng.gf | 6 +- src/english/DocumentationEng.gf | 32 +++--- src/english/NamesEng.gf | 33 ++++-- src/english/ParadigmsEng.gf | 60 +++++++--- src/english/ResEng.gf | 3 + src/estonian/CatEst.gf | 5 +- src/estonian/DocumentationEstFunctor.gf | 41 +++++++ src/estonian/NamesEst.gf | 34 +++++- src/estonian/ParadigmsEst.gf | 52 +++++++++ src/finnish/CatFin.gf | 5 +- src/finnish/DocumentationFinFunctor.gf | 21 ++-- src/finnish/NamesFin.gf | 33 +++++- src/finnish/ParadigmsFin.gf | 33 ++++++ src/french/DocumentationFreFunctor.gf | 46 ++++++++ src/french/NamesFre.gf | 23 +++- src/french/ParadigmsFre.gf | 42 ++++--- src/german/CatGer.gf | 3 +- src/german/DocumentationGerFunctor.gf | 60 ++++++++++ src/german/NamesGer.gf | 33 +++++- src/german/ParadigmsGer.gf | 26 +++++ src/german/ResGer.gf | 1 - src/italian/DocumentationItaFunctor.gf | 36 ++++++ src/italian/NamesIta.gf | 55 ++++++++- src/italian/ParadigmsIta.gf | 41 +++++-- src/norwegian/DiffNor.gf | 3 +- src/norwegian/MorphoNor.gf | 4 +- src/norwegian/ParadigmsNor.gf | 4 +- src/nynorsk/DiffNno.gf | 3 +- src/nynorsk/MorphoNno.gf | 4 +- src/nynorsk/ParadigmsNno.gf | 4 +- src/portuguese/DocumentationPorFunctor.gf | 36 ++++++ src/portuguese/NamesPor.gf | 55 ++++++++- src/portuguese/ParadigmsPor.gf | 47 ++++++-- src/romance/CatRomance.gf | 16 +-- src/russian/CatRus.gf | 18 ++- src/russian/DocumentationRusFunctor.gf | 96 +++++++++++++--- src/russian/NamesRus.gf | 61 ++++++---- src/russian/ParadigmsRus.gf | 131 +++++++++++++++++++++- src/scandinavian/CatScand.gf | 7 +- src/slovenian/CatSlv.gf | 7 +- src/slovenian/DocumentationSlv.gf | 70 +++++++++++- src/slovenian/NamesSlv.gf | 12 +- src/slovenian/ParadigmsSlv.gf | 44 +++++++- src/slovenian/ResSlv.gf | 1 - src/spanish/DocumentationSpaFunctor.gf | 36 ++++++ src/spanish/NamesSpa.gf | 35 +++--- src/spanish/ParadigmsSpa.gf | 39 ++++--- src/swedish/DocumentationSwe.gf | 17 +-- src/swedish/NamesSwe.gf | 25 ++++- src/swedish/ParadigmsSwe.gf | 24 +++- 69 files changed, 1584 insertions(+), 270 deletions(-) diff --git a/src/afrikaans/CatAfr.gf b/src/afrikaans/CatAfr.gf index e2f230c2..f26f6c55 100644 --- a/src/afrikaans/CatAfr.gf +++ b/src/afrikaans/CatAfr.gf @@ -83,6 +83,9 @@ concrete CatAfr of Cat = N = Noun ; N2 = {s : NForm => Str ; g : Gender} ** {c2 : Preposition} ; N3 = {s : NForm => Str ; g : Gender} ** {c2,c3 : Preposition} ; - GN, SN, LN, PN = {s : NPCase => Str} ; + PN = {s : NPCase => Str} ; + GN = {s : NPCase => Str; g : Sex} ; + SN = {s : Sex => NPCase => Str; pl : NPCase => Str} ; + LN = {s : Adjf => NPCase => Str ; hasArt : Bool ; n : Number} ; } diff --git a/src/afrikaans/DocumentationAfr.gf b/src/afrikaans/DocumentationAfr.gf index ebaf00e8..c080d206 100644 --- a/src/afrikaans/DocumentationAfr.gf +++ b/src/afrikaans/DocumentationAfr.gf @@ -29,9 +29,9 @@ lin } ; InflectionLN = \ln -> { - t = "ln" ; + t = "pn" ; s1 = heading1 "Naam" ; - s2 = paragraph (ln.s ! NPNom) + s2 = paragraph (ln.s ! Strong ! NPNom) } ; InflectionGN = \pn -> { @@ -43,7 +43,7 @@ lin InflectionSN = \pn -> { t = "van" ; s1 = heading1 "Van" ; - s2 = paragraph (pn.s ! NPNom) + s2 = paragraph (pn.s ! Male ! NPNom) } ; InflectionA, InflectionA2 = \adj -> diff --git a/src/afrikaans/NamesAfr.gf b/src/afrikaans/NamesAfr.gf index 15d12e89..f079b984 100644 --- a/src/afrikaans/NamesAfr.gf +++ b/src/afrikaans/NamesAfr.gf @@ -1,9 +1,40 @@ concrete NamesAfr of Names = CatAfr ** open ResAfr, Prelude in { -lin GivenName, MaleSurname, FemaleSurname = \n -> {s = n.s ; a = agrP3 Sg ; isPron = False} ; -lin FullName gn sn = - {s = \\c => gn.s ! NPNom ++ sn.s ! c ; a = agrP3 Sg ; isPron = False} ; +lin GivenName = \n -> {s = n.s ; a = agrP3 Sg ; isPron = False} ; +lin MaleSurname = \n -> {s = n.s ! Male ; a = agrP3 Sg ; isPron = False} ; +lin FemaleSurname = \n -> {s = n.s ! Female; a = agrP3 Sg ; isPron = False} ; +lin PlSurname = \n -> {s = n.pl ; a = agrP3 Sg ; isPron = False} ; -lin UseLN pn = {s = pn.s ; a = agrP3 Sg ; isPron = False} ; +lin FullName gn sn = + {s = \\c => gn.s ! NPNom ++ sn.s ! gn.g ! c ; a = agrP3 Sg ; isPron = False} ; + +lin UseLN ln = { + s = \\c => case ln.hasArt of { + True => "die" ++ ln.s ! Weak ! c ; + False => ln.s ! Strong ! c + } ; + a = agrP3 ln.n ; + isPron = False + } ; + + PlainLN ln = { + s = \\c => ln.s ! Strong ! c ; + a = agrP3 ln.n ; + isPron = False + } ; + + InLN ln = { + s = appPrep "in" (\\c => case ln.hasArt of { + True => "die" ++ ln.s ! Weak ! c ; + False => ln.s ! Strong ! c + }) + } ; + + AdjLN ap ln = ln ** { + s = \\a,c => + preOrPost ap.isPre + (ap.s ! agrAdj Neutr a (NF ln.n Nom)) + (ln.s ! a ! c) ; + } ; } diff --git a/src/afrikaans/ParadigmsAfr.gf b/src/afrikaans/ParadigmsAfr.gf index c7ae8b33..42dbfd8d 100644 --- a/src/afrikaans/ParadigmsAfr.gf +++ b/src/afrikaans/ParadigmsAfr.gf @@ -73,6 +73,25 @@ oper mkPN : Str -> PN ; -- proper name } ; + mkGN = overload { -- given name + mkGN : Str -> GN = \s -> lin GN {s = \\_ => s; g = Male} ; + mkGN : Str -> Sex -> GN = \s,g -> lin GN {s = \\_ => s; g = g} ; + } ; + + mkSN = overload { -- given name + mkSN : Str -> SN = \s -> lin SN {s = \\_,_ => s; pl = \\_=>s} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Male=>\\_=>male; Female=>\\_=>female}; pl=\\_=>pl} ; + } ; + + mkLN = overload { + mkLN : Str -> LN -- location name + = \s -> lin LN {s = \\_,_ => s; hasArt = False; n = Sg} ; + mkLN : Str -> Number -> LN -- location name + = \s,n -> lin LN {s = \\_,_ => s; hasArt = False; n = n} ; + } ; + + defLN : LN -> LN = \n -> n ** {hasArt = True} ; + --2 Adjectives @@ -205,6 +224,8 @@ oper feminine = Neutr ; het,neuter = Neutr ; de,utrum = Neutr ; + male = Male ; + female = Female ; mkA = overload { mkA : (vers : Str) -> A = \a -> lin A (regAdjective a) ; diff --git a/src/bulgarian/CatBul.gf b/src/bulgarian/CatBul.gf index c4bbfe3e..4eec21ca 100644 --- a/src/bulgarian/CatBul.gf +++ b/src/bulgarian/CatBul.gf @@ -88,7 +88,7 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, ( N3 = {s : NForm => Str; rel : AForm => Str; relType : NRelType; g : AGender} ** {c2,c3 : Preposition} ; GN = {s : Str; g : Sex} ; SN = {s : Sex => Str; pl : Str} ; - LN = {s : Species => Str; c : Preposition; gn : GenNum} ; + LN = {s : Species => Str; onPrep : Bool; gn : GenNum} ; PN = {s : Str; gn : GenNum} ; lindef diff --git a/src/bulgarian/DocumentationBul.gf b/src/bulgarian/DocumentationBul.gf index b047edda..76630cb5 100644 --- a/src/bulgarian/DocumentationBul.gf +++ b/src/bulgarian/DocumentationBul.gf @@ -103,7 +103,11 @@ lin }) ; s2 = paragraph (n.s ! Indef) ++ heading1 ("Наречие") ++ - paragraph (n.c.s ++ linCase n.c.c Pos ++ n.s ! Def) ; + paragraph (case n.onPrep of { + True => linCase Dat Pos ; + False => vyv_Str + } ++ + n.s ! Def) ; s3 = "" } ; @@ -160,7 +164,7 @@ lin } ; InflectionPrep = \prep -> { - t = "пр" ; + t = "пред" ; s1= heading1 ("Предлог") ; s2= paragraph (prep.s) ; s3= "" diff --git a/src/bulgarian/MorphoFunsBul.gf b/src/bulgarian/MorphoFunsBul.gf index 6fa19478..5aa59c45 100644 --- a/src/bulgarian/MorphoFunsBul.gf +++ b/src/bulgarian/MorphoFunsBul.gf @@ -292,16 +292,16 @@ oper } ; mkLN = overload { - mkLN : Str -> LN = \s -> lin LN {s = \\_ => s; c = {s = vyv_Str; c = CPrep}; gn = GSg Masc} ; + mkLN : Str -> LN = \s -> lin LN {s = \\_ => s; onPrep = False; gn = GSg Masc} ; mkLN : Str -> Gender -> LN = - \s,g -> lin LN {s = \\_ => s; c = {s = vyv_Str; c = CPrep}; gn = GSg g} ; + \s,g -> lin LN {s = \\_ => s; onPrep = False; gn = GSg g} ; mkLN : Str -> GenNum -> LN = - \s,gn -> lin LN {s = \\_ => s; c = {s = vyv_Str; c = CPrep}; gn = gn} ; + \s,gn -> lin LN {s = \\_ => s; onPrep = False; gn = gn} ; mkLN : Str -> Str -> GenNum -> LN = - \s1,s2,gn -> lin LN {s = table Species [s2; s1]; c = {s = vyv_Str; c = CPrep}; gn = gn} ; + \s1,s2,gn -> lin LN {s = table Species [s2; s1]; onPrep = False; gn = gn} ; } ; - prepLN : LN -> Prep -> LN = \n,p -> n ** {c = p} ; + onLN : LN -> LN = \n -> n ** {onPrep = True} ; --2 IAdv -- diff --git a/src/bulgarian/NamesBul.gf b/src/bulgarian/NamesBul.gf index 97f0307a..ea5c5901 100644 --- a/src/bulgarian/NamesBul.gf +++ b/src/bulgarian/NamesBul.gf @@ -1,4 +1,4 @@ -concrete NamesBul of Names = CatBul ** open ResBul in { +concrete NamesBul of Names = CatBul ** open ResBul, Prelude in { lin GivenName = \n -> { s = table { RObj c => linCase c Pos ++ n.s; @@ -44,7 +44,13 @@ lin UseLN, PlainLN = \n -> { p = NounP3 Pos } ; - InLN n = {s = n.c.s ++ linCase n.c.c Pos ++ n.s ! Def} ; + InLN n = { + s = case n.onPrep of { + True => linCase Dat Pos ; + False => vyv_Str + } ++ + n.s ! Def + } ; AdjLN ap n = n ** { s = \\sp => case ap.isPre of { diff --git a/src/bulgarian/ResBul.gf b/src/bulgarian/ResBul.gf index cde09a47..e869807c 100644 --- a/src/bulgarian/ResBul.gf +++ b/src/bulgarian/ResBul.gf @@ -47,7 +47,6 @@ resource ResBul = ParamX ** open Prelude, Predef in { param Gender = Masc | Fem | Neut ; - Sex = Male | Female ; Species = Indef | Def ; diff --git a/src/catalan/DocumentationCatFunctor.gf b/src/catalan/DocumentationCatFunctor.gf index 351fddbd..8b30bba5 100644 --- a/src/catalan/DocumentationCatFunctor.gf +++ b/src/catalan/DocumentationCatFunctor.gf @@ -40,6 +40,42 @@ lin ) } ; + InflectionGN = \gn -> { + t = "pn" ; + s1 = heading1 ("Prenom" ++ + case gn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = gn.s + } ; + + InflectionSN = \gn -> { + t = "pn" ; + s1 = heading1 "Família" ; + s2 = gn.s ! Masc + } ; + + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 ("Nom Propi" ++ + case pn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = pn.s + } ; + + InflectionLN = \ln -> { + t = "nl" ; + s1 = heading1 ("Nom de la Ubicació" ++ + case ln.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = paragraph ln.s + } ; + InflectionA, InflectionA2 = \adj -> { t = "a" ; s1 = heading1 (nounHeading adjective_Category).s ; diff --git a/src/catalan/NamesCat.gf b/src/catalan/NamesCat.gf index 52d69dba..e64c20fc 100644 --- a/src/catalan/NamesCat.gf +++ b/src/catalan/NamesCat.gf @@ -1,9 +1,41 @@ -concrete NamesCat of Names = CatCat ** open ResCat in { +concrete NamesCat of Names = CatCat ** open ResCat, CommonRomance, Prelude in { -lin GivenName, MaleSurname, FemaleSurname = \n -> pn2np n ; +lin GivenName = \n -> pn2np n ; +lin MaleSurname = \n -> pn2np {s = n.s ! Masc; g = Masc} ; +lin FemaleSurname = \n -> pn2np {s = n.s ! Fem; g = Fem} ; +lin PlSurname = \n -> heavyNPpol False { + s = \\c => prepCase c ++ n.pl ; + a = agrP3 Masc Pl + } ; lin FullName gn sn = pn2np { - s = gn.s ++ sn.s ; + s = gn.s ++ sn.s ! gn.g ; g = gn.g } ; +lin PlainLN n = heavyNP { + s = \\c => n.s; + a = {g = n.g ; n = n.num ; p = P3} + } ; + +lin UseLN n = heavyNP { + s = \\c => case n.art of { + UseArt => artDef True n.g n.num c ++ n.s ; + _ => n.s + } ; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin InLN n = { + s = "en" ++ case n.art of { + UseArt => artDef True n.g n.num Acc ++ n.s; + _ => prepCase Acc ++ n.s + } ; + } ; + + +lin AdjLN ap n = n ** { + s = preOrPost ap.isPre (ap.s ! AF n.g n.num) n.s ; + } ; + } diff --git a/src/catalan/ParadigmsCat.gf b/src/catalan/ParadigmsCat.gf index ada9ec08..edf09edb 100644 --- a/src/catalan/ParadigmsCat.gf +++ b/src/catalan/ParadigmsCat.gf @@ -139,12 +139,39 @@ oper mkPN : N -> PN ; } ; - mkLN : Str -> LN = \s -> - lin LN {s = s ; - p = {s=""; c=CPrep P_a; isDir=True} ; - art = NoArt ; - g = Masc ; - num = Sg} ; + mkGN = overload { + mkGN : (Anna : Str) -> GN = \s -> lin GN (regPN s) ; -- feminine for "-a", otherwise masculine + mkGN : (Pilar : Str) -> Gender -> GN = \s,g -> lin GN (mk2PN s g) ; -- force gender + } ; + + mkSN = overload { + mkSN : Str -> SN = \s -> lin SN {s = \\_ => s; pl = s} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Masc=>male; Fem=>female}; pl = pl} ; + } ; + + mkLN = overload { + mkLN : Str -> LN = \s -> + lin LN {s = s ; + onPrep=False ; + art = NoArt ; + g = Masc ; + num = Sg} ; + mkLN : Str -> Gender -> LN = \s,g -> + lin LN {s = s ; + onPrep=False ; + art = NoArt ; + g = g ; + num = Sg} ; + mkLN : Str -> Gender -> Number -> LN = \s,g,n -> + lin LN {s = s ; + onPrep=False ; + art = NoArt ; + g = g ; + num = n} + } ; + + defLN : LN -> LN = \n -> n ** {art = UseArt} ; + --2 Adjectives @@ -308,6 +335,8 @@ oper CopulaType = DiffCat.CopulaType ; masculine = Masc ; feminine = Fem ; + male = Masc ; + female = Fem ; singular = Sg ; plural = Pl ; serCopula = DiffCat.serCopula ; diff --git a/src/chinese/DocumentationChi.gf b/src/chinese/DocumentationChi.gf index 4b3e8678..0e2b84b8 100644 --- a/src/chinese/DocumentationChi.gf +++ b/src/chinese/DocumentationChi.gf @@ -112,26 +112,26 @@ lin } ; InflectionPN = \n -> { - t = "v" ; + t = "pn" ; s1 = heading1 "Proper Name" ; s2 = n.s } ; InflectionLN = \n -> { - t = "v" ; + t = "pn" ; s1 = heading1 "Location Name" ; s2 = n.s } ; InflectionGN = \n -> { - t = "v" ; + t = "pn" ; s1 = heading1 "Given Name" ; s2 = n.s } ; InflectionSN = \n -> { - t = "v" ; - s1 = heading1 "Surname Name" ; + t = "pn" ; + s1 = heading1 "Family Name" ; s2 = n.s } ; diff --git a/src/chinese/NamesChi.gf b/src/chinese/NamesChi.gf index c583a763..6d529154 100644 --- a/src/chinese/NamesChi.gf +++ b/src/chinese/NamesChi.gf @@ -1,4 +1,4 @@ -concrete NamesChi of Names = CatChi ** { +concrete NamesChi of Names = CatChi ** open ResChi, ParadigmsChi, Prelude in { lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ** {det = []} ; lin FullName gn sn = { @@ -6,6 +6,10 @@ lin FullName gn sn = { det = [] } ; -lin UseLN pn = pn ** {det = []} ; +lin UseLN ln = ln ** {det = []} ; + +lin InLN ln = + let prep : Prep = mkPrep "里" [] + in ss (appPrep prep (linNP (ln ** {det = []}))) ** {advType = prep.advType ; hasDe = prep.hasDe} ; --- should depend on np too ? } diff --git a/src/common/ParamX.gf b/src/common/ParamX.gf index a9940665..20cd9eba 100644 --- a/src/common/ParamX.gf +++ b/src/common/ParamX.gf @@ -18,6 +18,9 @@ resource ParamX = open Prelude in { | Cond --# notpresent ; + param + Sex = Male | Female ; + param Polarity = Pos | Neg ; diff --git a/src/dutch/CatDut.gf b/src/dutch/CatDut.gf index 80763f90..85bdb995 100644 --- a/src/dutch/CatDut.gf +++ b/src/dutch/CatDut.gf @@ -81,6 +81,9 @@ concrete CatDut of Cat = N = Noun ; N2 = {s : NForm => Str ; g : Gender} ** {c2 : Preposition} ; N3 = {s : NForm => Str ; g : Gender} ** {c2,c3 : Preposition} ; - GN, SN, LN, PN = {s : NPCase => Str} ; + PN = {s : NPCase => Str} ; + GN = {s : NPCase => Str; g : Sex} ; + SN = {s : Sex => NPCase => Str; pl : NPCase => Str} ; + LN = {s : Adjf => NPCase => Str ; hasArt : Bool ; n : Number} ; } diff --git a/src/dutch/DocumentationDutFunctor.gf b/src/dutch/DocumentationDutFunctor.gf index 920a7db3..6b5dadb1 100644 --- a/src/dutch/DocumentationDutFunctor.gf +++ b/src/dutch/DocumentationDutFunctor.gf @@ -36,6 +36,30 @@ lin ) } ; + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 "Naam" ; + s2 = paragraph (pn.s ! NPNom) + } ; + + InflectionLN = \ln -> { + t = "pn" ; + s1 = heading1 "Naam" ; + s2 = paragraph (ln.s ! Strong ! NPNom) + } ; + + InflectionGN = \pn -> { + t = "vnm" ; + s1 = heading1 "Voornaam" ; + s2 = paragraph (pn.s ! NPNom) + } ; + + InflectionSN = \pn -> { + t = "van" ; + s1 = heading1 "Van" ; + s2 = paragraph (pn.s ! Male ! NPNom) + } ; + InflectionA, InflectionA2 = \adj -> let gforms : AForm -> Str = \a -> @@ -61,7 +85,7 @@ lin InflectionAdv, InflectionAdV, InflectionAdA, InflectionAdN = \adv -> { t = "adv" ; - s1 = heading1 (heading preposition_Category) ; + s1 = heading1 "Bijwoord" ; s2 = paragraph adv.s } ; diff --git a/src/dutch/NamesDut.gf b/src/dutch/NamesDut.gf index c79205aa..e62b4729 100644 --- a/src/dutch/NamesDut.gf +++ b/src/dutch/NamesDut.gf @@ -1,9 +1,43 @@ concrete NamesDut of Names = CatDut ** open Prelude, ResDut in { -lin GivenName, MaleSurname, FemaleSurname = \n -> noMerge ** {s = n.s ; a = agrP3 Sg ; isPron = False} ; +lin GivenName = \n -> noMerge ** {s = n.s ; a = agrP3 Sg ; isPron = False} ; +lin MaleSurname = \n -> noMerge ** {s = n.s ! Male ; a = agrP3 Sg ; isPron = False} ; +lin FemaleSurname = \n -> noMerge ** {s = n.s ! Female; a = agrP3 Sg ; isPron = False} ; +lin PlSurname = \n -> noMerge ** {s = n.pl ; a = agrP3 Sg ; isPron = False} ; lin FullName gn sn = - noMerge ** {s = \\c => gn.s ! NPNom ++ sn.s ! c ; a = agrP3 Sg ; isPron = False} ; + noMerge ** {s = \\c => gn.s ! NPNom ++ sn.s ! gn.g ! c ; a = agrP3 Sg ; isPron = False} ; -lin UseLN pn = noMerge ** {s = pn.s ; a = agrP3 Sg ; isPron = False} ; +lin UseLN ln = noMerge ** { + s = \\c => case ln.hasArt of { + True => "de" ++ ln.s ! Weak ! c ; + False => ln.s ! Strong ! c + } ; + a = agrP3 ln.n ; + isPron = False + } ; + +lin PlainLN ln = noMerge ** { + s = \\c => ln.s ! Strong ! c ; + a = agrP3 ln.n ; + isPron = False + } ; + +lin InLN ln = { + s = "in" ++ case ln.hasArt of { + True => "de" ++ ln.s ! Weak ! NPAcc ; + False => ln.s ! Strong ! NPAcc + } + } ; + +lin AdjLN ap ln = ln ** { + s = \\a,c => + let gan : Gender*Adjf*NForm = case ap.isPre of { + True => ; + False => } ; + af = agrAdj gan.p1 gan.p2 gan.p3 ; + in preOrPost ap.isPre + (ap.s ! agrP3 Sg ! af) + (ln.s ! a ! c) ; + } ; } diff --git a/src/dutch/ParadigmsDut.gf b/src/dutch/ParadigmsDut.gf index a797b65b..dbbbc972 100644 --- a/src/dutch/ParadigmsDut.gf +++ b/src/dutch/ParadigmsDut.gf @@ -76,6 +76,24 @@ oper mkPN : N -> PN ; -- proper name from noun } ; + mkGN = overload { -- given name + mkGN : Str -> GN = \s -> lin GN {s = \\_ => s; g = Male} ; + mkGN : Str -> Sex -> GN = \s,g -> lin GN {s = \\_ => s; g = g} ; + } ; + + mkSN = overload { -- given name + mkSN : Str -> SN = \s -> lin SN {s = \\_,_ => s; pl = \\_=>s} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Male=>\\_=>male; Female=>\\_=>female}; pl=\\_=>pl} ; + } ; + + mkLN = overload { + mkLN : Str -> LN -- location name + = \s -> lin LN {s = \\_,_ => s; hasArt = False; n = Sg} ; + mkLN : Str -> Number -> LN -- location name + = \s,n -> lin LN {s = \\_,_ => s; hasArt = False; n = n} ; + } ; + + defLN : LN -> LN = \n -> n ** {hasArt = True} ; --2 Adjectives @@ -249,6 +267,10 @@ oper de,utrum = Utr ; nominative = Nom ; genitive = Gen ; + male = Male ; + female = Female ; + singular = Sg ; + plural = Pl ; mkA = overload { mkA : (vers : Str) -> A = \a -> lin A (regAdjective a) ; diff --git a/src/english/CatEng.gf b/src/english/CatEng.gf index 8a9482f3..18c30b0c 100644 --- a/src/english/CatEng.gf +++ b/src/english/CatEng.gf @@ -106,9 +106,11 @@ concrete CatEng of Cat = CommonX - [Pol,CAdv] ** open ResEng, Prelude in { N = {s : Number => Case => Str ; g : Gender} ; N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Str} ; N3 = {s : Number => Case => Str ; g : Gender} ** {c2,c3 : Str} ; - GN, SN, PN = {s : Case => Str ; g : Gender} ; + PN = {s : Case => Str ; g : Gender} ; + GN = {s : Case => Str ; g : Sex} ; + SN = {s : Sex => Case => Str; p : Case => Str} ; LN = {s : Case => Str; - p : Str; -- preposition "in Scandinavia", "on the Balkans" + prep : LNPrep; -- preposition "in Scandinavia", "on the Balkans", "at the South Pole" art : Bool; -- plain name "United States" vs "the United States" n : Number; } ; diff --git a/src/english/DocumentationEng.gf b/src/english/DocumentationEng.gf index 343e0c24..75066bb5 100644 --- a/src/english/DocumentationEng.gf +++ b/src/english/DocumentationEng.gf @@ -50,36 +50,36 @@ lin tr (td (n.s ! Nom) ++ td (n.s ! Gen)) ) ++ heading1 ("Adverb") ++ - paragraph (n.p ++ case n.art of { - True => "the" ++ n.s ! Nom ; - False => n.s ! Nom}) ; + paragraph (case n.prep of { + InPrep => "in" ; + OnPrep => "on" ; + AtPrep => "at" + } ++ + case n.art of { + True => "the" ++ n.s ! Nom ; + False => n.s ! Nom + }) ; } ; - InflectionGN = \pn -> { + InflectionGN = \gn -> { t = "gn" ; s1 = heading1 ("Given Name" ++ - case pn.g of { - Neutr => ""; - Masc => "(masc)"; - Fem => "(fem)" + case gn.g of { + Male => "(male)"; + Female => "(female)" }) ; s2 = frameTable ( tr (th "nom" ++ th "gen") ++ - tr (td (pn.s ! Nom) ++ td (pn.s ! Gen)) + tr (td (gn.s ! Nom) ++ td (gn.s ! Gen)) ) } ; InflectionSN = \pn -> { t = "sn" ; - s1 = heading1 ("Secondary Name" ++ - case pn.g of { - Neutr => ""; - Masc => "(masc)"; - Fem => "(fem)" - }) ; + s1 = heading1 "Secondary Name" ; s2 = frameTable ( tr (th "nom" ++ th "gen") ++ - tr (td (pn.s ! Nom) ++ td (pn.s ! Gen)) + tr (td (pn.s ! Male ! Nom) ++ td (pn.s ! Male ! Gen)) ) } ; diff --git a/src/english/NamesEng.gf b/src/english/NamesEng.gf index fa341f9c..b88a75b2 100644 --- a/src/english/NamesEng.gf +++ b/src/english/NamesEng.gf @@ -1,8 +1,22 @@ concrete NamesEng of Names = CatEng ** open Prelude, ResEng in { -lin GivenName gn = {s = \\c => gn.s ! npcase2case c ; a = agrgP3 Sg gn.g} ; -lin MaleSurname, FemaleSurname = \sn -> {s = \\c => sn.s ! npcase2case c ; a = agrgP3 Sg sn.g} ; -lin FullName gn sn = {s = \\c => gn.s ! Nom ++ sn.s ! npcase2case c ; a = agrgP3 Sg gn.g} ; +lin GivenName gn = { + s = \\c => gn.s ! npcase2case c ; + a = case gn.g of { + Male => agrgP3 Sg Masc ; + Female => agrgP3 Sg Fem + } + } ; +lin MaleSurname = \sn -> {s = \\c => sn.s ! Male ! npcase2case c ; a = agrgP3 Sg Masc} ; +lin FemaleSurname = \sn -> {s = \\c => sn.s ! Female ! npcase2case c ; a = agrgP3 Sg Fem} ; +lin PlSurname = \sn -> {s = \\c => sn.p ! npcase2case c ; a = agrgP3 Pl Masc} ; +lin FullName gn sn = { + s = \\c => gn.s ! Nom ++ sn.s ! gn.g ! npcase2case c ; + a = case gn.g of { + Male => agrgP3 Sg Masc ; + Female => agrgP3 Sg Fem + } + } ; lin UseLN n = { s = \\c => case n.art of { @@ -18,10 +32,15 @@ lin PlainLN n = { } ; lin InLN n = { - s = n.p ++ case n.art of { - True => "the" ++ n.s ! Nom ; - False => n.s ! Nom - } ; + s = case n.prep of { + InPrep => "in" ; + OnPrep => "on" ; + AtPrep => "at" + } ++ + case n.art of { + True => "the" ++ n.s ! Nom ; + False => n.s ! Nom + } ; } ; lin AdjLN ap n = n ** { diff --git a/src/english/ParadigmsEng.gf b/src/english/ParadigmsEng.gf index bf9556c0..36a00e5d 100644 --- a/src/english/ParadigmsEng.gf +++ b/src/english/ParadigmsEng.gf @@ -130,23 +130,6 @@ oper -- Proper names, with a regular genitive, are formed from strings. oper - mkLN = overload { - mkLN : Str -> LN = \s -> - lin LN {s = table {Gen => s + "'s" ; _ => s} ; - p = "in" ; - art = False ; - n = Sg} ; - - mkLN : Str -> Number -> LN = \s,n -> - lin LN {s = table {Gen => s + "'s" ; _ => s} ; - p = "in" ; - art = False ; - n = n} ; - } ; - - defLN : LN -> LN = \n -> n ** {art = True} ; - prepLN : LN -> Str -> LN = \n,s -> n ** {p = s} ; - mkPN : overload { mkPN : Str -> PN ; @@ -157,6 +140,47 @@ oper mkPN : N -> PN --% } ; + mkLN = overload { + mkLN : Str -> LN = \s -> + lin LN {s = table {Gen => s + "'s" ; _ => s} ; + prep = InPrep ; + art = False ; + n = Sg} ; + + mkLN : Str -> Number -> LN = \s,n -> + lin LN {s = table {Gen => s + "'s" ; _ => s} ; + prep = InPrep ; + art = False ; + n = n} ; + } ; + + defLN : LN -> LN = \n -> n ** {art = True} ; + onLN : LN -> LN = \n -> n ** {prep = OnPrep} ; + atLN : LN -> LN = \n -> n ** {prep = AtPrep} ; + + mkGN = overload { + mkGN : Str -> GN = \s -> + lin GN {s = table {Gen => s + "'s" ; _ => s} ; + g = Male} ; + + mkGN : Str -> Sex -> GN = \s,g -> + lin GN {s = table {Gen => s + "'s" ; _ => s} ; + g = g} ; + } ; + + mkSN = overload { + mkSN : Str -> SN = \s -> + lin SN {s = \\_ => table {Gen => s + "'s" ; _ => s} ; + p = table {Gen => s + "'s" ; _ => s}} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> + lin SN {s = table { + Male => table {Gen => male + "'s" ; _ => male} ; + Female => table {Gen => female + "'s" ; _ => female} + } ; + p = table {Gen => pl + "'s" ; _ => pl} + } ; + } ; + -- To extract the number of a noun phrase ifPluralNP : NP -> Bool @@ -397,6 +421,8 @@ mkVoc s = lin Voc (ss s) ; nonhuman = Neutr ; masculine = Masc ; feminine = Fem ; + male = Male ; + female = Female ; singular = Sg ; plural = Pl ; nominative = npNom ; diff --git a/src/english/ResEng.gf b/src/english/ResEng.gf index 1257ca98..440f2251 100644 --- a/src/english/ResEng.gf +++ b/src/english/ResEng.gf @@ -690,4 +690,7 @@ param finalComma : Str = pre {"," | "." => []; "" => SOFT_BIND ++ ","; _ => []} ; frontComma : Str = SOFT_BIND ++ "," ; +param + LNPrep = InPrep | OnPrep | AtPrep ; + } diff --git a/src/estonian/CatEst.gf b/src/estonian/CatEst.gf index 2c49380d..c019747e 100644 --- a/src/estonian/CatEst.gf +++ b/src/estonian/CatEst.gf @@ -91,7 +91,10 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { c2,c3 : Compl ; isPre,isPre2 : Bool } ; - GN, SN, LN, PN = {s : Case => Str} ; + PN = {s : Case => Str} ; + LN = {s : Case => Str; n : Number} ; + GN = {s : Case => Str; g : Sex} ; + SN = {s : Sex => Case => Str; pl : Case => Str} ; linref VP = \vp -> linV vp.v ; diff --git a/src/estonian/DocumentationEstFunctor.gf b/src/estonian/DocumentationEstFunctor.gf index 9441583e..e310ef79 100644 --- a/src/estonian/DocumentationEstFunctor.gf +++ b/src/estonian/DocumentationEstFunctor.gf @@ -36,6 +36,33 @@ lin s2 = inflNoun (caseplus2nf noun) } ; + InflectionPN = \pn -> { + t = "s" ; + s1 = heading1 "Õige Nimi" ; + s2 = inflPN pn.s + } ; + + InflectionLN = \ln -> { + t = "s" ; + s1 = heading1 "Asukoha Nimi" ; + s2 = inflPN ln.s + } ; + + InflectionGN = \gn -> { + t = "s" ; + s1 = heading1 "Eesnimi"++case gn.g of { + Male => "(mees)" ; + Female => "(naine)" + } ; + s2 = inflPN gn.s + } ; + + InflectionSN = \sn -> { + t = "s" ; + s1 = heading1 "Perekonnanimi" ; + s2 = inflPN (sn.s ! Male) + } ; + InflectionA, InflectionA2 = \adj -> let posit : (AForm => Str) = adj.s ! Posit ; compar : (AForm => Str) = adj.s ! Compar ; @@ -272,6 +299,20 @@ oper tr (th (heading instructive_Parameter) ++ td (nouns Sg Terminative) ++ td (nouns Pl Terminative)) ) ; + inflPN : (ResEst.Case => Str) -> Str = \pn -> + frameTable ( + tr (th (heading nominative_Parameter) ++ td (pn ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (pn ! Gen)) ++ + tr (th (heading partitive_Parameter) ++ td (pn ! Part)) ++ + tr (th (heading translative_Parameter) ++ td (pn ! Transl)) ++ + tr (th (heading illative_Parameter) ++ td (pn ! Illat)) ++ + tr (th (heading inessive_Parameter) ++ td (pn ! Iness)) ++ + tr (th (heading elative_Parameter) ++ td (pn ! Elat)) ++ + tr (th (heading allative_Parameter) ++ td (pn ! Allat)) ++ + tr (th (heading adessive_Parameter) ++ td (pn ! Adess)) ++ + tr (th (heading ablative_Parameter) ++ td (pn ! Ablat)) + ) ; + lin NoDefinition t = {s=t.s}; MkDefinition t d = {s="

Definitsioon:"++t.s++d.s++"

"}; diff --git a/src/estonian/NamesEst.gf b/src/estonian/NamesEst.gf index ee2c5371..38eee3e1 100644 --- a/src/estonian/NamesEst.gf +++ b/src/estonian/NamesEst.gf @@ -1,20 +1,44 @@ -concrete NamesEst of Names = CatEst ** open ResEst, Prelude in { +concrete NamesEst of Names = CatEst ** open ResEst, ParadigmsEst, Prelude in { -lin GivenName, MaleSurname, FemaleSurname = \n -> emptyNP ** { +lin GivenName n = emptyNP ** { s = \\c => n.s ! npform2case Sg c ; a = agrP3 Sg ; isPron = False } ; +lin MaleSurname n = emptyNP ** { + s = \\c => n.s ! Male ! npform2case Sg c ; + a = agrP3 Sg ; + isPron = False + } ; +lin FemaleSurname n = emptyNP ** { + s = \\c => n.s ! Female ! npform2case Sg c ; + a = agrP3 Sg ; + isPron = False + } ; +lin PlSurname n = emptyNP ** { + s = \\c => n.pl ! npform2case Sg c ; + a = agrP3 Pl ; + isPron = False + } ; lin FullName gn sn = emptyNP ** { - s = \\c => gn.s ! Nom ++ sn.s ! npform2case Sg c ; + s = \\c => gn.s ! Nom ++ sn.s ! gn.g ! npform2case Sg c ; a = agrP3 Sg ; isPron = False } ; -lin UseLN pn = emptyNP ** { - s = \\c => pn.s ! npform2case Sg c ; +lin UseLN, PlainLN = \ln -> emptyNP ** { + s = \\c => ln.s ! npform2case Sg c ; a = agrP3 Sg ; isPron = False } ; +lin InLN pn = { + s = appCompl True Pos (casePrep inessive) + (emptyNP ** { + s = \\c => pn.s ! npform2case Sg c ; + a = agrP3 Sg ; + isPron = False + }) + } ; + } diff --git a/src/estonian/ParadigmsEst.gf b/src/estonian/ParadigmsEst.gf index 6d0b7620..0e8723f4 100644 --- a/src/estonian/ParadigmsEst.gf +++ b/src/estonian/ParadigmsEst.gf @@ -42,6 +42,9 @@ resource ParadigmsEst = open -- defined in $ResEst$. oper + male = Male ; + female = Female ; + Number : Type ; singular : Number ; @@ -610,6 +613,55 @@ oper mkPN_1 : Str -> PN = \s -> lin PN {s = \\c => (mk1N s).s ! NCase Sg c} ; + mkLN = overload { + mkLN : Str -> LN = + \s -> lin LN {s = \\c => (mk1N s).s ! NCase Sg c ; + n = Sg} ; + mkLN : Str -> Number -> LN = + \s,n -> lin LN {s = \\c => (mk1N s).s ! NCase n c ; + n = n} ; + mkLN : N -> LN = + \noun -> lin LN {s = \\c => noun.s ! NCase Sg c ; + n = Sg} ; + mkLN : N -> Number -> LN = + \noun,n -> lin LN {s = \\c => noun.s ! NCase n c ; + n = n} ; + } ; + + mkGN = overload { + mkGN : Str -> GN = + \s -> lin GN {s = \\c => (mk1N s).s ! NCase Sg c ; + g = Male} ; + mkGN : Str -> Sex -> GN = + \s,g -> lin GN {s = \\c => (mk1N s).s ! NCase Sg c ; + g = g} ; + mkGN : N -> GN = + \noun -> lin GN {s = \\c => noun.s ! NCase Sg c ; + g = Male} ; + mkGN : N -> Sex -> GN = + \noun,g -> lin GN {s = \\c => noun.s ! NCase Sg c ; + g = g} ; + } ; + + mkSN = overload { + mkSN : Str -> SN = + \s -> lin SN {s = \\_,c => (mk1N s).s ! NCase Sg c ; + pl = \\c => (mk1N s).s ! NCase Sg c} ; + mkSN : Str -> Str -> Str -> SN = + \male,female,pl -> lin SN {s = table {Male =>\\c => (mk1N male).s ! NCase Sg c ; + Female=>\\c => (mk1N female).s ! NCase Sg c} ; + pl = \\c => (mk1N pl).s ! NCase Sg c} ; + mkSN : N -> SN = + \noun -> lin SN {s = \\_,c => noun.s ! NCase Sg c ; + pl = \\c => noun.s ! NCase Sg c} ; + mkSN : N -> N -> N -> SN = + \male,female,pl -> lin SN {s = table {Male =>\\c => male.s ! NCase Sg c ; + Female=>\\c => female.s ! NCase Sg c} ; + pl = \\c => pl.s ! NCase Sg c} ; + } ; + + prepLN : LN -> Prep -> LN = \n,s -> n ** {c = s} ; + -- adjectives mkA = overload { diff --git a/src/finnish/CatFin.gf b/src/finnish/CatFin.gf index 14778ba6..49f5ca19 100644 --- a/src/finnish/CatFin.gf +++ b/src/finnish/CatFin.gf @@ -95,7 +95,10 @@ concrete CatFin of Cat = CommonX ** open ResFin, StemFin, Prelude in { N = SNoun ; N2 = SNoun ** {c2 : Compl ; isPre : Bool ; postmod : Number => Str} ; N3 = SNoun ** {c2,c3 : Compl ; isPre,isPre2 : Bool} ; - GN, SN, LN, PN = SPN ; + PN = SPN ; + LN = SPN ** {n : Number} ; + GN = SPN ** {g : Sex} ; + SN = {s : Sex => SPN; pl : SPN} ; linref SSlash = \ss -> ss.s ++ ss.c2.s.p1 ; diff --git a/src/finnish/DocumentationFinFunctor.gf b/src/finnish/DocumentationFinFunctor.gf index 65a041fe..05a8f85c 100644 --- a/src/finnish/DocumentationFinFunctor.gf +++ b/src/finnish/DocumentationFinFunctor.gf @@ -33,26 +33,29 @@ lin InflectionPN = \pn -> { t = "s" ; - s1 = heading1 (heading noun_Category) ; + s1 = heading1 "Oikea Nimi" ; s2 = inflPN (\c -> pn.s ! c) } ; - InflectionLN = \pn -> { + InflectionLN ln = { t = "s" ; - s1 = heading1 (heading noun_Category) ; - s2 = inflPN (\c -> pn.s ! c) + s1 = heading1 "Paikannimi" ; + s2 = inflPN (\c -> ln.s ! c) } ; - InflectionGN = \pn -> { + InflectionGN gn = { t = "s" ; - s1 = heading1 "Etunimi" ; - s2 = inflPN (\c -> pn.s ! c) + s1 = heading1 "Etunimi"++case gn.g of { + Male => "(mies)" ; + Female => "(nainen)" + } ; + s2 = inflPN (\c -> gn.s ! c) } ; - InflectionSN = \pn -> { + InflectionSN sn = { t = "s" ; s1 = heading1 "Sukunimi" ; - s2 = inflPN (\c -> pn.s ! c) + s2 = inflPN (\c -> (sn.s ! Male).s ! c) } ; InflectionA, InflectionA2 = \adj -> { diff --git a/src/finnish/NamesFin.gf b/src/finnish/NamesFin.gf index 4039dc02..8ecbf92f 100644 --- a/src/finnish/NamesFin.gf +++ b/src/finnish/NamesFin.gf @@ -1,20 +1,43 @@ concrete NamesFin of Names = CatFin ** open ResFin, StemFin, Prelude in { -lin GivenName, MaleSurname, FemaleSurname = \n -> { +lin GivenName n = { s = snoun2np Sg n ; a = agrP3 Sg ; isPron = False ; isNeg = False } ; +lin MaleSurname n = { + s = snoun2np Sg (n.s ! Male) ; + a = agrP3 Sg ; + isPron = False ; isNeg = False + } ; +lin FemaleSurname n = { + s = snoun2np Sg (n.s ! Female) ; + a = agrP3 Sg ; + isPron = False ; isNeg = False + } ; +lin PlSurname n = { + s = snoun2np Pl n.pl ; + a = agrP3 Pl ; + isPron = False ; isNeg = False + } ; lin FullName gn sn = { - s = snoun2np Sg {s = \\c => gn.s ! Nom ++ sn.s ! c} ; + s = snoun2np Sg {s = \\c => gn.s ! Nom ++ (sn.s ! gn.g).s ! c} ; a = agrP3 Sg ; isPron = False ; isNeg = False } ; -lin UseLN pn = { - s = snoun2np Sg pn ; - a = agrP3 Sg ; +lin UseLN, PlainLN = \ln -> { + s = snoun2np ln.n ln ; + a = agrP3 ln.n ; isPron = False ; isNeg = False } ; +lin InLP ln = { + s = appCompl True Pos ln.c { s = snoun2np ln.n ln ; + a = agrP3 ln.n ; + isPron = False ; + isNeg = False + } + } ; + } diff --git a/src/finnish/ParadigmsFin.gf b/src/finnish/ParadigmsFin.gf index 53e921da..c6eca84e 100644 --- a/src/finnish/ParadigmsFin.gf +++ b/src/finnish/ParadigmsFin.gf @@ -422,6 +422,9 @@ mkVS = overload { Case = MorphoFin.Case ; Number = MorphoFin.Number ; + male = Male ; + female = Female ; + singular = Sg ; plural = Pl ; @@ -841,6 +844,36 @@ mkVS = overload { } } ; + mkLN = overload { + mkLN : Str -> LN = \s -> lin LN (snoun2spn (mk1N s) ** {n = Sg}) ; + mkLN : Str -> Number -> LN = \s,n -> lin LN (snoun2spn (mk1N s) ** {n = n}) ; + mkLN : N -> LN = \noun -> lin LN (snoun2spn noun ** {n = Sg}) ; + mkLN : N -> Number -> LN = \noun,n -> lin LN (snoun2spn noun ** {n = n}) ; + } ; + + mkGN = overload { + mkGN : Str -> GN = \s -> lin GN (snoun2spn (mk1N s) ** {g = Male}) ; + mkGN : Str -> Sex -> GN = \s,g -> lin GN (snoun2spn (mk1N s) ** {g = g}) ; + mkGN : N -> GN = \noun -> lin GN (snoun2spn noun ** {g = Male}) ; + mkGN : N -> Sex -> GN = \noun,g -> lin GN (snoun2spn noun ** {g = g}) ; + } ; + + mkSN = overload { + mkSN : Str -> SN = \s -> let spn = snoun2spn (mk1N s) in lin SN {s = \\_=>spn; pl=spn} ; + mkSN : Str -> Str -> Str -> SN + = \male,female,pl -> lin SN { + s = table {Male =>snoun2spn (mk1N male); + Female=>snoun2spn (mk1N female)}; + pl= snoun2spn (mk1N pl) + } ; + mkSN : N -> SN = \noun -> let spn = snoun2spn noun in lin SN {s = \\_=>spn; pl=spn} ; + mkSN : N -> N -> N -> SN + = \male,female,pl -> lin SN { + s = table {Male =>snoun2spn male; + Female=>snoun2spn female}; + pl= snoun2spn pl + } ; + } ; -- adjectives diff --git a/src/french/DocumentationFreFunctor.gf b/src/french/DocumentationFreFunctor.gf index 8dd61dcc..5a90f25e 100644 --- a/src/french/DocumentationFreFunctor.gf +++ b/src/french/DocumentationFreFunctor.gf @@ -40,6 +40,52 @@ lin ) } ; + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 ("Nom Propre" ++ + case pn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = pn.s + } ; + + InflectionGN = \gn -> { + t = "pn" ; + s1 = heading1 ("Prénom" ++ + case gn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = gn.s + } ; + + InflectionSN = \gn -> { + t = "pn" ; + s1 = heading1 "Nom de Famille" ; + s2 = gn.s ! Masc + } ; + + InflectionLN = \ln -> { + t = "nl" ; + s1 = heading1 ("Nom de la Localisation" ++ + case ln.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = paragraph ln.s ++ + heading2 "Adverbe" ++ + paragraph (let p : {s : Str; c:Prepos} = + case ln.onPrep of { + True => {s="en"; c=PNul} ; + False => {s=""; c=P_a} + } + in p.s ++ case ln.art of { + AlwaysArt => artDef True ln.g ln.num (CPrep p.c) ++ ln.s; + _ => prepCase (CPrep p.c) ++ ln.s + }) + } ; + InflectionA, InflectionA2 = \adj -> { t = "a" ; s1 = heading1 (nounHeading adjective_Category).s ; diff --git a/src/french/NamesFre.gf b/src/french/NamesFre.gf index b7415da8..77637c84 100644 --- a/src/french/NamesFre.gf +++ b/src/french/NamesFre.gf @@ -1,8 +1,14 @@ concrete NamesFre of Names = CatFre ** open Prelude, ResFre, CommonRomance, PhonoFre in { -lin GivenName, MaleSurname, FemaleSurname = \n -> pn2np n ; +lin GivenName = \n -> pn2np n ; +lin MaleSurname = \n -> pn2np {s = n.s ! Masc; g = Masc} ; +lin FemaleSurname = \n -> pn2np {s = n.s ! Fem; g = Fem} ; +lin PlSurname = \n -> heavyNPpol False { + s = \\c => prepCase c ++ n.pl ; + a = agrP3 Masc Pl + } ; lin FullName gn sn = pn2np { - s = gn.s ++ sn.s ; + s = gn.s ++ sn.s ! gn.g ; g = gn.g } ; @@ -21,10 +27,15 @@ lin UseLN n = heavyNP { lin InLN n = { - s = n.p.s ++ case n.art of { - AlwaysArt => artDef True n.g n.num n.p.c ++ n.s; - _ => prepCase n.p.c ++ n.s - } ; + s = let p : {s : Str; c:Prepos} = + case n.onPrep of { + True => {s="en"; c=PNul} ; + False => {s=""; c=P_a} + } + in p.s ++ case n.art of { + AlwaysArt => artDef True n.g n.num (CPrep p.c) ++ n.s; + _ => prepCase (CPrep p.c) ++ n.s + } ; } ; diff --git a/src/french/ParadigmsFre.gf b/src/french/ParadigmsFre.gf index 83a7fff2..fa11d608 100644 --- a/src/french/ParadigmsFre.gf +++ b/src/french/ParadigmsFre.gf @@ -132,17 +132,38 @@ oper -- Proper names need a string and a gender. If no gender is given, the -- feminine is used for strings ending with "e", the masculine for other strings. + mkPN : overload { + mkPN : Str -> PN ; -- feminine if ends with "e", otherwise masculine + mkPN : Str -> Gender -> PN ; -- gender deviant from the simple rule + mkPN : N -> PN ; -- gender inherited from noun + } ; + + mkGN = overload { + mkGN : (Anna : Str) -> GN = \s -> lin GN (regPN s) ; -- feminine for "-a", otherwise masculine + mkGN : (Pilar : Str) -> Gender -> GN = \s,g -> lin GN (mk2PN s g) ; -- force gender + } ; + + mkSN = overload { + mkSN : Str -> SN = \s -> lin SN {s = \\_ => s; pl = s} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Masc=>male; Fem=>female}; pl = pl} ; + } ; + mkLN = overload { + mkLN : Str -> LN = \s -> + lin LN {s = s ; + onPrep=False ; + art = NoArt ; + g = Masc ; + num = Sg} ; mkLN : Str -> Gender -> LN = \s,g -> lin LN {s = s ; - p = {s=""; c=CPrep P_a; isDir=True} ; + onPrep=False ; art = NoArt ; g = g ; num = Sg} ; - mkLN : Str -> Gender -> Number -> LN = \s,g,num -> lin LN {s = s ; - p = {s=""; c=CPrep P_a; isDir=True} ; + onPrep=False ; art = NoArt ; g = g ; num = num} ; @@ -151,14 +172,7 @@ oper defLN : LN -> LN = \n -> n ** {art = AlwaysArt} ; useDefLN : LN -> LN = \n -> n ** {art = UseArt} ; - prepLN : LN -> Prep -> LN = \n,p -> n ** {p = p} ; - - mkPN : overload { - mkPN : Str -> PN ; -- feminine if ends with "e", otherwise masculine - mkPN : Str -> Gender -> PN ; -- gender deviant from the simple rule - mkPN : N -> PN ; -- gender inherited from noun - } ; - + enLN : LN -> LN = \n -> n ** {onPrep = True} ; --2 Adjectives @@ -355,8 +369,10 @@ oper Gender = MorphoFre.Gender ; Number = MorphoFre.Number ; - masculine = Masc ; - feminine = Fem ; + masculine, male = Masc ; + feminine, female = Fem ; + male = Masc ; + female = Fem ; singular = Sg ; plural = Pl ; diff --git a/src/german/CatGer.gf b/src/german/CatGer.gf index 8130ea6f..9b7d8550 100644 --- a/src/german/CatGer.gf +++ b/src/german/CatGer.gf @@ -102,7 +102,8 @@ concrete CatGer of Cat = N3 = ResGer.Noun ** {c2,c3 : Preposition} ; GN = {s : Case => Str; g : Sex} ; SN = {s : Sex => Case => Str} ; - LN, PN = {s : Case => Str; g : Gender; n : Number} ; + PN = {s : Case => Str; g : Gender; n : Number} ; + LN = {s : Adjf => Case => Str; hasArt : Bool; g : Gender; n : Number} ; -- tense with possibility to choose conjunctive forms diff --git a/src/german/DocumentationGerFunctor.gf b/src/german/DocumentationGerFunctor.gf index eedea374..bfa43c3f 100644 --- a/src/german/DocumentationGerFunctor.gf +++ b/src/german/DocumentationGerFunctor.gf @@ -40,6 +40,66 @@ lin ) } ; + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 ("Eigenname" ++ + "("+case of { + => heading masculine_Parameter ; + => heading feminine_Parameter ; + => heading neuter_Parameter ; + <_,Pl> => heading plural_Parameter + } ++")") ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (pn.s ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (pn.s ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (pn.s ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (pn.s ! Acc)) + ) + } ; + + InflectionGN = \gn -> { + t = "vn" ; + s1 = heading1 ("Vorname" ++ + case gn.g of { + Male => "(männlich)" ; + Female => "(weiblich)" + }) ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (gn.s ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (gn.s ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (gn.s ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (gn.s ! Acc)) + ) ; + } ; + + InflectionSN = \sn -> { + t = "fn" ; + s1 = heading1 ("Familienname") ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (sn.s ! Male ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (sn.s ! Male ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (sn.s ! Male ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (sn.s ! Male ! Acc)) + ) ; + } ; + + InflectionLN = \ln -> { + t = "pn" ; + s1 = heading1 ("Standortnamen" ++ + "("+case of { + => heading masculine_Parameter ; + => heading feminine_Parameter ; + => heading neuter_Parameter ; + <_,Pl> => heading plural_Parameter + } ++")") ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (ln.s ! Strong ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (ln.s ! Strong ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (ln.s ! Strong ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (ln.s ! Strong ! Acc)) + ) + } ; + InflectionA, InflectionA2 = \adj -> let gforms : Degree -> ResGer.Case -> Str = \d,c -> diff --git a/src/german/NamesGer.gf b/src/german/NamesGer.gf index 978b99ca..7f3c8efa 100644 --- a/src/german/NamesGer.gf +++ b/src/german/NamesGer.gf @@ -1,4 +1,4 @@ -concrete NamesGer of Names = CatGer ** open ResGer in { +concrete NamesGer of Names = CatGer ** open ResGer, Prelude in { lin GivenName gn = { s = \\c => usePrepC c (\k -> gn.s ! k) ; @@ -31,15 +31,40 @@ lin PlSurname sn = { lin FullName gn sn = { s = \\c => usePrepC c (\k -> gn.s ! Nom ++ sn.s ! gn.g ! k) ; a = agrgP3 (sex2gender gn.g) Sg ; + w = WLight ; + rc, ext = [] + } ; + +lin UseLN ln = { + 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 ; rc, ext = [] } ; -lin UseLN pn = { - s = \\c => usePrepC c (\k -> pn.s ! k) ; - a = agrgP3 pn.g pn.n ; +lin PlainLN ln = { + s = \\c => usePrepC c (\k -> ln.s ! adjfCase Strong k ! k) ; + a = agrgP3 ln.g ln.n ; w = WLight ; rc, ext = [] } ; +lin InLN ln = { + 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) + } ; + } ; + +lin AdjLN ap ln = ln ** { + 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) ; + } ; + } diff --git a/src/german/ParadigmsGer.gf b/src/german/ParadigmsGer.gf index 65a87d85..17eaae58 100644 --- a/src/german/ParadigmsGer.gf +++ b/src/german/ParadigmsGer.gf @@ -165,6 +165,32 @@ mkN : overload { mkSN : (nom,acc,dat,gen : Str) -> GN ; -- name with all case forms } ; + mkLN = overload { + mkLN : Str -> LN = \s -> regLN s Masc ; -- regular name with genitive in "s", masculine + mkLN : Str -> Number -> LN = \s,n -> regLN s Masc ** {n=n} ; -- regular name with genitive in "s", masculine + mkLN : Str -> Gender -> LN = regLN ; -- regular name with genitive in "s" + +-- If only the genitive differs, two strings are needed. + + mkLN : (nom,gen : Str) -> Gender -> LN = mk2LN ; -- name with other genitive + +-- In the worst case, all four forms are needed. + + mkLN : (nom,acc,dat,gen : Str) -> Gender -> LN = \nom,acc,dat,gen,g -> + lin LN {s = \\a => table {Nom => nom ; Acc => acc ; Dat => dat ; Gen => gen} ; + g = g ; n = Sg ; + hasArt = False} + + } ; + + defLN : LN -> LN = \n -> n ** {hasArt = True} ; + + mk2LN : (karolus, karoli : Str) -> Gender -> LN = \karolus, karoli, g -> + lin LN {s = \\a => table {Gen => karoli ; _ => karolus} ; g = g ; n = Sg ; + hasArt = False} ; + regLN : (horst : Str) -> Gender -> LN = \horst, g -> + mk2LN horst (ifTok Tok (Predef.dp 1 horst) "s" horst (horst + "s")) g ; + -- To extract the number of a noun phrase ifPluralNP : NP -> Bool diff --git a/src/german/ResGer.gf b/src/german/ResGer.gf index 47eea586..34cb3ccc 100644 --- a/src/german/ResGer.gf +++ b/src/german/ResGer.gf @@ -25,7 +25,6 @@ resource ResGer = ParamX ** open Prelude in { param Case = Nom | Acc | Dat | Gen ; Gender = Masc | Fem | Neutr ; - Sex = Male | Female ; -- Complex $CN$s, like adjectives, have strong and weak forms. diff --git a/src/italian/DocumentationItaFunctor.gf b/src/italian/DocumentationItaFunctor.gf index 89afd907..b8c5ce01 100644 --- a/src/italian/DocumentationItaFunctor.gf +++ b/src/italian/DocumentationItaFunctor.gf @@ -40,6 +40,42 @@ lin ) } ; + InflectionGN = \gn -> { + t = "pn" ; + s1 = heading1 ("Prenome" ++ + case gn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = gn.s + } ; + + InflectionSN = \gn -> { + t = "pn" ; + s1 = heading1 "Cognome" ; + s2 = gn.s ! Masc + } ; + + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 ("Nome Proprio" ++ + case pn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = pn.s + } ; + + InflectionLN = \ln -> { + t = "nl" ; + s1 = heading1 ("Nom del Luogo" ++ + case ln.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = paragraph ln.s + } ; + InflectionA, InflectionA2 = \adj -> { t = "a" ; s1 = heading1 (nounHeading adjective_Category).s ; diff --git a/src/italian/NamesIta.gf b/src/italian/NamesIta.gf index 9dde301b..8cb83371 100644 --- a/src/italian/NamesIta.gf +++ b/src/italian/NamesIta.gf @@ -1,9 +1,58 @@ -concrete NamesIta of Names = CatIta ** open ResIta in { +concrete NamesIta of Names = CatIta ** open ResIta, CommonRomance, Prelude in { -lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> pn2np n ; +lin GivenName = \n -> pn2np n ; +lin MaleSurname = \n -> pn2np {s = n.s ! Masc; g = Masc} ; +lin FemaleSurname = \n -> pn2np {s = n.s ! Fem; g = Fem} ; +lin PlSurname = \n -> heavyNPpol False { + s = \\c => prepCase c ++ n.pl ; + a = agrP3 Masc Pl + } ; lin FullName gn sn = pn2np { - s = gn.s ++ sn.s ; + s = gn.s ++ sn.s ! gn.g ; g = gn.g } ; +lin PlainLN n = heavyNP { + s = \\c => n.s; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin UseLN n = heavyNP { + s = \\c => case n.art of { + UseArt => case n.g of { + Fem => case n.num of { + Sg => "la" ++ n.s; + Pl => "las" ++ n.s} ; + Masc => case n.num of { + Sg => "el" ++ n.s; + Pl => "los" ++ n.s + } + } ; + NoArt => n.s + } ; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin InLN n = { + s = case n.art of { + UseArt => case n.g of { + Fem => case n.num of { + Sg => "la" ++ n.s; + Pl => "las" ++ n.s} ; + Masc => case n.num of { + Sg => "el" ++ n.s; + Pl => "los" ++ n.s + } + } ; + NoArt => n.s + } ; + } ; + + +lin AdjLN ap n = n ** { + s = preOrPost ap.isPre (ap.s ! AF n.g n.num) n.s ; + } ; + } diff --git a/src/italian/ParadigmsIta.gf b/src/italian/ParadigmsIta.gf index bfd39385..2454bf15 100644 --- a/src/italian/ParadigmsIta.gf +++ b/src/italian/ParadigmsIta.gf @@ -145,13 +145,38 @@ oper mkPN : N -> PN ; -- get gender from noun } ; - mkLN : Str -> LN = \s -> - lin LN {s = s ; - p = {s=""; c=CPrep P_a; isDir=True} ; - art = NoArt ; - g = Masc ; - num = Sg} ; + mkGN = overload { + mkGN : (Anna : Str) -> GN = \s -> lin GN (regPN s) ; -- feminine for "-a", otherwise masculine + mkGN : (Pilar : Str) -> Gender -> GN = \s,g -> lin GN (mk2PN s g) ; -- force gender + } ; + mkSN = overload { + mkSN : Str -> SN = \s -> lin SN {s = \\_ => s; pl = s} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Masc=>male; Fem=>female}; pl = pl} ; + } ; + + mkLN = overload { + mkLN : Str -> LN = \s -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = Masc ; + num = Sg} ; + mkLN : Str -> Gender -> LN = \s,g -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = g ; + num = Sg} ; + mkLN : Str -> Gender -> Number -> LN = \s,g,n -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = g ; + num = n} + } ; + + defLN : LN -> LN = \n -> n ** {art = UseArt} ; --2 Adjectives @@ -333,8 +358,8 @@ oper Gender = MorphoIta.Gender ; Number = MorphoIta.Number ; - masculine = Masc ; - feminine = Fem ; + masculine, male = Masc ; + feminine, female = Fem ; singular = Sg ; plural = Pl ; diff --git a/src/norwegian/DiffNor.gf b/src/norwegian/DiffNor.gf index e3f7b771..0c807c6a 100644 --- a/src/norwegian/DiffNor.gf +++ b/src/norwegian/DiffNor.gf @@ -10,10 +10,9 @@ instance DiffNor of DiffScand = open CommonScand, Prelude in { param NGenderNor = NUtr Sex | NNeutr ; - Sex = Masc | Fem ; oper - utrum = NUtr Masc ; + utrum = NUtr Male ; neutrum = NNeutr ; detDef : Species = Def ; diff --git a/src/norwegian/MorphoNor.gf b/src/norwegian/MorphoNor.gf index 061ebe47..1a521c4a 100644 --- a/src/norwegian/MorphoNor.gf +++ b/src/norwegian/MorphoNor.gf @@ -14,8 +14,8 @@ resource MorphoNor = CommonScand, ResNor ** open Prelude, Predef in { -- genders oper - masc = NUtr Masc ; - fem = NUtr Fem ; + masc = NUtr Male ; + fem = NUtr Female ; neutr = NNeutr ; -- type synonyms diff --git a/src/norwegian/ParadigmsNor.gf b/src/norwegian/ParadigmsNor.gf index 53244829..a3dc7de9 100644 --- a/src/norwegian/ParadigmsNor.gf +++ b/src/norwegian/ParadigmsNor.gf @@ -279,8 +279,8 @@ oper Gender = MorphoNor.NGender ; Number = MorphoNor.Number ; Case = MorphoNor.Case ; - masculine = NUtr Masc ; - feminine = NUtr Fem ; + masculine = NUtr Male ; + feminine = NUtr Female ; neutrum = NNeutr ; utrum = masculine ; singular = Sg ; diff --git a/src/nynorsk/DiffNno.gf b/src/nynorsk/DiffNno.gf index 868a2bff..f0adcc0b 100644 --- a/src/nynorsk/DiffNno.gf +++ b/src/nynorsk/DiffNno.gf @@ -10,10 +10,9 @@ instance DiffNno of DiffScand = open CommonScand, Prelude in { param NGenderNno = NUtr Sex | NNeutr ; - Sex = Masc | Fem ; oper - utrum = NUtr Masc ; + utrum = NUtr Male ; neutrum = NNeutr ; detDef : Species = Def ; diff --git a/src/nynorsk/MorphoNno.gf b/src/nynorsk/MorphoNno.gf index d38761e7..2b59c14c 100644 --- a/src/nynorsk/MorphoNno.gf +++ b/src/nynorsk/MorphoNno.gf @@ -14,8 +14,8 @@ resource MorphoNno = CommonScand, ResNno ** open Prelude, Predef in { -- genders oper - masc = NUtr Masc ; - fem = NUtr Fem ; + masc = NUtr Male ; + fem = NUtr Female ; neutr = NNeutr ; -- type synonyms diff --git a/src/nynorsk/ParadigmsNno.gf b/src/nynorsk/ParadigmsNno.gf index f94046b4..14507490 100644 --- a/src/nynorsk/ParadigmsNno.gf +++ b/src/nynorsk/ParadigmsNno.gf @@ -276,8 +276,8 @@ oper Gender = MorphoNno.NGender ; Number = MorphoNno.Number ; Case = MorphoNno.Case ; - masculine = NUtr Masc ; - feminine = NUtr Fem ; + masculine = NUtr Male ; + feminine = NUtr Female ; neutrum = NNeutr ; singular = Sg ; plural = Pl ; diff --git a/src/portuguese/DocumentationPorFunctor.gf b/src/portuguese/DocumentationPorFunctor.gf index d4912ef5..23291679 100644 --- a/src/portuguese/DocumentationPorFunctor.gf +++ b/src/portuguese/DocumentationPorFunctor.gf @@ -40,6 +40,42 @@ lin ) } ; + InflectionGN = \gn -> { + t = "pn" ; + s1 = heading1 ("Prenome" ++ + case gn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = gn.s + } ; + + InflectionSN = \gn -> { + t = "pn" ; + s1 = heading1 "Sobrenome" ; + s2 = gn.s ! Masc + } ; + + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 ("Nome Próprio" ++ + case pn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = pn.s + } ; + + InflectionLN = \ln -> { + t = "nl" ; + s1 = heading1 ("Nom do Local" ++ + case ln.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = paragraph ln.s + } ; + InflectionA, InflectionA2 = \adj -> { t = "a" ; s1 = heading1 (nounHeading adjective_Category).s ; diff --git a/src/portuguese/NamesPor.gf b/src/portuguese/NamesPor.gf index 1d185325..b3ccdfc3 100644 --- a/src/portuguese/NamesPor.gf +++ b/src/portuguese/NamesPor.gf @@ -1,9 +1,58 @@ -concrete NamesPor of Names = CatPor ** open ResPor in { +concrete NamesPor of Names = CatPor ** open ResPor, CommonRomance, Prelude in { -lin GivenName, MaleSurname, FemaleSurname = \n -> pn2np n ; +lin GivenName = \n -> pn2np n ; +lin MaleSurname = \n -> pn2np {s = n.s ! Masc; g = Masc} ; +lin FemaleSurname = \n -> pn2np {s = n.s ! Fem; g = Fem} ; +lin PlSurname = \n -> heavyNPpol False { + s = \\c => prepCase c ++ n.pl ; + a = agrP3 Masc Pl + } ; lin FullName gn sn = pn2np { - s = gn.s ++ sn.s ; + s = gn.s ++ sn.s ! gn.g ; g = gn.g } ; +lin PlainLN n = heavyNP { + s = \\c => n.s; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin UseLN n = heavyNP { + s = \\c => case n.art of { + UseArt => case n.g of { + Fem => case n.num of { + Sg => "la" ++ n.s; + Pl => "las" ++ n.s} ; + Masc => case n.num of { + Sg => "el" ++ n.s; + Pl => "los" ++ n.s + } + } ; + NoArt => n.s + } ; + a = {g = n.g ; n = n.num ; p = P3} + } ; + + +lin InLN n = { + s = case n.art of { + UseArt => case n.g of { + Fem => case n.num of { + Sg => "la" ++ n.s; + Pl => "las" ++ n.s} ; + Masc => case n.num of { + Sg => "el" ++ n.s; + Pl => "los" ++ n.s + } + } ; + NoArt => n.s + } ; + } ; + + +lin AdjLN ap n = n ** { + s = preOrPost ap.isPre (ap.s ! AF n.g n.num) n.s ; + } ; + } diff --git a/src/portuguese/ParadigmsPor.gf b/src/portuguese/ParadigmsPor.gf index f183220d..f59bc66b 100644 --- a/src/portuguese/ParadigmsPor.gf +++ b/src/portuguese/ParadigmsPor.gf @@ -49,11 +49,11 @@ oper Gender : Type ; Gender = MorphoPor.Gender ; - masculine : Gender ; - masculine = Masc ; + masculine, male : Gender ; + masculine, male = Masc ; - feminine : Gender ; - feminine = Fem ; + feminine, female : Gender ; + feminine, female = Fem ; -- To abstract over number names, we define the following. @@ -206,12 +206,39 @@ oper = \n -> lin PN {s = n.s ! Sg ; g = n.g} ; } ; - mkLN : Str -> LN = \s -> - lin LN {s = s ; - p = {s=""; c=CPrep P_a; isDir=True} ; - art = NoArt ; - g = Masc ; - num = Sg} ; + mkGN = overload { + mkGN : (Anna : Str) -> GN = \s -> lin GN (regPN s) ; -- feminine for "-a", otherwise masculine + mkGN : (Pilar : Str) -> Gender -> GN = \s,g -> lin GN (mk2PN s g) ; -- force gender + } ; + + mkSN = overload { + mkSN : Str -> SN = \s -> lin SN {s = \\_ => s; pl = s} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Masc=>male; Fem=>female}; pl = pl} ; + } ; + + mkLN = overload { + mkLN : Str -> LN = \s -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = Masc ; + num = Sg} ; + mkLN : Str -> Gender -> LN = \s,g -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = g ; + num = Sg} ; + + mkLN : Str -> Gender -> Number -> LN = \s,g,num -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = g ; + num = num} ; + } ; + + defLN : LN -> LN = \n -> n ** {art = UseArt} ; --2 Adjectives compADeg : Adj -> A ; --% diff --git a/src/romance/CatRomance.gf b/src/romance/CatRomance.gf index 06cd7d87..e6932e44 100644 --- a/src/romance/CatRomance.gf +++ b/src/romance/CatRomance.gf @@ -110,14 +110,14 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol] N = Noun ; N2 = Noun ** {c2 : Compl} ; N3 = Noun ** {c2,c3 : Compl} ; - GN, SN, PN = {s : Str ; g : Gender} ; - - lincat LN = {s : Str; - p : Compl; - art : HasArt; - g : Gender; - num : Number; - } ; + GN, PN = {s : Str ; g : Gender} ; + SN = {s : Gender => Str ; pl : Str} ; + LN = {s : Str; + onPrep : Bool; + art : HasArt; + g : Gender; + num : Number; + } ; -- tense augmented with passé simple lincat diff --git a/src/russian/CatRus.gf b/src/russian/CatRus.gf index b96f6cc8..dd028baa 100644 --- a/src/russian/CatRus.gf +++ b/src/russian/CatRus.gf @@ -1,7 +1,21 @@ concrete CatRus of Cat = CommonX ** open ResRus, Prelude in { flags coding=utf8 ; optimize=all ; lincat - N, GN, SN, LN, PN = ResRus.NounForms ; + N, PN = ResRus.NounForms ; + GN = { + s : Case => Str ; + g : Sex ; + } ; + SN = { + s : Sex => Case => Str ; + p : Case => Str ; + } ; + LN = { + s : Case => Str ; + g : Gender ; + n : Number ; + anim : Animacy + } ; N2 = ResRus.Noun2Forms ; N3 = ResRus.Noun3Forms ; @@ -105,7 +119,7 @@ lincat linref N = \s -> s.snom ; PN = \s -> s.snom ; - LN = \s -> s.snom ; + LN = \s -> s.s ! Nom ; Pron = \s -> s.nom ; N2 = \s -> s.snom ++ s.c2.s ; N3 = \s -> s.snom ++ s.c2.s ++ s.c3.s ; diff --git a/src/russian/DocumentationRusFunctor.gf b/src/russian/DocumentationRusFunctor.gf index 694c69ee..20a4272b 100644 --- a/src/russian/DocumentationRusFunctor.gf +++ b/src/russian/DocumentationRusFunctor.gf @@ -26,13 +26,79 @@ oper lin InflectionN, InflectionN2, InflectionN3 = \noun -> { - t = "s" ; + t = "сущ." ; s1 = heading1 (heading noun_Category) ; s2 = inflNoun noun } ; + InflectionPN = \pn -> { + t = "сущ.с." ; + s1 = heading1 "Существительное Собственное" ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (pn.snom)) ++ + tr (th (heading genitive_Parameter) ++ td (pn.sgen)) ++ + tr (th (heading dative_Parameter) ++ td (pn.sdat)) ++ + tr (th (heading accusative_Parameter) ++ td (pn.sacc)) ++ + tr (th ("творительный") ++ td (pn.sins)) ++ + tr (th ("предложный") ++ td (pn.sprep)) ++ + tr (th (heading partitive_Parameter) ++ td (pn.sptv)) ++ + tr (th ("местный") ++ td (pn.sloc)) ++ + tr (th ("звательный") ++ td (pn.svoc)) + ) ; + } ; + + InflectionGN = \gn -> { + t = "сущ.с." ; + s1 = heading1 "Личное Имя" ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (gn.s ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (gn.s ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (gn.s ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (gn.s ! Acc)) ++ + tr (th ("творительный") ++ td (gn.s ! Ins)) ++ + tr (th ("предложный") ++ td (gn.s ! Pre)) ++ + tr (th (heading partitive_Parameter) ++ td (gn.s ! Ptv)) ++ + tr (th ("местный") ++ td (gn.s ! Loc)) ++ + tr (th ("звательный") ++ td (gn.s ! VocRus)) + ) + } ; + + InflectionSN = \sn -> { + t = "сущ.с." ; + s1 = heading1 "Фамилия" ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (sn.s ! Male ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (sn.s ! Male ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (sn.s ! Male ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (sn.s ! Male ! Acc)) ++ + tr (th ("творительный") ++ td (sn.s ! Male ! Ins)) ++ + tr (th ("предложный") ++ td (sn.s ! Male ! Pre)) ++ + tr (th (heading partitive_Parameter) ++ td (sn.s ! Male ! Ptv)) ++ + tr (th ("местный") ++ td (sn.s ! Male ! Loc)) ++ + tr (th ("звательный") ++ td (sn.s ! Male ! VocRus)) + ) + } ; + + InflectionLN = \ln -> { + t = "сущ.с." ; + s1 = heading1 "Название Местоположения" ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (ln.s ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (ln.s ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (ln.s ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (ln.s ! Acc)) ++ + tr (th ("творительный") ++ td (ln.s ! Ins)) ++ + tr (th ("предложный") ++ td (ln.s ! Pre)) ++ + tr (th (heading partitive_Parameter) ++ td (ln.s ! Ptv)) ++ + tr (th ("местный") ++ td (ln.s ! Loc)) ++ + tr (th ("звательный") ++ td (ln.s ! VocRus)) + ) ++ + heading2 (heading adverb_Category) ++ + paragraph "adv.s" + } ; + InflectionA, InflectionA2 = \adj -> { - t = "a" ; + t = "пр" ; s1 = heading1 (heading adjective_Category) ; s2 = heading2 (heading feminine_Parameter) ++ inflNoun (makeNFFromAF adj Fem Inanimate) ++ @@ -45,89 +111,89 @@ lin } ; InflectionAdv, InflectionAdV, InflectionAdA, InflectionAdN = \adv -> { - t = "adv" ; + t = "нар" ; s1 = heading1 (heading adverb_Category) ; s2 = paragraph adv.s } ; InflectionPrep p = { - t = "prep" ; + t = "пред" ; s1 = heading1 (heading preposition_Category) ; s2 = paragraph ((S.mkAdv (lin Prep p) S.it_NP).s ++ ";" ++ (S.mkAdv (lin Prep p) S.we_NP).s) } ; InflectionV v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v)) ; s2 = inflVerb v } ; InflectionV2 v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.something_NP)) ; s2 = inflVerb v } ; InflectionV3 v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.something_NP S.something_NP)) ; s2 = inflVerb v } ; InflectionV2V v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (S.mkVP (L.sleep_V)))) ; s2 = inflVerb v } ; InflectionV2S v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (lin S {s : Mood=>Str = \\m=>"..."}))) ; s2 = inflVerb v } ; InflectionV2Q v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (lin QS {s: QForm=>Str = \\m=>"..."}))) ; s2 = inflVerb v } ; InflectionV2A v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v S.we_NP L.beautiful_A)) ; s2 = inflVerb v } ; InflectionVV vv = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP vv (S.mkVP (L.sleep_V)))) ; s2 = inflVerb vv.v } ; InflectionVS v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v (lin S {s : Mood=>Str = \\m=>"..."}))) ; s2 = inflVerb v } ; InflectionVQ v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v (lin QS {s : Mood=>Str = \\m=>"..."}))) ; s2 = inflVerb v } ; InflectionVA v = { - t = "v" ; + t = "гл" ; s1 = heading1 (heading verb_Category) ++ paragraph (verbExample (S.mkCl S.she_NP v L.beautiful_A)) ; s2 = inflVerb v diff --git a/src/russian/NamesRus.gf b/src/russian/NamesRus.gf index e35bbf6d..3a89fae6 100644 --- a/src/russian/NamesRus.gf +++ b/src/russian/NamesRus.gf @@ -1,31 +1,54 @@ -concrete NamesRus of Names = CatRus ** open ResRus, Prelude in { +concrete NamesRus of Names = CatRus ** open ResRus, MorphoRus, Prelude in { -lin GivenName, MaleSurname, FemaleSurname, PlSurname = \pn -> - { s=\\cas => (nounFormsNoun pn).s ! Sg ! cas ; +lin GivenName gn = + { s=gn.s ; pron=False; - a=Ag (gennum pn.g Sg) P3 + a=let g = case gn.g of { + Male => Masc ; + Female => Fem + } + in Ag (gennum g Sg) P3 + } ; -- Does NP need animacy? +lin MaleSurname sn = + { s=\\cas => sn.s ! Male ! cas ; + pron=False; + a=Ag (GSg Masc) P3 + } ; -- Does NP need animacy? +lin FemaleSurname sn = + { s=\\cas => sn.s ! Female ! cas ; + pron=False; + a=Ag (GSg Fem) P3 + } ; -- Does NP need animacy? +lin PlSurname sn = + { s=sn.p ; + pron=False; + a=Ag GPl P3 } ; -- Does NP need animacy? lin FullName gn sn = - { s= table { - Nom => gn.snom ++ sn.snom ; - Gen => gn.snom ++ sn.sgen ; - Dat => gn.snom ++ sn.sdat ; - Acc => gn.snom ++ sn.sacc ; - Ins => gn.snom ++ sn.sins ; - Pre => gn.snom ++ sn.sprep ; - Loc => gn.snom ++ sn.sloc ; - Ptv => gn.snom ++ sn.sptv ; - VocRus => gn.snom ++ sn.svoc - } ; + { s=\\cas => gn.s ! Nom ++ sn.s ! gn.g ! cas ; pron=False; - a=Ag (gennum gn.g Sg) P3 + a=let g = case gn.g of { + Male => Masc ; + Female => Fem + } + in Ag (GSg g) P3 } ; - UseLN pn = { - s=\\cas => (nounFormsNoun pn).s ! Sg ! cas ; + UseLN, PlainLN = \ln -> { + s=\\cas => ln.s ! cas ; pron=False; - a=Ag (gennum pn.g Sg) P3 + a=Ag (gennum ln.g ln.n) P3 } ; -- Does NP need animacy? + InLN ln = ss (applyPrep {s=v_prep_mod; c=Loc; hasPrep=True} { + s=ln.s ; + pron=False; + a=Ag (gennum ln.g ln.n) P3 + }) ; -- Does NP need animacy? + + AdjLN ap ln = ln ** { + s=\\cas => preOrPost (notB ap.isPost) (ap.s ! (gennum ln.g ln.n) ! ln.anim ! cas) (ln.s ! cas) + } ; + } diff --git a/src/russian/ParadigmsRus.gf b/src/russian/ParadigmsRus.gf index 044f8e49..1c014d2c 100644 --- a/src/russian/ParadigmsRus.gf +++ b/src/russian/ParadigmsRus.gf @@ -1,6 +1,6 @@ --1 Russian Lexical Paradigms -resource ParadigmsRus = open CatRus, ResRus, (R=ResRus), ParamRus, (Z=InflectionRus), Prelude, Maybe in { +resource ParadigmsRus = open CatRus, ResRus, (R=ResRus), ParamRus, (Z=InflectionRus), Prelude, Maybe, MorphoRus in { --2 Parameters -- @@ -14,6 +14,11 @@ oper neuter : Gender = Neut ; + male : Sex + = Male ; + female : Sex + = Female ; + -- Abstracting numbers. Number is a parameter for mkPN, mkConj singular : Number = Sg ; @@ -380,6 +385,130 @@ oper = \word, g, anim, zi -> lin PN (noMinorCases (Z.makeNoun word g anim (Z.parseIndex zi))) ; } ; + mkGN = overload { + mkGN : Str -> GN + = \nom -> let nf = guessNounForms nom + in lin GN { + s = (nounFormsNoun nf).s ! Sg ; + g = case nf.g of { + Fem => Female ; + _ => Male + } + } ; + mkGN : Str -> Sex -> GN + = \nom, sex -> + let g = case sex of { + Male => Masc ; + Female => Fem + } ; + nf = guessLessNounForms nom g Animate + in lin GN { + s = (nounFormsNoun nf).s ! Sg ; + g = sex + } ; + mkGN : Str -> Sex -> Z.ZNIndex -> GN + = \nom, sex, z -> + let g = case sex of { + Male => Masc ; + Female => Fem + } ; + nf = noMinorCases (Z.makeNoun nom g Animate z) + in lin GN { + s = (nounFormsNoun nf).s ! Sg ; + g = sex + } ; + mkGN : Str -> Sex -> Str -> GN + = \nom, sex, zi -> + let g = case sex of { + Male => Masc ; + Female => Fem + } ; + nf = noMinorCases (Z.makeNoun nom g Animate (Z.parseIndex zi)) + in lin GN { + s = (nounFormsNoun nf).s ! Sg ; + g = sex + } ; + } ; + + mkSN = overload { + mkSN : Str -> SN + = \nom -> lin SN { + s = table { + Male => (nounFormsNoun (guessLessNounForms nom Masc Animate)).s ! Sg ; + Female => (nounFormsNoun (guessLessNounForms nom Fem Animate)).s ! Sg + } ; + p = (nounFormsNoun (guessLessNounForms nom Masc Animate)).s ! Pl ; + } ; + mkSN : Str -> Str -> SN + = \male,female -> lin SN { + s = table { + Male => (nounFormsNoun (guessLessNounForms male Masc Animate)).s ! Sg ; + Female => (nounFormsNoun (guessLessNounForms female Fem Animate)).s ! Sg + } ; + p = (nounFormsNoun (guessLessNounForms male Masc Animate)).s ! Pl ; + } ; + mkSN : Str -> Z.ZNIndex -> Str -> Z.ZNIndex -> SN + = \male,zm,female,zf -> lin SN { + s = table { + Male => (nounFormsNoun (noMinorCases (Z.makeNoun male Masc Animate zm))).s ! Sg ; + Female => (nounFormsNoun (noMinorCases (Z.makeNoun female Masc Animate zf))).s ! Sg + } ; + p = (nounFormsNoun (noMinorCases (Z.makeNoun male Masc Animate zm))).s ! Pl ; + } ; + } ; + + mkLN = overload { + mkLN : Str -> LN + = \nom -> let nf = guessNounForms nom + in lin LN { + s = (nounFormsNoun nf).s ! Sg ; + anim = nf.anim ; + c = mkPrep v_prep_mod Loc ; + g = nf.g ; + n = Sg + } ; + mkLN : Str -> Gender -> LN + = \nom, g -> + let nf = guessLessNounForms nom g Animate + in lin LN { + s = (nounFormsNoun nf).s ! Sg ; + anim = nf.anim ; + c = mkPrep v_prep_mod Loc ; + g = nf.g ; + n = Sg + } ; + mkLN : Str -> Gender -> Number -> LN + = \nom, g, n -> + let nf = guessLessNounForms nom g Animate + in lin LN { + s = (nounFormsNoun nf).s ! n ; + anim = nf.anim ; + c = mkPrep v_prep_mod Loc ; + g = nf.g ; + n = n + } ; + mkLN : Str -> Gender -> Number -> Z.ZNIndex -> LN + = \nom, g, n, z -> + let nf = noMinorCases (Z.makeNoun nom g Animate z) + in lin LN { + s = (nounFormsNoun nf).s ! n ; + anim = nf.anim ; + c = mkPrep v_prep_mod Loc ; + g = nf.g ; + n = n + } ; + mkLN : Str -> Gender -> Number -> Str -> LN + = \nom, g, n, zi -> + let nf = noMinorCases (Z.makeNoun nom g Animate (Z.parseIndex zi)) + in lin LN { + s = (nounFormsNoun nf).s ! n ; + anim = nf.anim ; + c = mkPrep v_prep_mod Loc ; + g = nf.g ; + n = n + } ; + } ; + --------------------- -- Adjectives diff --git a/src/scandinavian/CatScand.gf b/src/scandinavian/CatScand.gf index e78a312c..cdf4be02 100644 --- a/src/scandinavian/CatScand.gf +++ b/src/scandinavian/CatScand.gf @@ -108,9 +108,10 @@ incomplete concrete CatScand of Cat = -- {s : Number => Species => Case => Str ; g : Gender} ; N2 = Noun ** {c2 : Complement} ; N3 = Noun ** {c2,c3 : Complement} ; - LN = {s : Case => Str ; c : Complement ; g : Gender ; n : Number} ; - GN, SN, PN = {s : Case => Str ; g : Gender} ; - + PN = {s : Case => Str ; g : Gender} ; + LN = {s : Case => Str ; g : Gender ; n : Number} ; + GN = {s : Case => Str ; g : Sex} ; + SN = {s : Sex => Case => Str; pl : Case => Str} ; lincat diff --git a/src/slovenian/CatSlv.gf b/src/slovenian/CatSlv.gf index 7c069fb7..8fcf21e5 100644 --- a/src/slovenian/CatSlv.gf +++ b/src/slovenian/CatSlv.gf @@ -56,9 +56,10 @@ lincat N2 = {s : Case => Number => Str; g : AGender; c : Prep} ; N3 = {s : Case => Number => Str; g : AGender; c : Prep} ; - GN = {s : Case => Str; g : Sex}; - SN = {s : Sex => Case => Str}; - LN, PN = {s : Case => Str; g : AGender; n : Number}; + PN = {s : Case => Str; g : AGender; n : Number}; + LN = {s : Case => Str; g : AGender; n : Number}; + GN = {s : Case => Str; g : P.Sex}; + SN = {s : P.Sex => Case => Str}; linref V, VA, VS, V2, V3, V2A, V2S, V2Q, V2V = \v -> v.s ! VInf ++ v.refl ++ v.p; diff --git a/src/slovenian/DocumentationSlv.gf b/src/slovenian/DocumentationSlv.gf index 1812ce19..345b480b 100644 --- a/src/slovenian/DocumentationSlv.gf +++ b/src/slovenian/DocumentationSlv.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common concrete DocumentationSlv of Documentation = CatSlv ** open - ResSlv, + ResSlv, ParamX, HTML in { flags coding=utf8 ; @@ -31,6 +31,74 @@ lin ) } ; + InflectionPN = \n -> { + t = "li" ; + s1= heading1 ("Lastno Ime"++ + case n.g of { + AMasc Animate => "(m.s.ž.)" ; + AMasc Inanimate => "(m.s.)" ; + AFem => "(ž.s.)" ; + ANeut => "(s.s.)" + }) ; + s2= frameTable ( + tr (th "imen." ++ td (n.s!Nom))++ + tr (th "rod." ++ td (n.s!Gen))++ + tr (th "daj." ++ td (n.s!Dat))++ + tr (th "tož." ++ td (n.s!Acc))++ + tr (th "mest." ++ td (n.s!Loc))++ + tr (th "orod."++td (n.s!Instr)) + ) + } ; + + InflectionLN = \n -> { + t = "li" ; + s1= heading1 ("Ime Lokacije"++ + case n.g of { + AMasc Animate => "(m.s.ž.)" ; + AMasc Inanimate => "(m.s.)" ; + AFem => "(ž.s.)" ; + ANeut => "(s.s.)" + }) ; + s2= frameTable ( + tr (th "imen." ++ td (n.s!Nom))++ + tr (th "rod." ++ td (n.s!Gen))++ + tr (th "daj." ++ td (n.s!Dat))++ + tr (th "tož." ++ td (n.s!Acc))++ + tr (th "mest." ++ td (n.s!Loc))++ + tr (th "orod."++td (n.s!Instr)) + ) + } ; + + InflectionGN = \n -> { + t = "li" ; + s1= heading1 ("Dano Ime"++ + case n.g of { + Male => "(moški)" ; + Female => "(ženski)" + }) ; + s2= frameTable ( + tr (th "imen." ++ td (n.s!Nom))++ + tr (th "rod." ++ td (n.s!Gen))++ + tr (th "daj." ++ td (n.s!Dat))++ + tr (th "tož." ++ td (n.s!Acc))++ + tr (th "mest." ++ td (n.s!Loc))++ + tr (th "orod."++td (n.s!Instr)) + ) + } ; + + InflectionSN = \n -> { + t = "li" ; + s1= heading1 "Družinsko Ime" ; + s2= frameTable ( + tr (th "imen." ++ td (n.s!Male!Nom))++ + tr (th "rod." ++ td (n.s!Male!Gen))++ + tr (th "daj." ++ td (n.s!Male!Dat))++ + tr (th "tož." ++ td (n.s!Male!Acc))++ + tr (th "mest." ++ td (n.s!Male!Loc))++ + tr (th "orod."++td (n.s!Male!Instr)) + ) + } ; + InflectionA, InflectionA2 = \a -> { t = "pr" ; s1= heading1 ("Pridevnik") ; diff --git a/src/slovenian/NamesSlv.gf b/src/slovenian/NamesSlv.gf index 016f7715..1b767352 100644 --- a/src/slovenian/NamesSlv.gf +++ b/src/slovenian/NamesSlv.gf @@ -1,4 +1,4 @@ -concrete NamesSlv of Names = CatSlv ** open ResSlv, Prelude in { +concrete NamesSlv of Names = CatSlv ** open ResSlv, ParamX, Prelude in { lin GivenName = \n -> { s = n.s; @@ -21,10 +21,14 @@ lin FullName gn sn = { isPron = False } ; -lin UseLN pn = { - s = pn.s; - a = {g=agender2gender pn.g; n=pn.n; p=P3}; +lin UseLN, PlainLN = \ln -> { + s = ln.s; + a = {g=agender2gender ln.g; n=ln.n; p=P3}; isPron = False } ; +lin InLN ln = { + s = "v" ++ ln.s ! Loc + } ; + } diff --git a/src/slovenian/ParadigmsSlv.gf b/src/slovenian/ParadigmsSlv.gf index db45033e..54d0ab79 100644 --- a/src/slovenian/ParadigmsSlv.gf +++ b/src/slovenian/ParadigmsSlv.gf @@ -1,4 +1,4 @@ -resource ParadigmsSlv = open CatSlv, ResSlv, Prelude, Predef in { +resource ParadigmsSlv = open CatSlv, ResSlv, ParamX, Prelude, Predef in { oper nominative : Case = Nom ; @@ -34,6 +34,10 @@ oper mkN : (_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> AGender -> N = worstN ; } ; + compoundN = overload { + compoundN : N -> Str -> N = \noun,adv -> noun ** {s = \\c,n => noun.s ! c ! n ++ adv} ; + } ; + mkN2 : N -> Prep -> N2 = \n,c -> n ** {c=c} ; --All masculine forms (except those with long pluralstem) are formed here. @@ -241,6 +245,44 @@ oper }; } ; + mkLN = overload { + mkLN : N -> LN = \noun -> lin LN { + s = \\c => noun.s ! c ! Sg ; + g = noun.g ; + n = Sg + }; + mkLN : N -> Number -> LN = \noun,nr -> lin LN { + s = \\c => noun.s ! c ! nr ; + g = noun.g ; + n = nr + }; + mkLN : Str -> LN = + \s -> lin LN { + s = \\_ => s ; + g = AMasc Inanimate ; + n = Sg + }; + mkLN : Str -> AGender -> Number -> LN = + \s,g,n -> lin LN { + s = \\_ => s ; + g = g ; + n = n + }; + mkLN : (_,_,_,_,_,_ : Str) -> AGender -> Number -> LN = + \nom,gen,dat,acc,loc,instr,g,n -> lin LN { + s = table { + Nom => nom; + Gen => gen; + Dat => dat; + Acc => acc; + Loc => loc; + Instr => instr + }; + g = g ; + n = n + }; + } ; + mkV = overload { mkV : (inf : Str) -> V = \v -> regV v (dp 2 v) ; mkV : (inf,stem : Str) -> V = regV ; diff --git a/src/slovenian/ResSlv.gf b/src/slovenian/ResSlv.gf index 1b3e2446..7f1c846a 100644 --- a/src/slovenian/ResSlv.gf +++ b/src/slovenian/ResSlv.gf @@ -4,7 +4,6 @@ param Case = Nom | Gen | Dat | Acc | Loc | Instr; Number = Sg | Dl | Pl ; Gender = Masc | Fem | Neut ; - Sex = Male | Female ; Person = P1 | P2 | P3 ; Species = Indef | Def ; Animacy = Animate | Inanimate ; diff --git a/src/spanish/DocumentationSpaFunctor.gf b/src/spanish/DocumentationSpaFunctor.gf index fa09cdca..a23477ea 100644 --- a/src/spanish/DocumentationSpaFunctor.gf +++ b/src/spanish/DocumentationSpaFunctor.gf @@ -40,6 +40,42 @@ lin ) } ; + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 ("Nombre Proprio" ++ + case pn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = pn.s + } ; + + InflectionGN = \gn -> { + t = "pn" ; + s1 = heading1 ("Nombre de Pila" ++ + case gn.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = gn.s + } ; + + InflectionSN = \sn -> { + t = "sn" ; + s1 = heading1 "Apellido" ; + s2 = sn.s ! Masc + } ; + + InflectionLN = \ln -> { + t = "nl" ; + s1 = heading1 ("Nombre del Lugar" ++ + case ln.g of { + Masc => "("+heading masculine_Parameter+")" ; + Fem => "("+heading feminine_Parameter+")" + }) ; + s2 = paragraph ln.s + } ; + InflectionA, InflectionA2 = \adj -> { t = "a" ; s1 = heading1 (nounHeading adjective_Category).s ; diff --git a/src/spanish/NamesSpa.gf b/src/spanish/NamesSpa.gf index 8164d81d..3940d26a 100644 --- a/src/spanish/NamesSpa.gf +++ b/src/spanish/NamesSpa.gf @@ -1,8 +1,14 @@ concrete NamesSpa of Names = CatSpa ** open Prelude, ResSpa, CommonRomance in { -lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> pn2np n ; +lin GivenName = \n -> pn2np n ; +lin MaleSurname = \n -> pn2np {s = n.s ! Masc; g = Masc} ; +lin FemaleSurname = \n -> pn2np {s = n.s ! Fem; g = Fem} ; +lin PlSurname = \n -> heavyNPpol False { + s = \\c => prepCase c ++ n.pl ; + a = agrP3 Masc Pl + } ; lin FullName gn sn = pn2np { - s = gn.s ++ sn.s ; + s = gn.s ++ sn.s ! gn.g ; g = gn.g } ; @@ -30,18 +36,19 @@ lin UseLN n = heavyNP { lin InLN n = { - s = n.p.s ++ case n.art of { - UseArt => case n.g of { - Fem => case n.num of { - Sg => "la" ++ n.s; - Pl => "las" ++ n.s} ; - Masc => case n.num of { - Sg => "el" ++ n.s; - Pl => "los" ++ n.s - } - } ; - NoArt => n.s - } ; + s = "en" ++ + case n.art of { + UseArt => case n.g of { + Fem => case n.num of { + Sg => "la" ++ n.s; + Pl => "las" ++ n.s} ; + Masc => case n.num of { + Sg => "el" ++ n.s; + Pl => "los" ++ n.s + } + } ; + NoArt => n.s + } ; } ; diff --git a/src/spanish/ParadigmsSpa.gf b/src/spanish/ParadigmsSpa.gf index 124f3aef..5f850596 100644 --- a/src/spanish/ParadigmsSpa.gf +++ b/src/spanish/ParadigmsSpa.gf @@ -137,17 +137,38 @@ oper -- Proper names need a string and a gender. -- The default gender is feminine for names ending with "a", otherwise masculine. + mkPN : overload { + mkPN : (Anna : Str) -> PN ; -- feminine for "-a" + mkPN : (Pilar : Str) -> Gender -> PN ; -- force gender + mkPN : N -> PN ; -- gender from noun + } ; + + mkGN = overload { + mkGN : (Anna : Str) -> GN = \s -> lin GN (regPN s) ; -- feminine for "-a", otherwise masculine + mkGN : (Pilar : Str) -> Gender -> GN = \s,g -> lin GN (mk2PN s g) ; -- force gender + } ; + + mkSN = overload { + mkSN : Str -> SN = \s -> lin SN {s = \\_ => s; pl = s} ; + mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Masc=>male; Fem=>female}; pl = pl} ; + } ; + mkLN = overload { + mkLN : Str -> LN = \s -> + lin LN {s = s ; + onPrep = False ; + art = NoArt ; + g = Masc ; + num = Sg} ; mkLN : Str -> Gender -> LN = \s,g -> lin LN {s = s ; - p = {s = "en"; c = Nom; isDir = True} ; + onPrep = False ; art = NoArt ; g = g ; num = Sg} ; - mkLN : Str -> Gender -> Number -> LN = \s,g,num -> lin LN {s = s ; - p = {s = "en"; c = Nom; isDir = True} ; + onPrep = False ; art = NoArt ; g = g ; num = num} ; @@ -155,14 +176,6 @@ oper defLN : LN -> LN = \n -> n ** {art = UseArt} ; - prepLN : LN -> Prep -> LN = \n,p -> n ** {p = p} ; - - mkPN : overload { - mkPN : (Anna : Str) -> PN ; -- feminine for "-a" - mkPN : (Pilar : Str) -> Gender -> PN ; -- force gender - mkPN : N -> PN ; -- gender from noun - } ; - --2 Adjectives @@ -350,8 +363,8 @@ oper Gender = MorphoSpa.Gender ; Number = MorphoSpa.Number ; CopulaType = DiffSpa.CopulaType ; - masculine = Masc ; - feminine = Fem ; + masculine, male = Masc ; + feminine, female = Fem ; singular = Sg ; plural = Pl ; serCopula = DiffSpa.serCopula ; diff --git a/src/swedish/DocumentationSwe.gf b/src/swedish/DocumentationSwe.gf index c5e011b8..230ba12a 100644 --- a/src/swedish/DocumentationSwe.gf +++ b/src/swedish/DocumentationSwe.gf @@ -41,16 +41,14 @@ lin s2 = frameTable ( tr (th "nom" ++ td (n.s ! Nom)) ++ tr (th "gen" ++ td (n.s ! Gen)) - ) ++ - heading1 ("Adverb") ++ - paragraph (n.c.s ++ n.s ! caseNP accusative) ; + ) ; } ; InflectionGN = \pn -> { t = "fnm" ; s1 = heading1 ("Förnamn" ++ case pn.g of { - Utr => "(utr)" ; - Neutr => "(neutr)" + Male => "(man)" ; + Female => "(kvinna)" }) ; s2 = frameTable ( tr (th "nom" ++ td (pn.s ! Nom)) ++ @@ -60,13 +58,10 @@ lin InflectionSN = \pn -> { t = "enm" ; - s1 = heading1 ("Efternamn" ++ case pn.g of { - Utr => "(utr)" ; - Neutr => "(neutr)" - }) ; + s1 = heading1 "Efternamn" ; s2 = frameTable ( - tr (th "nom" ++ td (pn.s ! Nom)) ++ - tr (th "gen" ++ td (pn.s ! Gen)) + tr (th "nom" ++ td (pn.s ! Male ! Nom)) ++ + tr (th "gen" ++ td (pn.s ! Male ! Gen)) ) } ; diff --git a/src/swedish/NamesSwe.gf b/src/swedish/NamesSwe.gf index a6a99337..b36acf3e 100644 --- a/src/swedish/NamesSwe.gf +++ b/src/swedish/NamesSwe.gf @@ -1,13 +1,28 @@ concrete NamesSwe of Names = CatSwe ** open CommonScand, ResSwe, Prelude in { -lin GivenName, MaleSurname, FemaleSurname = \pn -> { +lin GivenName = \pn -> { s = \\c => pn.s ! caseNP c ; - a = agrP3 pn.g Sg ; + a = agrP3 Utr Sg ; + isPron = False + } ; +lin MaleSurname = \pn -> { + s = \\c => pn.s ! Male ! caseNP c ; + a = agrP3 Utr Sg ; + isPron = False + } ; +lin FemaleSurname = \pn -> { + s = \\c => pn.s ! Female ! caseNP c ; + a = agrP3 Utr Sg ; + isPron = False + } ; +lin PlSurname = \pn -> { + s = \\c => pn.pl ! caseNP c ; + a = agrP3 Utr Pl ; isPron = False } ; lin FullName gn sn = { - s = \\c => gn.s ! Nom ++ sn.s ! caseNP c ; - a = agrP3 gn.g Sg ; + s = \\c => gn.s ! Nom ++ sn.s ! gn.g ! caseNP c ; + a = agrP3 Utr Sg ; isPron = False } ; @@ -17,6 +32,6 @@ lin FullName gn sn = { isPron = False } ; - InLN n = {s = n.c.s ++ n.s ! caseNP accusative} ; + InLN n = {s = "i" ++ n.s ! caseNP accusative} ; } diff --git a/src/swedish/ParadigmsSwe.gf b/src/swedish/ParadigmsSwe.gf index 2898f1fd..f87a6f58 100644 --- a/src/swedish/ParadigmsSwe.gf +++ b/src/swedish/ParadigmsSwe.gf @@ -155,12 +155,24 @@ oper geoPN : Str -> PN ; -- neuter, with identical genitive if ends in a vowel mkLN = overload { - mkLN : Str -> LN = \s -> lin LN (regPN s) ** {c={s="i";hasPrep=True}; n=Sg}; -- default gender utrum - mkLN : Str -> Gender -> LN = \s,g -> lin LN (regGenPN s g) ** {c={s="i";hasPrep=True}; n=Sg} ; -- set other gender - mkLN : Str -> Gender -> Number -> LN = \s,g,n -> lin LN (regGenPN s g) ** {c={s="i";hasPrep=True}; n=n} ; -- set other gender + mkLN : Str -> LN = \s -> lin LN (regPN s) ** {n=Sg}; -- default gender utrum + mkLN : Str -> Gender -> LN = \s,g -> lin LN (regGenPN s g) ** {n=Sg} ; -- set other gender + mkLN : Str -> Gender -> Number -> LN = \s,g,n -> lin LN (regGenPN s g) ** {n=n} ; -- set other gender and number + } ; + + mkGN = overload { + mkGN : Str -> GN = \s -> lin GN {s = \\c => mkCase c s ; g = Male}; -- default gender utrum + mkGN : Str -> Sex -> GN = \s,g -> lin GN {s = \\c => mkCase c s ; g = g} ; -- set other gender + } ; + + mkSN = overload { + mkSN : Str -> SN = \s -> lin SN {s = \\_,c => mkCase c s; pl = \\c => mkCase c s}; -- default gender utrum + mkSN : Str -> Str -> Str -> SN = + \male,female,pl -> lin SN {s = table {Male => \\c => mkCase c male; + Female => \\c => mkCase c female} ; + pl = \\c => mkCase c pl + } ; } ; - - prepLN : LN -> Prep -> LN = \n,p -> n ** {c = mkComplement p.s} ; --2 Adjectives @@ -359,6 +371,8 @@ oper utrum = Utr ; neutrum = Neutr ; neuter = Neutr ; + male = Male ; + female = Female ; singular = Sg ; plural = Pl ; nominative = Nom ; From 1f73830d4bde9dd5247d407bfbf4502758a742fa Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 16 Aug 2023 21:27:09 +0200 Subject: [PATCH 030/129] fix the documentation --- src/bulgarian/DocumentationBul.gf | 2 +- src/english/DocumentationEng.gf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bulgarian/DocumentationBul.gf b/src/bulgarian/DocumentationBul.gf index 76630cb5..9f3c82c1 100644 --- a/src/bulgarian/DocumentationBul.gf +++ b/src/bulgarian/DocumentationBul.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common concrete DocumentationBul of Documentation = CatBul ** open - ResBul, + ResBul, Prelude, HTML in { flags coding=utf8 ; diff --git a/src/english/DocumentationEng.gf b/src/english/DocumentationEng.gf index 75066bb5..c4c66eee 100644 --- a/src/english/DocumentationEng.gf +++ b/src/english/DocumentationEng.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common concrete DocumentationEng of Documentation = CatEng ** open - ResEng, + ResEng, Prelude, HTML in { lincat From 7a75cf3fb3fecb1025ad99a10275c4149cdf39a2 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Thu, 17 Aug 2023 17:08:33 +0300 Subject: [PATCH 031/129] 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 032/129] 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 033/129] 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 034/129] 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 035/129] (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 1562e53d7720714ce5d2792af85993bd5f57f42e Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 21 Aug 2023 14:41:24 +0200 Subject: [PATCH 036/129] small All module for Zul --- src/zulu/AllZul.gf | 5 +++++ src/zulu/AllZulAbs.gf | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 src/zulu/AllZul.gf create mode 100644 src/zulu/AllZulAbs.gf diff --git a/src/zulu/AllZul.gf b/src/zulu/AllZul.gf new file mode 100644 index 00000000..96de6245 --- /dev/null +++ b/src/zulu/AllZul.gf @@ -0,0 +1,5 @@ +--# -path=.:../abstract:../common:../api + +concrete AllZul of AllZulAbs = + CatZul ** { +} diff --git a/src/zulu/AllZulAbs.gf b/src/zulu/AllZulAbs.gf new file mode 100644 index 00000000..1996d79a --- /dev/null +++ b/src/zulu/AllZulAbs.gf @@ -0,0 +1,5 @@ +--# -path=.:../abstract:../common:../api + +abstract AllZulAbs = + Cat ** { +} From dc58886b79c5c6c05b04669b196e3682bf8c7426 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 21 Aug 2023 14:41:55 +0200 Subject: [PATCH 037/129] add Zulu in the list of languages --- languages.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/languages.csv b/languages.csv index 76cae962..ac2d7caf 100644 --- a/languages.csv +++ b/languages.csv @@ -52,3 +52,4 @@ Tha,Thai,thai,,to_thai,,,,,,y Tur,Turkish,turkish,,,y,,,n,,n Urd,Urdu,urdu,Hindustani,,,,,,,y Som,Somali,somali,,,,,n,n,,n +Zul,Zulu,zulu,,,,,n,n,,n From f08c9c0c93b33d22f75c649dd826c5d0f48ff3bb Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Mon, 21 Aug 2023 15:58:57 +0300 Subject: [PATCH 038/129] 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 039/129] 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 ; From 0b52307e9170fbf6e2f7617e8eb56bad68b9ca83 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 21 Aug 2023 15:02:21 +0200 Subject: [PATCH 040/129] added lin FClause --- src/german/ExtraGer.gf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/german/ExtraGer.gf b/src/german/ExtraGer.gf index c884dd8b..14eae0be 100644 --- a/src/german/ExtraGer.gf +++ b/src/german/ExtraGer.gf @@ -330,8 +330,8 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** lin VPass v = let vp = predV werdenPass - in vp ** {subj = esSubj ; - inf = vp.inf ** {s = v.s ! VPastPart APred } } ; -- construct the formal clause + in lin FClause (vp ** {subj = esSubj ; + inf = vp.inf ** {s = v.s ! VPastPart APred } }) ; -- construct the formal clause AdvFor adv fcl = fcl ** {a2 = adv.s} ; From 956d2fc9c4165848eccd6a8fe4b0cbe71930cc6c Mon Sep 17 00:00:00 2001 From: LauretteM Date: Mon, 21 Aug 2023 15:04:17 +0200 Subject: [PATCH 041/129] (zul) temp paradigms fix (#435) --- src/zulu/ParadigmsZul.gf | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/zulu/ParadigmsZul.gf b/src/zulu/ParadigmsZul.gf index 9dec01fd..b53b7e2f 100755 --- a/src/zulu/ParadigmsZul.gf +++ b/src/zulu/ParadigmsZul.gf @@ -127,23 +127,30 @@ oper } ; mkV3 = overload { - mkV3 : (phuz : Str) -> V3 = \phuz -> lin V3 (regVerb phuz) ; - -- mkV2 : (phathw : Str) -> Voice -> V2 = \phathw,voice -> lin V2 (passiveVerb phathw voice) ; + mkV3 : (hamb : Str) -> V3 = \hamb -> lin V3 (regVerb hamb) ; + mkV3 : (th,thi : Str) -> V3 = \th,thi -> lin V3 (th_Verb th thi) ; + mkV3 : (guqubal,guqubala,guqubele : Str) -> V3 = \guqubal,guqubala,guqubele -> lin V3 (three_Verb guqubal guqubala guqubele) ; + mkV3 : (guqubal,guqubala,guqubele,guqubele_2 : Str) -> V3 = \guqubal,guqubala,guqubele,guqubele_2 -> lin V3 (four_Verb guqubal guqubala guqubele guqubele_2) ; + } ; + + mkV2V = overload { + mkV2V : (hamb : Str) -> V2V = \hamb -> lin V2V (regVerb hamb) ; + mkV2V : (th,thi : Str) -> V2V = \th,thi -> lin V2V (th_Verb th thi) ; + mkV2V : (guqubal,guqubala,guqubele : Str) -> V2V = \guqubal,guqubala,guqubele -> lin V2V (three_Verb guqubal guqubala guqubele) ; + mkV2V : (guqubal,guqubala,guqubele,guqubele_2 : Str) -> V2V = \guqubal,guqubala,guqubele,guqubele_2 -> lin V2V (four_Verb guqubal guqubala guqubele guqubele_2) ; } ; mkVA = overload { mkVA : (b : Str) -> VA = \b -> lin VA (regVerb b) ; } ; - mkVS = overload { - mkVS : (cel : Str) -> VS = \cel -> lin VS (regVerb cel) ; + mkVV = overload { + mkVV : (f : Str) -> VV = \f -> lin VV (regVerb f) } ; - mkVAux = overload { - mkVAux : (hlale : Str) -> VAux = \hlale -> lin VAux { - s = hlale ; - at = PartAux - } + mkVS = overload { + mkVS : (cel : Str) -> SType -> VS = \cel,st -> lin VS ((regVerb cel) ** { s_type = st } ) ; + mkVS : (az,azi : Str) -> SType -> VS = \az,azi,st -> lin VS ((th_Verb az azi) ** { s_type = st } ) ; } ; -- yourPl_Det = overload { From a00d41dcfaf82a650d409fd7f21cf12184ed611e Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Mon, 21 Aug 2023 16:08:52 +0300 Subject: [PATCH 042/129] re-enabled Ger.possess_Prep --- src/german/GrammarGer.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/german/GrammarGer.gf b/src/german/GrammarGer.gf index bb679ff7..5d1032ee 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 - [part_Prep,possess_Prep], -- use PartNP, PossNP instead + StructuralGer, -- AR: keep for BW comp - [part_Prep,possess_Prep], -- use PartNP, PossNP instead TenseGer ---- NamesGer -- notYet! ** { From 1c775791b4d5b35e1ad4ec10b301fd945927d942 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 21 Aug 2023 17:31:40 +0200 Subject: [PATCH 043/129] make Zulu compile --- src/zulu/AllZul.gf | 4 ++-- src/zulu/AllZulAbs.gf | 2 +- src/zulu/GrammarZul.gf | 2 +- src/zulu/ParadigmsZul.gf | 20 ++++++++++---------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/zulu/AllZul.gf b/src/zulu/AllZul.gf index 96de6245..c80d00a6 100644 --- a/src/zulu/AllZul.gf +++ b/src/zulu/AllZul.gf @@ -1,5 +1,5 @@ ---# -path=.:../abstract:../common:../api +--# -path=.:../abstract:../common:../zulu/abstract_ext concrete AllZul of AllZulAbs = - CatZul ** { + LangZul ** { } diff --git a/src/zulu/AllZulAbs.gf b/src/zulu/AllZulAbs.gf index 1996d79a..a120b25b 100644 --- a/src/zulu/AllZulAbs.gf +++ b/src/zulu/AllZulAbs.gf @@ -1,5 +1,5 @@ --# -path=.:../abstract:../common:../api abstract AllZulAbs = - Cat ** { + Lang ** { } diff --git a/src/zulu/GrammarZul.gf b/src/zulu/GrammarZul.gf index 4acef21b..0a8a8bc3 100755 --- a/src/zulu/GrammarZul.gf +++ b/src/zulu/GrammarZul.gf @@ -9,7 +9,7 @@ concrete GrammarZul of Grammar = SentenceZul, QuestionZul, RelativeZul, - ConjunctionZul, +-- ConjunctionZul, PhraseZul, TextX - [Temp,Adv,IAdv], StructuralZul, diff --git a/src/zulu/ParadigmsZul.gf b/src/zulu/ParadigmsZul.gf index b53b7e2f..09ef28d1 100755 --- a/src/zulu/ParadigmsZul.gf +++ b/src/zulu/ParadigmsZul.gf @@ -133,12 +133,12 @@ oper mkV3 : (guqubal,guqubala,guqubele,guqubele_2 : Str) -> V3 = \guqubal,guqubala,guqubele,guqubele_2 -> lin V3 (four_Verb guqubal guqubala guqubele guqubele_2) ; } ; - mkV2V = overload { - mkV2V : (hamb : Str) -> V2V = \hamb -> lin V2V (regVerb hamb) ; - mkV2V : (th,thi : Str) -> V2V = \th,thi -> lin V2V (th_Verb th thi) ; - mkV2V : (guqubal,guqubala,guqubele : Str) -> V2V = \guqubal,guqubala,guqubele -> lin V2V (three_Verb guqubal guqubala guqubele) ; - mkV2V : (guqubal,guqubala,guqubele,guqubele_2 : Str) -> V2V = \guqubal,guqubala,guqubele,guqubele_2 -> lin V2V (four_Verb guqubal guqubala guqubele guqubele_2) ; - } ; +-- mkV2V = overload { +-- mkV2V : (hamb : Str) -> V2V = \hamb -> lin V2V (regVerb hamb) ; +-- mkV2V : (th,thi : Str) -> V2V = \th,thi -> lin V2V (th_Verb th thi) ; +-- mkV2V : (guqubal,guqubala,guqubele : Str) -> V2V = \guqubal,guqubala,guqubele -> lin V2V (three_Verb guqubal guqubala guqubele) ; +-- mkV2V : (guqubal,guqubala,guqubele,guqubele_2 : Str) -> V2V = \guqubal,guqubala,guqubele,guqubele_2 -> lin V2V (four_Verb guqubal guqubala guqubele guqubele_2) ; +-- } ; mkVA = overload { mkVA : (b : Str) -> VA = \b -> lin VA (regVerb b) ; @@ -148,10 +148,10 @@ oper mkVV : (f : Str) -> VV = \f -> lin VV (regVerb f) } ; - mkVS = overload { - mkVS : (cel : Str) -> SType -> VS = \cel,st -> lin VS ((regVerb cel) ** { s_type = st } ) ; - mkVS : (az,azi : Str) -> SType -> VS = \az,azi,st -> lin VS ((th_Verb az azi) ** { s_type = st } ) ; - } ; + -- mkVS = overload { + -- mkVS : (cel : Str) -> SType -> VS = \cel,st -> lin VS ((regVerb cel) ** { s_type = st } ) ; + -- mkVS : (az,azi : Str) -> SType -> VS = \az,azi,st -> lin VS ((th_Verb az azi) ** { s_type = st } ) ; + -- } ; -- yourPl_Det = overload { -- yourPl_Det : Det = lin Det { s = "jou" ; n = Pl ; p = TPos } ; From 20dcab32080ea191eb48a5dc6b76ad7de0fb5730 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Mon, 21 Aug 2023 19:44:20 +0300 Subject: [PATCH 044/129] some more infinitives and their interpretations in Fin --- src/finnish/infinitives/Infinitive.gf | 7 +- src/finnish/infinitives/InfinitiveFin.gf | 11 ++- .../infinitives/InterpretInfinitives.hs | 75 ++++++++++++------- 3 files changed, 62 insertions(+), 31 deletions(-) diff --git a/src/finnish/infinitives/Infinitive.gf b/src/finnish/infinitives/Infinitive.gf index d029d19d..f8f9cb91 100644 --- a/src/finnish/infinitives/Infinitive.gf +++ b/src/finnish/infinitives/Infinitive.gf @@ -33,7 +33,8 @@ fun Inf1LongRAdv : VP -> RAdv ; -- mennäkse (ni/si/...) - Inf2InessAdv : NP -> VP -> Adv ; -- junan mennessä + Inf2InessAdv : NP -> VP -> Adv ; -- junan mennessä + Inf2InessRAdv : VP -> RAdv ; -- mennessään Inf2InessPassAdv : VP -> Adv ; -- odotettaessa (junaa), touhuttaessa (junan kanssa) Inf2InessPassInvAdv : NP -> VPSlash -> Adv ; -- junaa odotettaessa, junan kanssa touhutessa @@ -59,8 +60,8 @@ fun ComplPresPartActVS : VS -> NP -> VP -> VP ; -- sanoa junan menevän ComplPastPartActVS : VS -> NP -> VP -> VP ; -- sanoa junan menneen - ComplPresPartActAgrVS : VS -> VP -> VP ; -- sanoa menevänsä - ComplPastPartActAgrVS : VS -> VP -> VP ; -- sanoa menneensä + ComplPresPartActReflVS : VS -> VP -> VP ; -- sanoa menevänsä + ComplPastPartActReflVS : VS -> VP -> VP ; -- sanoa menneensä ComplPresPartPassVS : VS -> NP -> VPSlash -> VP ; -- sanoa junaa odotettavan ComplPastPartPassVS : VS -> NP -> VPSlash -> VP ; -- sanoa junaa odotetun diff --git a/src/finnish/infinitives/InfinitiveFin.gf b/src/finnish/infinitives/InfinitiveFin.gf index 322f1645..249b9780 100644 --- a/src/finnish/infinitives/InfinitiveFin.gf +++ b/src/finnish/infinitives/InfinitiveFin.gf @@ -87,7 +87,14 @@ lin s = np.s ! NPCase Gen ++ infVP SCNom Pos np.a vp Inf2Iness } ; + + Inf2InessRAdv vp = { + s = \\a => + infVP SCNom Pos infAdvAgr vp Inf2Iness ++ BIND ++ + case vp.s.h of {Back => possSuffix a ; Front => possSuffixFront a} + } ; + Inf2InessPassAdv vp = { s = infVP SCNom Pos infAdvAgr vp Inf2InessPass } ; @@ -158,9 +165,9 @@ lin ComplPastPartActVS vs np vp = insertExtrapos (subjPartVP np vp (NPCase Gen) (PastPartAct (AN (NCase Sg Gen)))) (predSV vs) ; - ComplPresPartActAgrVS vs vp = + ComplPresPartActReflVS vs vp = insertObj (\\_,_,agr => subjPartAgrVP vp (PresPartAct (AN (NPossGen Sg))) agr) (predSV vs) ; - ComplPastPartActAgrVS vs vp = + ComplPastPartActReflVS vs vp = insertObj (\\_,_,agr => subjPartAgrVP vp (PastPartAct (AN (NPossGen Sg))) agr) (predSV vs) ; ComplPresPartPassVS vs np vps = diff --git a/src/finnish/infinitives/InterpretInfinitives.hs b/src/finnish/infinitives/InterpretInfinitives.hs index 4057e072..40ad9680 100644 --- a/src/finnish/infinitives/InterpretInfinitives.hs +++ b/src/finnish/infinitives/InterpretInfinitives.hs @@ -10,23 +10,20 @@ data Fact = Fact { content :: [Fact], tense :: Maybe GTemp, polarity :: Maybe GPol, - source :: Maybe GNP, - attitude :: Maybe GVS, agent :: Maybe GNP, - action :: Maybe GVP + action :: Either GVS GVP } -initFact = Fact [] Nothing Nothing Nothing Nothing Nothing Nothing +initFact = Fact [] Nothing Nothing Nothing (Left undefined) -factTree fact = case action fact of - (Just vp) -> - GUttS $ GUseCl - (maybe presentTense id (tense fact)) - (maybe positivePol id (polarity fact)) - (GPredVP - (maybe (maybe Gsomebody_NP id (source fact)) id (agent fact)) - vp) - _ -> GUttNP Gnothing_NP +factTree fact = GUseCl mtense mpolarity (GPredVP magent mvp) + where + mvp = case action fact of + Left vs -> GComplVS vs (factTree (head (content fact))) ---- head -> ambiguity + Right vp -> vp + mtense = maybe presentTense id (tense fact) + mpolarity = maybe positivePol id (polarity fact) + magent = maybe GX_NP id (agent fact) presentTense = GTTAnt GTPres GASimul pastTense = GTTAnt GTPast GASimul @@ -38,28 +35,53 @@ negativePol = GPNeg facts :: Infinitive.Tree a -> [Fact] facts t = case t of + GUseCl temp pol s -> + [f{ + tense = Just temp, + polarity = Just pol + } | f <- facts s] GAdjCN (GAgentPartAP np vpslash) cn -> [initFact{ tense = Just perfectTense, agent = Just np, - action = Just (GComplSlash vpslash (GMassNP cn))}] - GPredVP np (GComplPresPartActAgrVS vs vp) -> + action = Right (GComplSlash vpslash (GMassNP cn))}] + GPredVP ag (GUseComp (GCompAP (GAgentPartAP np vpslash))) -> [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}] + tense = Just perfectTense, + agent = Just np, + action = Right (GComplSlash vpslash ag)}] + GPredVP np (GComplPresPartActReflVS vs vp) -> + [initFact{ + agent = Just np, + action = Left vs, + content = [ + initFact{ + agent = Just np, + action = Right vp + }]}] + GPredVP np (GComplPastPartActReflVS vs vp) -> + [initFact{ + agent = Just np, + action = Left vs, + content = [ + initFact{ + tense = Just perfectTense, + agent = Just np, + action = Right vp + }]}] GPredVP np (GAdvVP vp adv) -> - [f{source = Just np} | f <- facts vp ++ facts adv] + [f{agent = Just np} | f <- facts vp ++ facts adv] +---- GPredVP np (GRAdvVP vp (GInf1LongRAdv vpa)) -> +---- [f{agent = Just np, action = } | f <- facts vp ++ facts adv] GPredVP np vp -> - [f{source = Just np} | f <- facts vp] + [f{agent = Just np} | f <- facts vp] GUseV v -> [initFact{ - action = Just t}] + action = Right t}] + GUseV2 v -> + [initFact{ + action = Right (GComplSlash (GSlashV2a v) GY_NP)}] +{- GComplPresPartActVS vs np vp -> [initFact{ attitude = @@ -85,6 +107,7 @@ facts t = case t of tense = Just perfectTense, attitude = Just vs, action = Just (GComplSlash vpslash np)}] +-} _ -> composOpMPlus facts t From ce8b4575ee6b7f346f100bde0eab8199a21e7d1c Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 21 Aug 2023 19:37:52 +0200 Subject: [PATCH 045/129] partly restore the Names API in German --- src/german/GrammarGer.gf | 4 ++-- src/german/NamesGer.gf | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/german/GrammarGer.gf b/src/german/GrammarGer.gf index 5d1032ee..410c401f 100644 --- a/src/german/GrammarGer.gf +++ b/src/german/GrammarGer.gf @@ -14,8 +14,8 @@ concrete GrammarGer of Grammar = TextX - [Tense,Temp], IdiomGer, StructuralGer, -- AR: keep for BW comp - [part_Prep,possess_Prep], -- use PartNP, PossNP instead - TenseGer ----- NamesGer -- notYet! + TenseGer, + NamesGer ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/german/NamesGer.gf b/src/german/NamesGer.gf index 9b4ecc31..d97381e6 100644 --- a/src/german/NamesGer.gf +++ b/src/german/NamesGer.gf @@ -36,32 +36,32 @@ lin FullName gn sn = { } ; -- 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) - } ; +lin UseLN ln = { + s = \\b,c => case ln.hasArt of { + True => case b of { + True => [] ; -- defart dropped + False => artDef ! (gennum ln.g ln.n) ! c + } ++ + ln.s ! (adjfCase Weak c) ! c ; + False => ln.s ! Strong ! c + } ; a = agrgP3 ln.g ln.n ; w = WLight ; rc, ext = [] } ; --} -- PlainLN : LN -> NP ; -lin PlainLN ln = notYet "PlainLN" ; -{- { - s = \\c => usePrepC c (\k -> ln.s ! adjfCase Strong k ! k) ; +lin PlainLN ln = { + s = \\_,c => ln.s ! Strong ! c ; a = agrgP3 ln.g ln.n ; w = WLight ; rc, ext = [] } ; --} +{- -- InLN : LN -> Adv ; -lin InLN ln = notYet "InLN" ; -{- { - s = let c = NPP CInDat +lin InLN ln = { + s = let c = 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) From fb398c603e45c008524820d2fe9deaa2ac7f68e7 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 21 Aug 2023 20:14:26 +0200 Subject: [PATCH 046/129] The new Decimal API --- src/abstract/Cat.gf | 1 + src/abstract/Noun.gf | 5 ++-- src/abstract/Numeral.gf | 12 ++++++---- src/afrikaans/CatAfr.gf | 1 + src/afrikaans/NounAfr.gf | 8 +------ src/afrikaans/NumeralAfr.gf | 16 ++++++++++++- src/amharic/CatAmh.gf | 1 + src/amharic/NounAmh.gf | 1 + src/amharic/NumeralAmh.gf | 14 ++++++++++- src/amharic/ResAmh.gf | 4 ++++ src/ancient_greek/CatGrc.gf | 1 + src/ancient_greek/NounGrc.gf | 2 ++ src/ancient_greek/NumeralGrc.gf | 4 +++- src/arabic/CatAra.gf | 2 ++ src/arabic/NounAra.gf | 4 ++++ src/arabic/NumeralAra.gf | 16 ++++++++++++- src/bantu/CatBantu.gf | 3 ++- src/bantu/NounBantu.gf | 1 + src/basque/CatEus.gf | 1 + src/basque/NounEus.gf | 3 ++- src/basque/NumeralEus.gf | 15 +++++++++++- src/bulgarian/CatBul.gf | 1 + src/bulgarian/NounBul.gf | 9 +------ src/bulgarian/NumeralBul.gf | 40 ++++++++++++++++++++++++++------ src/catalan/NumeralCat.gf | 16 ++++++++++++- src/chinese/CatChi.gf | 1 + src/chinese/NounChi.gf | 1 + src/chinese/NumeralChi.gf | 14 ++++++++++- src/chinese/pinyin/NumeralChi.gf | 12 ++++++++++ src/croatian/CatHrv.gf | 1 + src/croatian/NounHrv.gf | 1 + src/croatian/NumeralHrv.gf | 16 ++++++++++++- src/czech/CatCze.gf | 1 + src/czech/NounCze.gf | 1 + src/czech/NumeralCze.gf | 16 ++++++++++++- src/danish/NumeralDan.gf | 16 ++++++++++++- src/dutch/CatDut.gf | 1 + src/dutch/NounDut.gf | 8 +------ src/dutch/NumeralDut.gf | 16 ++++++++++++- src/egekusii/NumeralGus.gf | 14 +++++++++++ src/english/CatEng.gf | 1 + src/english/DocumentationEng.gf | 3 ++- src/english/NounEng.gf | 7 +----- src/english/NumeralEng.gf | 24 +++++++++++++------ src/estonian/CatEst.gf | 1 + src/estonian/NounEst.gf | 12 +++------- src/estonian/NumeralEst.gf | 16 ++++++++++++- src/finnish/CatFin.gf | 1 + src/finnish/NounFin.gf | 13 +++-------- src/finnish/NumeralFin.gf | 20 +++++++++++++--- src/french/NumeralFre.gf | 16 ++++++++++++- src/german/CatGer.gf | 1 + src/german/NounGer.gf | 10 +------- src/german/NumeralGer.gf | 24 +++++++++++++++---- src/greek/CatGre.gf | 2 ++ src/greek/NounGre.gf | 3 ++- src/greek/NumeralGre.gf | 16 ++++++++++++- src/greenlandic/NumeralKal.gf | 14 +++++++++++ src/hebrew/CatHeb.gf | 1 + src/hindi/NumeralHin.gf | 3 ++- src/hindustani/CatHindustani.gf | 1 + src/hindustani/NounHindustani.gf | 1 + src/hungarian/CatHun.gf | 1 + src/hungarian/NounHun.gf | 4 ++++ src/hungarian/NumeralHun.gf | 9 ++++++- src/icelandic/CatIce.gf | 1 + src/icelandic/NounIce.gf | 4 ++++ src/icelandic/NumeralIce.gf | 16 ++++++++++++- src/interlingua/CatIna.gf | 1 + src/interlingua/NounIna.gf | 1 + src/interlingua/NumeralIna.gf | 16 ++++++++++++- src/italian/NumeralIta.gf | 16 ++++++++++++- src/japanese/CatJpn.gf | 1 + src/japanese/NounJpn.gf | 1 + src/japanese/NumeralJpn.gf | 20 ++++++++++++++-- src/kikamba/NumeralKam.gf | 14 +++++++++++ src/korean/CatKor.gf | 3 +-- src/korean/NounKor.gf | 6 ++--- src/korean/NumeralKor.gf | 12 +++++++++- src/latin/CatLat.gf | 1 + src/latin/NumeralLat.gf | 2 ++ src/latvian/CatLav.gf | 1 + src/latvian/NounLav.gf | 1 + src/latvian/NumeralLav.gf | 16 ++++++++++++- src/lithuanian/CatLit.gf | 1 + src/lithuanian/NounLit.gf | 1 + src/lithuanian/NumeralLit.gf | 17 ++++++++++++++ src/malay/CatMay.gf | 3 ++- src/malay/NounMay.gf | 4 ++++ src/malay/NumeralMay.gf | 12 +++++++++- src/maltese/CatMlt.gf | 5 ++++ src/maltese/NounMlt.gf | 4 +--- src/maltese/NumeralMlt.gf | 16 ++++++++++++- src/mongolian/CatMon.gf | 3 ++- src/mongolian/NounMon.gf | 2 +- src/mongolian/NumeralMon.gf | 16 ++++++++++++- src/nepali/CatNep.gf | 1 + src/nepali/NounNep.gf | 1 + src/nepali/NumeralNep.gf | 12 +++++++++- src/nepali/src/NumeralNep.gf | 2 ++ src/norwegian/NumeralNor.gf | 16 ++++++++++++- src/nynorsk/NumeralNno.gf | 16 ++++++++++++- src/persian/CatPes.gf | 3 ++- src/persian/NounPes.gf | 1 + src/persian/NumeralPes.gf | 18 ++++++++++++-- src/polish/CatPol.gf | 1 + src/polish/NounPol.gf | 9 +------ src/polish/NumeralPol.gf | 22 +++++++++++++++++- src/portuguese/NumeralPor.gf | 16 ++++++++++++- src/punjabi/CatPnb.gf | 3 ++- src/punjabi/NounPnb.gf | 2 ++ src/punjabi/NumeralPnb.gf | 15 +++++++++++- src/romance/CatRomance.gf | 1 + src/romance/NounRomance.gf | 8 +------ src/romanian/CatRon.gf | 1 + src/romanian/NounRon.gf | 4 ++-- src/romanian/NumeralRon.gf | 17 +++++++++++++- src/rukiga/CatCgg.gf | 1 + src/rukiga/NounCgg.gf | 1 + src/rukiga/NumeralCgg.gf | 12 +++++++++- src/russian/CatRus.gf | 1 + src/russian/NounRus.gf | 8 +------ src/russian/NumeralRus.gf | 18 +++++++++++++- src/russian/v1/NumeralRus.gf | 2 ++ src/scandinavian/CatScand.gf | 1 + src/scandinavian/NounScand.gf | 8 +------ src/sindhi/CatSnd.gf | 1 + src/sindhi/NounSnd.gf | 1 + src/sindhi/NumeralSnd.gf | 3 ++- src/slovak/CatSlo.gf | 1 + src/slovak/NounSlo.gf | 1 + src/slovak/NumeralSlo.gf | 16 ++++++++++++- src/slovenian/CatSlv.gf | 2 ++ src/slovenian/NounSlv.gf | 10 +++++++- src/slovenian/NumeralSlv.gf | 20 +++++++++++++--- src/somali/CatSom.gf | 1 + src/somali/NumeralSom.gf | 15 +++++++++++- src/spanish/NumeralSpa.gf | 16 ++++++++++++- src/swahili/NumeralSwa.gf | 12 +++++++++- src/swedish/NumeralSwe.gf | 24 +++++++++++++++---- src/thai/CatTha.gf | 1 + src/thai/NounTha.gf | 1 + src/thai/NumeralTha.gf | 2 ++ src/turkish/CatTur.gf | 1 + src/turkish/NounTur.gf | 4 ++-- src/turkish/NumeralTur.gf | 17 +++++++++++++- src/urdu/NumeralUrd.gf | 15 +++++++++++- 147 files changed, 918 insertions(+), 188 deletions(-) diff --git a/src/abstract/Cat.gf b/src/abstract/Cat.gf index 93b7fa75..72bd5f58 100644 --- a/src/abstract/Cat.gf +++ b/src/abstract/Cat.gf @@ -93,6 +93,7 @@ abstract Cat = Common ** { Numeral ; -- cardinal or ordinal in words e.g. "five/fifth" Digits ; -- cardinal or ordinal in digits e.g. "1,000/1,000th" + Decimal ; -- decimal number e.g. "1/2/3.14/-1" --2 Structural words diff --git a/src/abstract/Noun.gf b/src/abstract/Noun.gf index ee4fc0cb..413eb3af 100644 --- a/src/abstract/Noun.gf +++ b/src/abstract/Noun.gf @@ -58,7 +58,7 @@ abstract Noun = Cat ** { data NumDigits : Digits -> Card ; -- 51 - NumFloat : Digits -> Digits -> Card ; -- 3.14 + NumDecimal : Decimal -> Card ; -- 3.14, -1, etc NumNumeral : Numeral -> Card ; -- fifty-one -- The construction of numerals is defined in [Numeral Numeral.html]. @@ -158,7 +158,6 @@ abstract Noun = Cat ** { --2 Quantities - QuantityNP : Digits -> MU -> NP ; - QuantityFloatNP : Digits -> Digits -> MU -> NP ; + QuantityNP : Decimal -> MU -> NP ; } diff --git a/src/abstract/Numeral.gf b/src/abstract/Numeral.gf index 01702b5c..be0d904e 100644 --- a/src/abstract/Numeral.gf +++ b/src/abstract/Numeral.gf @@ -17,7 +17,7 @@ -- parts of a numeral, which is often incorrect - more work on -- (un)lexing is needed to solve this problem. -abstract Numeral = Cat [Numeral,Digits] ** { +abstract Numeral = Cat [Numeral,Digits,Decimal] ** { cat Digit ; -- 2..9 @@ -53,18 +53,18 @@ data pot3 : Sub1000 -> Sub1000000 ; -- m * 1000 pot3plus : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n pot3as4 : Sub1000000 -> Sub1000000000 ; -- coercion of 1..999999 - pot3float : Float -> Sub1000000 ; -- 3.5 thousand + pot3decimal : Decimal -> Sub1000000 ; -- 3.5 thousand pot41 : Sub1000000000 ; -- a million instead of one million pot4 : Sub1000 -> Sub1000000000 ; -- m * 1000000000 pot4plus : Sub1000 -> Sub1000000 -> Sub1000000000 ; -- m * 1000000000 + n pot4as5 : Sub1000000000 -> Sub1000000000000 ; -- coercion of 1..999999999 - pot4float : Float -> Sub1000000000 ; -- 3.5 million + pot4decimal : Decimal -> Sub1000000000 ; -- 3.5 million pot51 : Sub1000000000000 ; -- a billion instead of one billion pot5 : Sub1000 -> Sub1000000000000 ; -- m * 1000000000 pot5plus : Sub1000 -> Sub1000000000 -> Sub1000000000000 ; -- m * 1000000000 + n - pot5float : Float -> Sub1000000000000 ; -- 3.5 billion + pot5decimal : Decimal -> Sub1000000000000 ; -- 3.5 billion -- Numerals as sequences of digits have a separate, simpler grammar @@ -77,4 +77,8 @@ data D_0, D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9 : Dig ; + PosDecimal : Digits -> Decimal ; -- 8 + NegDecimal : Digits -> Decimal ; -- -8 + IFrac : Decimal -> Dig -> Decimal ; -- 3.14 -> 3.141 + } diff --git a/src/afrikaans/CatAfr.gf b/src/afrikaans/CatAfr.gf index f26f6c55..27b5882a 100644 --- a/src/afrikaans/CatAfr.gf +++ b/src/afrikaans/CatAfr.gf @@ -62,6 +62,7 @@ concrete CatAfr of Cat = Numeral = {s : CardOrd => Str ; n : Number } ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/afrikaans/NounAfr.gf b/src/afrikaans/NounAfr.gf index a1667f70..b265c919 100644 --- a/src/afrikaans/NounAfr.gf +++ b/src/afrikaans/NounAfr.gf @@ -77,7 +77,7 @@ concrete NounAfr of Noun = CatAfr ** open ResAfr, Prelude in { NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; - NumFloat n1 n2 = {s = \\g,c => n1.s ! NCard Neutr Nom ++ BIND ++ "." ++ BIND ++ n1.s ! NCard g c; n = Pl } ; + NumDecimal dec = {s = \\g,c => dec.s ! NCard g c; n = dec.n } ; NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdNumeral numeral = {s = \\af => numeral.s ! NOrd af} ; @@ -185,10 +185,4 @@ concrete NounAfr of Noun = CatAfr ** open ResAfr, Prelude in { isPron = False } ; - QuantityFloatNP n1 n2 m = { - s = \\c => preOrPost m.isPre m.s (n1.s ! NCard Neutr Nom ++ BIND ++ "." ++ BIND ++ n1.s ! NCard Neutr Nom) ; - a = agrP3 Pl ; - isPron = False - } ; - } diff --git a/src/afrikaans/NumeralAfr.gf b/src/afrikaans/NumeralAfr.gf index 22202418..7fee53c7 100644 --- a/src/afrikaans/NumeralAfr.gf +++ b/src/afrikaans/NumeralAfr.gf @@ -1,5 +1,5 @@ -concrete NumeralAfr of Numeral = CatAfr [Numeral,Digits] ** open ResAfr, Prelude in { +concrete NumeralAfr of Numeral = CatAfr [Numeral,Digits,Decimal] ** open ResAfr, Prelude in { flags optimize = all_subs ; coding=utf8 ; @@ -75,6 +75,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! invNum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ; diff --git a/src/amharic/CatAmh.gf b/src/amharic/CatAmh.gf index 398a6261..ab1cd918 100644 --- a/src/amharic/CatAmh.gf +++ b/src/amharic/CatAmh.gf @@ -22,6 +22,7 @@ lincat Prep = ResAmh.Prep; Numeral = ResAmh.Numeral; --{s : CardOrd => Case => Str ; n : Number} ; Digits = ResAmh.Digits;--{s : CardOrd => Case => Str ; n : Number ; tail : DTail} ; + Decimal = ResAmh.Decimal; Ord = ResAmh.Ord ; --{ s : Case => Str } ; Num = ResAmh.Num;--{s : Case => Str ; n : Number ; hasCard : Bool} ; Card = ResAmh.Card;--{s : Case => Str ; n : Number} ; diff --git a/src/amharic/NounAmh.gf b/src/amharic/NounAmh.gf index c2816561..7ff5fb29 100644 --- a/src/amharic/NounAmh.gf +++ b/src/amharic/NounAmh.gf @@ -94,6 +94,7 @@ lin NumCard n = {s = \\s,c => n.s!Masc!Sg!s!c ; n = Pl; hasCard = True} ; NumDigits n = {s = n.s ! NCard } ; + NumDecimal n = {s = n.s ! NCard } ; NumNumeral numeral = {s = numeral.s ! NCard} ; diff --git a/src/amharic/NumeralAmh.gf b/src/amharic/NumeralAmh.gf index 79cad2e3..421227a2 100644 --- a/src/amharic/NumeralAmh.gf +++ b/src/amharic/NumeralAmh.gf @@ -1,5 +1,5 @@ -concrete NumeralAmh of Numeral = CatAmh [Numeral,Digits] ** open ResAmh,ParamX,Prelude in { +concrete NumeralAmh of Numeral = CatAmh [Numeral,Digits,Decimal] ** open ResAmh,ParamX,Prelude in { flags coding = utf8; lincat @@ -91,6 +91,18 @@ lin pot3plus n m = { D_8 = mkDig "8" ; D_9 = mk2Dig "9" "9ኛ"; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o,g,n,s,c => "-" ++ BIND ++ d.s !o!g!n!s!c ; + hasDot=False + } ; + IFrac d i = { + s = \\o,g,n,s,c => d.s!NCard!Masc!Sg!Indef!c ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! g ! n ! s ! c; + hasDot=True + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND++","++BIND ; diff --git a/src/amharic/ResAmh.gf b/src/amharic/ResAmh.gf index bea4c5bd..b21ec291 100644 --- a/src/amharic/ResAmh.gf +++ b/src/amharic/ResAmh.gf @@ -161,6 +161,10 @@ resource ResAmh = PatternsAmh** open Prelude,MorphoAmh,ParamX in { s : CardOrd=>Gender=>Number=>Species=>Case => Str ; tail : DTail } ; + Decimal = { + s : CardOrd=>Gender=>Number=>Species=>Case => Str ; + hasDot : Bool + } ; Ord = {s : Gender=>Number=>Species=>Case => Str} ; diff --git a/src/ancient_greek/CatGrc.gf b/src/ancient_greek/CatGrc.gf index 65cb892b..06dbfdec 100644 --- a/src/ancient_greek/CatGrc.gf +++ b/src/ancient_greek/CatGrc.gf @@ -90,6 +90,7 @@ concrete CatGrc of Cat = CommonX - [Temp,Tense] ** open ResGrc, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : Str ; unit : Unit} ; + Decimal = {s : Str ; unit : Unit ; hasDot : Bool} ; -- Structural diff --git a/src/ancient_greek/NounGrc.gf b/src/ancient_greek/NounGrc.gf index fa7b5d11..376e4e24 100644 --- a/src/ancient_greek/NounGrc.gf +++ b/src/ancient_greek/NounGrc.gf @@ -83,6 +83,8 @@ concrete NounGrc of Noun = CatGrc ** open Prelude, ResGrc, (M = MorphoGrc) in { -- TODO: check the following two: NumDigits digits = let num : Number = case digits.unit of {one => Sg ; _ => Pl} in {s = \\g,c => digits.s ++ "'"; n = num ; isCard = True} ; + NumDecimal digits = let num : Number = case digits.unit of {one => Sg ; _ => Pl} + in {s = \\g,c => digits.s ++ "'"; n = num ; isCard = True} ; NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; AdNum adn num = {s = \\g,c => adn.s ++ num.s ! g ! c ; n = num.n} ; diff --git a/src/ancient_greek/NumeralGrc.gf b/src/ancient_greek/NumeralGrc.gf index a1042a30..42dfcb8d 100644 --- a/src/ancient_greek/NumeralGrc.gf +++ b/src/ancient_greek/NumeralGrc.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../prelude: -concrete NumeralGrc of Numeral = CatGrc ** open ResGrc, MorphoGrc in { +concrete NumeralGrc of Numeral = CatGrc ** open ResGrc, MorphoGrc, Prelude in { lincat Digit = {s : DForm => CardOrd => Str} ; @@ -81,6 +81,8 @@ lin -- mkDigit d (d+10) (d*10) d-th d-times D_8 = mkDig "h" "p" "w" ; D_9 = mkDig "v" "K" "P" ; -- TODO: replace K by koppa, P by sampi (not in ut -ancientgreek) + PosDecimal d = d ** {hasDot=False} ; + oper TDigit = { s : Unit => Str diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 10fcfb70..222c798b 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -67,6 +67,8 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { n : Size } ; Digits = {s : Str; n : Size}; + Decimal = {s : Str; + n : Size; hasDot : Bool}; -- Structural diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index e22f7c99..8af8ce0b 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -130,6 +130,10 @@ lin s = \\_,_,_ => digits.s ; isNum = True }; + NumDecimal dec = dec ** { + s = \\_,_,_ => dec.s ; + isNum = True + }; NumNumeral numeral = numeral ** { s = numeral.s ! NCard ; diff --git a/src/arabic/NumeralAra.gf b/src/arabic/NumeralAra.gf index fd510469..1fe70634 100644 --- a/src/arabic/NumeralAra.gf +++ b/src/arabic/NumeralAra.gf @@ -1,4 +1,4 @@ -concrete NumeralAra of Numeral = CatAra [Numeral,Digits] ** +concrete NumeralAra of Numeral = CatAra [Numeral,Digits,Decimal] ** open Predef, Prelude, ResAra, MorphoAra in { flags coding=utf8 ; @@ -136,6 +136,20 @@ lincat D_8 = mk1Dig "8" ; D_9 = mk1Dig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s; + n = ThreeTen ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + n = ThreeTen ; + hasDot=True + } ; + oper diff --git a/src/bantu/CatBantu.gf b/src/bantu/CatBantu.gf index 0f810524..9f014c39 100644 --- a/src/bantu/CatBantu.gf +++ b/src/bantu/CatBantu.gf @@ -61,7 +61,8 @@ incomplete concrete CatBantu of Cat = Numeral = {s : CardOrd => Gender => Str ; n : Number} ; - Digits = {s : CardOrd => Gender => Str ; n : Number} ; + Digits = {s : CardOrd => Gender => Str ; n : Number} ; + Decimal = {s : CardOrd => Gender => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/bantu/NounBantu.gf b/src/bantu/NounBantu.gf index 847d3598..8da208d6 100644 --- a/src/bantu/NounBantu.gf +++ b/src/bantu/NounBantu.gf @@ -77,6 +77,7 @@ lin NumCard n = n ;--** {hasCard = True} ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = { s = n.s ! NOrd} ; NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; diff --git a/src/basque/CatEus.gf b/src/basque/CatEus.gf index 7ef71011..28687c0c 100644 --- a/src/basque/CatEus.gf +++ b/src/basque/CatEus.gf @@ -85,6 +85,7 @@ concrete CatEus of Cat = CommonX ** open ResEus, Prelude in { Numeral = { s : Str ; n : Number } ; Digits = { s : CardOrd => Str ; n : Number } ; + Decimal = { s : CardOrd => Str ; n : Number ; hasDot : Bool} ; diff --git a/src/basque/NounEus.gf b/src/basque/NounEus.gf index ceef7e74..5efb55ce 100644 --- a/src/basque/NounEus.gf +++ b/src/basque/NounEus.gf @@ -125,6 +125,7 @@ concrete NounEus of Noun = CatEus ** open ResEus, Prelude in { -- : Digits -> Card ; NumDigits dig = { s = dig.s ! NCard ; n = dig.n } ; + NumDecimal dec = { s = dec.s ! NCard ; n = dec.n } ; -- : Numeral -> Card ; NumNumeral num = num ; @@ -260,4 +261,4 @@ concrete NounEus of Noun = CatEus ** open ResEus, Prelude in { oper elative : NP -> Str = \np -> glue (np.s ! LocStem) "rik" ; -} \ No newline at end of file +} diff --git a/src/basque/NumeralEus.gf b/src/basque/NumeralEus.gf index 91392fe4..69d6cb73 100644 --- a/src/basque/NumeralEus.gf +++ b/src/basque/NumeralEus.gf @@ -1,4 +1,4 @@ -concrete NumeralEus of Numeral = CatEus [Numeral,Digits] ** open Prelude, ResEus, ParamX in { +concrete NumeralEus of Numeral = CatEus [Numeral,Digits,Decimal] ** open Prelude, ResEus, ParamX in { oper LinDigit : Type = { s : DForm => Str ; n : Number ; @@ -112,5 +112,18 @@ lin D_9 = mkDig "9" ; lin IDig dig = dig ; -- : Dig -> Digits -> Digits ; lin IIDig dig digs = digs ** {s = \\co => glue (dig.s ! co) (digs.s ! co) } ; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { + s = \\co => glue "-" (d.s ! co) ; + n = Pl ; + hasDot=False + } ; +lin IFrac d i = { + s = \\co => d.s ! co ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! co ; + n = Pl ; + hasDot=False + } ; } diff --git a/src/bulgarian/CatBul.gf b/src/bulgarian/CatBul.gf index 4eec21ca..08d922b9 100644 --- a/src/bulgarian/CatBul.gf +++ b/src/bulgarian/CatBul.gf @@ -64,6 +64,7 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, ( Numeral = {s : CardOrd => Str; n : Number} ; Digits = {s : CardOrd => Str; n : Number; tail : DTail} ; + Decimal = {s : CardOrd => Str; n : Number; hasDot : Bool} ; -- Structural diff --git a/src/bulgarian/NounBul.gf b/src/bulgarian/NounBul.gf index bab08547..0dd9715f 100644 --- a/src/bulgarian/NounBul.gf +++ b/src/bulgarian/NounBul.gf @@ -116,10 +116,9 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in { NumCard n = {s=n.s; nn=n.nn; nonEmpty = True} ; NumDigits n = {s = \\gspec => n.s ! NCard gspec; nn = case n.n of {Sg => NNum Sg; Pl => NCountable}} ; + NumDecimal n = {s = \\gspec => n.s ! NCard gspec; nn = case n.n of {Sg => NNum Sg; Pl => NCountable}} ; OrdDigits n = {s = \\aform => n.s ! NOrd aform} ; - NumFloat n1 n2 = {s = \\gspec => n1.s ! NCard (CFMasc Indef NonHuman) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard gspec ; nn = NCountable} ; - NumNumeral numeral = {s = \\gspec => numeral.s ! NCard gspec; nn = case numeral.n of {Sg => NNum Sg; Pl => NCountable}} ; OrdNumeral numeral = {s = \\aform => numeral.s ! NOrd aform} ; @@ -247,10 +246,4 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in { p = NounP3 Pos } ; - QuantityFloatNP n1 n2 m = { - s = \\role => preOrPost m.isPre m.s (n1.s ! NCard (CFMasc Indef NonHuman) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (CFMasc Indef NonHuman)) ; - gn = gennum (AMasc NonHuman) Pl ; - p = NounP3 Pos - } ; - } diff --git a/src/bulgarian/NumeralBul.gf b/src/bulgarian/NumeralBul.gf index 170351fd..149e2362 100644 --- a/src/bulgarian/NumeralBul.gf +++ b/src/bulgarian/NumeralBul.gf @@ -1,5 +1,5 @@ --# -coding=utf8 -concrete NumeralBul of Numeral = CatBul [Numeral,Digits] ** open Prelude, ResBul in { +concrete NumeralBul of Numeral = CatBul [Numeral,Digits,Decimal] ** open Prelude, ResBul in { flags coding=utf8 ; @@ -97,8 +97,11 @@ lin pot3plus n m = { n = Pl } ; lin pot3as4 n = n ; -lin pot3float f = { - s = \\c,nf => f.s ++ mkCardOrd100 "хиляди" "хилядите" "хиляден" ! c ; +lin pot3decimal d = { + s = \\c,nf => case d.n of { + Sg => mkCardOrd100 "хиляда" "хилядата" "хиляден" ! NCard (CFMasc Indef NonHuman) ; + Pl => d.s ! NCard (CFFem Indef) ++ mkCardOrd100 "хиляди" "хилядите" "хиляден" ! c + } ; n = Pl } ; @@ -118,8 +121,17 @@ lin pot4plus n1 n2 = { n = Pl } ; lin pot4as5 n = n ; -lin pot4float f = { - s = \\c,nf => f.s ++ mkCardOrd100 "милиона" "милиона" "милионен" ! c ; +lin pot4decimal d = { + s = \\c,nf => case c of { + NCard (CFMasc s a) => d.s ! NCard (CFMasc s NonHuman) ; + NCard (CFMascDefNom a) => d.s ! NCard (CFMascDefNom NonHuman) ; + NCard cf => d.s ! NCard cf ; + NOrd _ => d.s ! NCard (CFMasc Indef NonHuman) + } ++ + case d.n of { + Sg => "милион" ; + Pl => "милиона" + } ; n = Pl } ; @@ -138,8 +150,12 @@ lin pot5plus n1 n2 = { s = \\o,f => (pot5 n1).s ! o ! f ++ "и" ++ n2.s ! o ! f; n = Pl } ; -lin pot5float f = { - s = \\c,nf => f.s ++ mkCardOrd100 "милиярда" "милиярда" "милиярден" ! c ; +lin pot5decimal d = { + s = \\c,nf => d.s ! NCard (CFFem Indef) ++ + case d.n of { + Sg => mkCardOrd100 "милиярд" "милиярда" "милиярден" ! c ; + Pl => mkCardOrd100 "милиярди" "милиярдите" "милиярден" ! c + } ; n = Pl } ; @@ -168,6 +184,16 @@ lin pot5float f = { D_8 = mk3Dig "8" "8на" "8ми" Pl ; D_9 = mk3Dig "9" "9има" "9ти" Pl ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o=>"-" ++ BIND ++ d.s ! o; hasDot=False; n = Pl} ; + IFrac d i = { + s = \\o => d.s ! NCard (CFMasc Indef NonHuman) ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper spaceIf : DTail -> Str = \t -> case t of { T3 => SOFT_BIND ; diff --git a/src/catalan/NumeralCat.gf b/src/catalan/NumeralCat.gf index 1d5f6938..374ba782 100644 --- a/src/catalan/NumeralCat.gf +++ b/src/catalan/NumeralCat.gf @@ -1,4 +1,4 @@ -concrete NumeralCat of Numeral = CatCat [Numeral,Digits] ** +concrete NumeralCat of Numeral = CatCat [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoCat, Prelude in { flags coding=utf8 ; @@ -158,6 +158,20 @@ param D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":o") ; diff --git a/src/chinese/CatChi.gf b/src/chinese/CatChi.gf index 74c0d2c4..7caa895e 100644 --- a/src/chinese/CatChi.gf +++ b/src/chinese/CatChi.gf @@ -57,6 +57,7 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu Numeral = {s,p : Str} ; Card, Digits = {s : Str} ; + Decimal = {s : Str ; hasDot : Bool} ; -- Structural diff --git a/src/chinese/NounChi.gf b/src/chinese/NounChi.gf index 9912791e..30cd7dde 100644 --- a/src/chinese/NounChi.gf +++ b/src/chinese/NounChi.gf @@ -62,6 +62,7 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in { NumCard n = n ** {numType = NTFull} ; NumDigits d = d ** {numType = NTFull} ; + NumDecimal d = d ** {numType = NTFull} ; OrdDigits d = {s = ordinal_s ++ d.s} ; NumNumeral numeral = {s = numeral.p} ; -- liang instead of yi diff --git a/src/chinese/NumeralChi.gf b/src/chinese/NumeralChi.gf index 52bb9076..71df8d7f 100644 --- a/src/chinese/NumeralChi.gf +++ b/src/chinese/NumeralChi.gf @@ -1,4 +1,4 @@ -concrete NumeralChi of Numeral = CatChi [Numeral,Digits] ** open ResChi, Prelude in { +concrete NumeralChi of Numeral = CatChi [Numeral,Digits,Decimal] ** open ResChi, Prelude in { flags coding = utf8 ; @@ -162,4 +162,16 @@ lin pot4as5 n = n ; D_8 = ss "8" ; D_9 = ss "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + hasDot=False + } ; + IFrac d i = { + s=d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + hasDot=True + } ; + } diff --git a/src/chinese/pinyin/NumeralChi.gf b/src/chinese/pinyin/NumeralChi.gf index bcaf6892..7769d362 100644 --- a/src/chinese/pinyin/NumeralChi.gf +++ b/src/chinese/pinyin/NumeralChi.gf @@ -160,4 +160,16 @@ lin pot3plus n m = D_8 = ss "8" ; D_9 = ss "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + hasDot=False + } ; + IFrac d i = { + s=d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + hasDot=True + } ; + } diff --git a/src/croatian/CatHrv.gf b/src/croatian/CatHrv.gf index 065e479b..16745d89 100644 --- a/src/croatian/CatHrv.gf +++ b/src/croatian/CatHrv.gf @@ -68,5 +68,6 @@ concrete CatHrv of Cat = lincat Numeral = {s : AdjForms ; size : NumSize} ; lincat Digits = {s : Str ; size : NumSize} ; + lincat Decimal = {s : Str ; size : NumSize ; hasDot : Bool} ; } diff --git a/src/croatian/NounHrv.gf b/src/croatian/NounHrv.gf index ee4faf67..7a83d73a 100644 --- a/src/croatian/NounHrv.gf +++ b/src/croatian/NounHrv.gf @@ -89,6 +89,7 @@ lin NumCard c = c ; NumDigits ds = ds ** {s = \\_,_ => ds.s} ; + NumDecimal dec = dec ** {s = \\_,_ => dec.s} ; NumNumeral nu = { s = \\g,c => (adjFormsAdjective nu.s).s ! g ! Sg ! c ; ---- TODO Sg? size = nu.size diff --git a/src/croatian/NumeralHrv.gf b/src/croatian/NumeralHrv.gf index 40756b3e..64ac816e 100644 --- a/src/croatian/NumeralHrv.gf +++ b/src/croatian/NumeralHrv.gf @@ -1,6 +1,6 @@ concrete NumeralHrv of Numeral = - CatHrv [Numeral, Digits] ** + CatHrv [Numeral, Digits, Decimal] ** open ResHrv, @@ -125,6 +125,20 @@ oper mkThousand : Str -> NumSize -> Str = \attr,size -> IIDig d dd = {s = d.s ++ Predef.BIND ++ dd.s ; size = dd.size} ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ Predef.BIND ++ d.s ; + size = d.size ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + size = d.size ; + hasDot=True + } ; + D_0 = { s = "0" ; size = NS_1} ; ---- ?? D_1 = { s = "1" ; size = NS_1} ; D_2 = { s = "2" ; size = NS_2_4} ; diff --git a/src/czech/CatCze.gf b/src/czech/CatCze.gf index 31f01a73..04166930 100644 --- a/src/czech/CatCze.gf +++ b/src/czech/CatCze.gf @@ -66,6 +66,7 @@ concrete CatCze of Cat = lincat Numeral = Determiner ; ---- TODO: should contain Ord as well lincat Digits = {s:Str ; size : NumSize} ; + lincat Decimal = {s:Str ; size : NumSize ; hasDot : Bool} ; } diff --git a/src/czech/NounCze.gf b/src/czech/NounCze.gf index 4bc4d231..6b31f8f7 100644 --- a/src/czech/NounCze.gf +++ b/src/czech/NounCze.gf @@ -96,6 +96,7 @@ lin NumCard c = c ; NumDigits ds = ds ** {s = \\_,_ => ds.s} ; + NumDecimal ds = ds ** {s = \\_,_ => ds.s} ; NumNumeral nu = nu ; diff --git a/src/czech/NumeralCze.gf b/src/czech/NumeralCze.gf index c9a7a333..ece5fd5a 100644 --- a/src/czech/NumeralCze.gf +++ b/src/czech/NumeralCze.gf @@ -1,6 +1,6 @@ concrete NumeralCze of Numeral = - CatCze [Numeral,Digits] ** + CatCze [Numeral,Digits,Decimal] ** open ResCze, @@ -117,4 +117,18 @@ oper determinerStr : Determiner -> Str = \d -> d.s ! Masc Anim ! Nom ; D_8 = { s = "8" ; size = Num5} ; D_9 = { s = "9" ; size = Num5} ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ Predef.BIND ++ d.s ; + size = Num5 ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + size = Num5 ; + hasDot=True + } ; + } diff --git a/src/danish/NumeralDan.gf b/src/danish/NumeralDan.gf index 3e8a84f2..c817b0ce 100644 --- a/src/danish/NumeralDan.gf +++ b/src/danish/NumeralDan.gf @@ -1,4 +1,4 @@ -concrete NumeralDan of Numeral = CatDan [Numeral,Digits] ** open MorphoDan,Prelude in { +concrete NumeralDan of Numeral = CatDan [Numeral,Digits,Decimal] ** open MorphoDan,Prelude in { flags coding=utf8 ; @@ -67,6 +67,20 @@ lin n9 = mkTal "ni" "nitten" "halvfems" "niende" "halvfemsindstyvende" ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s=\\o=>d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + hasDot=True; + n = Pl + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/dutch/CatDut.gf b/src/dutch/CatDut.gf index 85bdb995..b72a8bfb 100644 --- a/src/dutch/CatDut.gf +++ b/src/dutch/CatDut.gf @@ -59,6 +59,7 @@ concrete CatDut of Cat = Numeral = {s : CardOrd => Str ; n : Number } ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/dutch/NounDut.gf b/src/dutch/NounDut.gf index c8242b4c..84972558 100644 --- a/src/dutch/NounDut.gf +++ b/src/dutch/NounDut.gf @@ -85,7 +85,7 @@ concrete NounDut of Noun = CatDut ** open ResDut, Prelude in { NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; - NumFloat n1 n2 = {s = \\g,c => n1.s ! NCard Utr Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard g c; n = Pl } ; + NumDecimal numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdNumeral numeral = {s = let tiende : AForm => Str = \\af => numeral.s ! NOrd af @@ -207,10 +207,4 @@ concrete NounDut of Noun = CatDut ** open ResDut, Prelude in { isPron = False } ; - QuantityFloatNP n1 n2 m = noMerge ** { - s = \\role => preOrPost m.isPre m.s (n1.s ! NCard Utr Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard Utr Nom) ; - a = agrP3 Pl ; - isPron = False - } ; - } diff --git a/src/dutch/NumeralDut.gf b/src/dutch/NumeralDut.gf index 00697295..f13fdfb8 100644 --- a/src/dutch/NumeralDut.gf +++ b/src/dutch/NumeralDut.gf @@ -1,4 +1,4 @@ -concrete NumeralDut of Numeral = CatDut [Numeral,Digits] ** open ResDut, Prelude in { +concrete NumeralDut of Numeral = CatDut [Numeral,Digits,Decimal] ** open ResDut, Prelude in { flags optimize = all_subs ; coding=utf8 ; @@ -74,6 +74,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! invNum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ; diff --git a/src/egekusii/NumeralGus.gf b/src/egekusii/NumeralGus.gf index b149a100..0fec9444 100644 --- a/src/egekusii/NumeralGus.gf +++ b/src/egekusii/NumeralGus.gf @@ -71,6 +71,20 @@ lin pot3plus n m = { s = table { D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o,g => "-" ++ BIND ++ d.s ! o ! g ; + n = Pl + hasDot=False + } ; + IFrac d i = { + s = \\o,g => d.s ! NCard ! g ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! g; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c ) ; diff --git a/src/english/CatEng.gf b/src/english/CatEng.gf index 18c30b0c..35bfc2d2 100644 --- a/src/english/CatEng.gf +++ b/src/english/CatEng.gf @@ -81,6 +81,7 @@ concrete CatEng of Cat = CommonX - [Pol,CAdv] ** open ResEng, Prelude in { Numeral = {s : Bool => CardOrd => Case => Str ; n : Number} ; Digits = {s : CardOrd => Case => Str ; n : Number ; tail : DTail} ; + Decimal = {s : CardOrd => Case => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/english/DocumentationEng.gf b/src/english/DocumentationEng.gf index c4c66eee..7df89b43 100644 --- a/src/english/DocumentationEng.gf +++ b/src/english/DocumentationEng.gf @@ -1,6 +1,7 @@ --# -path=.:../abstract:../common concrete DocumentationEng of Documentation = CatEng ** open - ResEng, Prelude, + ResEng, + Prelude, HTML in { lincat diff --git a/src/english/NounEng.gf b/src/english/NounEng.gf index c95f9a85..760460e9 100644 --- a/src/english/NounEng.gf +++ b/src/english/NounEng.gf @@ -77,7 +77,7 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in { NumDigits n = {s,sp = \\_ => n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd} ; - NumFloat n1 n2 = {s,sp = \\_,c => n1.s ! NCard ! Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard ! c ; n = Pl} ; + NumDecimal d = {s,sp = \\_ => d.s ! NCard ; n = d.n} ; NumNumeral numeral = {s,sp = \\d => numeral.s ! d ! NCard; n = numeral.n} ; OrdNumeral numeral = {s = numeral.s ! True ! NOrd} ; @@ -181,9 +181,4 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in { a = agrgP3 n.n Neutr } ; - QuantityFloatNP n1 n2 m = { - s = \\c => preOrPost m.isPre m.s (n1.s ! NCard ! Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard ! Nom) ; - a = agrgP3 Pl Neutr - } ; - } diff --git a/src/english/NumeralEng.gf b/src/english/NumeralEng.gf index 999da63d..e71e80bd 100644 --- a/src/english/NumeralEng.gf +++ b/src/english/NumeralEng.gf @@ -1,4 +1,4 @@ -concrete NumeralEng of Numeral = CatEng [Numeral,Digits] ** open Prelude, ResEng in { +concrete NumeralEng of Numeral = CatEng [Numeral,Digits,Decimal] ** open Prelude, ResEng in { lincat Digit = {s : DForm => CardOrd => Case => Str} ; @@ -57,8 +57,8 @@ lin pot3 n = { lin pot3plus n m = { s = \\d,o,c => n.s ! d ! NCard ! Nom ++ "thousand" ++ m.s ! False ! o ! c; n = Pl} ; lin pot3as4 n = n ; -lin pot3float f = { - s = \\d,o,c => f.s ++ mkCard o "thousand" ! c ; n = Pl} ; +lin pot3decimal f = { + s = \\d,o,c => f.s ! NCard ! Nom ++ mkCard o "thousand" ! c ; n = Pl} ; lin pot41 = { s = \\d,o,c => case d of {True => []; False => "a"} ++ @@ -74,8 +74,8 @@ lin pot4plus n1 n2 = { n = Pl } ; lin pot4as5 n = n ; -lin pot4float f = { - s = \\d,o,c => f.s ++ pot41.s ! True ! o ! c ; n = Pl} ; +lin pot4decimal f = { + s = \\d,o,c => f.s ! NCard ! Nom ++ pot41.s ! True ! o ! c ; n = Pl} ; lin pot51 = { s = \\d,o,c => case d of {True => []; False => "a"} ++ @@ -90,8 +90,8 @@ lin pot5plus n1 n2 = { s = \\d,o,c => n1.s ! d ! NCard ! Nom ++ pot51.s ! True ! NCard ! Nom ++ "and" ++ n2.s ! True ! o ! c; n = Pl } ; -lin pot5float f = { - s = \\d,o,c => f.s ++ pot51.s ! True ! o ! c ; n = Pl} ; +lin pot5decimal f = { + s = \\d,o,c => f.s ! NCard ! Nom ++ pot51.s ! True ! o ! c ; n = Pl} ; -- numerals as sequences of digits @@ -118,6 +118,16 @@ lin pot5float f = { D_8 = mkDig "8" ; D_9 = mkDig "9" ; +lin PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o,c=>"-" ++ BIND ++ d.s ! o ! c; hasDot=False; n = Pl} ; + IFrac d i = { + s=\\o,c=>d.s ! NCard ! Nom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! c ; + hasDot=True; + n = Pl + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND ++ "," ++ BIND ; diff --git a/src/estonian/CatEst.gf b/src/estonian/CatEst.gf index c019747e..a1338df1 100644 --- a/src/estonian/CatEst.gf +++ b/src/estonian/CatEst.gf @@ -63,6 +63,7 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/estonian/NounEst.gf b/src/estonian/NounEst.gf index 68bff0c8..96e4489d 100644 --- a/src/estonian/NounEst.gf +++ b/src/estonian/NounEst.gf @@ -120,9 +120,9 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in } ; OrdDigits numeral = {s = \\nc => numeral.s ! NOrd nc} ; - NumFloat n1 n2 = { - s = \\n,c => n1.s ! NCard (NCase Sg Nom) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (NCase n c) ; - n = Pl + NumDecimal numeral = { + s = \\n,c => numeral.s ! NCard (NCase n c) ; + n = numeral.n } ; NumNumeral numeral = { @@ -225,12 +225,6 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in isPron = False } ; - QuantityFloatNP n1 n2 m = emptyNP ** { - s = \\role => preOrPost m.isPre m.s (n1.s ! NCard (NCase Sg Nom) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (NCase Sg Nom)) ; - a = agrP3 Pl ; - isPron = False - } ; - oper numN : NForm -> Number = \nf -> case nf of { NCase n _ => n diff --git a/src/estonian/NumeralEst.gf b/src/estonian/NumeralEst.gf index db30ad22..712f5f12 100644 --- a/src/estonian/NumeralEst.gf +++ b/src/estonian/NumeralEst.gf @@ -1,4 +1,4 @@ -concrete NumeralEst of Numeral = CatEst [Numeral,Digits] ** open Prelude, ParadigmsEst, MorphoEst in { +concrete NumeralEst of Numeral = CatEst [Numeral,Digits,Decimal] ** open Prelude, ParadigmsEst, MorphoEst in { -- Notice: possessive forms are not used. They get wrong, since every -- part is made to agree in them. @@ -146,6 +146,20 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard (NCase Sg Nom) ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=False + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o MorphoEst.Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ".") ; diff --git a/src/finnish/CatFin.gf b/src/finnish/CatFin.gf index 49f5ca19..7e93e5b4 100644 --- a/src/finnish/CatFin.gf +++ b/src/finnish/CatFin.gf @@ -72,6 +72,7 @@ concrete CatFin of Cat = CommonX ** open ResFin, StemFin, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/finnish/NounFin.gf b/src/finnish/NounFin.gf index 3aeb46d1..8743cb41 100644 --- a/src/finnish/NounFin.gf +++ b/src/finnish/NounFin.gf @@ -143,9 +143,9 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in } ; OrdDigits numeral = {s = \\f => numeral.s ! NOrd f} ; - NumFloat n1 n2 = { - s = \\n,c => n1.s ! NCard (NCase Sg Nom) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (NCase n c) ; - n = Pl + NumDecimal numeral = { + s = \\n,c => numeral.s ! NCard (NCase n c) ; + n = numeral.n } ; NumNumeral numeral = { @@ -303,13 +303,6 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in isNeg = False } ; - QuantityFloatNP n1 n2 m = { - s = \\role => preOrPost m.isPre m.s (n1.s ! NCard (NCase Sg Nom) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (NCase Sg Nom)) ; - a = agrP3 Pl ; - isPron = False ; - isNeg = False - } ; - oper numN : NForm -> Number = \nf -> case nf of { NCase n _ => n ; diff --git a/src/finnish/NumeralFin.gf b/src/finnish/NumeralFin.gf index b182c1b8..2e136b3e 100644 --- a/src/finnish/NumeralFin.gf +++ b/src/finnish/NumeralFin.gf @@ -1,4 +1,4 @@ -concrete NumeralFin of Numeral = CatFin [Numeral,Digits] ** open Prelude, ParadigmsFin, MorphoFin, StemFin in { +concrete NumeralFin of Numeral = CatFin [Numeral,Digits,Decimal] ** open Prelude, ParadigmsFin, MorphoFin, StemFin in { -- Notice: possessive forms are not used. They get wrong, since every -- part is made to agree in them. @@ -73,10 +73,10 @@ lin s = \\c => d.s ! NumAttr ! c ++ nBIND d.n ++ tuhattaN.s ! d.n ! c ++ e.s ! NumIndep ! c } ; pot3as4 n = n ; - pot3float f = {n = Pl ; s = \\c => f.s ++ BIND ++ tuhattaN.s ! Pl ! c} ; + pot3decimal d = {n = Pl ; s = \\c => d.s ! NCard (NCase Sg Nom) ++ BIND ++ tuhattaN.s ! Pl ! c} ; pot4as5 n = n ; - pot4float f = {n = Pl ; s = \\c => f.s ++ "miljoonaa"} ; -- KA: case inflection missing + pot4decimal d = {n = Pl ; s = \\c => d.s ! NCard (NCase Sg Nom) ++ "miljoonaa"} ; -- KA: case inflection missing pot51 = {n = Pl ; s = \\c => "miljardi"} ; -- KA: case inflection missing @@ -180,6 +180,20 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard (NCase Sg Nom) ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=False + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o MorphoFin.Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ".") ; diff --git a/src/french/NumeralFre.gf b/src/french/NumeralFre.gf index 5e667d8b..56e505cf 100644 --- a/src/french/NumeralFre.gf +++ b/src/french/NumeralFre.gf @@ -1,4 +1,4 @@ -concrete NumeralFre of Numeral = CatFre [Numeral,Digits] ** +concrete NumeralFre of Numeral = CatFre [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoFre, Prelude in { flags coding=utf8 ; @@ -171,6 +171,20 @@ oper hyphen = BIND ++ "-" ++ BIND ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "ème") ; diff --git a/src/german/CatGer.gf b/src/german/CatGer.gf index 1577cc13..5082cf56 100644 --- a/src/german/CatGer.gf +++ b/src/german/CatGer.gf @@ -88,6 +88,7 @@ concrete CatGer of Cat = Numeral = {s : CardOrd => Str ; n : Number } ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index 89ce277f..9de307d2 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -117,7 +117,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; - NumFloat dig1 dig2 = {s = \\g,c => dig1.s ! invNum ++ BIND ++ "." ++ BIND ++ dig2.s ! NCard g c ; n = Pl } ; + NumDecimal numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdNumeral numeral = {s = \\af => numeral.s ! NOrd af} ; @@ -262,12 +262,4 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { ext = "" ; } ; - QuantityFloatNP dig1 dig2 m = { - s = \\_,c => preOrPost m.isPre m.s (dig1.s ! invNum ++ BIND ++ "." ++ BIND ++ dig2.s ! invNum) ; - a = agrP3 Pl ; - w = WLight ; - rc = "" ; - ext = "" ; - } ; - } diff --git a/src/german/NumeralGer.gf b/src/german/NumeralGer.gf index befad3c5..a9b3e267 100644 --- a/src/german/NumeralGer.gf +++ b/src/german/NumeralGer.gf @@ -1,4 +1,4 @@ -concrete NumeralGer of Numeral = CatGer [Numeral,Digits] ** open MorphoGer, Prelude in { +concrete NumeralGer of Numeral = CatGer [Numeral,Digits,Decimal] ** open MorphoGer, Prelude in { flags optimize = all_subs ; coding=utf8 ; @@ -50,12 +50,12 @@ lin pot3plus n m = {s = \\g => multiple n.s n.n ++ "tausend" ++ m.s ! g ; n = Pl} ; pot3as4 n = n ; - pot3float f = {s = \\g => - f.s ++ cardOrd "tausend" "tausendte" ! g ; n = Pl} ; ---- + pot3decimal d = {s = \\g => + d.s ! invNum ++ cardOrd "tausend" "tausendte" ! g ; n = Pl} ; ---- pot4as5 n = n ; - pot4float f = {s = \\g => - f.s ++ cardOrd "Millionen" "Millionte" ! g ; n = Pl} ; ---- + pot4decimal d = {s = \\g => + d.s ! invNum ++ cardOrd "Millionen" "Millionte" ! g ; n = Pl} ; ---- pot51 = {s = \\g => "einer Milliarde"; n = Pl} ; -- KA: case inflection missing @@ -88,6 +88,20 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s=\\o=>d.s ! invNum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ; diff --git a/src/greek/CatGre.gf b/src/greek/CatGre.gf index 69772dc3..7b49c7b1 100644 --- a/src/greek/CatGre.gf +++ b/src/greek/CatGre.gf @@ -68,6 +68,8 @@ concrete CatGre of Cat = CommonGre ** open ResGre, Prelude in { Numeral = {s : CardOrd => Str ; n : Number } ; Digits = {s : CardOrd => Str ; n : Number} ; + + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/greek/NounGre.gf b/src/greek/NounGre.gf index 689faff5..58bee560 100644 --- a/src/greek/NounGre.gf +++ b/src/greek/NounGre.gf @@ -111,6 +111,7 @@ concrete NounGre of Noun = CatGre ** open ResGre, ParadigmsGre, Prelude in { NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; + NumDecimal numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; AdNum adn num = {s = \\g,c => adn.s ++ num.s!g!c; n = num.n } ; @@ -244,4 +245,4 @@ concrete NounGre of Noun = CatGre ** open ResGre, ParadigmsGre, Prelude in { -} \ No newline at end of file +} diff --git a/src/greek/NumeralGre.gf b/src/greek/NumeralGre.gf index b898da1c..1c3eddd1 100644 --- a/src/greek/NumeralGre.gf +++ b/src/greek/NumeralGre.gf @@ -1,4 +1,4 @@ -concrete NumeralGre of Numeral = CatGre [Numeral,Digits] ** open ResGre,Prelude in { +concrete NumeralGre of Numeral = CatGre [Numeral,Digits,Decimal] ** open ResGre,Prelude in { flags coding= utf8 ; @@ -291,6 +291,20 @@ Xilias : CardOrd -> (CardOrd => Str) -> Number -> Str = \co,d,n -> D_8 = mk2Dig "8" Pl; D_9 = mk2Dig "9" Pl ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Neut Nom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=False + } ; + oper mk3Dig : Str -> Number -> TDigit = \c,n -> { diff --git a/src/greenlandic/NumeralKal.gf b/src/greenlandic/NumeralKal.gf index b5a96844..88bf6bb4 100644 --- a/src/greenlandic/NumeralKal.gf +++ b/src/greenlandic/NumeralKal.gf @@ -89,6 +89,20 @@ lin pot1 d = {s = \\nf => d.s ! NInstr ++ "qulillit"} ; ---- inflection of quli D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/hebrew/CatHeb.gf b/src/hebrew/CatHeb.gf index 83a1b9bf..256505d0 100644 --- a/src/hebrew/CatHeb.gf +++ b/src/hebrew/CatHeb.gf @@ -34,6 +34,7 @@ concrete CatHeb of Cat = CommonX - [Utt,Tense,Temp] ** open ResHeb, Prelude, Pa A2 = {s : Str} ; Conj = {s : Str} ; Digits = {s : Str} ; +Decimal = {s : Str; hasDot : Bool} ; IComp = {s : Str} ; IDet = {s : Str} ; IP = {s : Str} ; diff --git a/src/hindi/NumeralHin.gf b/src/hindi/NumeralHin.gf index 4818d26a..8775ebcf 100644 --- a/src/hindi/NumeralHin.gf +++ b/src/hindi/NumeralHin.gf @@ -2,7 +2,7 @@ -- Modification for Urdu Shafqat Virk -concrete NumeralHin of Numeral = CatHin [Numeral,Digits] ** open ResHin,CommonHindustani,ParamX, Prelude in { +concrete NumeralHin of Numeral = CatHin [Numeral,Digits,Decimal] ** open ResHin,CommonHindustani,ParamX, Prelude in { flags coding=utf8 ; param DForm = unit | ten ; @@ -110,6 +110,7 @@ lin D_8 = { s = "८" ; n = Pl}; lin D_9 = { s = "९" ; n = Pl}; lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue (dg.s ! df) d.s ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; oper ekhazar : Str = variants {"हज़ार" ; "एक" ++ "हज़ार"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "हज़ार"} ! sz ; diff --git a/src/hindustani/CatHindustani.gf b/src/hindustani/CatHindustani.gf index b50e5ffb..22ada04b 100644 --- a/src/hindustani/CatHindustani.gf +++ b/src/hindustani/CatHindustani.gf @@ -70,6 +70,7 @@ incomplete concrete CatHindustani of Cat = Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; ---- Structural diff --git a/src/hindustani/NounHindustani.gf b/src/hindustani/NounHindustani.gf index d9f951d3..fb677814 100644 --- a/src/hindustani/NounHindustani.gf +++ b/src/hindustani/NounHindustani.gf @@ -64,6 +64,7 @@ incomplete concrete NounHindustani of Noun = NumCard n = n ** {hasCard = True} ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd; n = n.n} ; NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; diff --git a/src/hungarian/CatHun.gf b/src/hungarian/CatHun.gf index b4705e3f..2247e484 100644 --- a/src/hungarian/CatHun.gf +++ b/src/hungarian/CatHun.gf @@ -79,6 +79,7 @@ concrete CatHun of Cat = CommonX - [Adv] ** open ResHun, Prelude in { Card = ResHun.Numeral ; Numeral = ResHun.Numeral ; Digits = {s : CardOrd => Str} ; + Decimal = {s : CardOrd => Str; hasDot : Bool} ; diff --git a/src/hungarian/NounHun.gf b/src/hungarian/NounHun.gf index 7021a900..c132d348 100644 --- a/src/hungarian/NounHun.gf +++ b/src/hungarian/NounHun.gf @@ -137,6 +137,10 @@ concrete NounHun of Noun = CatHun ** open s = \\place => dig.s ! NCard ; } ; + NumDecimal dec = dec ** { + s = \\place => dec.s ! NCard ; + } ; + -- : Numeral -> Card ; NumNumeral num = num ; diff --git a/src/hungarian/NumeralHun.gf b/src/hungarian/NumeralHun.gf index f9c66af1..58405457 100644 --- a/src/hungarian/NumeralHun.gf +++ b/src/hungarian/NumeralHun.gf @@ -1,4 +1,4 @@ -concrete NumeralHun of Numeral = CatHun [Numeral,Digits] ** +concrete NumeralHun of Numeral = CatHun [Numeral,Digits,Decimal] ** open Prelude, ResHun in { lincat @@ -115,6 +115,13 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecinal d = { + s = \\x => "-" ++ BIND ++ d.s ! x ; + n = numNumber ; + hasDot=False + } ; + oper mkDig : Str -> TDigit = \s -> { s = s ; diff --git a/src/icelandic/CatIce.gf b/src/icelandic/CatIce.gf index 986911b6..063d6b16 100644 --- a/src/icelandic/CatIce.gf +++ b/src/icelandic/CatIce.gf @@ -126,6 +126,7 @@ concrete CatIce of Cat = CommonX ** open ResIce, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; --2 Structural words diff --git a/src/icelandic/NounIce.gf b/src/icelandic/NounIce.gf index d4720a68..a938c16c 100644 --- a/src/icelandic/NounIce.gf +++ b/src/icelandic/NounIce.gf @@ -86,6 +86,10 @@ concrete NounIce of Noun = CatIce ** open MorphoIce, ResIce, Prelude in { s = \\g,c => d.s ! NCard d.n g c; n = d.n } ; + NumDecimal d = { + s = \\g,c => d.s ! NCard d.n g c; + n = d.n + } ; NumNumeral d = { s = \\g,c => d.s ! NCard Sg g c; diff --git a/src/icelandic/NumeralIce.gf b/src/icelandic/NumeralIce.gf index 43b93c5b..640e8081 100644 --- a/src/icelandic/NumeralIce.gf +++ b/src/icelandic/NumeralIce.gf @@ -1,4 +1,4 @@ -concrete NumeralIce of Numeral = CatIce [Numeral,Digits] ** open Prelude, ResIce in { +concrete NumeralIce of Numeral = CatIce [Numeral,Digits,Decimal] ** open Prelude, ResIce in { param DForm = unit | teen | ten ; @@ -203,6 +203,20 @@ concrete NumeralIce of Numeral = CatIce [Numeral,Digits] ** open Prelude, ResIce D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Sg Masc Nom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mkDig : Str -> TDigit = \c -> mk2Dig c (c + ".") ; diff --git a/src/interlingua/CatIna.gf b/src/interlingua/CatIna.gf index 2a463890..b5bbdecf 100644 --- a/src/interlingua/CatIna.gf +++ b/src/interlingua/CatIna.gf @@ -55,6 +55,7 @@ concrete CatIna of Cat = CommonX ** open ResIna, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number ; tail : DTail} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/interlingua/NounIna.gf b/src/interlingua/NounIna.gf index a61bca01..c3c8e5cd 100644 --- a/src/interlingua/NounIna.gf +++ b/src/interlingua/NounIna.gf @@ -61,6 +61,7 @@ concrete NounIna of Noun = CatIna ** open ResIna, Prelude in { NumCard c = c ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd} ; diff --git a/src/interlingua/NumeralIna.gf b/src/interlingua/NumeralIna.gf index dbec5cf3..c486598e 100644 --- a/src/interlingua/NumeralIna.gf +++ b/src/interlingua/NumeralIna.gf @@ -1,4 +1,4 @@ -concrete NumeralIna of Numeral = CatIna [Numeral,Digits] ** open ResIna,Prelude in { +concrete NumeralIna of Numeral = CatIna [Numeral,Digits,Decimal] ** open ResIna,Prelude in { lincat Digit = {s : DForm => CardOrd => Str} ; @@ -66,6 +66,20 @@ concrete NumeralIna of Numeral = CatIna [Numeral,Digits] ** open ResIna,Prelude D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND++","++BIND ; diff --git a/src/italian/NumeralIta.gf b/src/italian/NumeralIta.gf index d5e9e8e1..93a55a2f 100644 --- a/src/italian/NumeralIta.gf +++ b/src/italian/NumeralIta.gf @@ -1,4 +1,4 @@ -concrete NumeralIta of Numeral = CatIta [Numeral,Digits] ** +concrete NumeralIta of Numeral = CatIta [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoIta, PhonoIta, Prelude in { lincat @@ -137,6 +137,20 @@ param Pred = pred | indip ; D_7 = mkDig "7" ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; oper mkDig : Str -> TDigit = \c -> mk2Dig c Pl ; diff --git a/src/japanese/CatJpn.gf b/src/japanese/CatJpn.gf index 0cf0cc74..fa667d1f 100644 --- a/src/japanese/CatJpn.gf +++ b/src/japanese/CatJpn.gf @@ -54,6 +54,7 @@ flags coding = utf8 ; DAP = Det ; Numeral = {s : Str ; n : Number ; tenPlus : Bool} ; Digits = {s : Str ; n : Number ; tenPlus : Bool ; tail : DTail} ; + Decimal = {s : Str ; n : Number ; tenPlus : Bool ; hasDot : Bool} ; Conj = Conjunction ; -- {s : Str ; null : Str ; type : ConjType} ; Subj = Subjunction ; -- {s : Str ; type : SubjType} ; Prep = Preposition ; -- {s : Str ; null : Str} ; diff --git a/src/japanese/NounJpn.gf b/src/japanese/NounJpn.gf index 182181ec..be22c711 100644 --- a/src/japanese/NounJpn.gf +++ b/src/japanese/NounJpn.gf @@ -134,6 +134,7 @@ flags coding = utf8 ; NumCard card = card ** {inclCard = True} ; NumDigits num = num ** {postpositive = []} ; + NumDecimal num = num ** {postpositive = []} ; NumNumeral num = num ** {postpositive = []} ; diff --git a/src/japanese/NumeralJpn.gf b/src/japanese/NumeralJpn.gf index 90ce9a46..32c873a6 100644 --- a/src/japanese/NumeralJpn.gf +++ b/src/japanese/NumeralJpn.gf @@ -1,4 +1,4 @@ -concrete NumeralJpn of Numeral = CatJpn [Numeral,Digits] ** open ResJpn, ParadigmsJpn, Prelude in { +concrete NumeralJpn of Numeral = CatJpn [Numeral,Digits,Decimal] ** open ResJpn, ParadigmsJpn, Prelude in { flags coding = utf8 ; @@ -202,7 +202,23 @@ flags coding = utf8 ; D_7 = {s = "7" ; n = Pl ; is0 = False} ; D_8 = {s = "8" ; n = Pl ; is0 = False} ; D_9 = {s = "9" ; n = Pl ; is0 = False} ; - + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + n = Pl ; + tenPlus = d.tenPlus ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + n = Pl ; + tenPlus = d.tenPlus ; + hasDot=True + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => "," ; diff --git a/src/kikamba/NumeralKam.gf b/src/kikamba/NumeralKam.gf index d66ae919..030cb1a3 100644 --- a/src/kikamba/NumeralKam.gf +++ b/src/kikamba/NumeralKam.gf @@ -69,6 +69,20 @@ lin pot3plus n m = { s = table { D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o,g => "-" ++ BIND ++ d.s ! o ! g ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o,g => d.s ! NCard ! g ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! g ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c ) ; diff --git a/src/korean/CatKor.gf b/src/korean/CatKor.gf index 042778e2..5248a598 100644 --- a/src/korean/CatKor.gf +++ b/src/korean/CatKor.gf @@ -78,8 +78,7 @@ concrete CatKor of Cat = CommonX ** open ResKor, Prelude in { Card = ResKor.Num ; Numeral = ResKor.Numeral ; Digits = {s : CardOrd => Str ; n : Number} ; - - + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; --2 Structural words diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf index 4fdb8787..e446fb6c 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -107,9 +107,9 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { numtype = IsDig } ; - NumFloat dig1 dig2 = baseNum ** { - s = \\_,_ => dig1.s ! NCard ++ BIND ++ "." ++ BIND ++ dig2.s ! NCard ; - n = Pl ; + NumDecimal dec = baseNum ** { + s = \\_,_ => dec.s ! NCard ; + n = dec.n ; numtype = IsDig } ; diff --git a/src/korean/NumeralKor.gf b/src/korean/NumeralKor.gf index e8b41c2c..7b7d979d 100644 --- a/src/korean/NumeralKor.gf +++ b/src/korean/NumeralKor.gf @@ -1,4 +1,4 @@ -concrete NumeralKor of Numeral = CatKor [Numeral,Digits] ** +concrete NumeralKor of Numeral = CatKor [Numeral,Digits,Decimal] ** open Prelude, ResKor in { lincat @@ -154,6 +154,16 @@ lin D_7 = mkDig "7" ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o=>"-" ++ BIND ++ d.s ! o; hasDot=False; n = Pl} ; + IFrac d i = { + s=\\o=>d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + hasDot=True; + n = Pl + } ; oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o numNumber ; diff --git a/src/latin/CatLat.gf b/src/latin/CatLat.gf index b283d865..8394fe0d 100644 --- a/src/latin/CatLat.gf +++ b/src/latin/CatLat.gf @@ -63,6 +63,7 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, ParamX, Prelude in { -- Numeral = ResLat.TNumeral ; Digits = {s : Str ; unit : Unit} ; + Decimal = {s : Str ; unit : Unit ; hasDot : Bool} ; -- ---- Structural -- diff --git a/src/latin/NumeralLat.gf b/src/latin/NumeralLat.gf index 0ed4fe40..cb25237a 100644 --- a/src/latin/NumeralLat.gf +++ b/src/latin/NumeralLat.gf @@ -209,6 +209,8 @@ concrete NumeralLat of Numeral = CatLat, ParamX[Number] ** open ParadigmsLat, Pr D_8 = mkDig "VIII" "XVIII" "LXXX" "DCCC" "(VIII)" "(LXXX)" "(DCCC)" ; D_9 = mkDig "IX" "XIX" "XC" "CM" "(IX)" "(XC)" "(CM)" ; + PosDecimal d = d ** {hasDot=False} ; + oper TDig = { s : Unit => Str diff --git a/src/latvian/CatLav.gf b/src/latvian/CatLav.gf index fda3d86e..be990f60 100644 --- a/src/latvian/CatLav.gf +++ b/src/latvian/CatLav.gf @@ -78,6 +78,7 @@ lincat Numeral = {s : CardOrd => Gender => Case => Str ; num : Number} ; Digits = {s : CardOrd => Str ; num : Number} ; + Decimal = {s : CardOrd => Str ; num : Number ; hasDot : Bool} ; -- Structural words diff --git a/src/latvian/NounLav.gf b/src/latvian/NounLav.gf index 4e37d722..2d82dd2b 100644 --- a/src/latvian/NounLav.gf +++ b/src/latvian/NounLav.gf @@ -138,6 +138,7 @@ lin -- Digits -> Card -- e.g. '51' NumDigits digits = { s = \\_,_ => digits.s ! NCard ; num = digits.num } ; + NumDecimal dec = { s = \\_,_ => dec.s ! NCard ; num = dec.num } ; -- Numeral -> Card -- e.g. 'fifty-one' diff --git a/src/latvian/NumeralLav.gf b/src/latvian/NumeralLav.gf index c53a5a49..2bcdfa9a 100644 --- a/src/latvian/NumeralLav.gf +++ b/src/latvian/NumeralLav.gf @@ -1,6 +1,6 @@ --# -path=.:abstract:common:prelude -concrete NumeralLav of Numeral = CatLav [Numeral,Digits] ** open ResLav, ParadigmsLav, Prelude in { +concrete NumeralLav of Numeral = CatLav [Numeral,Digits,Decimal] ** open ResLav, ParadigmsLav, Prelude in { flags coding = utf8 ; @@ -109,6 +109,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + num = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + num = Pl ; + hasDot=True + } ; + oper mkDig : Str -> Dig = \c -> mk2Dig c Pl ; diff --git a/src/lithuanian/CatLit.gf b/src/lithuanian/CatLit.gf index 1951adda..200568cc 100644 --- a/src/lithuanian/CatLit.gf +++ b/src/lithuanian/CatLit.gf @@ -75,6 +75,7 @@ concrete CatLit of Cat = CommonX - [CAdv, Adv] ** open ResLit, Prelude, (R = Par numAgr:NumComb; nb:Number }; Ord = { s:AForm => Str }; Digits = { s:Str; o:Str; numAgr:NumComb; nb:Number }; + Decimal = { s:Str; o:Str; numAgr:NumComb; nb:Number; hasDot : Bool }; ---- Structural diff --git a/src/lithuanian/NounLit.gf b/src/lithuanian/NounLit.gf index d37f7beb..4a090181 100644 --- a/src/lithuanian/NounLit.gf +++ b/src/lithuanian/NounLit.gf @@ -249,6 +249,7 @@ concrete NounLit of Noun = CatLit ** open ResLit, Prelude, MorphoLit, Predef in -- NumDigits : Digits -> Card ; -- 51 NumDigits n = { s=\\_,_ => n.s; numAgr=n.numAgr; nb=n.nb }; + NumDecimal n = { s=\\_,_ => n.s; numAgr=n.numAgr; nb=n.nb }; -- NumCard : Card -> Num ; NumCard c = c ** { hasCard = True }; diff --git a/src/lithuanian/NumeralLit.gf b/src/lithuanian/NumeralLit.gf index 6693535b..5d1909d0 100644 --- a/src/lithuanian/NumeralLit.gf +++ b/src/lithuanian/NumeralLit.gf @@ -345,4 +345,21 @@ oper simtas : Case * Number => Str D_8 = { s = "8"; o="8."; nb=Pl; numAgr=AgrComb }; D_9 = { s = "9"; o="9."; nb=Pl; numAgr=AgrComb }; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s; + o = "-" ++ BIND ++ d.o; + nb=Pl; + numAgr=d.numAgr; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + nb = Pl ; + numAgr=d.numAgr; + hasDot=True + } ; + } diff --git a/src/malay/CatMay.gf b/src/malay/CatMay.gf index 74b5192c..089d1a44 100644 --- a/src/malay/CatMay.gf +++ b/src/malay/CatMay.gf @@ -80,6 +80,7 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in { Card = ResMay.CardNum ; Numeral = ResMay.CardOrdNum ; Digits = ResMay.DigNum ; + Decimal = ResMay.DigNum**{hasDot : Bool} ; @@ -132,4 +133,4 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in { -- Determiner : Type = Quant ** { -- pr : Str ; -- prefix for numbers -- n : NumType ; -- number as in 5 (noun in singular), Sg or Pl --- } ; \ No newline at end of file +-- } ; diff --git a/src/malay/NounMay.gf b/src/malay/NounMay.gf index 48c8854f..72d85a76 100644 --- a/src/malay/NounMay.gf +++ b/src/malay/NounMay.gf @@ -101,6 +101,10 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { s = dig.s ! NCard } ; + NumDecimal dec = { + s = dec.s ! NCard + } ; + -- : Numeral -> Card ; NumNumeral num = num ; diff --git a/src/malay/NumeralMay.gf b/src/malay/NumeralMay.gf index a0d39193..c835cedd 100644 --- a/src/malay/NumeralMay.gf +++ b/src/malay/NumeralMay.gf @@ -1,6 +1,6 @@ -- David Wahlstedt 2002 (cardinal numbers) -- Inari Listenmaa 2020 (ordinals + cosmetic changes) -concrete NumeralMay of Numeral = CatMay [Numeral,Digits] ** +concrete NumeralMay of Numeral = CatMay [Numeral,Digits,Decimal] ** open Prelude, ResMay in { lincat @@ -151,6 +151,16 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o=>"-" ++ BIND ++ d.s ! o; hasDot=False} ; + IFrac d i = { + s=\\o=>d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + hasDot=True; + n = Pl + } ; + oper mkDig : Str -> DigNum = \s -> { s = table { diff --git a/src/maltese/CatMlt.gf b/src/maltese/CatMlt.gf index a091c831..bf77bc9f 100644 --- a/src/maltese/CatMlt.gf +++ b/src/maltese/CatMlt.gf @@ -98,6 +98,11 @@ concrete CatMlt of Cat = CommonX - [Adv] ** open ResMlt, Prelude in { n : NumForm ; tail : DTail ; } ; + Decimal = { + s : NumCase => Str ; -- No need for CardOrd, i.e. no 1st, 2nd etc in Maltese + n : NumForm ; + hasDot : Bool ; + } ; -- Structural diff --git a/src/maltese/NounMlt.gf b/src/maltese/NounMlt.gf index 5ca05370..408e7aa8 100644 --- a/src/maltese/NounMlt.gf +++ b/src/maltese/NounMlt.gf @@ -189,9 +189,7 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude, Maybe in { -- 51 NumDigits d = {s = d.s ; n = d.n} ; - -- Digits -> Digits -> Card - -- 3.14 - NumFloat d1 d2 = {s = \\c => d1.s ! NumNom ++ BIND ++ "." ++ BIND ++ d2.s ! c ; n = d1.n} ; + NumDecimal d = {s = d.s ; n = d.n} ; -- Digits -> Ord -- 51st diff --git a/src/maltese/NumeralMlt.gf b/src/maltese/NumeralMlt.gf index 1d19d1e0..313f3a4d 100644 --- a/src/maltese/NumeralMlt.gf +++ b/src/maltese/NumeralMlt.gf @@ -4,7 +4,7 @@ -- John J. Camilleri 2011 -- 2013 -- Licensed under LGPL -concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt in { +concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits,Decimal] ** open Prelude,ResMlt in { flags coding=utf8 ; @@ -437,4 +437,18 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt tail = inc i.tail } ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = d.n ; + hasDot=False + } ; + IFrac d i = { + s=\\o=>d.s ! NumNom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = d.n; + hasDot=True + } ; + } diff --git a/src/mongolian/CatMon.gf b/src/mongolian/CatMon.gf index 172798e6..e9cb5082 100644 --- a/src/mongolian/CatMon.gf +++ b/src/mongolian/CatMon.gf @@ -84,7 +84,8 @@ lincat Num = {s : Str ; sp : RCase => Str ; n : Number ; isNum : Bool} ; Card = {s : Str ; sp : RCase => Str ; n : Number} ; Numeral = {s : CardOrd => Str; n : Number} ; - Digits = {s : CardOrd => Str ; n : Number} ; + Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; -- Structural diff --git a/src/mongolian/NounMon.gf b/src/mongolian/NounMon.gf index 672e84af..6bedac07 100644 --- a/src/mongolian/NounMon.gf +++ b/src/mongolian/NounMon.gf @@ -109,7 +109,7 @@ lin NumCard n = n ** {isNum = True} ; - NumDigits,NumNumeral = \numeral -> { + NumDigits,NumNumeral,NumDecimal = \numeral -> { s = numeral.s ! NCard ; sp = \\_ => numeral.s ! NCard ; n = numeral.n diff --git a/src/mongolian/NumeralMon.gf b/src/mongolian/NumeralMon.gf index 2c2d941b..060ad731 100644 --- a/src/mongolian/NumeralMon.gf +++ b/src/mongolian/NumeralMon.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../prelude -concrete NumeralMon of Numeral = CatMon [Numeral,Digits] ** open ResMon, MorphoMon, Prelude in { +concrete NumeralMon of Numeral = CatMon [Numeral,Digits,Decimal] ** open ResMon, MorphoMon, Prelude in { flags coding=utf8 ; @@ -158,6 +158,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\co => "-" ++ BIND ++ d.s ! co ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\co => d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! co; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "-р") ; diff --git a/src/nepali/CatNep.gf b/src/nepali/CatNep.gf index 9414f783..53a066f0 100644 --- a/src/nepali/CatNep.gf +++ b/src/nepali/CatNep.gf @@ -68,6 +68,7 @@ concrete CatNep of Cat = CommonX - [Adv] ** open ResNep, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; ---- Structural diff --git a/src/nepali/NounNep.gf b/src/nepali/NounNep.gf index ccfd710f..5a278765 100644 --- a/src/nepali/NounNep.gf +++ b/src/nepali/NounNep.gf @@ -72,6 +72,7 @@ concrete NounNep of Noun = CatNep ** open ResNep, Prelude in { PossPron p = {s = \\_,_ => p.ps } ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd ; n = n.n} ; NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; diff --git a/src/nepali/NumeralNep.gf b/src/nepali/NumeralNep.gf index b9778f70..e16dba72 100644 --- a/src/nepali/NumeralNep.gf +++ b/src/nepali/NumeralNep.gf @@ -1,4 +1,4 @@ -concrete NumeralNep of Numeral = CatNep [Numeral,Digits] ** open ResNep, Prelude in { +concrete NumeralNep of Numeral = CatNep [Numeral,Digits,Decimal] ** open ResNep, Prelude in { -- By Harald Hammarstroem -- Modification for Nepali by Dinesh Simkhada and Shafqat Virk - 2011 flags coding=utf8 ; @@ -114,6 +114,16 @@ lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue d.s (dg.s ! df) ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { s = \\df => Prelude.glue "-" (d.s ! df) ; n = Pl ; hasDot=False } ; + IFrac d i = { + s=\\df=>d.s ! df ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + hasDot=True; + n = Pl + } ; + oper ekhazar : Str = variants {"एक" ++ "हजार" ; "हजार"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "हजार"} ! sz ; oper mksau : Str -> DSize -> Str = \s -> \sz -> table {sg => "एक" ++ "सय" ; _ => s ++ "सय"} ! sz ; diff --git a/src/nepali/src/NumeralNep.gf b/src/nepali/src/NumeralNep.gf index d3a2ba71..5a9a53d6 100644 --- a/src/nepali/src/NumeralNep.gf +++ b/src/nepali/src/NumeralNep.gf @@ -114,6 +114,8 @@ lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue d.s (dg.s ! df) ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; + oper ekhazar : Str = variants {"e:k" ++ "hjar" ; "hjar"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "hjar"} ! sz ; oper mksau : Str -> DSize -> Str = \s -> \sz -> table {sg => "e:k" ++ "sy" ; _ => s ++ "sy"} ! sz ; diff --git a/src/norwegian/NumeralNor.gf b/src/norwegian/NumeralNor.gf index 19074963..08c315bb 100644 --- a/src/norwegian/NumeralNor.gf +++ b/src/norwegian/NumeralNor.gf @@ -1,4 +1,4 @@ -concrete NumeralNor of Numeral = CatNor [Numeral,Digits] ** open MorphoNor, Prelude in { +concrete NumeralNor of Numeral = CatNor [Numeral,Digits,Decimal] ** open MorphoNor, Prelude in { flags coding=utf8 ; lincat @@ -68,6 +68,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/nynorsk/NumeralNno.gf b/src/nynorsk/NumeralNno.gf index 35282eff..8334230f 100644 --- a/src/nynorsk/NumeralNno.gf +++ b/src/nynorsk/NumeralNno.gf @@ -1,4 +1,4 @@ -concrete NumeralNno of Numeral = CatNno [Numeral,Digits] ** open MorphoNno, Prelude in { +concrete NumeralNno of Numeral = CatNno [Numeral,Digits,Decimal] ** open MorphoNno, Prelude in { flags coding=utf8 ; lincat @@ -68,6 +68,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/persian/CatPes.gf b/src/persian/CatPes.gf index 2cc00b12..86b1def4 100644 --- a/src/persian/CatPes.gf +++ b/src/persian/CatPes.gf @@ -64,7 +64,8 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in { ---- Numeral Numeral = {s : CardOrd => Str ; n : Number} ; - Digits = {s : CardOrd => Str ; n : Number } ; + Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; ---- Structural diff --git a/src/persian/NounPes.gf b/src/persian/NounPes.gf index c76776b8..d4db1324 100644 --- a/src/persian/NounPes.gf +++ b/src/persian/NounPes.gf @@ -97,6 +97,7 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { NumCard n = n ** {isNum = True} ; NumDigits n = n ** {s = n.s ! NCard; isNum = True} ; + NumDecimal n = n ** {s = n.s ! NCard; isNum = True} ; OrdDigits n = n ** {s = n.s ! NOrd ; isNum = True ; isPre=False} ; NumNumeral n = n ** {s = n.s ! NCard; isNum = True} ; diff --git a/src/persian/NumeralPes.gf b/src/persian/NumeralPes.gf index 3e1f767b..1305364f 100644 --- a/src/persian/NumeralPes.gf +++ b/src/persian/NumeralPes.gf @@ -1,5 +1,5 @@ --# -path=.:../abstract:../common: -concrete NumeralPes of Numeral = CatPes [Numeral,Digits] ** open ResPes,Prelude in { +concrete NumeralPes of Numeral = CatPes [Numeral,Digits,Decimal] ** open ResPes,Prelude in { flags coding = utf8; @@ -83,7 +83,21 @@ lin pot3plus n m = { D_9 = mkDig "9" ; -- lin IDig d = { s = \\_ => d.s ; n = Sg} ; - lin IIDig d dg = { s = \\df => d.s ! NCard ++ dg.s ! df ; n = Pl}; + IIDig d dg = { s = \\df => d.s ! NCard ++ dg.s ! df ; n = Pl}; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\df => "-" ++ d.s ! df ; + n = Pl ; + hasDot=False + }; + IFrac d i = { + s=\\df=>d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! df; + n = Pl; + hasDot=True + } ; oper commaIf : DTail -> Str = \t -> case t of { diff --git a/src/polish/CatPol.gf b/src/polish/CatPol.gf index 877432ca..cf29fa91 100644 --- a/src/polish/CatPol.gf +++ b/src/polish/CatPol.gf @@ -75,6 +75,7 @@ concrete CatPol of Cat = CommonX - [CAdv] ** open ResPol, Prelude, (R = ParamX) a:Accom; n:Number }; Ord = { s: AForm => Str }; Digits = { s:Str; o:Str; a:Accom; n:Number }; + Decimal = { s:Str; o:Str; a:Accom; n:Number; hasDot : Bool }; ---- Structural diff --git a/src/polish/NounPol.gf b/src/polish/NounPol.gf index f0138063..36c82e92 100644 --- a/src/polish/NounPol.gf +++ b/src/polish/NounPol.gf @@ -164,7 +164,7 @@ concrete NounPol of Noun = CatPol ** open ResPol, Prelude, PronounMorphoPol, Mor -- NumDigits : Digits -> Card ; -- 51 NumDigits n = { s=\\_,_ => n.s; a=n.a; n=n.n }; - NumFloat n1 n2 = { s=\\_,_ => n1.s ++ BIND ++ "." ++ BIND ++ n2.s; a=n1.a; n=Pl }; + NumDecimal n = { s=\\_,_ => n.s; a=n.a; n=n.n }; -- NumCard : Card -> Num ; NumCard c = c ** { hasCard = True }; @@ -217,11 +217,4 @@ concrete NounPol of Noun = CatPol ** open ResPol, Prelude, PronounMorphoPol, Mor p = P3 } ; - QuantityFloatNP n1 n2 m = { - nom,voc = preOrPost m.isPre m.s (n1.s ++ BIND ++ "." ++ BIND ++ n2.s) ; - dep = \\cc => preOrPost m.isPre m.s (n1.s ++ BIND ++ "." ++ BIND ++ n2.s) ; - gn = OthersPl; - p = P3 - } ; - } diff --git a/src/polish/NumeralPol.gf b/src/polish/NumeralPol.gf index 92a8e1c3..60ec8784 100644 --- a/src/polish/NumeralPol.gf +++ b/src/polish/NumeralPol.gf @@ -2,7 +2,7 @@ -- Adam Slaski, 2009, 2010 -concrete NumeralPol of Numeral = CatPol [Numeral,Digits] ** open ResPol,Prelude, AdjectiveMorphoPol in { +concrete NumeralPol of Numeral = CatPol [Numeral,Digits,Decimal] ** open ResPol,Prelude, AdjectiveMorphoPol in { flags coding=utf8 ; @@ -553,4 +553,24 @@ oper tysiac = table { D_8 = { s = "8"; o="8."; n=Pl; a=PiecA }; D_9 = { s = "9"; o="9."; n=Pl; a=PiecA }; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s; + o = "-" ++ BIND ++ d.o; + n=Pl; + a=d.a; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + o = d.o ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.o; + n=Pl; + a=d.a; + hasDot=True + } ; + } diff --git a/src/portuguese/NumeralPor.gf b/src/portuguese/NumeralPor.gf index 5006a5ec..b1ddce78 100644 --- a/src/portuguese/NumeralPor.gf +++ b/src/portuguese/NumeralPor.gf @@ -1,4 +1,4 @@ -concrete NumeralPor of Numeral = CatPor [Numeral,Digits] ** +concrete NumeralPor of Numeral = CatPor [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoPor, Prelude, Predef in { flags coding=utf8 ; @@ -207,6 +207,20 @@ concrete NumeralPor of Numeral = CatPor [Numeral,Digits] ** D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper mk4Dig : Str -> Str -> Str -> Number -> TDigit = \c,o,a,n -> { s = table { diff --git a/src/punjabi/CatPnb.gf b/src/punjabi/CatPnb.gf index fdccd81c..5410a10f 100644 --- a/src/punjabi/CatPnb.gf +++ b/src/punjabi/CatPnb.gf @@ -61,7 +61,8 @@ concrete CatPnb of Cat = CommonX - [Adv] ** open ResPnb, Prelude in { ---- Numeral Numeral = {s : CardOrd => Str ; n : Number} ; - Digits = {s : CardOrd => Str ; n : Number } ; + Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; ---- Structural diff --git a/src/punjabi/NounPnb.gf b/src/punjabi/NounPnb.gf index 1231e9aa..959e8772 100644 --- a/src/punjabi/NounPnb.gf +++ b/src/punjabi/NounPnb.gf @@ -64,6 +64,8 @@ concrete NounPnb of Noun = CatPnb ** open ResPnb, Prelude in { NumDigits n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; + NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; OrdNumeral numeral = {s = numeral.s ! NOrd ; n = numeral.n} ; diff --git a/src/punjabi/NumeralPnb.gf b/src/punjabi/NumeralPnb.gf index 8dcdb71f..ceba5005 100644 --- a/src/punjabi/NumeralPnb.gf +++ b/src/punjabi/NumeralPnb.gf @@ -1,4 +1,4 @@ -concrete NumeralPnb of Numeral = CatPnb [Numeral,Digits] ** open ResPnb, Prelude in { +concrete NumeralPnb of Numeral = CatPnb [Numeral,Digits,Decimal] ** open ResPnb, Prelude in { -- By Harald Hammarstroem -- Modification for Punjabi by Shafqat Virk flags coding=utf8 ; @@ -119,6 +119,19 @@ lin D_8 = { s = "۸" ; n = Pl}; lin D_9 = { s = "۹" ; n = Pl}; lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue (dg.s ! df) d.s ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; +lin IFrac d i = { + s = \\o => d.s ! o ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + n = Pl ; + hasDot=True + } ; oper ekhazar : Str = variants {"ہزار" ; "اك" ++ "ہزار"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "ہزار"} ! sz ; diff --git a/src/romance/CatRomance.gf b/src/romance/CatRomance.gf index e6932e44..034c5f73 100644 --- a/src/romance/CatRomance.gf +++ b/src/romance/CatRomance.gf @@ -88,6 +88,7 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol] Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/romance/NounRomance.gf b/src/romance/NounRomance.gf index 56bc6776..6d6615de 100644 --- a/src/romance/NounRomance.gf +++ b/src/romance/NounRomance.gf @@ -96,7 +96,7 @@ incomplete concrete NounRomance of Noun = NumDigits nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdDigits nu = {s = \\a => nu.s ! NOrd a.g a.n} ; - NumFloat n1 n2 = {s = \\g => n1.s ! NCard Masc ++ BIND ++ "." ++ BIND ++ n2.s ! NCard g ; n = Pl} ; + NumDecimal nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; NumNumeral nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdNumeral nu = {s = \\a => nu.s ! NOrd a.g a.n} ; @@ -213,10 +213,4 @@ incomplete concrete NounRomance of Noun = hasClit = False } ; - QuantityFloatNP n1 n2 m = heavyNPpol False { - s = \\c => preOrPost m.isPre m.s (n1.s ! NCard Masc ++ BIND ++ "." ++ BIND ++ n2.s ! NCard Masc) ; - a = agrP3 Masc Pl ; - hasClit = False - } ; - } diff --git a/src/romanian/CatRon.gf b/src/romanian/CatRon.gf index 9cb5bb4f..f55a135e 100644 --- a/src/romanian/CatRon.gf +++ b/src/romanian/CatRon.gf @@ -80,6 +80,7 @@ concrete CatRon of Cat = sp : ACase => CardOrd => NumF => Str ; size : Size } ; Digits = {s : CardOrd => Str ; n : Size ; isDig : Bool} ; + Decimal = {s : CardOrd => Str ; n : Size ; isDig : Bool; hasDot : Bool} ; Num = {s : Gender => Str ; sp : Gender => Str ; isNum : Bool ; n : Number; size : Str } ; diff --git a/src/romanian/NounRon.gf b/src/romanian/NounRon.gf index 13af4df6..f879288b 100644 --- a/src/romanian/NounRon.gf +++ b/src/romanian/NounRon.gf @@ -172,8 +172,8 @@ in { isPre = True }; - NumFloat n1 n2 = {s,sp = \\g => n1.s ! NCard g ++ BIND ++ "." ++ BIND ++ n2.s ! NCard g ; - size = n1.n; n = Pl }; + NumDecimal nu = {s,sp = \\g => nu.s ! NCard g ; + size = nu.n; n = getNumber nu.n }; NumNumeral nu = {s = \\g => nu.s ! ANomAcc ! (NCard g) ! Formal ; sp = \\g => nu.sp ! ANomAcc ! (NCard g) ! Formal ; diff --git a/src/romanian/NumeralRon.gf b/src/romanian/NumeralRon.gf index 2370af48..a7680923 100644 --- a/src/romanian/NumeralRon.gf +++ b/src/romanian/NumeralRon.gf @@ -1,4 +1,4 @@ -concrete NumeralRon of Numeral = CatRon [Numeral,Digits] ** +concrete NumeralRon of Numeral = CatRon [Numeral,Digits,Decimal] ** open MorphoRon, CatRon, Prelude in { flags coding = utf8 ; @@ -247,6 +247,21 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = pl; + isDig = False ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = pl ; + isDig = False ; + hasDot=True + } ; oper mkDig : Str -> Dig = \c -> mk3Dig c (c + "lea") (c + "a") less20 ; diff --git a/src/rukiga/CatCgg.gf b/src/rukiga/CatCgg.gf index 419b3dd7..286c754d 100644 --- a/src/rukiga/CatCgg.gf +++ b/src/rukiga/CatCgg.gf @@ -90,6 +90,7 @@ lincat } ; Numeral = {s : Res.CardOrd=>Res.Agreement=> Str ; g : Res.Gender; n: Res.Number} ; Digits = {s : Res.CardOrd => Res.Agreement=>Str ; n : Res.Number ; tail : Px.DTail} ; + Decimal = {s : Res.CardOrd => Res.Agreement=>Str ; n : Res.Number; hasDot : Bool} ; Ord = {s :Res.Agreement=>Str; position:Res.Position} ; Card = {s :Res.Agreement=>Str; n : Res.Number} ; A2 = Res.Adjective ** { c2 : Str ; isPre : Bool} ; diff --git a/src/rukiga/NounCgg.gf b/src/rukiga/NounCgg.gf index 41aa22b8..09af39a4 100644 --- a/src/rukiga/NounCgg.gf +++ b/src/rukiga/NounCgg.gf @@ -116,6 +116,7 @@ lin --NumDigits : Digits -> Card ; -- 51 NumDigits dig = {s = dig.s!NCard ; n=dig.n}; + NumDecimal dec = {s = dec.s!NCard ; n=dec.n}; --NumNumeral : Numeral -> Card ; -- fifty-one NumNumeral numeral = {s=numeral.s!NCard; n=numeral.n}; --OrdDigits : Digits -> Ord ; -- 51st diff --git a/src/rukiga/NumeralCgg.gf b/src/rukiga/NumeralCgg.gf index 1af17162..be0e1961 100644 --- a/src/rukiga/NumeralCgg.gf +++ b/src/rukiga/NumeralCgg.gf @@ -1,6 +1,6 @@ --# -path=.:../prelude:../abstract:../common -concrete NumeralCgg of Numeral = CatCgg [Numeral,Digits] ** +concrete NumeralCgg of Numeral = CatCgg [Numeral,Digits,Decimal] ** open ResCgg, Prelude in { lincat @@ -100,6 +100,16 @@ lin pot3plus n m = let D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o,a=>"-" ++ BIND ++ d.s ! o ! a; hasDot=False; n = Pl} ; + IFrac d i = { + s=\\o,a=>d.s ! NCard ! a ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! a ; + hasDot=True; + n = Pl + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND ++ "," ++ BIND ; diff --git a/src/russian/CatRus.gf b/src/russian/CatRus.gf index dd028baa..2c770052 100644 --- a/src/russian/CatRus.gf +++ b/src/russian/CatRus.gf @@ -82,6 +82,7 @@ lincat Num = NumDet ; Card = NumDet ; Digits = {s : Str ; size: NumSize} ; + Decimal = {s : Str ; size: NumSize; hasDot : Bool} ; QS = {s : QForm => Str} ; QCl = { diff --git a/src/russian/NounRus.gf b/src/russian/NounRus.gf index 6ea0cd48..83cbc3ff 100644 --- a/src/russian/NounRus.gf +++ b/src/russian/NounRus.gf @@ -87,7 +87,7 @@ lin -- : Digits -> Card ; -- 51 NumDigits n = {s = \\_,_,_ => n.s ; size = n.size } ; - NumFloat n1 n2 = {s = \\_,_,_ => n1.s ++ BIND ++ "." ++ BIND ++ n2.s ; size = n1.size } ; + NumDecimal n = {s = \\_,_,_ => n.s ; size = n.size } ; -- : Quant -> Num -> Det ; -- these five DetQuant quant num = { @@ -247,10 +247,4 @@ lin a=Ag (gennum Masc (numSizeNumber n.size)) P3 } ; - QuantityFloatNP n1 n2 m = { - s = \\cas => preOrPost m.isPre m.s (n1.s ++ BIND ++ "." ++ BIND ++ n2.s) ; - pron=False ; - a=Ag GPl P3 - } ; - } diff --git a/src/russian/NumeralRus.gf b/src/russian/NumeralRus.gf index 889212e3..cc483602 100644 --- a/src/russian/NumeralRus.gf +++ b/src/russian/NumeralRus.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../../prelude -concrete NumeralRus of Numeral = CatRus [Numeral,Digits] ** open ResRus, InflectionRus, Prelude in { +concrete NumeralRus of Numeral = CatRus [Numeral,Digits,Decimal] ** open ResRus, InflectionRus, Prelude in { flags coding=utf8 ; @@ -431,6 +431,22 @@ lin D_7 = mk2Dig "7" Num5 ; D_8 = mk2Dig "8" Num5 ; D_9 = mk2Dig "9" Num5 ; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + n = Pl ; + size = d.size ; + hasDot=False + } ; + IFrac d i = { + s=d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + n = Pl ; + size = d.size ; + hasDot=True + } ; oper mk3Dig : Str -> Str -> NumSize -> TDigit = \c,o,size -> mk4Dig c o Pl size ; diff --git a/src/russian/v1/NumeralRus.gf b/src/russian/v1/NumeralRus.gf index 298098c4..ffa54c6a 100644 --- a/src/russian/v1/NumeralRus.gf +++ b/src/russian/v1/NumeralRus.gf @@ -252,6 +252,8 @@ lin pot3plus n m = D_8 = mk2Dig "8" plg ; D_9 = mk2Dig "9" plg ; + PosDecimal d = d ** {hasDot=False} ; + oper mk3Dig : Str -> Str -> Size -> TDigit = \c,o,size -> mk4Dig c o Pl size ; mk2Dig : Str -> Size -> TDigit = \c,size -> mk3Dig c (c + "o") size ; diff --git a/src/scandinavian/CatScand.gf b/src/scandinavian/CatScand.gf index cdf4be02..56572e92 100644 --- a/src/scandinavian/CatScand.gf +++ b/src/scandinavian/CatScand.gf @@ -87,6 +87,7 @@ incomplete concrete CatScand of Cat = Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/scandinavian/NounScand.gf b/src/scandinavian/NounScand.gf index b6cfa775..2f034c05 100644 --- a/src/scandinavian/NounScand.gf +++ b/src/scandinavian/NounScand.gf @@ -110,7 +110,7 @@ incomplete concrete NounScand of Noun = NumDigits nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdDigits nu = {s = nu.s ! NOrd SupWeak} ; - NumFloat n1 n2 = {s = \\g => n1.s ! NCard neutrum ++ BIND ++ "." ++ BIND ++ n2.s ! NCard g ; n = Pl} ; + NumDecimal dec = {s = \\g => dec.s ! NCard g ; n = dec.n} ; NumNumeral nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdNumeral nu = {s = nu.s ! NOrd SupWeak} ; @@ -269,10 +269,4 @@ incomplete concrete NounScand of Noun = isPron = False } ; - QuantityFloatNP n1 n2 m = { - s = \\c => preOrPost m.isPre m.s (n1.s ! NCard neutrum ++ BIND ++ "." ++ BIND ++ n2.s ! NCard neutrum) ; - a = agrP3 Utr Pl ; - isPron = False - } ; - } diff --git a/src/sindhi/CatSnd.gf b/src/sindhi/CatSnd.gf index 9431d5c3..d0c37a96 100644 --- a/src/sindhi/CatSnd.gf +++ b/src/sindhi/CatSnd.gf @@ -71,6 +71,7 @@ concrete CatSnd of Cat = CommonX - [Adv] ** open ResSnd, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; ---- Structural diff --git a/src/sindhi/NounSnd.gf b/src/sindhi/NounSnd.gf index 1cfffd48..2679e3ee 100644 --- a/src/sindhi/NounSnd.gf +++ b/src/sindhi/NounSnd.gf @@ -62,6 +62,7 @@ concrete NounSnd of Noun = CatSnd ** open ResSnd, Prelude in { NumCard n = n ** {hasCard = True} ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd; n = n.n} ; NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; diff --git a/src/sindhi/NumeralSnd.gf b/src/sindhi/NumeralSnd.gf index 0a1201a5..81fa1902 100644 --- a/src/sindhi/NumeralSnd.gf +++ b/src/sindhi/NumeralSnd.gf @@ -1,4 +1,4 @@ -concrete NumeralSnd of Numeral = CatSnd [Numeral,Digits] ** open ResSnd, Prelude in { +concrete NumeralSnd of Numeral = CatSnd [Numeral,Digits,Decimal] ** open ResSnd, Prelude in { -- By Harald Hammarstroem -- Modification for Punjabi by Shafqat Virk flags coding=utf8 ; @@ -119,6 +119,7 @@ lin D_8 = { s = "۸" ; n = Pl}; lin D_9 = { s = "۹" ; n = Pl}; lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue (dg.s ! df) d.s ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; oper ekhazar : Str = variants {"ھزار" ; "ھڪ" ++ "ھزار"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "ھزار"} ! sz ; diff --git a/src/slovak/CatSlo.gf b/src/slovak/CatSlo.gf index bc5b6be9..afcc325a 100644 --- a/src/slovak/CatSlo.gf +++ b/src/slovak/CatSlo.gf @@ -66,6 +66,7 @@ concrete CatSlo of Cat = lincat Numeral = Determiner ; ---- TODO: should contain Ord as well lincat Digits = {s:Str ; size : NumSize} ; + lincat Decimal = {s:Str ; size : NumSize; hasDot : Bool} ; } diff --git a/src/slovak/NounSlo.gf b/src/slovak/NounSlo.gf index a1af7b10..fef689f1 100644 --- a/src/slovak/NounSlo.gf +++ b/src/slovak/NounSlo.gf @@ -95,6 +95,7 @@ lin NumCard c = c ; NumDigits ds = ds ** {s = \\_,_ => ds.s} ; + NumDecimal ds = ds ** {s = \\_,_ => ds.s} ; NumNumeral nu = nu ; diff --git a/src/slovak/NumeralSlo.gf b/src/slovak/NumeralSlo.gf index ece83a78..b44e11b7 100644 --- a/src/slovak/NumeralSlo.gf +++ b/src/slovak/NumeralSlo.gf @@ -1,6 +1,6 @@ concrete NumeralSlo of Numeral = - CatSlo [Numeral,Digits] ** + CatSlo [Numeral,Digits,Decimal] ** open ResSlo, @@ -122,4 +122,18 @@ oper determinerStr : Determiner -> Str = \d -> d.s ! Masc Anim ! Nom ; D_8 = { s = "8" ; size = Num5} ; D_9 = { s = "9" ; size = Num5} ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ Predef.BIND ++ d.s ; + size = d.size ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + size = d.size ; + hasDot=True + } ; + } diff --git a/src/slovenian/CatSlv.gf b/src/slovenian/CatSlv.gf index 8fcf21e5..41285bb5 100644 --- a/src/slovenian/CatSlv.gf +++ b/src/slovenian/CatSlv.gf @@ -31,6 +31,8 @@ lincat -- Numeral Numeral = {s : Gender => Case => Str ; n : NumAgr} ; + Digits = {s : Str ; n : NumAgr} ; + Decimal = {s : Str ; n : NumAgr ; hasDot : Bool} ; -- Structural Conj = {s : Str; n : Number} ; diff --git a/src/slovenian/NounSlv.gf b/src/slovenian/NounSlv.gf index 02aef980..c9e992aa 100644 --- a/src/slovenian/NounSlv.gf +++ b/src/slovenian/NounSlv.gf @@ -58,7 +58,15 @@ concrete NounSlv of Noun = CatSlv ** open ResSlv,Prelude in { NumCard n = n ; - NumNumeral numeral = {s = numeral.s; n = numeral.n} ; + NumNumeral numeral = numeral ; + NumDigits digits = { + s = \\g,c => digits.s; + n = digits.n + } ; + NumDecimal decimal = { + s = \\g,c => decimal.s; + n = decimal.n + } ; DefArt = { s = \\_,_,_ => "" ; diff --git a/src/slovenian/NumeralSlv.gf b/src/slovenian/NumeralSlv.gf index 6dc79d5f..c805aeae 100644 --- a/src/slovenian/NumeralSlv.gf +++ b/src/slovenian/NumeralSlv.gf @@ -1,4 +1,4 @@ -concrete NumeralSlv of Numeral = CatSlv [Numeral,Digits] ** open Prelude, ResSlv in { +concrete NumeralSlv of Numeral = CatSlv [Numeral,Digits,Decimal] ** open Prelude, ResSlv in { lincat Digit = {s : DForm => Case => Str; n : NumAgr} ; @@ -200,12 +200,12 @@ oper mkDigit2 : (_,_,_,_,_,_ : Str) -> Gender => Case => Str; Dig = TDigit ; lin - IDig d = d ; + IDig d = d ** {n=UseNum d.n}; IIDig d i = { s = d.s ++ BIND ++ i.s ; ---- s = \\o => d.s ! NCard Masc ++ BIND ++ i.s ! o ; - n = Pl + n = UseNum Pl } ; D_0 = mkDig "0" ; @@ -219,6 +219,20 @@ oper mkDigit2 : (_,_,_,_,_,_ : Str) -> Gender => Case => Str; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + n = UseNum Pl ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + n = UseNum Pl ; + hasDot=True + } ; + oper mkDig : Str -> TDigit = \c -> mk2Dig c Pl ; diff --git a/src/somali/CatSom.gf b/src/somali/CatSom.gf index d66f323b..3f97933d 100644 --- a/src/somali/CatSom.gf +++ b/src/somali/CatSom.gf @@ -80,6 +80,7 @@ concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in { Card = BaseNum ; Numeral = ResSom.Numeral ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; diff --git a/src/somali/NumeralSom.gf b/src/somali/NumeralSom.gf index 51660dee..32a32dc0 100644 --- a/src/somali/NumeralSom.gf +++ b/src/somali/NumeralSom.gf @@ -1,4 +1,4 @@ -concrete NumeralSom of Numeral = CatSom [Numeral,Digits] ** +concrete NumeralSom of Numeral = CatSom [Numeral,Digits,Decimal] ** open Prelude, ResSom, ParamSom in { oper @@ -161,5 +161,18 @@ lin D_9 = mkDig "9" ; lin IDig dig = dig ; -- : Dig -> Digits -> Digits ; lin IIDig dig digs = digs ** {s = \\co => glue (dig.s ! co) (digs.s ! co) } ; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { + s = \\co => glue "-" (d.s ! co) ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\co => d.s ! co ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! co; + n = Pl ; + hasDot=True + } ; } diff --git a/src/spanish/NumeralSpa.gf b/src/spanish/NumeralSpa.gf index 7cf6ecf6..139dee15 100644 --- a/src/spanish/NumeralSpa.gf +++ b/src/spanish/NumeralSpa.gf @@ -1,4 +1,4 @@ -concrete NumeralSpa of Numeral = CatSpa [Numeral,Digits] ** +concrete NumeralSpa of Numeral = CatSpa [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoSpa, Prelude in { flags coding=utf8 ; @@ -132,6 +132,20 @@ param D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=False + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":o") ; diff --git a/src/swahili/NumeralSwa.gf b/src/swahili/NumeralSwa.gf index 7b645114..3b3ce8ff 100644 --- a/src/swahili/NumeralSwa.gf +++ b/src/swahili/NumeralSwa.gf @@ -1,4 +1,4 @@ -concrete NumeralSwa of Numeral = CatSwa [Numeral,Digits] ** +concrete NumeralSwa of Numeral = CatSwa [Numeral,Digits,Decimal] ** open Prelude,DiffSwa,MorphoSwa in { lincat @@ -76,6 +76,16 @@ lin pot4as5 n = n ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o,g=>"-" ++ BIND ++ d.s ! o ! g; hasDot=False; n = Pl} ; + IFrac d i = { + s=\\o,g=>d.s ! NCard ! g ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! g ; + hasDot=True; + n = Pl + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c ) ; diff --git a/src/swedish/NumeralSwe.gf b/src/swedish/NumeralSwe.gf index 6e4c60ef..23e0d57e 100644 --- a/src/swedish/NumeralSwe.gf +++ b/src/swedish/NumeralSwe.gf @@ -1,4 +1,4 @@ -concrete NumeralSwe of Numeral = CatSwe [Numeral,Digits] ** open ResSwe, MorphoSwe, Prelude in { +concrete NumeralSwe of Numeral = CatSwe [Numeral,Digits,Decimal] ** open ResSwe, MorphoSwe, Prelude in { flags coding=utf8 ; lincat @@ -56,16 +56,16 @@ lin pot4plus n m = {s = \\g => n.s ! NCard Utr ++ BIND ++ "miljon" ++ m.s ! g ; n = Pl} ; pot4as5 n = n ; - pot4float f = - numPl (\\g => f.s ++ cardOrd "miljoner" "miljonde" ! g) ; + pot4decimal d = + numPl (\\g => d.s ! NCard Utr ++ cardOrd "miljoner" "miljonde" ! g) ; pot51 = numPl (cardOrd "miljard" "miljarde") ; pot5 n = numPl (\\g => n.s ! NCard Utr ++ cardOrd "miljard" "miljarde" ! g) ; pot5plus n m = {s = \\g => n.s ! NCard Utr ++ BIND ++ "miljard" ++ m.s ! g ; n = Pl} ; - pot5float f = - numPl (\\g => f.s ++ cardOrd "miljarder" "miljarde" ! g) ; + pot5decimal d = + numPl (\\g => d.s ! NCard Utr ++ cardOrd "miljarder" "miljarde" ! g) ; lincat Dig = TDigit ; @@ -89,6 +89,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/thai/CatTha.gf b/src/thai/CatTha.gf index 398c19f1..b35c4e22 100644 --- a/src/thai/CatTha.gf +++ b/src/thai/CatTha.gf @@ -51,6 +51,7 @@ concrete CatTha of Cat = CommonX ** open ResTha, Prelude in { -- Numeral Numeral, Card, Digits = {s : Str} ; + Decimal = {s : Str; hasDot : Bool} ; -- Structural diff --git a/src/thai/NounTha.gf b/src/thai/NounTha.gf index 6cc9c232..914ca2d8 100644 --- a/src/thai/NounTha.gf +++ b/src/thai/NounTha.gf @@ -38,6 +38,7 @@ concrete NounTha of Noun = CatTha ** open StringsTha, ResTha, Prelude in { NumCard n = n ** {hasC = True} ; NumDigits d = d ; + NumDecimal d = d ; OrdDigits d = {s = thbind thii_s d.s} ; NumNumeral numeral = numeral ** {hasC = True} ; diff --git a/src/thai/NumeralTha.gf b/src/thai/NumeralTha.gf index 347006a1..23fa6c64 100644 --- a/src/thai/NumeralTha.gf +++ b/src/thai/NumeralTha.gf @@ -89,4 +89,6 @@ oper D_8 = ss "๘" ; D_9 = ss "๙" ; + PosDecimal d = d ** {hasDot=False} ; + } diff --git a/src/turkish/CatTur.gf b/src/turkish/CatTur.gf index ec30fa20..c81ce41c 100644 --- a/src/turkish/CatTur.gf +++ b/src/turkish/CatTur.gf @@ -30,6 +30,7 @@ concrete CatTur of Cat = CommonX - [CAdv,AdN] ** open ResTur, HarmonyTur, Prelud Numeral = {s : CardOrd => Number => Case => Str ; n : Number} ; Digits = {s : CardOrd => Number => Case => Str ; n : Number; tail : DTail} ; + Decimal = {s : CardOrd => Number => Case => Str ; n : Number; hasDot : Bool} ; -- Adjective AP = {s : Number => Case => Str; h : Harmony} ; diff --git a/src/turkish/NounTur.gf b/src/turkish/NounTur.gf index 7aba93fe..1f23ac08 100644 --- a/src/turkish/NounTur.gf +++ b/src/turkish/NounTur.gf @@ -176,8 +176,8 @@ concrete NounTur of Noun = CatTur ** open ResTur, SuffixTur, HarmonyTur, Prelude s = n.s ! NCard ; n = n.n } ; - NumFloat n1 n2 = { - s = \\n,c => n1.s ! NCard ! Sg ! Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard ! n ! c ; n = Pl + NumDecimal n = { + s = n.s ! NCard ; n = n.n } ; OrdNumeralSuperl n a = { diff --git a/src/turkish/NumeralTur.gf b/src/turkish/NumeralTur.gf index 710ea0c5..5f833aae 100644 --- a/src/turkish/NumeralTur.gf +++ b/src/turkish/NumeralTur.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../../prelude -concrete NumeralTur of Numeral = CatTur [Numeral,Digits] ** open Prelude, ResTur, ParadigmsTur in { +concrete NumeralTur of Numeral = CatTur [Numeral,Digits,Decimal] ** open Prelude, ResTur, ParadigmsTur in { flags coding = utf8 ; @@ -72,6 +72,21 @@ lin D_7 = mkDig "7" ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\t,num,c => "-" ++ BIND ++ d.s ! t ! num ! c; + n = Pl; + hasDot=False + } ; + IFrac d i = { + s=\\t,num,c => d.s ! NCard ! Sg ! Nom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! t ! num ! c; + n = Pl ; + hasDot=True + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND++","++BIND ; diff --git a/src/urdu/NumeralUrd.gf b/src/urdu/NumeralUrd.gf index a4e6cfc0..d5126405 100644 --- a/src/urdu/NumeralUrd.gf +++ b/src/urdu/NumeralUrd.gf @@ -2,7 +2,7 @@ -- Modification for Urdu Shafqat Virk -concrete NumeralUrd of Numeral = CatUrd [Numeral,Digits] ** open ResUrd,CommonHindustani,ParamX, Prelude in { +concrete NumeralUrd of Numeral = CatUrd [Numeral,Digits,Decimal] ** open ResUrd,CommonHindustani,ParamX, Prelude in { flags coding=utf8 ; param DForm = unit | ten ; @@ -110,6 +110,19 @@ lin D_8 = { s = "۸" ; n = Pl}; lin D_9 = { s = "۹" ; n = Pl}; lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue (dg.s ! df) d.s ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { + s = \\df => Prelude.glue "-" (d.s ! df) ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\df => d.s!df ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + n = Pl ; + hasDot=True + } ; oper ekhazar : Str = variants {"ہزار" ; "ایک" ++ "ہزار"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "ہزار"} ! sz ; From 84a03ef78a1c73848d4fb270b7917dfeb546a200 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Mon, 21 Aug 2023 22:21:47 +0300 Subject: [PATCH 047/129] added PiedPiping to Extend and corrected the comment on RelSlash in RelativeEng --- src/abstract/Extend.gf | 6 ++++-- src/common/ExtendFunctor.gf | 8 +++++--- src/english/ExtendEng.gf | 12 +++++++++++- src/english/QuestionEng.gf | 2 +- src/english/RelativeEng.gf | 4 ++-- src/finnish/VerbFin.gf | 2 +- 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/abstract/Extend.gf b/src/abstract/Extend.gf index 2781e92a..a5eb3e24 100644 --- a/src/abstract/Extend.gf +++ b/src/abstract/Extend.gf @@ -27,9 +27,11 @@ abstract Extend = Cat ** { CompBareCN : CN -> Comp ; -- (is) teacher + PiedPipingQuestSlash : IP -> ClSlash -> QCl ; -- with whom does John live + PiedPipingRelSlash : RP -> ClSlash -> RCl ; -- with whom John lives StrandQuestSlash : IP -> ClSlash -> QCl ; -- whom does John live with - StrandRelSlash : RP -> ClSlash -> RCl ; -- that he lives in - EmptyRelSlash : ClSlash -> RCl ; -- he lives in + StrandRelSlash : RP -> ClSlash -> RCl ; -- that he lives with + EmptyRelSlash : ClSlash -> RCl ; -- he lives with -- $VP$ conjunction, separate categories for finite and infinitive forms (VPS and VPI, respectively) diff --git a/src/common/ExtendFunctor.gf b/src/common/ExtendFunctor.gf index a5711b37..1b78fd20 100644 --- a/src/common/ExtendFunctor.gf +++ b/src/common/ExtendFunctor.gf @@ -22,9 +22,11 @@ lin GenModNP num np cn = DetCN (DetQuant DefArt num) (AdvCN cn (PrepNP possess_Prep np)) ; -- this man's car(s) ; DEFAULT the car of this man GenModIP = variants {} ; -- Num -> IP -> CN -> IP ; -- whose car(s) CompBareCN cn = CompCN cn ; -- (is) teacher ; DEFAULT is a teacher - StrandQuestSlash = QuestSlash ; -- whom does John live with ; DEFAULT with whom does John live - StrandRelSlash = RelSlash ; -- that he lives in ; DEFAULT in which he lives - EmptyRelSlash = RelSlash IdRP ; -- he lives in ; DEFAULT in which he lives + StrandQuestSlash = QuestSlash ; -- whom does John live with (default in Eng) + StrandRelSlash = RelSlash ; -- that he lives in (standard in Eng) + PiedPipingQuestSlash = QuestSlash ; -- with whom does John live (default in most languages) + PiedPipingRelSlash = RelSlash ; -- in which he lives (default in most languages) + EmptyRelSlash = RelSlash IdRP ; -- he lives in ; that he lives in MkVPS vp = variants {} ; -- Temp -> Pol -> VP -> VPS ; -- hasn't slept ConjVPS = variants {} ; -- Conj -> [VPS] -> VPS ; -- has walked and won't sleep PredVPS = variants {} ; -- NP -> VPS -> S ; -- has walked and won't sleep diff --git a/src/english/ExtendEng.gf b/src/english/ExtendEng.gf index c43e535a..ec15e1ce 100644 --- a/src/english/ExtendEng.gf +++ b/src/english/ExtendEng.gf @@ -16,7 +16,8 @@ concrete ExtendEng of Extend = FocusAP, FocusAdV, FocusAdv, FocusObj, GenIP, GenModIP, GenModNP, GenNP, GenRP, GerundAdv, GerundCN, GerundNP, IAdvAdv, ICompAP, InOrderToVP, NominalizeVPSlashNP, PassAgentVPSlash, PassVPSlash, ProgrVPSlash, PastPartAP, PastPartAgentAP, PositAdVAdj, PredVPSVV, PredetRNP, PrepCN, - EmbedSSlash, PredIAdvVP, PresPartAP, PurposeVP, ReflPoss, ReflPron, ReflRNP, SlashBareV2S, SlashV2V, StrandQuestSlash, StrandRelSlash, + EmbedSSlash, PredIAdvVP, PresPartAP, PurposeVP, ReflPoss, ReflPron, ReflRNP, SlashBareV2S, SlashV2V, + StrandQuestSlash, StrandRelSlash, PiedPipingQuestSlash, PiedPipingRelSlash, UncontractedNeg, UttAccIP, UttAccNP, UttAdV, UttDatIP, UttDatNP, UttVPShort, WithoutVP, A2VPSlash, N2VPSlash, CardCNCard, ProDrop, theyFem_Pron, theyNeutr_Pron ] @@ -50,6 +51,15 @@ concrete ExtendEng of Extend = GenModNP num np cn = DetCN (DetQuant (GenNP (lin NP np)) num) cn ; GenModIP num ip cn = IdetCN (IdetQuant (GenIP (lin IP ip)) num) cn ; + PiedPipingRelSlash rp slash = { + s = \\t,a,p,agr => + slash.c2 ++ rp.s ! RPrep (fromAgr agr).g ++ slash.s ! t ! a ! p ! oDir ; + c = NPAcc + } ; + + PiedPipingQuestSlash ip slash = + mkQuestion (ss (slash.c2 ++ ip.s ! NPAcc)) slash ; + StrandQuestSlash ip slash = {s = \\t,a,b,q => (mkQuestion (ss (ip.s ! NPAcc)) slash).s ! t ! a ! b ! q ++ slash.c2 diff --git a/src/english/QuestionEng.gf b/src/english/QuestionEng.gf index 775a8f86..95ba1510 100644 --- a/src/english/QuestionEng.gf +++ b/src/english/QuestionEng.gf @@ -21,7 +21,7 @@ concrete QuestionEng of Question = CatEng ** open ResEng, Prelude in { {s = \\t,a,b,q => (mkQuestion (ss (ip.s ! NPAcc)) slash).s ! t ! a ! b ! q ++ slash.c2 } ; - --- changed AR 5/6/2016: uses stranding; pied-piping in ExtraEng + --- changed AR 5/6/2016: uses stranding; pied-piping in ExtraEng and ExtendEng QuestIAdv iadv cl = mkQuestion iadv cl ; diff --git a/src/english/RelativeEng.gf b/src/english/RelativeEng.gf index 512d6e1a..d2572a3e 100644 --- a/src/english/RelativeEng.gf +++ b/src/english/RelativeEng.gf @@ -22,8 +22,8 @@ concrete RelativeEng of Relative = CatEng ** open ResEng, Prelude in { c = npNom } ; --- Pied piping: "that we are looking at". Pied piping and empty --- relative are defined in $ExtraEng.gf$ ("at which we are looking", +-- Preposition stranding: "that we are looking at". Pied piping and empty +-- relative are defined in $ExtendEng.gf$ ("at which we are looking", -- "we are looking at"). RelSlash rp slash = { diff --git a/src/finnish/VerbFin.gf b/src/finnish/VerbFin.gf index cee24034..0bade582 100644 --- a/src/finnish/VerbFin.gf +++ b/src/finnish/VerbFin.gf @@ -80,7 +80,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin, StemFin in { -} ---- - SlashV2VNP = StemFin.slashV2VNP ; ---- compilation to pgf takes too long 6/8/2013 hence a simplified version in stemmed/ +SlashV2VNP = StemFin.slashV2VNP ; ---- compilation to pgf takes too long 6/8/2013 hence a simplified version in stemmed/ AdvVP vp adv = insertAdv (\\_ => adv.s) vp ; ExtAdvVP vp adv = insertAdv (\\_ => embedInCommas adv.s) vp ; From 9a413efd6f9bda37dc47e9a56a193cb45d4aa7f3 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 22 Aug 2023 08:06:07 +0200 Subject: [PATCH 048/129] restore InLN in German --- src/german/NamesGer.gf | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/german/NamesGer.gf b/src/german/NamesGer.gf index d97381e6..5f6f8391 100644 --- a/src/german/NamesGer.gf +++ b/src/german/NamesGer.gf @@ -1,4 +1,4 @@ -concrete NamesGer of Names = CatGer ** open ResGer, Prelude in { +concrete NamesGer of Names = CatGer ** open ResGer, Prelude, (P=ParadigmsGer) in { lin GivenName gn = { s = \\_,c => gn.s ! c ; @@ -58,16 +58,22 @@ lin PlainLN ln = { rc, ext = [] } ; -{- -- InLN : LN -> Adv ; lin InLN ln = { - s = let c = 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) - } ; + s = appPrepNP P.inDat_Prep { + s = \\b,c => case ln.hasArt of { + True => case b of { + True => [] ; -- defart dropped + False => artDef ! (gennum ln.g ln.n) ! c + } ++ + ln.s ! (adjfCase Weak c) ! c ; + False => ln.s ! Strong ! c + } ; + a = agrgP3 ln.g ln.n ; + w = WLight ; + rc, ext = [] + } } ; --} -- AdjLN : AP -> LN -> LN ; lin AdjLN ap ln = ln ** { From 5afe500935a99d2dc6805307d526af222d9151e7 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 22 Aug 2023 08:11:34 +0200 Subject: [PATCH 049/129] restore the compilation for Slovak, Croatian and Czech --- src/croatian/ExtendHrv.gf | 2 ++ src/czech/ExtendCze.gf | 4 +++- src/slovak/ExtendSlo.gf | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/croatian/ExtendHrv.gf b/src/croatian/ExtendHrv.gf index 5fa1d39c..8eba3b1f 100644 --- a/src/croatian/ExtendHrv.gf +++ b/src/croatian/ExtendHrv.gf @@ -26,6 +26,8 @@ concrete ExtendHrv of Extend = CatHrv ** ,ComplBareVS ,CompIQuant ,CompBareCN + ,PiedPipingQuestSlash + ,PiedPipingRelSlash ] with (Grammar = GrammarHrv) ** diff --git a/src/czech/ExtendCze.gf b/src/czech/ExtendCze.gf index 12659f69..de797dd6 100644 --- a/src/czech/ExtendCze.gf +++ b/src/czech/ExtendCze.gf @@ -25,6 +25,8 @@ concrete ExtendCze of Extend = CatCze ** ,ComplBareVS ,CompIQuant ,CompBareCN + ,PiedPipingQuestSlash + ,PiedPipingRelSlash ] with (Grammar = GrammarCze) ** @@ -35,4 +37,4 @@ in { lin ReflPossPron = justDemPronFormsAdjective reflPossessivePron ; -} \ No newline at end of file +} diff --git a/src/slovak/ExtendSlo.gf b/src/slovak/ExtendSlo.gf index c5ff3c5f..86732cb0 100644 --- a/src/slovak/ExtendSlo.gf +++ b/src/slovak/ExtendSlo.gf @@ -25,6 +25,8 @@ concrete ExtendSlo of Extend = CatSlo ** ,ComplBareVS ,CompIQuant ,CompBareCN + ,PiedPipingQuestSlash + ,PiedPipingRelSlash ] with (Grammar = GrammarSlo) ** @@ -35,4 +37,4 @@ in { lin ReflPossPron = justDemPronFormsAdjective reflPossessivePron ; -} \ No newline at end of file +} From 128cf3de8c5e3b4be4ce76d36ec0bb483e6804ee Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 22 Aug 2023 13:54:09 +0200 Subject: [PATCH 050/129] started on the Documentation for Zulu --- src/zulu/DocumentationZul.gf | 59 +++++++++++++++++++++--------------- src/zulu/LangZul.gf | 2 +- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/src/zulu/DocumentationZul.gf b/src/zulu/DocumentationZul.gf index b5483e15..a9499808 100755 --- a/src/zulu/DocumentationZul.gf +++ b/src/zulu/DocumentationZul.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common concrete DocumentationZul of Documentation = CatZul ** open - ResZul, + ResZul,ParamX,Prelude, HTML in { lincat @@ -9,21 +9,32 @@ lincat Document = {s : Str} ; Tag = {s : Str} ; --- lin --- InflectionN, InflectionN2, InflectionN3 = \noun -> { --- t = "n" ; --- s1 = heading1 ("Noun" ++ case noun.g of { --- Neutr => ""; --- Masc => "(masc)"; --- Fem => "(fem)" --- }) ; --- s2 = frameTable ( --- tr (th "" ++ th "nom" ++ th "gen") ++ --- tr (th "sg" ++ td (noun.s ! Sg ! Nom) ++ td (noun.s ! Sg ! Gen)) ++ --- tr (th "pl" ++ td (noun.s ! Pl ! Nom) ++ td (noun.s ! Pl ! Gen)) --- ) --- } ; --- +lin + InflectionN, InflectionN2, InflectionN3 = \noun -> { + t = "n" ; + s1 = heading1 ("Noun (class" ++ + case noun.c of { + C1_2 => "1/2"; + C1a_2a => "1a/2a"; + C3_4 => "3/4"; + C5_6 => "5/6"; + C7_8 => "7/8"; + C9_10 => "9/10"; + C11_10 => "11/10"; + C9_6 => "9/6"; + C14 => "14"; + C15 => "15"; + C17 => "17" + } ++ BIND ++ ")") ; + s2 = frameTable ( + tr (th "" ++ th "sg" ++ th "pl") ++ + tr (th "full" ++ td (noun.s ! Sg ! NFull) ++ td (noun.s ! Pl ! NFull)) ++ + tr (th "reduced" ++ td (noun.s ! Sg ! NReduced) ++ td (noun.s ! Pl ! NReduced)) ++ + tr (th "poss" ++ td (noun.s ! Sg ! NPoss) ++ td (noun.s ! Pl ! NPoss)) ++ + tr (th "loc" ++ td (noun.s ! Sg ! NLoc) ++ td (noun.s ! Pl ! NLoc)) + ) + } ; + -- InflectionA, InflectionA2 = \adj -> { -- t = "a" ; -- s1 = heading1 "Adjective" ; @@ -178,13 +189,13 @@ lincat -- -- pp : Str -> Str = \s -> "<"+s+">"; -- --- lin --- NoDefinition t = {s=t.s}; --- MkDefinition t d = {s="

Definition:"++t.s++d.s++"

"}; --- MkDefinitionEx t d e = {s="

Definition:"++t.s++d.s++"

Example:"++e.s++"

"}; --- --- lin --- MkDocument d i e = {s = i.s1 ++ d.s ++ i.s2 ++ paragraph e.s} ; --- MkTag i = {s = i.t} ; +lin + NoDefinition t = {s=t.s}; + MkDefinition t d = {s="

Definition:"++t.s++d.s++"

"}; + MkDefinitionEx t d e = {s="

Definition:"++t.s++d.s++"

Example:"++e.s++"

"}; + +lin + MkDocument d i e = {s = i.s1 ++ d.s ++ i.s2 ++ paragraph e.s} ; + MkTag i = {s = i.t} ; } diff --git a/src/zulu/LangZul.gf b/src/zulu/LangZul.gf index 3ff15f49..63fa54c5 100755 --- a/src/zulu/LangZul.gf +++ b/src/zulu/LangZul.gf @@ -4,7 +4,7 @@ concrete LangZul of Lang = GrammarZul, LexiconZul -- ,ConstructionZul - -- ,DocumentationZul --# notpresent + ,DocumentationZul --# notpresent -- ,MarkupZul - [stringMark] ** { From 7758291f8ee936f9983ee2b9bae58d561b2d1ac4 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 22 Aug 2023 15:54:33 +0200 Subject: [PATCH 051/129] fixed typo --- src/italian/TerminologyIta.gf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/italian/TerminologyIta.gf b/src/italian/TerminologyIta.gf index 448bc972..745b96b9 100644 --- a/src/italian/TerminologyIta.gf +++ b/src/italian/TerminologyIta.gf @@ -23,7 +23,7 @@ lincat lin noun_Category = mkN "nome" ; - adjective_Category = mkN "addiettivo" ; + adjective_Category = mkN "aggettivo" ; verb_Category = mkN "verbe" masculine ; gender_ParameterType = mkN "genere" masculine ; @@ -65,4 +65,4 @@ lin exampleGr_N = mkN "esempio" masculine ; -} \ No newline at end of file +} From 39e01f04ab3592269b4345cd9a2294b0155fb92d Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 22 Aug 2023 15:56:33 +0200 Subject: [PATCH 052/129] another typo --- src/italian/TerminologyIta.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/italian/TerminologyIta.gf b/src/italian/TerminologyIta.gf index 745b96b9..42d77a72 100644 --- a/src/italian/TerminologyIta.gf +++ b/src/italian/TerminologyIta.gf @@ -31,7 +31,7 @@ lin singular_Parameter = mkN "singolare" ; plural_Parameter = mkN "plurale" ; - masculine_Parameter = mkN "maschio" ; + masculine_Parameter = mkN "maschile" ; feminine_Parameter = mkN "femminile" ; neuter_Parameter = mkN "neutro" ; From 54f5b687feb2f459bd3d8fdb4a2d3c52d15d3b66 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 23 Aug 2023 05:34:30 +0200 Subject: [PATCH 053/129] added Decimals --- src/zulu/CatZul.gf | 3 +- src/zulu/NumeralZul.gf | 81 ++++++++++++++++-------------------------- 2 files changed, 33 insertions(+), 51 deletions(-) diff --git a/src/zulu/CatZul.gf b/src/zulu/CatZul.gf index 82cfd8bf..c0541362 100755 --- a/src/zulu/CatZul.gf +++ b/src/zulu/CatZul.gf @@ -128,7 +128,8 @@ concrete CatZul of Cat = CommonX - [Temp,Tense,Adv,IAdv] ** -- Numeral -- Numeral = {s : Bool => CardOrd => Case => Str ; n : Number} ; --- Digits = {s : CardOrd => Case => Str ; n : Number ; tail : DTail} ; + Digits = {s : Str} ; + Decimal = {s : Str; hasDot : Bool} ; -- Structural diff --git a/src/zulu/NumeralZul.gf b/src/zulu/NumeralZul.gf index 1f434875..1f6f0522 100755 --- a/src/zulu/NumeralZul.gf +++ b/src/zulu/NumeralZul.gf @@ -1,4 +1,4 @@ -concrete NumeralZul of Numeral = CatZul [Numeral,Digits] ** open Prelude, ResZul in { +concrete NumeralZul of Numeral = CatZul [Numeral,Digits,Decimal] ** open Prelude, ResZul in { -- lincat -- Digit = {s : DForm => CardOrd => Case => Str} ; @@ -42,54 +42,35 @@ concrete NumeralZul of Numeral = CatZul [Numeral,Digits] ** open Prelude, ResZul -- lin pot3plus n m = { -- s = \\d,o,c => n.s ! d ! NCard ! Nom ++ "thousand" ++ m.s ! False ! o ! c; n = Pl} ; -- --- -- numerals as sequences of digits --- --- lincat --- Dig = TDigit ; --- --- lin --- IDig d = d ** {tail = T1} ; --- --- IIDig d i = { --- s = \\o,c => d.s ! NCard ! Nom ++ commaIf i.tail ++ i.s ! o ! c ; --- n = Pl ; --- tail = inc i.tail --- } ; --- --- D_0 = mkDig "0" ; --- D_1 = mk3Dig "1" "1st" Sg ; --- D_2 = mk2Dig "2" "2nd" ; --- D_3 = mk2Dig "3" "3rd" ; --- D_4 = mkDig "4" ; --- D_5 = mkDig "5" ; --- D_6 = mkDig "6" ; --- D_7 = mkDig "7" ; --- D_8 = mkDig "8" ; --- D_9 = mkDig "9" ; --- --- oper --- commaIf : DTail -> Str = \t -> case t of { --- T3 => BIND ++ "," ++ BIND ; --- _ => BIND --- } ; --- --- inc : DTail -> DTail = \t -> case t of { --- T1 => T2 ; --- T2 => T3 ; --- T3 => T1 --- } ; --- --- mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; --- mkDig : Str -> TDigit = \c -> mk2Dig c (c + "th") ; --- --- mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> { --- s = table {NCard => regGenitiveS c ; NOrd => regGenitiveS o} ; --- n = n --- } ; --- --- TDigit = { --- n : Number ; --- s : CardOrd => Case => Str --- } ; +-- numerals as sequences of digits +lincat Dig = {s:Str} ; + +lin + IDig d = d ; + + IIDig d dd = {s = d.s ++ Predef.BIND ++ dd.s} ; + + D_0 = { s = "0"} ; + D_1 = { s = "1"} ; + D_2 = { s = "2"} ; + D_3 = { s = "3"} ; + D_4 = { s = "4"} ; + D_5 = { s = "5"} ; + D_6 = { s = "6"} ; + D_7 = { s = "7"} ; + D_8 = { s = "8"} ; + D_9 = { s = "9"} ; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ Predef.BIND ++ d.s ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + hasDot=True + } ; } From 68b9e4b327330d8cdf7ce4dd8892b0d592712d19 Mon Sep 17 00:00:00 2001 From: Arianna Masciolini Date: Wed, 23 Aug 2023 13:14:39 +0200 Subject: [PATCH 054/129] use det 'lo' instead of 'il' even when next word starts with y in ita --- src/italian/PhonoIta.gf | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/italian/PhonoIta.gf b/src/italian/PhonoIta.gf index 1330e5b6..d28d26f5 100644 --- a/src/italian/PhonoIta.gf +++ b/src/italian/PhonoIta.gf @@ -16,12 +16,10 @@ oper "Sb" ; "Sc" ; "Sd" ; "Sf" ; "Sg" ; "Sh" ; "Sl" ; "Sm" ; "Sn" ; "Sp" ; "Sq" ; "Sr" ; "St" ; "Sv" } ; - z : Strs = strs { - "z" ; "Z" - } ; - - x : Strs = strs { - "x" ; "X" + xyz : Strs = strs { + "x" ; "X" ; + "z" ; "Z" ; + "y" ; "Y" } ; gn : Strs = strs { @@ -38,7 +36,7 @@ oper elision : (_,_,_ : Str) -> Str = \il, l', lo -> let ll = case last l' of {"'" => l' ++ Predef.BIND ; _ => l'} in - pre {il ; ll / vocale ; lo / sImpuro ; lo / z ; lo / x ; lo / gn ; lo / pn ; lo / ps } ; + pre {il ; ll / vocale ; lo / sImpuro ; lo / xyz ; lo / gn ; lo / pn ; lo / ps } ; --- pre {vocale => l' ; sImpuro => lo ; _ => il} ; --- doesn't work properly 15/4/2014 } From 578112713a2c966d37a547f148bec1d0ba4358ee Mon Sep 17 00:00:00 2001 From: Arianna Masciolini Date: Wed, 23 Aug 2023 20:29:19 +0200 Subject: [PATCH 055/129] fix ita terminology (#440) --- src/italian/TerminologyIta.gf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/italian/TerminologyIta.gf b/src/italian/TerminologyIta.gf index 42d77a72..9e396c53 100644 --- a/src/italian/TerminologyIta.gf +++ b/src/italian/TerminologyIta.gf @@ -24,7 +24,7 @@ lincat lin noun_Category = mkN "nome" ; adjective_Category = mkN "aggettivo" ; - verb_Category = mkN "verbe" masculine ; + verb_Category = mkN "verbo" ; gender_ParameterType = mkN "genere" masculine ; @@ -38,12 +38,12 @@ lin nominative_Parameter = mkN "nominativo" ; genitive_Parameter = mkN "genitivo" ; dative_Parameter = mkN "dativo" ; - accusative_Parameter = mkN "accusativi" ; + accusative_Parameter = mkN "accusativo" ; imperative_Parameter = mkN "imperativo" ; indicative_Parameter = mkN "indicativo" ; conjunctive_Parameter = mkN "congiuntivo" ; - infinitive_Parameter = mkN "infinitivo" ; + infinitive_Parameter = mkN "infinito" ; present_Parameter = mkN "presente" ; past_Parameter = mkN "passato" ; @@ -59,7 +59,7 @@ lin positive_Parameter = mkN "positivo" ; comparative_Parameter = mkN "comparativo" ; superlative_Parameter = mkN "superlativo" ; - predicative_Parameter = mkN "prédicativo" ; + predicative_Parameter = mkN "predicativo" ; nounHeading n = ss (n.s ! Sg) ; From 6c71465939df928b438a4d1524293f671482016c Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 25 Aug 2023 11:35:54 +0300 Subject: [PATCH 056/129] Template for starting a new resource grammar (#441) Also addressing this https://github.com/GrammaticalFramework/gf-rgl/issues/238 with a README that adds a suggested implementation order. --- src/README.md | 28 +- src/TEMPLATE/AdjectiveTMP.gf | 68 ++++ src/TEMPLATE/AdverbTMP.gf | 39 +++ src/TEMPLATE/AllTMP.gf | 6 + src/TEMPLATE/AllTMPAbs.gf | 5 + src/TEMPLATE/CatTMP.gf | 121 +++++++ src/TEMPLATE/ConjunctionTMP.gf | 147 +++++++++ src/TEMPLATE/ConstructionTMP.gf | 117 +++++++ src/TEMPLATE/ExtendTMP.gf | 35 +++ src/TEMPLATE/GrammarTMP.gf | 17 + src/TEMPLATE/IdiomTMP.gf | 56 ++++ src/TEMPLATE/LangTMP.gf | 5 + src/TEMPLATE/LexiconTMP.gf | 419 +++++++++++++++++++++++++ src/TEMPLATE/MissingTMP.gf | 313 ++++++++++++++++++ src/TEMPLATE/NamesTMP.gf | 36 +++ src/TEMPLATE/NounTMP.gf | 210 +++++++++++++ src/TEMPLATE/NumeralTMP.gf | 115 +++++++ src/TEMPLATE/ParadigmsTMP.gf | 211 +++++++++++++ src/TEMPLATE/PhraseTMP.gf | 27 ++ src/TEMPLATE/QuestionTMP.gf | 105 +++++++ src/TEMPLATE/README.md | 391 +++++++++++++++++++++++ src/TEMPLATE/RelativeTMP.gf | 24 ++ src/TEMPLATE/ResTMP.gf | 296 +++++++++++++++++ src/TEMPLATE/SentenceTMP.gf | 76 +++++ src/TEMPLATE/StructuralTMP.gf | 171 ++++++++++ src/TEMPLATE/SymbolTMP.gf | 73 +++++ src/TEMPLATE/VerbTMP.gf | 114 +++++++ src/TEMPLATE/unittest/nouns.gftest | 9 + src/TEMPLATE/unittest/sentences.gftest | 7 + 29 files changed, 3237 insertions(+), 4 deletions(-) create mode 100644 src/TEMPLATE/AdjectiveTMP.gf create mode 100644 src/TEMPLATE/AdverbTMP.gf create mode 100644 src/TEMPLATE/AllTMP.gf create mode 100644 src/TEMPLATE/AllTMPAbs.gf create mode 100644 src/TEMPLATE/CatTMP.gf create mode 100644 src/TEMPLATE/ConjunctionTMP.gf create mode 100644 src/TEMPLATE/ConstructionTMP.gf create mode 100644 src/TEMPLATE/ExtendTMP.gf create mode 100644 src/TEMPLATE/GrammarTMP.gf create mode 100644 src/TEMPLATE/IdiomTMP.gf create mode 100644 src/TEMPLATE/LangTMP.gf create mode 100644 src/TEMPLATE/LexiconTMP.gf create mode 100644 src/TEMPLATE/MissingTMP.gf create mode 100644 src/TEMPLATE/NamesTMP.gf create mode 100644 src/TEMPLATE/NounTMP.gf create mode 100644 src/TEMPLATE/NumeralTMP.gf create mode 100644 src/TEMPLATE/ParadigmsTMP.gf create mode 100644 src/TEMPLATE/PhraseTMP.gf create mode 100644 src/TEMPLATE/QuestionTMP.gf create mode 100644 src/TEMPLATE/README.md create mode 100644 src/TEMPLATE/RelativeTMP.gf create mode 100644 src/TEMPLATE/ResTMP.gf create mode 100644 src/TEMPLATE/SentenceTMP.gf create mode 100644 src/TEMPLATE/StructuralTMP.gf create mode 100644 src/TEMPLATE/SymbolTMP.gf create mode 100644 src/TEMPLATE/VerbTMP.gf create mode 100644 src/TEMPLATE/unittest/nouns.gftest create mode 100644 src/TEMPLATE/unittest/sentences.gftest diff --git a/src/README.md b/src/README.md index fd22f494..5999aef4 100644 --- a/src/README.md +++ b/src/README.md @@ -12,11 +12,31 @@ This Readme was written by Nemo and edited by Inari on 14th August 2022. # Creating a new resource grammar -If you are working on an RGL for a new language, you will need to run "Clone.hs" in the "src" folder so that you can clone a project from another language to your language to give you a basis to start with. +If you are working on an RGL for a new language, you will need to run "Clone.hs" in the "src" folder so that you can clone a project from another language to your language to give you a basis to start with. -As per the instructions, the syntax is "Clone fromdir todir fromlang tolang", e.g. "runghc Clone swedish danish Swe Dan". You may want to add the option --comment-body after the word "Clone" to comment out every line in the body of the files to start fresh. +### From an existing RGL language -This is especially useful if your new language has very little in common with the language you are copying from because they come from different language families. +If your language already has a close relative in the RGL, then you can clone your language from that one, in order reuse the same structures with only minor modifications. As per the instructions, the syntax is `Clone fromdir todir fromlang tolang`.Suppose you want to clone Slovak from Czech, then do as follows: + +```bash +$ runghc Clone czech slovak Cze Slo +``` + +You may want to add the option `--comment-body` after the word `Clone` to comment out every line in the body of the files. + +```bash +$ runghc Clone --comment-body czech slovak Cze Slo +``` + +### From a generic template + +Often it is easier to start from a rather clean slate, so the recommended way is to clone the [TEMPLATE](TEMPLATE/) module. So suppose you want to start a resource grammar for Albanian, do it as follows: + +```bash +$ runghc Clone TEMPLATE albanian TMP Sqi +``` + +You will see more detailed instructions on how to continue from the cloned template in the [README file](template/README.md). # File hierarchy @@ -43,7 +63,7 @@ https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#my-naming-scheme-for-l # Main goal -You may think of your long-term goal as eventually implementing all the abstract functions found in the "abstract" folder. In other words, you are somewhat constrained by the available categories in Cat.gf and functions in relevant e.g. Noun.gf, Verb.gf etc. files. +You may think of your long-term goal as eventually implementing all the abstract functions found in the "abstract" folder. In other words, you are somewhat constrained by the available categories in Cat.gf and functions in relevant e.g. Noun.gf, Verb.gf etc. files. In the future, if you find that the available functions do not apply to your language, you may search in the Extend.gf file for more optional functions, or in Extra.gf. if it doesn't exist, create your own ExtraLangAbs.gf with the concrete ExtraLang.gf, all in the same directory gf-rgl/src/lang. This blog post contains more information. diff --git a/src/TEMPLATE/AdjectiveTMP.gf b/src/TEMPLATE/AdjectiveTMP.gf new file mode 100644 index 00000000..2122bd07 --- /dev/null +++ b/src/TEMPLATE/AdjectiveTMP.gf @@ -0,0 +1,68 @@ +concrete AdjectiveTMP of Adjective = CatTMP ** open ResTMP, Prelude in { + + flags optimize=all_subs ; + + lin + + -- : AP -> Adv -> AP ; -- warm by nature + AdvAP ap adv = ap ** { + s = ap.s ++ adv.s ; + } ; + + -- : A -> AP ; + PositA a = a ** { + compar = [] ; + } ; + + -- : A -> NP -> AP ; + ComparA a np = a ** { + compar = np.s + } ; + + -- : A2 -> NP -> AP ; -- married to her + -- ComplA2 a2 np = a2 ** { } ; + + -- : A2 -> AP ; -- married to itself + -- ReflA2 a2 = a2 ** { } ; + + -- : A2 -> AP ; -- married + UseA2 = PositA ; + + -- : A -> AP ; -- warmer + -- UseComparA a = a ** { + -- s = \\af => "???" ++ a.s ! af ; + -- compar = [] + -- } ; + + + -- : CAdv -> AP -> NP -> AP ; -- as cool as John + -- CAdvAP adv ap np = ap ** { } ; + +-- The superlative use is covered in $Ord$. + + -- : Ord -> AP ; -- warmest + -- AdjOrd ord = ord ** { + -- compar = [] + -- } ; + -- AdjOrd : Ord -> AP = + AdjOrd ord = ord ; + +-- Sentence and question complements defined for all adjectival +-- phrases, although the semantics is only clear for some adjectives. + + -- : AP -> SC -> AP ; -- good that she is here + -- SentAP ap sc = ap ** { + -- s = \\af => ap.s ! af ++ sc.s + -- } ; + +-- An adjectival phrase can be modified by an *adadjective*, such as "very". + + -- : AdA -> AP -> AP ; + -- AdAP ada ap = ap ** { } ; + + +-- It can also be postmodified by an adverb, typically a prepositional phrase. + + + +} diff --git a/src/TEMPLATE/AdverbTMP.gf b/src/TEMPLATE/AdverbTMP.gf new file mode 100644 index 00000000..7eb5289b --- /dev/null +++ b/src/TEMPLATE/AdverbTMP.gf @@ -0,0 +1,39 @@ +concrete AdverbTMP of Adverb = CatTMP ** open ResTMP, ParadigmsTMP, Prelude in { +{- +lin + + -- : A -> Adv ; + PositAdvAdj adj = + + -- : CAdv -> A -> NP -> Adv ; -- more warmly than John + ComparAdvAdj cadv a np = + + -- : CAdv -> A -> S -> Adv ; -- more warmly than he runs + ComparAdvAdjS cadv a s = + + -- : Prep -> NP -> Adv ; + PrepNP prep np = ; + +-- Adverbs can be modified by 'adadjectives', just like adjectives. + + -- : AdA -> Adv -> Adv ; -- very quickly + AdAdv ada adv = adv ** + +-- Like adverbs, adadjectives can be produced by adjectives. + + -- : A -> AdA ; -- extremely + PositAdAAdj a = + + -- Subordinate clauses can function as adverbs. + + -- : Subj -> S -> Adv ; + SubjS subj s = {s = subj.s ++ s.s} ; + +-- Comparison adverbs also work as numeral adverbs. + + -- : CAdv -> AdN ; -- less (than five) + AdnCAdv cadv = ; + +-} + +} diff --git a/src/TEMPLATE/AllTMP.gf b/src/TEMPLATE/AllTMP.gf new file mode 100644 index 00000000..8709fafe --- /dev/null +++ b/src/TEMPLATE/AllTMP.gf @@ -0,0 +1,6 @@ +--# -path=.:../abstract:../common:../prelude + +concrete AllTMP of AllTMPAbs = + LangTMP, + ExtendTMP + ; diff --git a/src/TEMPLATE/AllTMPAbs.gf b/src/TEMPLATE/AllTMPAbs.gf new file mode 100644 index 00000000..91341ce5 --- /dev/null +++ b/src/TEMPLATE/AllTMPAbs.gf @@ -0,0 +1,5 @@ +--# -path=.:../abstract:../common:prelude + +abstract AllTMPAbs = + Lang, + Extend ; diff --git a/src/TEMPLATE/CatTMP.gf b/src/TEMPLATE/CatTMP.gf new file mode 100644 index 00000000..1daeee1b --- /dev/null +++ b/src/TEMPLATE/CatTMP.gf @@ -0,0 +1,121 @@ +concrete CatTMP of Cat = CommonX ** open ResTMP, Coordination, Prelude in { + + flags optimize=all_subs ; + + lincat + +--2 Sentences and clauses +-- Constructed in SentenceTMP, and also in IdiomTMP + S = SS ; + QS = SS ; + RS = SS ; + -- relative sentence. Tense and polarity fixed, + -- but agreement may depend on the CN/NP it modifies. + + Cl = ResTMP.LinCl ; + ClSlash = SS ; + SSlash = SS ; -- sentence missing NP; e.g. "she has looked at" + Imp = SS ; -- imperative e.g. "look at this" + +--2 Questions and interrogatives + +-- Constructed in QuestionTMP. + QCl = SS ; + IComp = SS ; -- interrogative complement of copula e.g. "where" + IDet = SS ; -- interrogative determiner e.g. "how many" + IQuant = SS ; -- interrogative quantifier e.g. "which" + IP = SS ; -- interrogative pronoun e.g. "who" + +--2 Subord clauses and pronouns + + RCl = SS ; + RP = SS ; + +--2 Verb phrases + +-- Constructed in VerbTMP. + VP = ResTMP.LinVP ; + VPSlash = SS ; + Comp = SS ; + +--2 Adjectival phrases + +-- Constructed in AdjectiveTMP. + AP = SS ; + +--2 Nouns and noun phrases + +-- Constructed in NounTMP. +-- Many atomic noun phrases e.g. "everybody" +-- are constructed in StructuralTMP. + + CN = ResTMP.LinCN ; + NP = ResTMP.LinNP ; + Pron = SS ; -- NB. Pronouns need enough info to become NP or Quant. + Det = ResTMP.LinDet ; -- s : Str , n : Number + Predet = SS ; + Quant = ResTMP.LinQuant ; -- s : Number => Str + Num = ResTMP.LinDet ; + Card = ResTMP.LinDet ; + ACard = SS ; + Ord = SS ; + DAP = SS ; + + +--2 Numerals + +-- Constructed in NumeralTMP. + + Numeral = ResTMP.LinNumeral ; + Digits = ResTMP.LinNumeral ; + +--2 Structural words + +-- Constructed in StructuralTMP. + Conj = Coordination.ConjunctionDistr ** { + n : Number -- The number of the NP that results from + -- coordinating a list of NPs with that Conj. + } ; -- "[Ann and Bob] are children" → and_Conj.n = Pl + Subj = SS ; + Prep = SS ; + + + +--2 Words of open classes + +-- These are constructed in LexiconTMP and in +-- additional lexicon modules. + + -- TODO: eventually different lincats + VS, -- sentence-complement verb e.g. "claim" + VQ, -- question-complement verb e.g. "wonder" + VA, -- adjective-complement verb e.g. "look" + V = ResTMP.LinV ; + + VV -- verb-phrase-complement verb e.g. "want" + = SS ; + + V2A, -- verb with NP and AP complement e.g. "paint" + V2V, -- verb with NP and V complement e.g. "cause" + V2S, -- verb with NP and S complement e.g. "tell" + V2Q, -- verb with NP and Q complement e.g. "ask" + V2 = SS ; + V3 = SS ; + + A = SS ; + A2 = SS ; + + N = ResTMP.LinN ; + N2 = ResTMP.LinN ; + N3 = ResTMP.LinN ; + PN = SS ; + + -- From the Names module, not in the official API as of 2023-08 + GN = SS ; -- Given name, e.g. "George" + SN = SS ; -- Second name, e.g. "Washington" + LN = SS ; -- Location name, e.g. "Sweden" + + linref + Cl = linCl ; + +} diff --git a/src/TEMPLATE/ConjunctionTMP.gf b/src/TEMPLATE/ConjunctionTMP.gf new file mode 100644 index 00000000..b6b29bf0 --- /dev/null +++ b/src/TEMPLATE/ConjunctionTMP.gf @@ -0,0 +1,147 @@ +concrete ConjunctionTMP of Conjunction = + CatTMP ** open ResTMP, Coordination, Prelude in { + + flags optimize=all_subs ; + + {- Conjunction for category X needs four things: + lincat [X] + lin BaseX + lin ConsX + lin ConjX + + For example, if X is defined as + + lincat X = {s : Number => Str ; g : Gender} ; + + then [X] will split its s field into two, and retain its other fields as is: + + lincat [X] = {s1,s2 : Number => Str ; g : Gender} ; + + Let us look at a simple case: Adv is of type {s : Str} + Then [Adv] is {s1,s2 : Str}. + BaseAdv, ConsAdv and ConjAdv can all use functions defined in prelude/Coordination: + + BaseAdv = twoSS ; + ConsAdv = consrSS comma ; + ConjAdv = conjunctSS ; + + --} + +----------------------------------------------------------------------------- +-- Adverb and other simple {s : Str} types. +lincat + [Adv],[AdV],[IAdv] = {s1,s2 : Str} ; + +lin + BaseAdv, BaseAdV, BaseIAdv = twoSS ; + ConsAdv, ConsAdV, ConsIAdv = consrSS comma ; + ConjAdv, ConjAdV, ConjIAdv = conjunctDistrSS ; + +{- + +----------------------------------------------------------------------------- +-- S is sometimes already {s : Str}, sometimes open for mood or word order. +-- Simply take the lincat of S, and split the s field into s1 and s2. +-- Then make sure that all of the other fields are retained. + +lincat + [S] = {s1, s2 : …} ; + +lin + -- : S -> S -> ListS ; -- John walks, Mary runs + BaseS x y = + + -- : S -> ListS -> ListS ; -- John walks, Mary runs, Bill swims + ConsS x xs = + + -- : Conj -> ListS -> S ; -- he walks and she runs + ConjS conj xs = + +----------------------------------------------------------------------------- +-- RS is variable on … and has inherent … +-- RS can modify CNs, which are open for …, and have inherent … + +lincat + [RS] = {s1,s2 : … => Str} ; + +lin + + -- : RS -> RS -> ListRS ; -- who walks, whom I know + BaseRS x y = + + -- : RS -> ListRS -> ListRS ; -- who wals, whom I know, who is here + ConsRS x xs = + + -- : Conj -> ListRS -> RS ; -- who walks and whose mother runs + ConjRS conj xs = + + +----------------------------------------------------------------------------- +-- NP is variable on … and has inherent … + +lincat + [NP] = {s1, s2 : …} ; + +lin + -- : NP -> NP -> ListNP ; -- John, Mary + BaseNP x y = + + -- : NP -> ListNP -> ListNP ; -- John, Mary, Bill + ConsNP x xs = + + -- : Conj -> ListNP -> NP ; -- she or we + ConjNP conj xs = + +----------------------------------------------------------------------------- +-- AP is variable on … and has an inherent … + +lincat + [AP] = {s1, s2 : …} ; + +lin + -- : AP -> AP -> ListAP ; -- red, white + BaseAP x y = + + -- : AP -> ListAP -> ListAP ; -- red, white, blue + ConsAP x xs = + + -- : Conj -> ListAP -> AP ; -- cold and warm + ConjAP conj xs = + +----------------------------------------------------------------------------- +-- CN is variable on … +-- CN conjunction is not in the API, so this can be lower prio + +lincat + [CN] = {s1, s2 : …} ; + +lin + -- : CN -> CN -> ListCN ; -- man, woman + BaseCN x y = + + -- : CN -> ListCN -> ListCN ; -- man, woman, child + ConsCN x xs = + + -- : Conj -> ListCN -> CN ; -- man and woman + ConjCN conj xs = + +----------------------------------------------------------------------------- +-- Det and DAP +-- Note that there is no [Det], the way to coordinate Dets is to make them +-- into DAP first, using Noun.DetDAP : Det -> DAP ; +-- DAP ("three small") isn't used in any API functions, so lower prio. + +lincat + [DAP] = {s1, s2 : …} ; + +lin + -- : DAP -> DAP -> ListDAP ; + BaseDAP x y = + + -- : DAP -> ListDAP -> ListDAP ; + ConsDAP xs x = + + -- : Conj -> ListDAP -> Det ; -- his or her + ConjDet conj xs = +-} +} diff --git a/src/TEMPLATE/ConstructionTMP.gf b/src/TEMPLATE/ConstructionTMP.gf new file mode 100644 index 00000000..0aaa2788 --- /dev/null +++ b/src/TEMPLATE/ConstructionTMP.gf @@ -0,0 +1,117 @@ +concrete ConstructionTMP of Construction = CatTMP ** open ParadigmsTMP in { + +lincat + Timeunit = N ; + Weekday = N ; + Monthday = NP ; + Month = N ; + Year = NP ; +{- +lin + + timeunitAdv n time = + let n_card : Card = n ; + n_hours_NP : NP = mkNP n_card time ; + in SyntaxTMP.mkAdv for_Prep n_hours_NP | mkAdv (n_hours_NP.s ! R.npNom) ; + + weekdayPunctualAdv w = ; -- on Sunday + weekdayHabitualAdv w = ; -- on Sundays + weekdayNextAdv w = -- next Sunday + weekdayLastAdv w = -- last Sunday + + monthAdv m = mkAdv in_Prep (mkNP m) ; + yearAdv y = mkAdv in_Prep y ; + dayMonthAdv d m = ; -- on 17 TMP + monthYearAdv m y = ; -- in TMP 2012 + dayMonthYearAdv d m y = ; -- on 17 TMP 2013 + + intYear = symb ; + intMonthday = symb ; + +lincat Language = N ; + +lin InLanguage l = mkAdv ???_Prep (mkNP l) ; + +lin + weekdayN w = w ; + monthN m = m ; + + weekdayPN w = mkPN w ; + monthPN m = mkPN m ; + + languageCN l = mkCN l ; + languageNP l = mkNP l ; + + +oper mkLanguage : Str -> N = \s -> mkN s ; + +---------------------------------------------- +---- lexicon of special names + +lin second_Timeunit = mkN "second" ; +lin minute_Timeunit = mkN "minute" ; +lin hour_Timeunit = mkN "hour" ; +lin day_Timeunit = mkN "day" ; +lin week_Timeunit = mkN "week" ; +lin month_Timeunit = mkN "month" ; +lin year_Timeunit = mkN "year" ; + +lin monday_Weekday = mkN "Monday" ; +lin tuesday_Weekday = mkN "Tuesday" ; +lin wednesday_Weekday = mkN "Wednesday" ; +lin thursday_Weekday = mkN "Thursday" ; +lin friday_Weekday = mkN "Friday" ; +lin saturday_Weekday = mkN "Saturday" ; +lin sunday_Weekday = mkN "Sunday" ; + +lin january_Month = mkN "January" ; +lin february_Month = mkN "February" ; +lin march_Month = mkN "March" ; +lin april_Month = mkN "April" ; +lin may_Month = mkN "May" ; +lin june_Month = mkN "June" ; +lin july_Month = mkN "July" ; +lin august_Month = mkN "August" ; +lin september_Month = mkN "September" ; +lin october_Month = mkN "October" ; +lin november_Month = mkN "November" ; +lin december_Month = mkN "December" ; + +lin afrikaans_Language = mkLanguage "Afrikaans" ; +lin amharic_Language = mkLanguage "Amharic" ; +lin arabic_Language = mkLanguage "Arabic" ; +lin bulgarian_Language = mkLanguage "Bulgarian" ; +lin catalan_Language = mkLanguage "Catalan" ; +lin chinese_Language = mkLanguage "Chinese" ; +lin danish_Language = mkLanguage "Danish" ; +lin dutch_Language = mkLanguage "Dutch" ; +lin english_Language = mkLanguage "Euslish" ; +lin estonian_Language = mkLanguage "Estonian" ; +lin finnish_Language = mkLanguage "Finnish" ; +lin french_Language = mkLanguage "French" ; +lin german_Language = mkLanguage "German" ; +lin greek_Language = mkLanguage "Greek" ; +lin hebrew_Language = mkLanguage "Hebrew" ; +lin hindi_Language = mkLanguage "Hindi" ; +lin japanese_Language = mkLanguage "Japanese" ; +lin italian_Language = mkLanguage "Italian" ; +lin latin_Language = mkLanguage "Latin" ; +lin latvian_Language = mkLanguage "Latvian" ; +lin maltese_Language = mkLanguage "Maltese" ; +lin nepali_Language = mkLanguage "Nepali" ; +lin norwegian_Language = mkLanguage "Norwegian" ; +lin persian_Language = mkLanguage "Persian" ; +lin polish_Language = mkLanguage "Polish" ; +lin punjabi_Language = mkLanguage "Punjabi" ; +lin romanian_Language = mkLanguage "Romanian" ; +lin russian_Language = mkLanguage "Russian" ; +lin sindhi_Language = mkLanguage "Sindhi" ; +lin spanish_Language = mkLanguage "Spanish" ; +lin swahili_Language = mkLanguage "Swahili" ; +lin swedish_Language = mkLanguage "Swedish" ; +lin thai_Language = mkLanguage "Thai" ; +lin turkish_Language = mkLanguage "Turkish" ; +lin urdu_Language = mkLanguage "Urdu" ; + +-} +} diff --git a/src/TEMPLATE/ExtendTMP.gf b/src/TEMPLATE/ExtendTMP.gf new file mode 100644 index 00000000..599d4811 --- /dev/null +++ b/src/TEMPLATE/ExtendTMP.gf @@ -0,0 +1,35 @@ +--# -path=.:../common:../abstract + +concrete ExtendTMP of Extend = CatTMP + ** ExtendFunctor - [ + VPS -- finite VP's with tense and polarity + , ListVPS + , VPI + , ListVPI -- infinitive VP's (TODO: with anteriority and polarity) + , MkVPS + , PredVPS + + -- excluded because RGL funs needed for them not implemented yet + , SlashBareV2S + , PredAPVP + , ComplBareVS + , AdvIsNP, AdvIsNPAP + , CompBareCN + , CompIQuant + , ComplSlashPartLast + , ComplDirectVQ + , ComplDirectVS + , DetNPFem, DetNPMasc + , ExistCN, ExistMassCN, ExistPluralCN, ExistsNP + , ExistIPQS, ExistNPQS, ExistS + , PredIAdvVP + , PrepCN + , ReflPossPron + , UttVP, UttVPShort, UttAccNP, UttDatNP, UttAccIP, UttDatIP + , EmptyRelSlash, StrandQuestSlash, StrandRelSlash + , SubjRelNP + , UseComp_ser, UseComp_estar + , iFem_Pron, weFem_Pron, youFem_Pron, youPlFem_Pron, youPolFem_Pron, youPolPlFem_Pron, youPolPl_Pron, theyFem_Pron, theyNeutr_Pron + , GenModNP + + ] with (Grammar=GrammarTMP) ; diff --git a/src/TEMPLATE/GrammarTMP.gf b/src/TEMPLATE/GrammarTMP.gf new file mode 100644 index 00000000..3686dd30 --- /dev/null +++ b/src/TEMPLATE/GrammarTMP.gf @@ -0,0 +1,17 @@ +concrete GrammarTMP of Grammar = + NounTMP + , VerbTMP + , AdjectiveTMP + , AdverbTMP + , NumeralTMP + , SentenceTMP + , QuestionTMP + , RelativeTMP + , ConjunctionTMP + , PhraseTMP + , TextX + , StructuralTMP + , IdiomTMP + , TenseX + , NamesTMP -- Not part of original Grammar, here to trigger compilation + ; \ No newline at end of file diff --git a/src/TEMPLATE/IdiomTMP.gf b/src/TEMPLATE/IdiomTMP.gf new file mode 100644 index 00000000..bc3a072b --- /dev/null +++ b/src/TEMPLATE/IdiomTMP.gf @@ -0,0 +1,56 @@ + +--1 Idiom: Idiomatic Expressions + +concrete IdiomTMP of Idiom = CatTMP ** open Prelude, ResTMP, VerbTMP, QuestionTMP, NounTMP, StructuralTMP in { + +-- This module defines constructions that are formed in fixed ways, +-- often different even in closely related languages. + +{- + lin + + + -- ImpersCl : VP -> Cl ; -- it is hot + ImpersCl vp = { + } ; + + -- : NP -> Cl ; -- there is a house + ExistNP np = + + -- ExistIP : IP -> QCl ; -- which houses are there + ExistIP ip = + + -- GenericCl : VP -> Cl ; -- one sleeps + GenericCl vp = + + CleftNP : NP -> RS -> Cl ; -- it is I who did it + CleftAdv : Adv -> S -> Cl ; -- it is here she slept + + -- : NP -> Cl ; -- there is a house + ExistNP np = + + 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 + + -- : VP -> VP ; + ProgrVP vp = vp ** { + } ; + + + -- : VP -> Utt ; -- let's go + ImpPl1 vp = { } ; + + 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/TEMPLATE/LangTMP.gf b/src/TEMPLATE/LangTMP.gf new file mode 100644 index 00000000..27ecda23 --- /dev/null +++ b/src/TEMPLATE/LangTMP.gf @@ -0,0 +1,5 @@ +--# -path=.:../abstract:../common:../prelude:../api +concrete LangTMP of Lang = + GrammarTMP, + LexiconTMP, + ConstructionTMP ; diff --git a/src/TEMPLATE/LexiconTMP.gf b/src/TEMPLATE/LexiconTMP.gf new file mode 100644 index 00000000..c85ec2c0 --- /dev/null +++ b/src/TEMPLATE/LexiconTMP.gf @@ -0,0 +1,419 @@ +concrete LexiconTMP of Lexicon = CatTMP ** + open ParadigmsTMP, ResTMP in { + +---- +-- A +{- +lin add_V3 = mkV3 (mkV "") ; +lin airplane_N = mkN "" ; +lin alas_Interj = mkInterj "" ; +lin already_Adv = mkA "" ; +lin animal_N = mkN "" ; +lin answer_V2S = mkV2S (mkV "") ; +lin apartment_N = mkN "" ; +lin apple_N = mkN "" ; +lin art_N = mkN "" ; +lin ashes_N = mkN "" ; +lin ask_V2Q = mkV2Q (mkV "") ; + +---- +-- B + +lin baby_N = mkN "" ; +lin back_N = mkN "" ; +lin bad_A = mkA "" ; +lin bank_N = mkN "" ; +lin bark_N = mkN "" ; +lin beautiful_A = mkA "" ; +lin become_VA = mkVA (mkV "") ; +lin beer_N = mkN "" ; +lin beg_V2V = mkV2V (mkV "") ; +lin belly_N = mkN "" ; +lin big_A = mkA "" ; +lin bike_N = mkN "" ; +lin bird_N = mkN "" ; +lin bite_V2 = mkV2 "" ; +lin black_A = mkA "" ; -} +lin blood_N = mkN "blood" ; +{-lin blow_V = mkV "" ; +lin blue_A = mkA "" ; +lin boat_N = mkN "" ; +lin bone_N = mkN "" ; +lin boot_N = mkN "" ; +lin boss_N = mkN "" ; +lin book_N = mkN "" ; +lin boy_N = mkN "" ; +lin bread_N = mkN "" ; +lin break_V2 = mkV2 "" ; +lin breast_N = mkN "" ; +lin breathe_V = mkV "" ; +lin broad_A = mkA "" ; +lin brother_N2 = mkN "" ; +lin brown_A = mkA "" ; +lin burn_V = mkV "" ; +lin butter_N = mkN "" ; +lin buy_V2 = mkV2 "" ; + +---- +-- C + +lin camera_N = mkN "" ; +lin cap_N = mkN "" ; +lin car_N = mkN "" ; +lin carpet_N = mkN "" ; +lin cat_N = mkN "" ; +lin ceiling_N = mkN "" ; +lin chair_N = mkN "" ; +lin cheese_N = mkN "" ; +lin child_N = mkN "" ; +lin church_N = mkN "" ; +lin city_N = mkN "" ; +lin clean_A = mkA "" ; +lin clever_A = mkA "" ; +lin close_V2 = mkV2 "" ; +lin cloud_N = mkN "" ; +lin coat_N = mkN "" ; +lin cold_A = mkA "" ; +lin come_V = mkV "" ; +lin computer_N = mkN "" ; +lin correct_A = mkA "" ; +lin count_V2 = mkV2 "" ; +lin country_N = mkN "" ; +lin cousin_N = mkN "" ; +lin cow_N = mkN "" ; +lin cut_V2 = mkV2 "" ; + +---- +-- D + +lin day_N = mkN "" ; -} +lin die_V = mkV "die" ; +{-lin dig_V = mkV "" ; +lin dirty_A = mkA "" ; +lin distance_N3 = mkN3 (mkN "") ; +lin do_V2 = mkV2 "" ; +lin doctor_N = mkN "" ; +lin dog_N = mkN "" ; +lin door_N = mkN "" ; +lin drink_V2 = mkV2 "" ; +lin dry_A = mkA "" ; +lin dull_A = mkA "" ; +lin dust_N = mkN "" ; + +---- +-- E + +lin ear_N = mkN "" ; +lin earth_N = mkN "" ; +lin eat_V2 = mkV "" ; +lin egg_N = mkN "" ; +lin empty_A = mkA "" ; +lin enemy_N = mkN "" ; +lin eye_N = mkN "" ; + +---- +-- F + +lin factory_N = mkN "" ; +lin fall_V = mkV "" ; +lin far_Adv = mkA "" ; +lin fat_N = mkN "" ; +lin father_N2 = mkN2 (mkN "") ; +lin fear_V2 = mkV2 "" ; +lin fear_VS = mkVS (mkV "") ; +lin feather_N = mkN "" ; +lin fight_V2 = mkV2 "" ; +lin find_V2 = mkV2 "" ; +lin fingernail_N = mkN "" ; +lin fire_N = mkN "" ; +lin fish_N = mkN "" ; +lin float_V = mkV "" ; +lin floor_N = mkN "" ; +lin flow_V = mkV "" ; +lin flower_N = mkN "" ; +lin fly_V = mkV "" ; +lin fog_N = mkN "" ; +lin foot_N = mkN "" ; +lin forest_N = mkN "" ; +lin forget_V2 = mkV2 "" ; +lin freeze_V = mkV "" ; +lin fridge_N = mkN "" ; +lin friend_N = mkN "" ; +lin fruit_N = mkN "" ; +lin full_A = mkA "" ; +--lin fun_AV + +---- +-- G + +lin garden_N = mkN "" ; +lin girl_N = mkN "" ; +lin give_V3 = mkV3 (mkV "") ; +lin glove_N = mkN "" ; +lin go_V = mkV "" ; +lin gold_N = mkN "" ; +lin good_A = mkA "" ; +lin grammar_N = mkN "" ; +lin grass_N = mkN "" ; +lin green_A = mkA "" ; + +---- +-- H + +lin hair_N = mkN "" ; +lin hand_N = mkN "" ; +lin harbour_N = mkN "" ; +lin hat_N = mkN "" ; +lin hate_V2 = mkV2 "" ; +lin head_N = mkN "" ; +lin hear_V2 = mkV2 "" ; +lin heart_N = mkN "" ; +lin heavy_A = mkA "" ; +lin hill_N = mkN "" ; +lin hit_V2 = mkV2 "" ; +lin hold_V2 = mkV2 "" ; +lin hope_VS = mkV "" ; +lin horn_N = mkN "" ; +lin horse_N = mkN "" ; +lin hot_A = mkA "" ; +lin house_N = mkN "" ; +lin hunt_V2 = mkV2 "" ; +lin husband_N = mkN "" ; + +-------- +-- I - K + +lin ice_N = mkN "" ; +lin industry_N = mkN "" ; +lin iron_N = mkN "" ; +lin john_PN = mkPN "" ; +lin jump_V = mkV "" ; +lin kill_V2 = mkV2 "" ; +lin king_N = mkN "" ; +lin knee_N = mkN "" ; +lin know_V2 = mkV2 "" ; +lin know_VQ = mkVQ (mkV "") ; +lin know_VS = mkV "" ; + + +---- +-- L + +lin lake_N = mkN "" ; +lin lamp_N = mkN "" ; +lin language_N = mkN "" ; +lin laugh_V = mkV "" ; +lin leaf_N = mkN "" ; +lin learn_V2 = mkV2 "" ; +lin leather_N = mkN "" ; +lin leave_V2 = mkV2 "" ; +lin leg_N = mkN "" ; +lin lie_V = mkV "" ; +lin like_V2 = mkV2 "" ; +lin listen_V2 = mkV2 "" ; +lin live_V = mkV ""; +lin liver_N = mkN "" ; +lin long_A = mkA "" ; +lin lose_V2 = mkV2 "" ; +lin louse_N = mkN "" ; +lin love_N = mkN "" ; +lin love_V2 = mkV2 "" ; + +---- +-- M + +lin man_N = mkN "" ; +lin married_A2 = mkA2 (mkA "") ; +lin meat_N = mkN "" ; +lin milk_N = mkN "" ; +lin moon_N = mkN "" ; +lin mother_N2 = mkN2 (mkN "") ; +lin mountain_N = mkN "" ; +lin mouth_N = mkN "" ; +lin music_N = mkN "" ; + +---- +-- N + +lin name_N = mkN "" ; +lin narrow_A = mkA "" ; +lin near_A = mkA "" ; +lin neck_N = mkN "" ; +lin new_A = mkA "" ; +lin newspaper_N = mkN "" ; +lin night_N = mkN "" ; +lin nose_N = mkN "" ; +lin now_Adv = mkAdv "" ; +lin number_N = mkN "" ; + +-------- +-- O - P + + +lin oil_N = mkN "" ; +lin old_A = mkA "" ; +lin open_V2 = mkV2 "" ; +lin paint_V2A = mkV2A (mkV "") ; +lin paper_N = mkN "" ; +lin paris_PN = mkPN "Paris" ; +lin peace_N = mkN "" ; +lin pen_N = mkN "" ; +lin person_N = mkN "" ; +lin planet_N = mkN "" ; +lin plastic_N = mkN "" ; +lin play_V = mkV "" ; +lin policeman_N = mkN "" ; +lin priest_N = mkN "" ; +lin pull_V2 = mkV2 "" ; +lin push_V2 = mkV2 "" ; +lin put_V2 = mkV2 "" ; + +-------- +-- Q - R + + +lin queen_N = mkN "" ; +lin question_N = mkN "" ; +lin radio_N = mkN "" ; +lin rain_N = mkN "" ; +lin rain_V0 = mkV "" ; +lin read_V2 = mkV2 "" ; +lin ready_A = mkA "" ; +lin reason_N = mkN "" ; +lin red_A = mkA "" ; +lin religion_N = mkN "" ; +lin restaurant_N = mkN "" ; +lin river_N = mkN "" ; +lin road_N = mkN "" ; +lin rock_N = mkN "" ; +lin roof_N = mkN "" ; +lin root_N = mkN "" ; +lin rope_N = mkN "" ; +lin rotten_A = mkA "" ; +lin round_A = mkA "" ; +lin rub_V2 = mkV2 "" ; +lin rubber_N = mkN "" ; +lin rule_N = mkN "" ; +lin run_V = mkV "" ; + +---- +-- S + +lin salt_N = mkN "" ; +lin sand_N = mkN "" ; +lin say_VS = mkVS (mkV "") ; +lin school_N = mkN "" ; +lin science_N = mkN "" ; +lin scratch_V2 = mkV2 "" ; +lin sea_N = mkN "" ; +lin see_V2 = mkV2 "" ; +lin seed_N = mkN "" ; +lin seek_V2 = mkV2 "" ; +lin sell_V3 = mkV3 (mkV "" Meng) emptyPrep emptyPrep ; -- TODO +lin send_V3 = mkV3 (mkV "") ; +lin sew_V = mkV "" ; +lin sharp_A = mkA "" ; +lin sheep_N = mkN "" fem ; +lin ship_N = mkN "" ; +lin shirt_N = mkN "" ; +lin shoe_N = mkN "" ; +lin shop_N = mkN "" ; +lin short_A = mkA "" ; +lin silver_N = mkN "" ; +lin sing_V = mkV "" ; +lin sister_N = mkN "" ; +lin sit_V = mkV "" ; +lin skin_N = mkN "" ; +lin sky_N = mkN "" ; +lin sleep_V = mkV "" ; +lin small_A = mkA "" ; +lin smell_V = mkV "" ; +lin smoke_N = mkN "" ; +lin smooth_A = mkA "" ; +lin snake_N = mkN "" ; +lin snow_N = mkN "" ; +lin sock_N = mkN "" ; +lin song_N = mkN "" ; +lin speak_V2 = mkV2 "" ; +lin spit_V = mkV "" ; +lin split_V2 = mkV2 "" ; +lin squeeze_V2 = mkV2 "" ; +lin stab_V2 = mkV2 "" ; +lin stand_V = mkV "" ; +lin star_N = mkN "" ; +lin steel_N = mkN "" ; +lin stick_N = mkN "" ; +lin stone_N = mkN "" ; +lin stop_V = mkV "" ; +lin stove_N = mkN "" ; +lin straight_A = mkA "" ; +lin student_N = mkN "" ; +lin stupid_A = mkA "" ; +lin suck_V2 = mkV2 "" ; +lin sun_N = mkN "" ; +lin swell_V = mkV "" ; +lin swim_V = mkV "" ; + +---- +-- T + + +lin table_N = mkN "" ; +lin tail_N = mkN "" ; +lin talk_V3 = mkV3 (mkV "" Ber) (mkPrep "") (mkPrep "") ; +lin teach_V2 = mkV2 "" ; +lin teacher_N = mkN "" ; +lin television_N = mkN "" ; +lin thick_A = mkA "" ; +lin thin_A = mkA "" ; +lin think_V = mkV "" ; +lin throw_V2 = mkV2 "" ; +lin tie_V2 = mkV2 "" ; +lin today_Adv = mkA "" ; +lin tongue_N = mkN "" ; +lin tooth_N = mkN "" ; +lin train_N = mkN "" ; +lin travel_V = mkV "" ; +lin tree_N = mkN "" ; +lin turn_V = mkV "" ; + +-------- +-- U - V + +lin ugly_A = mkA "" ; +lin uncertain_A = mkA "" ; +lin understand_V2 = mkV2 "" ; +lin university_N = mkN "" ; +lin village_N = mkN "" ; +lin vomit_V = mkV2 "" ; + +-------- +-- W - Y + +lin wait_V2 = mkV2 "" ; +lin walk_V = mkV "" ; +lin war_N = mkN "" ; +lin warm_A = mkA "" ; +lin wash_V2 = mkV2 "" ; +lin watch_V2 = mkV2 "" ; +lin water_N = mkNoun "" ; +lin wet_A = mkA "" ; +lin white_A = mkA "" ; +lin wide_A = mkA "" ; +lin wife_N = mkN "" ; +lin win_V2 = mkV2 "" ; +lin wind_N = mkN "" ; +lin window_N = mkN "" ; +lin wine_N = mkN "" ; +lin wing_N = mkN "" ; +lin wipe_V2 = mkV2 "" ; +lin woman_N = mkN "" ; +lin wonder_VQ = mkVQ (mkV "") ; +lin wood_N = mkN "" ; +lin worm_N = mkN "" ; +lin write_V2 = mkV2 "" ; +lin year_N = mkN "" ; +lin yellow_A = mkA "" ; +lin young_A = mkA "" ; +-} +} diff --git a/src/TEMPLATE/MissingTMP.gf b/src/TEMPLATE/MissingTMP.gf new file mode 100644 index 00000000..529ad094 --- /dev/null +++ b/src/TEMPLATE/MissingTMP.gf @@ -0,0 +1,313 @@ +resource MissingTMP = open GrammarTMP, Prelude in { +-- temporary definitions to enable the compilation of RGL API +oper AdAP : AdA -> AP -> AP = notYet "AdAP" ; +oper AdAdv : AdA -> Adv -> Adv = notYet "AdAdv" ; +oper AdNum : AdN -> Card -> Card = notYet "AdNum" ; +oper AdVVP : AdV -> VP -> VP = notYet "AdVVP" ; +oper AdVVPSlash : AdV -> VPSlash -> VPSlash = notYet "AdVVPSlash" ; +oper AddAdvQVP : QVP -> IAdv -> QVP = notYet "AddAdvQVP" ; +oper AdjCN : AP -> CN -> CN = notYet "AdjCN" ; +oper AdjDAP : DAP -> AP -> DAP = notYet "AdjDAP" ; +oper AdjOrd : Ord -> AP = notYet "AdjOrd" ; +oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ; +oper AdvAP : AP -> Adv -> AP = notYet "AdvAP" ; +oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ; +oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ; +oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ; +oper AdvImp : Adv -> Imp -> Imp = notYet "AdvImp" ; +oper AdvNP : NP -> Adv -> NP = notYet "AdvNP" ; +oper AdvQVP : VP -> IAdv -> QVP = notYet "AdvQVP" ; +oper AdvS : Adv -> S -> S = notYet "AdvS" ; +oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ; +oper AdvVP : VP -> Adv -> VP = notYet "AdvVP" ; +oper AdvVPSlash : VPSlash -> Adv -> VPSlash = notYet "AdvVPSlash" ; +oper ApposCN : CN -> NP -> CN = notYet "ApposCN" ; +oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ; +oper BaseAdV : AdV -> AdV -> ListAdV = notYet "BaseAdV" ; +oper BaseAdv : Adv -> Adv -> ListAdv = notYet "BaseAdv" ; +oper BaseCN : CN -> CN -> ListCN = notYet "BaseCN" ; +oper BaseIAdv : IAdv -> IAdv -> ListIAdv = notYet "BaseIAdv" ; +oper BaseNP : NP -> NP -> ListNP = notYet "BaseNP" ; +oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ; +oper BaseS : S -> S -> ListS = notYet "BaseS" ; +oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ; +oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ; +oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ; +oper CompAP : AP -> Comp = notYet "CompAP" ; +oper CompAdv : Adv -> Comp = notYet "CompAdv" ; +oper CompCN : CN -> Comp = notYet "CompCN" ; +oper CompIAdv : IAdv -> IComp = notYet "CompIAdv" ; +oper CompIP : IP -> IComp = notYet "CompIP" ; +oper CompNP : NP -> Comp = notYet "CompNP" ; +oper ComparA : A -> NP -> AP = notYet "ComparA" ; +oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ; +oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ; +oper ComplA2 : A2 -> NP -> AP = notYet "ComplA2" ; +oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ; +oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ; +oper ComplSlash : VPSlash -> NP -> VP = notYet "ComplSlash" ; +oper ComplSlashIP : VPSlash -> IP -> QVP = notYet "ComplSlashIP" ; +oper ComplVA : VA -> AP -> VP = notYet "ComplVA" ; +oper ComplVQ : VQ -> QS -> VP = notYet "ComplVQ" ; +oper ComplVS : VS -> S -> VP = notYet "ComplVS" ; +oper ComplVV : VV -> VP -> VP = notYet "ComplVV" ; +oper ConjAP : Conj -> ListAP -> AP = notYet "ConjAP" ; +oper ConjAdV : Conj -> ListAdV -> AdV = notYet "ConjAdV" ; +oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ; +oper ConjCN : Conj -> ListCN -> CN = notYet "ConjCN" ; +oper ConjDet : Conj -> ListDAP -> Det = notYet "ConjDet" ; +oper ConjIAdv : Conj -> ListIAdv -> IAdv = notYet "ConjIAdv" ; +oper ConjNP : Conj -> ListNP -> NP = notYet "ConjNP" ; +oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ; +oper ConjS : Conj -> ListS -> S = notYet "ConjS" ; +oper ConsAP : AP -> ListAP -> ListAP = notYet "ConsAP" ; +oper ConsAdV : AdV -> ListAdV -> ListAdV = notYet "ConsAdV" ; +oper ConsAdv : Adv -> ListAdv -> ListAdv = notYet "ConsAdv" ; +oper ConsCN : CN -> ListCN -> ListCN = notYet "ConsCN" ; +oper ConsIAdv : IAdv -> ListIAdv -> ListIAdv = notYet "ConsIAdv" ; +oper ConsNP : NP -> ListNP -> ListNP = notYet "ConsNP" ; +oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ; +oper ConsS : S -> ListS -> ListS = notYet "ConsS" ; +oper CountNP : Det -> NP -> NP = notYet "CountNP" ; +oper DetCN : Det -> CN -> NP = notYet "DetCN" ; +oper DetDAP : Det -> DAP = notYet "DetDAP" ; +oper DetNP : Det -> NP = notYet "DetNP" ; +oper DetQuantOrd : Quant -> Num -> Ord -> Det = notYet "DetQuantOrd" ; +oper EmbedQS : QS -> SC = notYet "EmbedQS" ; +oper EmbedS : S -> SC = notYet "EmbedS" ; +oper EmbedVP : VP -> SC = notYet "EmbedVP" ; +oper ExistIP : IP -> QCl = notYet "ExistIP" ; +oper ExistIPAdv : IP -> Adv -> QCl = notYet "ExistIPAdv" ; +oper ExistNP : NP -> Cl = notYet "ExistNP" ; +oper ExistNPAdv : NP -> Adv -> Cl = notYet "ExistNPAdv" ; +oper ExtAdvS : Adv -> S -> S = notYet "ExtAdvS" ; +oper ExtAdvVP : VP -> Adv -> VP = notYet "ExtAdvVP" ; +oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ; +oper GenericCl : VP -> Cl = notYet "GenericCl" ; +oper IdRP : RP = notYet "IdRP" ; +oper IdetCN : IDet -> CN -> IP = notYet "IdetCN" ; +oper IdetIP : IDet -> IP = notYet "IdetIP" ; +oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ; +oper ImpP3 : NP -> VP -> Utt = notYet "ImpP3" ; +oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ; +oper ImpVP : VP -> Imp = notYet "ImpVP" ; +oper ImpersCl : VP -> Cl = notYet "ImpersCl" ; +oper MassNP : CN -> NP = notYet "MassNP" ; +oper NumCard : Card -> Num = notYet "NumCard" ; +oper NumDigits : Digits -> Card = notYet "NumDigits" ; +oper NumNumeral : Numeral -> Card = notYet "NumNumeral" ; +oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ; +oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ; +oper OrdNumeralSuperl : Numeral -> A -> Ord = notYet "OrdNumeralSuperl" ; +oper OrdSuperl : A -> Ord = notYet "OrdSuperl" ; +oper PConjConj : Conj -> PConj = notYet "PConjConj" ; +oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ; +oper PartNP : CN -> NP -> CN = notYet "PartNP" ; +oper PassV2 : V2 -> VP = notYet "PassV2" ; +oper PhrUtt : PConj -> Utt -> Voc -> Phr = notYet "PhrUtt" ; +oper PositA : A -> AP = notYet "PositA" ; +oper PositAdAAdj : A -> AdA = notYet "PositAdAAdj" ; +oper PositAdvAdj : A -> Adv = notYet "PositAdvAdj" ; +oper PossNP : CN -> NP -> CN = notYet "PossNP" ; +oper PossPron : Pron -> Quant = notYet "PossPron" ; +oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ; +oper PredVP : NP -> VP -> Cl = notYet "PredVP" ; +oper PredetNP : Predet -> NP -> NP = notYet "PredetNP" ; +oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ; +oper PrepNP : Prep -> NP -> Adv = notYet "PrepNP" ; +oper ProgrVP : VP -> VP = notYet "ProgrVP" ; +oper QuestCl : Cl -> QCl = notYet "QuestCl" ; +oper QuestIAdv : IAdv -> Cl -> QCl = notYet "QuestIAdv" ; +oper QuestIComp : IComp -> NP -> QCl = notYet "QuestIComp" ; +oper QuestQVP : IP -> QVP -> QCl = notYet "QuestQVP" ; +oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ; +oper QuestVP : IP -> VP -> QCl = notYet "QuestVP" ; +oper ReflA2 : A2 -> AP = notYet "ReflA2" ; +oper ReflVP : VPSlash -> VP = notYet "ReflVP" ; +oper RelCN : CN -> RS -> CN = notYet "RelCN" ; +oper RelCl : Cl -> RCl = notYet "RelCl" ; +oper RelNP : NP -> RS -> NP = notYet "RelNP" ; +oper RelS : S -> RS -> S = notYet "RelS" ; +oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ; +oper RelVP : RP -> VP -> RCl = notYet "RelVP" ; +oper SSubjS : S -> Subj -> S -> S = notYet "SSubjS" ; +oper SelfAdVVP : VP -> VP = notYet "SelfAdVVP" ; +oper SelfAdvVP : VP -> VP = notYet "SelfAdvVP" ; +oper SelfNP : NP -> NP = notYet "SelfNP" ; +oper SentAP : AP -> SC -> AP = notYet "SentAP" ; +oper SentCN : CN -> SC -> CN = notYet "SentCN" ; +oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ; +oper Slash3V3 : V3 -> NP -> VPSlash = notYet "Slash3V3" ; +oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ; +oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ; +oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ; +oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ; +oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ; +oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ; +oper SlashV2a : V2 -> VPSlash = notYet "SlashV2a" ; +oper SlashVP : NP -> VPSlash -> ClSlash = notYet "SlashVP" ; +oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ; +oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ; +oper SubjS : Subj -> S -> Adv = notYet "SubjS" ; +oper TFullStop : Phr -> Text -> Text = notYet "TFullStop" ; +oper Use2N3 : N3 -> N2 = notYet "Use2N3" ; +oper Use3N3 : N3 -> N2 = notYet "Use3N3" ; +oper UseA2 : A2 -> AP = notYet "UseA2" ; +oper UseCl : Temp -> Pol -> Cl -> S = notYet "UseCl" ; +oper UseComp : Comp -> VP = notYet "UseComp" ; +oper UseComparA : A -> AP = notYet "UseComparA" ; +oper UseCopula : VP = notYet "UseCopula" ; +oper UseN : N -> CN = notYet "UseN" ; +oper UseN2 : N2 -> CN = notYet "UseN2" ; +oper UsePN : PN -> NP = notYet "UsePN" ; +oper UsePron : Pron -> NP = notYet "UsePron" ; +oper UseQCl : Temp -> Pol -> QCl -> QS = notYet "UseQCl" ; +oper UseRCl : Temp -> Pol -> RCl -> RS = notYet "UseRCl" ; +oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ; +oper UseV : V -> VP = notYet "UseV" ; +oper UttAP : AP -> Utt = notYet "UttAP" ; +oper UttAdv : Adv -> Utt = notYet "UttAdv" ; +oper UttCN : CN -> Utt = notYet "UttCN" ; +oper UttCard : Card -> Utt = notYet "UttCard" ; +oper UttIAdv : IAdv -> Utt = notYet "UttIAdv" ; +oper UttIP : IP -> Utt = notYet "UttIP" ; +oper UttImpPl : Pol -> Imp -> Utt = notYet "UttImpPl" ; +oper UttImpPol : Pol -> Imp -> Utt = notYet "UttImpPol" ; +oper UttImpSg : Pol -> Imp -> Utt = notYet "UttImpSg" ; +oper UttInterj : Interj -> Utt = notYet "UttInterj" ; +oper UttNP : NP -> Utt = notYet "UttNP" ; +oper UttQS : QS -> Utt = notYet "UttQS" ; +oper UttS : S -> Utt = notYet "UttS" ; +oper UttVP : VP -> Utt = notYet "UttVP" ; +oper VPSlashPrep : VP -> Prep -> VPSlash = notYet "VPSlashPrep" ; +oper VocNP : NP -> Voc = notYet "VocNP" ; +oper above_Prep : Prep = notYet "above_Prep" ; +oper active2passive : Cl -> Cl = notYet "active2passive" ; +oper after_Prep : Prep = notYet "after_Prep" ; +oper alas_Interj : Interj = notYet "alas_Interj" ; +oper all_Predet : Predet = notYet "all_Predet" ; +oper almost_AdA : AdA = notYet "almost_AdA" ; +oper almost_AdN : AdN = notYet "almost_AdN" ; +oper already_Adv : Adv = notYet "already_Adv" ; +oper although_Subj : Subj = notYet "although_Subj" ; +oper always_AdV : AdV = notYet "always_AdV" ; +oper as_CAdv : CAdv = notYet "as_CAdv" ; +oper at_least_AdN : AdN = notYet "at_least_AdN" ; +oper at_most_AdN : AdN = notYet "at_most_AdN" ; +oper because_Subj : Subj = notYet "because_Subj" ; +oper before_Prep : Prep = notYet "before_Prep" ; +oper behind_Prep : Prep = notYet "behind_Prep" ; +oper between_Prep : Prep = notYet "between_Prep" ; +oper both7and_DConj : Conj = notYet "both7and_DConj" ; +oper but_PConj : PConj = notYet "but_PConj" ; +oper by8agent_Prep : Prep = notYet "by8agent_Prep" ; +oper by8means_Prep : Prep = notYet "by8means_Prep" ; +oper dconcat : Digits -> Digits -> Digits = notYet "dconcat" ; +oper digits2num : Digits -> Numeral = notYet "digits2num" ; +oper digits2numeral : Card -> Card = notYet "digits2numeral" ; +oper dn : Dig -> Digit = notYet "dn" ; +oper dn10 : Dig -> Sub10 = notYet "dn10" ; +oper dn100 : Dig -> Dig -> Sub100 = notYet "dn100" ; +oper dn1000 : Dig -> Dig -> Dig -> Sub1000 = notYet "dn1000" ; +oper dn1000000a : Dig -> Dig -> Dig -> Dig -> Sub1000000 = notYet "dn1000000a" ; +oper dn1000000b : Dig -> Dig -> Dig -> Dig -> Dig -> Sub1000000 = notYet "dn1000000b" ; +oper dn1000000c : Dig -> Dig -> Dig -> Dig -> Dig -> Dig -> Sub1000000 = notYet "dn1000000c" ; +oper during_Prep : Prep = notYet "during_Prep" ; +oper either7or_DConj : Conj = notYet "either7or_DConj" ; +oper every_Det : Det = notYet "every_Det" ; +oper everybody_NP : NP = notYet "everybody_NP" ; +oper everything_NP : NP = notYet "everything_NP" ; +oper everywhere_Adv : Adv = notYet "everywhere_Adv" ; +oper except_Prep : Prep = notYet "except_Prep" ; +oper few_Det : Det = notYet "few_Det" ; +oper for_Prep : Prep = notYet "for_Prep" ; +oper from_Prep : Prep = notYet "from_Prep" ; +oper he_Pron : Pron = notYet "he_Pron" ; +oper here7from_Adv : Adv = notYet "here7from_Adv" ; +oper here7to_Adv : Adv = notYet "here7to_Adv" ; +oper here_Adv : Adv = notYet "here_Adv" ; +oper how8many_IDet : IDet = notYet "how8many_IDet" ; +oper how8much_IAdv : IAdv = notYet "how8much_IAdv" ; +oper how_IAdv : IAdv = notYet "how_IAdv" ; +oper i_Pron : Pron = notYet "i_Pron" ; +oper if_Subj : Subj = notYet "if_Subj" ; +oper if_then_Conj : Conj = notYet "if_then_Conj" ; +oper in8front_Prep : Prep = notYet "in8front_Prep" ; +oper in_Prep : Prep = notYet "in_Prep" ; +oper it_Pron : Pron = notYet "it_Pron" ; +oper john_PN : PN = notYet "john_PN" ; +oper language_title_Utt : Utt = notYet "language_title_Utt" ; +oper left_Ord : Ord = notYet "left_Ord" ; +oper less_CAdv : CAdv = notYet "less_CAdv" ; +oper many_Det : Det = notYet "many_Det" ; +oper more_CAdv : CAdv = notYet "more_CAdv" ; +oper most_Predet : Predet = notYet "most_Predet" ; +oper much_Det : Det = notYet "much_Det" ; +oper nd : Digit -> Dig = notYet "nd" ; +oper nd10 : Sub10 -> Digits = notYet "nd10" ; +oper nd100 : Sub100 -> Digits = notYet "nd100" ; +oper nd1000 : Sub1000 -> Digits = notYet "nd1000" ; +oper nd1000000 : Sub1000000 -> Digits = notYet "nd1000000" ; +oper no_Quant : Quant = notYet "no_Quant" ; +oper no_Utt : Utt = notYet "no_Utt" ; +oper nobody_NP : NP = notYet "nobody_NP" ; +oper not_Predet : Predet = notYet "not_Predet" ; +oper nothing_NP : NP = notYet "nothing_NP" ; +oper num : Sub1000000 -> Numeral = notYet "num" ; +oper num2digits : Numeral -> Digits = notYet "num2digits" ; +oper on_Prep : Prep = notYet "on_Prep" ; +oper only_Predet : Predet = notYet "only_Predet" ; +oper or_Conj : Conj = notYet "or_Conj" ; +oper otherwise_PConj : PConj = notYet "otherwise_PConj" ; +oper part_Prep : Prep = notYet "part_Prep" ; +oper please_Voc : Voc = notYet "please_Voc" ; +oper possess_Prep : Prep = notYet "possess_Prep" ; +oper pot01 : Sub10 = notYet "pot01" ; +oper pot1 : Digit -> Sub100 = notYet "pot1" ; +oper pot110 : Sub100 = notYet "pot110" ; +oper pot111 : Sub100 = notYet "pot111" ; +oper pot1plus : Digit -> Sub10 -> Sub100 = notYet "pot1plus" ; +oper pot1to19 : Digit -> Sub100 = notYet "pot1to19" ; +oper pot2 : Sub10 -> Sub1000 = notYet "pot2" ; +oper pot2plus : Sub10 -> Sub100 -> Sub1000 = notYet "pot2plus" ; +oper pot3 : Sub1000 -> Sub1000000 = notYet "pot3" ; +oper pot3plus : Sub1000 -> Sub1000 -> Sub1000000 = notYet "pot3plus" ; +oper quite_Adv : AdA = notYet "quite_Adv" ; +oper right_Ord : Ord = notYet "right_Ord" ; +oper she_Pron : Pron = notYet "she_Pron" ; +oper so_AdA : AdA = notYet "so_AdA" ; +oper somePl_Det : Det = notYet "somePl_Det" ; +oper someSg_Det : Det = notYet "someSg_Det" ; +oper somebody_NP : NP = notYet "somebody_NP" ; +oper something_NP : NP = notYet "something_NP" ; +oper somewhere_Adv : Adv = notYet "somewhere_Adv" ; +oper that_Quant : Quant = notYet "that_Quant" ; +oper that_Subj : Subj = notYet "that_Subj" ; +oper there7from_Adv : Adv = notYet "there7from_Adv" ; +oper there7to_Adv : Adv = notYet "there7to_Adv" ; +oper there_Adv : Adv = notYet "there_Adv" ; +oper therefore_PConj : PConj = notYet "therefore_PConj" ; +oper they_Pron : Pron = notYet "they_Pron" ; +oper this_Quant : Quant = notYet "this_Quant" ; +oper through_Prep : Prep = notYet "through_Prep" ; +oper to_Prep : Prep = notYet "to_Prep" ; +oper too_AdA : AdA = notYet "too_AdA" ; +oper under_Prep : Prep = notYet "under_Prep" ; +oper very_AdA : AdA = notYet "very_AdA" ; +oper we_Pron : Pron = notYet "we_Pron" ; +oper whatPl_IP : IP = notYet "whatPl_IP" ; +oper whatSg_IP : IP = notYet "whatSg_IP" ; +oper when_IAdv : IAdv = notYet "when_IAdv" ; +oper when_Subj : Subj = notYet "when_Subj" ; +oper where_IAdv : IAdv = notYet "where_IAdv" ; +oper which_IQuant : IQuant = notYet "which_IQuant" ; +oper whoPl_IP : IP = notYet "whoPl_IP" ; +oper whoSg_IP : IP = notYet "whoSg_IP" ; +oper why_IAdv : IAdv = notYet "why_IAdv" ; +oper with_Prep : Prep = notYet "with_Prep" ; +oper without_Prep : Prep = notYet "without_Prep" ; +oper yes_Utt : Utt = notYet "yes_Utt" ; +oper youPl_Pron : Pron = notYet "youPl_Pron" ; +oper youPol_Pron : Pron = notYet "youPol_Pron" ; +oper youSg_Pron : Pron = notYet "youSg_Pron" ; +} \ No newline at end of file diff --git a/src/TEMPLATE/NamesTMP.gf b/src/TEMPLATE/NamesTMP.gf new file mode 100644 index 00000000..8dff2d6b --- /dev/null +++ b/src/TEMPLATE/NamesTMP.gf @@ -0,0 +1,36 @@ +concrete NamesTMP of Names = CatTMP ** open Prelude in { + +-- An API layer to deal with names +-- Not part of the RGL API, but used in the AW project +-- So depends on your goals whether this is high or low priority to implement. +{- + lin + -- : GN -> NP ; + GivenName gn = + + -- : SN -> NP ; + MaleSurname sn = + + -- : SN -> NP ; + FemaleSurname sn = + + -- : SN -> NP ; + PlSurname sn = + + -- : GN -> SN -> NP ; + FullName gn sn = + + lin + -- : LN -> NP ; + UseLN ln = + + -- : LN -> NP ; + PlainLN ln = + + -- : LN -> Adv ; + InLN ln = + + -- : AP -> LN -> LN ; + AdjLN ap ln = +-} +} diff --git a/src/TEMPLATE/NounTMP.gf b/src/TEMPLATE/NounTMP.gf new file mode 100644 index 00000000..b352421a --- /dev/null +++ b/src/TEMPLATE/NounTMP.gf @@ -0,0 +1,210 @@ +concrete NounTMP of Noun = CatTMP ** open ResTMP, Prelude in { + + flags optimize=all_subs ; + + lin + +--2 Noun phrases + +-- : Det -> CN -> NP + DetCN det cn = emptyNP ** { + s = det.s ++ cn.s ! det.n + } ; +{- + -- : PN -> NP ; + -- Assuming that lincat PN = lincat NP + UsePN pn = pn ; + + -- : Pron -> NP ; + -- Assuming that lincat Pron = lincat NP + UsePron pron = pron ; + + -- : Predet -> NP -> NP ; -- only the man + PredetNP predet np = + +-- A noun phrase can also be postmodified by the past participle of a +-- verb, by an adverb, or by a relative clause + + -- low prio + -- : NP -> V2 -> NP ; -- the man seen + -- PPartNP np v2 = np ** { + -- s = + -- } ; + + -- : NP -> Adv -> NP ; -- Paris today + AdvNP np adv = np ** { + s = np.s ++ "," ++ adv.s + } ; + + -- : NP -> Adv -> NP ; -- boys, such as .. + ExtAdvNP np adv = AdvNP np {s = "," ++ adv.s} ; + + -- : NP -> RS -> NP ; -- Paris, which is here + RelNP np rs = np ** { + + } ; + +-- Determiners can form noun phrases directly. + + -- : Det -> NP ; + DetNP det = emptyNP ** { + s = \\_ => linDet det ; + } ; +-} + -- MassNP : CN -> NP ; + MassNP cn = emptyNP ** { + s = linCN cn + } ; + + +--2 Determiners + +-- The determiner has a fine-grained structure, in which a 'nucleus' +-- quantifier and an optional numeral can be discerned. + + -- : Quant -> Num -> Det ; + DetQuant quant num = quant ** { + s = quant.s ! num.n ++ num.s ; + n = num.n ; + } ; + + -- : Quant -> Num -> Ord -> Det ; + -- DetQuantOrd quant num ord = quant ** { + + -- } ; + +-- 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 = {s = [] ; n = Sg} ; + NumPl = {s = [] ; n = Pl} ; + +{- + -- : Card -> Num ; -- two + NumCard card = card ; + + -- : Digits -> Card ; + NumDigits dig = -- probably like OrdDigits, but choose the NCard form + + -- : Numeral -> Card ; + NumNumeral num = { + s = num.s ! NCard ; + n = num.n -- inherits grammatical number (Sg, Pl, …) from the Numeral + } ; + + -- : AdN -> Card -> Card ; + AdNum adn card = card ** { s = adn.s ++ card.s } ; + + -- : Digits -> Ord ; + OrdDigits digs = digs ** { s = digs.s ! NOrd } ; + + -- : Numeral -> Ord ; + OrdNumeral num = { + s = num.s ! NOrd + } ; + + -- : A -> Ord ; + OrdSuperl a = { + s = "most" ++ a.s ! Superl + } ; + +-- One can combine a numeral and a superlative. + + -- : Numeral -> A -> Ord ; -- third largest + OrdNumeralSuperl num a = { + s = num.s ! NOrd ++ a.s ! Superl + } ; +-} + + -- : Quant + DefArt = mkQuant "the" "the" ; + + -- : Quant + IndefArt = mkQuant "a" [] ; + +{- + -- : Pron -> Quant -- my + PossPron pron = mkQuant pron.s ** { + + } ; +-} + +--2 Common nouns + + -- : N -> CN + UseN n = n ; + +{- + -- : N2 -> CN ; + UseN2 n2 = + + -- : N2 -> NP -> CN ; + ComplN2 n2 np = + + -- : N3 -> NP -> N2 ; -- distance from this city (to Paris) + ComplN3 n3 np = + + -- : N3 -> N2 ; -- distance (from this city) + Use2N3 n3 = lin N2 n3 ** { c2 = n3.c3 } ; + + -- : N3 -> N2 ; -- distance (to Paris) + Use3N3 n3 = lin N2 n3 ; + + -- : AP -> CN -> CN + AdjCN ap cn = + + -- : CN -> RS -> CN ; + RelCN cn rs = + + + -- : CN -> Adv -> CN ; + AdvCN cn adv = + +-- 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 VerbTMP. + + -- : CN -> SC -> CN ; -- question where she sleeps + SentCN cn sc = + +--2 Apposition + +-- This is certainly overgenerating. + + -- : CN -> NP -> CN ; -- city Paris (, numbers x and y) + ApposCN cn np = cn ** { + s = + } ; + +--2 Possessive and partitive constructs +-- NB. Below this, the functions are not in the API, so lower prio to implement + + -- : PossNP : CN -> NP -> CN ; + -- in English: book of someone; point is that we can add a determiner to the CN, + -- so it can become "a book of someone" or "the book of someone" + PossNP cn np = + + + -- : Det -> NP -> NP ; -- three of them, some of the boys + CountNP det np = -- Nonsense for DefArt or IndefArt, but don't worry about that! RGL can contain weird sentences, as long as it contains the non-weird stuff we want + + + -- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples + PartNP cn np = + +--3 Conjoinable determiners and ones with adjectives + + -- : DAP -> AP -> DAP ; -- the large (one) + AdjDAP dap ap = dap ** { + + } ; + + -- : Det -> DAP ; -- this (or that) + DetDAP det = det ; +-} + +} diff --git a/src/TEMPLATE/NumeralTMP.gf b/src/TEMPLATE/NumeralTMP.gf new file mode 100644 index 00000000..2556e67a --- /dev/null +++ b/src/TEMPLATE/NumeralTMP.gf @@ -0,0 +1,115 @@ +concrete NumeralTMP of Numeral = CatTMP [Numeral,Digits] ** + open Prelude, ResTMP in { + + lincat + Digit = LinNumeral ; -- 2..9 + Sub10, -- 1..9 + Sub100, -- 1..99 + Sub1000, -- 1..999 + Sub1000000, -- 1..999999 + Sub1000000000, -- 1..999999999 + Sub1000000000000 -- 1..999999999999 + = LinNumeral ; + +-- param CardOrd defined in ResTMP +-- type LinNumeral -""- + + + lin + -- : Sub1000000 -> Numeral ; -- 123456 [coercion to top category] + num x = x ; + + -- : Digit ; + n2 = mkNumeral "two" ; + n3 = mkNumeral "three" ; + n4 = mkNumeral "four" ; + n5 = mkNumeral "five" ; + n6 = mkNumeral "six" ; + n7 = mkNumeral "seven" ; + n8 = mkNumeral "eight" ; + n9 = mkNumeral "nine" ; + + -- : Sub10 ; -- 1 + -- pot01 = + + -- : Digit -> Sub10 ; -- d * 1 + pot0 d = d ; + + -- : Sub100 ; -- 10 + -- pot110 = mkNum "ten" ; + + -- : Sub100 ; -- 11 + -- pot111 = mkNum "eleven" ; + + -- : Digit -> Sub100 ; -- 10 + d + -- pot1to19 d = + + -- : Sub10 -> Sub100 ; -- coercion of 1..9 + pot0as1 n = n ; + + -- : Digit -> Sub100 ; -- d * 10 + -- pot1 d = + + -- : Digit -> Sub10 -> Sub100 ; -- d * 10 + n + -- pot1plus d e = + + -- : Sub100 -> Sub1000 ; -- coercion of 1..99 + pot1as2 n = n ; + + -- : Sub10 -> Sub1000 ; -- m * 100 + -- pot2 d = + + -- : Sub10 -> Sub100 -> Sub1000 ; -- m * 100 + n + -- pot2plus d e = + + -- : Sub1000 -> Sub1000000 ; -- coercion of 1..999 + pot2as3 n = n ; + + -- : Sub1000 -> Sub1000000 ; -- m * 1000 + -- pot3 d = + + -- : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n + -- pot3plus d e = + +-------------------------------------------------------------------------------- +-- Numerals as sequences of digits have a separate, simpler grammar +-- + + lincat + Dig = LinDig ; -- single digit 0..9 + + lin + -- : Dig -> Digits ; -- 8 + IDig d = d ; + + -- : Dig -> Digits -> Digits ; -- 876 + IIDig d e = { + s = table { + NCard => glue (d.s ! NCard) (e.s ! NCard) ; + NOrd => glue (d.s ! NCard) (e.s ! NOrd) + } ; + n = Pl ; + } ; + + -- : Dig ; + D_0 = mkDig "0" ; + D_1 = mkDig "1" ; + D_2 = mkDig "2" ; + D_3 = mkDig "3" ; + D_4 = mkDig "4" ; + D_5 = mkDig "5" ; + D_6 = mkDig "6" ; + D_7 = mkDig "7" ; + D_8 = mkDig "8" ; + D_9 = mkDig "9" ; + + oper + LinDig : Type = {s : CardOrd => Str ; n : Number} ; + mkDig : Str -> LinDig = \s -> { + s = table { + NCard => s ; + NOrd => s + "th" + } ; + n = Pl ; -- TODO: handle number 1 + } ; +} diff --git a/src/TEMPLATE/ParadigmsTMP.gf b/src/TEMPLATE/ParadigmsTMP.gf new file mode 100644 index 00000000..de526a04 --- /dev/null +++ b/src/TEMPLATE/ParadigmsTMP.gf @@ -0,0 +1,211 @@ +resource ParadigmsTMP = open CatTMP, ResTMP, NounTMP, Prelude in { + +oper + +--2 Parameters +-- +-- To abstract over number, valency and (some) case names, +-- we define the following identifiers. The application programmer +-- should always use these constants instead of the constructors +-- defined in $ResSom$. + + Prep : Type ; + noPrep : Prep ; + + -- Add more overload instances if needed for all categories! + +--2 Nouns + + mkN : overload { + mkN : Str -> N ; -- Predictable nouns + } ; + + mkPN : overload { + mkPN : Str -> PN ; -- Proper nouns + } ; + +--2 Adjectives + + mkA : overload { + mkA : Str -> A ; -- Predictable adjective + } ; + + mkA2 : overload { + mkA2 : Str -> A2 ; -- Predictable A2, no preposition + mkA2 : A -> Prep -> A2 ; -- A2 made from A and Prep + } ; + +--2 Verbs + + -- Verbs + mkV : overload { + mkV : Str -> V ; -- Predictable verb + } ; + + + mkV2 : overload { + mkV2 : Str -> V2 ; -- Predictable transitive verb + mkV2 : V -> Prep -> V2 ; -- V2 made from V and Prep + } ; + + mkV3 : overload { + mkV3 : V -> V3 ; -- No prepositions + mkV3 : V -> Prep -> Prep -> V3 ; -- Prepositions for direct and indirect objects given + } ; + + mkVV : overload { + mkVV : V -> VV ; + } ; + + mkVA : overload { + mkVA : V -> VA ; + } ; + + mkVQ : overload { + mkVQ : V -> VQ ; + } ; + + mkVS : overload { + mkV : V -> VS ; + } ; + + -- Etc. do the same for other V subcats (V2A, V2V, V2S, …) + + + ----- + +--2 Structural categories + + -- If prepositions take case, add that as argument to mkPrep + mkPrep : overload { + mkPrep : Str -> Prep ; + } ; + + mkConj : overload { + mkConj : (and : Str) -> Conj ; -- (coffee) and (tea) + mkConj : (either : Str) -> (or : Str) -> Conj ; -- either (coffee) or (tea) + } ; + + mkSubj : overload { + mkSubj : Str -> Subj ; + } ; + + mkAdv : overload { + mkAdv : Str -> Adv ; + } ; + + mkAdV : overload { + mkAdV : Str -> AdV ; + } ; + + mkAdA : overload { + mkAdA : Str -> AdA ; + } ; + + +--. +------------------------------------------------------------------------------- +-- The definitions should not bother the user of the API. So they are +-- hidden from the document. + + Prep = CatTMP.Prep ; + noPrep = mkPrep [] ; + + -- Add more overload instances if needed for all categories! + + -- For explanation of `lin N`, see + -- https://inariksit.github.io/gf/2018/05/25/subtyping-gf.html#lock-fields + + mkN = overload { + mkN : Str -> N = \s -> lin N (ResTMP.mkNoun s) ; + -- TODO: more overload instances + } ; + +{- + mkPN = overload { + mkPN : Str -> PN = … + } ; + +--2 Adjectives + + mkA = overload { + mkA : Str -> A = \s -> … + } ; + + mkA2 = overload { + mkA2 : Str -> A2 = \s -> … + mkA2 : A -> Prep -> A2 = \s -> … + } ; + +--2 Verbs +-} + -- Verbs + mkV = overload { + mkV : Str -> V = \s -> lin V (mkVerb s) ; + } ; + +{- + + mkV2 = overload { + mkV2 : Str -> V2 = \s -> … + mkV2 : V -> Prep -> V2 = \s -> … + } ; + + mkV3 = overload { + mkV3 : V -> V3 = \s -> … + mkV3 : V -> Prep -> Prep -> V3 = \s -> … + } ; + + mkVV = overload { + mkVV : V -> VV = \s -> … + } ; + + mkVA = overload { + mkVA : V -> VA = \s -> … + } ; + + mkVQ = overload { + mkVQ : V -> VQ = \s -> … + } ; + + + mkVS = overload { + mkV : V -> VS = \s -> … + } ; + + -- Etc. do the same for other V subcats (V2A, V2V, V2S, …) + + + ----- +-} + + -- If prepositions take case, add that as argument to mkPrep + mkPrep = overload { + mkPrep : Str -> Prep = \s -> lin Prep {s = s} ; + } ; +{- + mkConj = overload { + mkConj : (and : Str) -> Conj = \s -> … + mkConj : (either : Str) -> (or : Str) -> Conj = \s -> … + } ; + + mkSubj = overload { + mkSubj : Str -> Subj = \s -> … + } ; + + mkAdv = overload { + mkAdv : Str -> Adv = \s -> … + } ; + + mkAdV = overload { + mkAdV : Str -> AdV = \s -> … + } ; + + mkAdA = overload { + mkAdA : Str -> AdA = \s -> … + } ; + +-} +-------------------------------------------------------------------------------- + +} diff --git a/src/TEMPLATE/PhraseTMP.gf b/src/TEMPLATE/PhraseTMP.gf new file mode 100644 index 00000000..4fb1ca27 --- /dev/null +++ b/src/TEMPLATE/PhraseTMP.gf @@ -0,0 +1,27 @@ +concrete PhraseTMP of Phrase = CatTMP ** open Prelude, ResTMP in { + + lin + PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; + + UttS s = s ; +{- + UttQS qs = qs ; + UttIAdv iadv = iadv ; + UttNP np = + UttIP ip = + UttImpSg pol imp = { s = pol.s ++ imp.s ! Sg ! pol.p } ; + UttImpPl pol imp = + UttImpPol pol imp = {s = pol.s ++ imp.s ! Sg ! pol.p} ; + UttVP vp = {s = linVP vp} ; + UttAP ap = { s = ap.s } ; + UttAdv adv = {s = } ; + UttCN n = {s = } ; + UttCard n = {s = } ; + UttInterj i = i ; -} + NoPConj = {s = []} ; +-- PConjConj conj = {s = conj.s1 ++ conj.s2 ! …} ; + + NoVoc = {s = []} ; +-- VocNP np = { s = "," ++ np.s ! … } ; + +} diff --git a/src/TEMPLATE/QuestionTMP.gf b/src/TEMPLATE/QuestionTMP.gf new file mode 100644 index 00000000..cd1add2a --- /dev/null +++ b/src/TEMPLATE/QuestionTMP.gf @@ -0,0 +1,105 @@ +concrete QuestionTMP of Question = CatTMP ** open + Prelude, ResTMP, ParadigmsTMP, (V=VerbTMP), (Noun=NounTMP), (S=StructuralTMP) in { + +-- A question can be formed from a clause ('yes-no question') or +-- with an interrogative. +-- Interrogative pronouns can be formed with interrogative +-- determiners, with or without a noun. + +{- +lin + -- : IDet -> CN -> IP ; -- which five songs + IdetCN idet cn = Noun.DetCN idet cn ** { + } ; + + -- : IDet -> IP ; -- which five + IdetIP idet = Noun.DetNP idet ** {sp = idet.sp}; + + -- : IQuant -> Num -> IDet ; -- which (five) + IdetQuant iquant num = iquant ** { + } ; + + -- : IP -> ClSlash -> QCl ; -- whom does John love + QuestSlash ip cls = cls ** { + + } ; + + -- : Cl -> QCl ; + QuestCl cl = cl ** { + }; + + + -- : IP -> VP -> QCl ; + QuestVP ip cl = cl ** { + } ; + + -- : IAdv -> Cl -> QCl ; -- why does John walk + QuestIAdv iadv cls = { + } ; + + -- : IP -> IComp ; + CompIP ip = {s = ip.s ! } ; -- who (is it) + + -- : IComp -> NP -> QCl ; -- where is John? + QuestIComp icomp np = { + } ; + + +-- Interrogative pronouns can be formed with interrogative +-- determiners, with or without a noun. + + -- : IDet -> CN -> IP ; -- which five songs + IdetCN idet cn = + + -- : IDet -> IP ; -- which five + IdetIP idet = + +-- They can be modified with adverbs. + + -- : IP -> Adv -> IP ; -- who in Paris + AdvIP = Noun.AdvNP ; + +-- Interrogative quantifiers have number forms and can take number modifiers. + + -- : IQuant -> Num -> IDet ; -- which (five) + IdetQuant = Noun.DetQuant ; + +-- Interrogative adverbs can be formed prepositionally. + -- : Prep -> IP -> IAdv ; -- with whom + PrepIP prep ip = + +-- They can be modified with other adverbs. + + -- : IAdv -> Adv -> IAdv ; -- where in Paris + AdvIAdv iadv adv = + +-- Interrogative complements to copulas can be both adverbs and +-- pronouns. + + -- : IAdv -> IComp ; + CompIAdv iadv = iadv ; -- where (is it) + + +-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$. + +-- Wh questions with two or more question words require a new, special category. + + lincat + -- buy what where + QVP = + lin + -- : VPSlash -> IP -> QVP ; -- buys what + ComplSlashIP vps ip = + + -- : VP -> IAdv -> QVP ; -- lives where + AdvQVP vp iadv = + + -- : QVP -> IAdv -> QVP ; -- buys what where + AddAdvQVP qvp iadv = + + -- : IP -> QVP -> QCl ; -- who buys what where + QuestQVP ip qvp = +-} + + +} diff --git a/src/TEMPLATE/README.md b/src/TEMPLATE/README.md new file mode 100644 index 00000000..162b60a6 --- /dev/null +++ b/src/TEMPLATE/README.md @@ -0,0 +1,391 @@ +# TEMPLATE + +This is a starting point to clone a new RGL language. It has some pre-populated lincats and lins, mostly in the `Noun` module, but also a few minimal things for verbs and sentences. This README contains a guided tour of lincats and lins to implement first, and the modules also contain comments and suggestions aimed for new grammarians. + +**If you want a 100% just strings template**, you can find that in [github.com/daherb/gf-rgl-template](https://github.com/daherb/gf-rgl-template). If you choose the string-only template, you can still read this document for suggestions about implementation order. + +- [How to use this tutorial](#how-to-use-this-tutorial) +- [Guided tour: what to implement first?](#guided-tour-what-to-implement-first) + * [1. N-CN-NP(-AP)](#1-n-cn-np-ap) + + [Already implemented](#already-implemented) + + [Next steps](#next-steps) + - [More morphology](#more-morphology) + - [More syntax](#more-syntax) + + [How about adjectives?](#how-about-adjectives) + + [Side note: a word about MassNP](#side-note-a-word-about-massnp) + * [2. V-VP](#2-v-vp) + + [Already implemented](#already-implemented-1) + + [Next steps](#next-steps-1) + - [Add morphology](#add-morphology) + - [Add syntax](#add-syntax) + * [3. Cl-S-Utt-Phr](#3-cl-s-utt-phr) + + [Already implemented](#already-implemented-2) + + [Next steps](#next-steps-2) + - [Declarative sentences](#declarative-sentences) + - [Imperatives](#imperatives) + + [Unused or nonexistent forms?](#unused-or-nonexistent-forms) +- [Choose your own adventure: what to implement next](#choose-your-own-adventure-what-to-implement-next) + * [Questions](#questions) + * [Adjectives](#adjectives) + * [Relative clauses](#relative-clauses) + * [Numerals](#numerals) + * [Conjunctions](#conjunctions) + + [List without inflection table and single field](#list-without-inflection-table-and-single-field) + + [List with inflection table and multiple fields](#list-with-inflection-table-and-multiple-fields) + + [Inspiration from existing RGL languages](#inspiration-from-existing-rgl-languages) + * [Phrases](#phrases) + * [Idioms](#idioms) + * [Symbol](#symbol) + * [Extend](#extend) +- [Functions outside the API or otherwise lower priority](#functions-outside-the-api-or-otherwise-lower-priority) +# How to use this tutorial + +If you haven't done so yet, clone your language from this template as instructed [here](../README.md#from-a-generic-template). The cloning doesn't include README.md, so there's only one copy of this README document. + +You can open the grammar in a GF shell and see its functions as follows. (I'm using here the `TMP` concrete syntax, but you should have cloned it to some other concrete syntax with a different extension, so substitute as necessary.) + +``` +$ gf LangTMP.gf +Lang> gr -depth=6 | l -treebank +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN blood_N)) (UseV die_V)))) NoVoc +LangTMP: the blood die +``` + +There are also a couple of unit tests in the [`unittest`](/unittest) directory. To see how to use them, see the [instructions](https://github.com/GrammaticalFramework/gf-rgl/tree/master/unittest#readme). + + +# Guided tour: what to implement first? + +In this section, I group the RGL functions in clusters and suggest an implementation order. If you have different needs, e.g. you're making the resource grammar for a particular application and need specific RGL functions for that, feel free to prioritise your needs. I'm giving this list as a suggestion for people who just want something to start from. + +## 1. N-CN-NP(-AP) + +Most of these are in the Noun module. This is the cluster that has most work done in this template. + +### Already implemented + +With the following functions, it is possible to construct simple noun phrases. + +- `DetCN` +- `DetQuant` +- `DefArt`, `IndefArt` (no problem if they are empty strings in your language!) +- `NumSg`, `NumPl` +- `MassNP` +- `UseN` +- `blood_N` (in Lexicon module) + +You can see all NPs with the following command: + +```bash +Lang> gt -cat=NP | l -treebank +``` + +### Next steps + +#### More morphology +Check the categories and params in `ResTMP`: how well do they apply to your language? Is the initial implementation missing inflectional features that your language has, like case, gender/noun class, other numbers like dual? + +If so, then I would suggest adding the missing morphology before implementing any new syntactic functions. Whenever you change a lincat, e.g. by making something that used to be a Str into an inflection table, all the lins that handle that lincat will break. So it's less painful to change the lincats when the amount of lins is still small. + +#### More syntax +Once you're happy with the morphology, you can start with other lins and lincats. In addition to nouns, the RGL allows making NPs out of pronouns and proper nouns: +- lincat for `Pron` +- lin for `UsePron` and `PossPron` +- lin for some `Pron`s in Structural +- lincat for `PN` +- lin for `UsePN` +- lin for `john_PN` and `paris_PN` in Lexicon + +You can also make the NPs a bit more varied by adding more quantifiers and modifiers: +- lins for more `Quant`s, `Det`s etc. in Structural + +Some things in the Noun module will have to wait for other categories to be done. For instance, `AdjCN` relies on adjectives, `RelCN` on relatives, `NumCard` and `NumNumeral` on numerals, none of which is (properly) implemented in this template. So feel free to postpone the rest. + +### How about adjectives? + +In some languages, adjectives behave like nouns. In other languages, they behave like verbs. In yet other languages, the situation is more complicated. But if your language happens to be one where adjectives are like nouns, it's pretty cheap to just implement adjectives here as well. The minimal set is as follows: + +- lincat for `A` and `AP` +- lin for some `A`s from Lexicon +- lin for `PositA` and `AdjCN` + +But if adjectives are rather like verbs (e.g. Korean), or there are other complications (e.g. Zulu), just postpone their implementation. + + +### Side note: a word about MassNP +In the Noun module, there is a function called `MassNP : CN -> NP`. This is a *mass construction*, which is usually applied to mass nouns like "water". + +However, the RGL does not contain a semantic distinction between mass and count nouns, and thus the `MassNP` function can be applied to any CN. Sometimes this results in semantically weird results. + +As a resource grammarian, don't worry if `MassNP` applied to count nouns sounds weird. It's the application grammarian's problem to choose when to use MassNP and when DetCN. If `MassNP` sounds good when applied to mass nouns, then you're doing it right. + +## 2. V-VP + +### Already implemented + +For verbs, we have much fewer things implemented: a single intransitive verb, and a function that elevates an intransitive verb into a VP. + +* `UseV` +* `die_V` (in Lexicon module) + +You can see all (=1) VPs with the following command. + +```bash +Lang> gt -cat=VP | l -treebank +Langs: UseV die_V +LangTMP: die +``` + +### Next steps + +#### Add morphology + +Just like with nouns, look at the `VForm` param in the Res module, and add the missing inflectional features. If verbs are very complex in your language, it's fine to start with a smaller subset, e.g. only indicative mood, or only a couple of tenses. + +Again, you should extend the `VForm` param, and change the lincats of `V` and `VP` in other ways, if needed. It is very common that the lincat for `VP` has many fields, so that it + +In addition, you could implement some morphological paradigms, so that you can add some verbs in the lexicon. + +#### Add syntax + +In addition to intransitive verbs (`V`), the GF RGL has a large set of verb subcategories. So now you can start adding lincats to `V2` (direct object), `VV` (verbal complement), `VS` (sentence complement) etc. + +The most important are the following: + +- lincat for `V2` and `VPSlash` +- lin for some `V2`s from Lexicon +- lin for `SlashV2a` and `ComplSlash` + +If you have done a thorough implementation on noun morphology, you might find it useful here. For instance, if verbs mark their arguments with cases, now is a great time to add those cases as *inherent* argument in the verbs. (For explanation on parametric vs. inherent, see [GF tutorial](https://www.grammaticalframework.org/doc/tutorial/gf-tutorial.html#toc54)). + +Another way to make VPs is to use adjectives, noun phrases and adverbials as complements. If you haven't implemented adjectives yet, feel free to skip them at this step. But the other complements should be in reach already, so the next most important steps are the following: + +- lincat for `Comp` +- lin for `CompNP`, (`CompAdv`) and `UseComp` +- (If you already have AP: lin for `CompAP`) + +These functions don't care whether your language has an explicit copula or not. Just implement whatever strategy that it uses for non-V❋ predication. + +In terms of word order, you could consider how adverbials attach to verbs. + +## 3. Cl-S-Utt-Phr + +At this level, there is rarely new morphology to be added, but there can be interesting decisions about e.g. word order or subordination. + +### Already implemented + +The following rarely need any changes. By the time an `Utt` is reached, the grammatical decisions should have been already made, and the lincats of `Utt` and `Phr` should be just `{s : Str}`. +- `PhrUtt` +- `NoPConj`, `NoVoc` +- `UttS` + +The following functions, and the lincats they operate on, are implemented in the most naive only-strings way, and they need to be changed. +- `UseCl` +- `TTAnt`, `TPres`, `TPast`, `TFut`, `TCond`, `ASimul`, `AAnter` +- `PPos`, `PNeg` +- `PredVP` + +### Next steps + +#### Declarative sentences + +If you have added verb inflection in the V❋ and VP categories, then you need to connect them to the Cl category. `PredVP : NP → VP → Cl` picks the correct person inflection from its VP argument, but any tense and polarity is still open. So in most languages, the lincat of `Cl` should have an inflection table, and only `UseCl : Temp → Pol → Cl → S` will choose the final form. + +Sometimes even the lincat of `S` has an inflection table or it is discontinuous. That's because `S` can be used in a VP or an Adv, and in those cases, it may have a different word order or inflectional form than as standalone sentence. + +If you're not sure whether the lincat of `S` should be still open for something, try to implement the following functions and see if it needs tweaking. + +- `ComplVS : VS → S → VP` +- `SubjS : Subj → S → Adv` + +#### Imperatives + +In the Sentence module, there are also functions to construct imperatives. Depending on your language, it could be rather easy to implement them after you've added declarative sentences. But nothing depends on imperatives, so you can as well postpone them. + +### Unused or nonexistent forms? + +What if your language has no form that corresponds to e.g. future anterior negative (*won't have walked*)? That's fine, you can put some other form in that slot and move on. + +What if your language has tenses, aspects, moods, politeness forms or any other inflection that isn't accessible via the core RGL? That's fine too, you can always create a language-specific extra module with functions that do access them. If you're working towards a specific application that needs such forms, then you should of course prioritise them. But if covering the core RGL that is in the API is the most important, feel free to postpone all the verbal inflection that is not accessible via the core. + +# Choose your own adventure: what to implement next + +If you've implemented the first 3 clusters, you already have a nice chunk of the RGL! +You have tackled many of the hard decisions, so it's natural that these things can take a long time, and you may need to revise often. + +The following set doesn't have to be followed in any particular order. + +## Questions + +The Question module introduces interrogative noun phrases (`IP`) like *who* or *whose car*, and question clauses (`QCl`) and sentences (`QS`). Their implementation is often similar to that of noun phrases and declarative clauses and sentences. + +Compared to declarative sentences, questions may require more variation in word order. You may need to make some fields discontinuous, e.g. splitting a single `s` field (e.g. *eat porridge*) of a VP into `verb` (*eat*) and `complement` (*porridge*). + +The minimal set to get questions is the following: +- lincat for `QCl` +- lin for `QuestCl` +With these, you get yes/no questions, like "do you walk". + +To get wh-questions, like "who walks", you first need the `IP` category for interrogative noun phrases. Here's a full set for wh-questions with the IP as a subject. +- lincat for `IP`, `IDet` and `IQuant` +- lin for `IDetCN`, `IdetQuant` +- lin for some `IQuant`s and `IP`s in Structural +- lin for `QuestVP` + +The next thing to add is `IAdv` for interrogative adverbs, like "why" or "where". With these, you can ask questions like "why do you walk" and "where are you". +- lincat for `IAdv` +- lin for some `IAdv`s in Structural, and/or `PrepIP` in Question +- lin for `QuestIAdv` +- lincat for `IComp` +- lin for `CompIAdv`, `CompIP` and `QuestIComp` + +Finally, we can also make a question using `IP` as an object, e.g. "who do you like". Where previously we have formed QCls from a normal VP with a special subject (`IP` instead of `NP`), here we introduce a new category `ClSlash`, which is a `Cl` missing an object. So you need the following: +- lincat for `ClSlash` +- lin for `QuestSlash` + +## Adjectives + +If you haven't implemented adjectives yet, it's about time! If your adjectives are more of the nouny type, I hope it's rather straightforward to do them. The minimal cluster is the following: + +- lincat for `A` and `AP` +- lin for `PositA` and `AdjCN` +- lin for `CompAP`, check whether you have to update lincat for `Comp` + +If adjectives behave like verbs, then the lincat for `Comp` and lin for `CompAP` can reuse the lincats and lins of the V-VP cluster. But `AdjCN` can be a bit difficult. Based on previous RGL languages that have verby adjectives, you get a lot of synergy with the Relative module. Basically, APs as modifiers behave just like relative clauses, so `AdjCN` and `RelCN` are similar or even identical. + +## Relative clauses + +These may be complicated, so feel free to postpone until further. But if your APs are verby, it makes sense to implement these in parallel with `AdjCN`, because you will need some way of making verby/clause-y things into modifiers. + +## Numerals + +There is a tentative lincat for numerals, and linearisations for the digits `D_0..D_9` and `n2..n9`, as well as the simple coercions `pot0`, `pot0as1`, `pot1as2`, `pot2as3` and `num`. However, it's possible that the simple lincat needs to be changed, and so I haven't implemented any of the lins that do something complex. + +The numeral module the oldest piece of code in the RGL, and hence it looks pretty strange compared to the rest of the RGL. If you don't understand it, don't worry–just leave it aside until you have other parts implemented. Nothing depends on it, and in fact, I would recommend that your N-CN-NP cluster is solid before you do numerals, because then you know better which inflectional features are needed in numerals. + +But eventually the time comes to tackle numerals. First tip is to check in https://github.com/GrammaticalFramework/gf-contrib/tree/master/numerals whether someone has already implemented them for your language, or a close relative that behaves similarly. Second tip is to look at the existing implementation of any RGL language that you know, and try to reverse engineer based on that. But even if these tips don't work, please submit your grammar to gf-rgl anyway! A grammar without full numeral implementation is much better than no grammar at all. + +Once you have some kind of implementation of the Numeral module, you can connect it to the Noun module by implementing the following. The minimal meaningful set is these two: + +- `NumNumeral : Numeral -> Card` +- `NumCard : Card -> Num` + +With these, you get a `Num` that can be used in `DetQuant` to make a Det, and that unlocks numerals as determiners, like "two cats". + +## Conjunctions + +Conjunction for category X needs 4 things: + +- lincat for `[X]` +- lin for `BaseX` +- lin for `ConsX` +- lin for `ConjX` + +For example, if `X` is defined as +```haskell +lincat X = {s : Case => Str ; a : Agr} ; +``` +then `[X]` will split its s field into two, and retain its other fields as is: + +```haskell +lincat [X] = {s1,s2 : Case => Str ; a : Agr} ; +``` + +### List without inflection table and single field + +Let's start with a simple case: Adv is of type `{s : Str}`. Then `[Adv]` is `{s1,s2 : Str}`. +`BaseAdv`, `ConsAdv` and `ConjAdv` can all use functions defined in [prelude/Coordination](../prelude/Coordination.gf): + +```haskell +lin BaseAdv = twoSS ; +lin ConsAdv = consrSS comma ; +lin ConjAdv = conjunctSS ; +``` + +### List with inflection table and multiple fields + +Let's take the previous example and call it NP. Our lincats are as follows: +```haskell +lincat + NP = {s : Case => Str ; a : Agr} ; -- in Cat + [NP] = {s1,s2 : Case => Str ; a : Agr} ; -- in Conjunction +``` + +Now we need to do a bit more work in our linearisations. +```haskell +lin + BaseNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ; + +oper + conjAgr : Agr -> Agr -> Agr ; + conjAgr agr1 agr2 = -- TODO actual implementation +``` +First, we use the [twoTable](https://github.com/GrammaticalFramework/gf-rgl/blob/master/src/prelude/Coordination.gf#L57-L60) oper from Coordination, which puts the right values in the right fields. + +But it doesn't deal with the rest of the fields, `g : Agr` in our case, and so we need to put it in manually. That's what happens in the *record extension* with the two stars. To combine two Agrs into one Agr, we define an oper `conjAgr`, that takes two Agrs and returns their combination. + +Then let's do the rest of the linearisations. + +```haskell +lin + ConsNP x xs = consrTable NPCase comma x xs ** {a = conjAgr xs.a x.a} ; + ConjNP conj xs = conjunctDistrTable NPCase conj xs ** { + a = -- xs.a, with possible Number input from the Conj + } ; +``` +ConsNP is similar to BaseNP, except that we will now include the separator character. `comma` is defined as the string "," in Prelude, but other languages use other characters, e.g. **、** in Chinese. + +ConjNP puts together a NP from the list of NPs, using a conjunction: "Inari, Krasimir and Aarne". This resulting NP has to also have an `a` field, and in this final stage, we are putting together the `conjAgr` from all the arguments, and also taking into account the Conj itself. For instance, in [English style guides](https://editorsmanual.com/articles/compound-subject-singular-or-plural/), + +> Two or more nouns joined by and form a plural compound subject, which takes plural verbs. But when a compound subject contains or or nor, the verb should agree with the part of the subject closest to it. + +So in the English resource grammar, `and_Conj` has an inherent number Pl, and `or_Conj` has an inherent number Sg. If your language doesn't do that, then it's just the list of NPs that determines the agreement of the resulting coordinated NP. + +### Inspiration from existing RGL languages + +Most existing RGL languages use the Coordination module and its opers that are rather cryptic. Sometimes you can copy and paste an existing RGL language, just adjust the arity of the opers (e.g. call `twoTable3` instead of `twoTable2`) and which `param`s are given to those opers as argument. Other times you need to do more manual tweaking. + +Here are some examples of [coordination strategies that are more complex than English](https://inariksit.github.io/gf/2021/02/22/lists.html#natural-language-strategies-beyond-a-b-and-c). The more your language differs from English, the more work you need to do in the internal params. + +Some of the categories that have list instances may not be able to coordinate in your language. In such a case, you can decide whether to leave it unimplemented (thus trying to use it via the API gives an exception), or linearise something ungrammatical. + +## Phrases + +In the Phrase module, there are functions that create standalone utterances of multiple RGL categories. They are usually rather easy to implement: the `Utt` category should be just a `{s : Str}`, and the task is to decide which of the inflection forms is the standalone form. + +## Idioms + +The Idiom module defines constructions that are formed in idiosyncratic ways. Examples of its constructions are impersonal and generic clauses ("it is warm") and clefts ("it is John who sleeps"). This module is not a dependency of any other module, and its constructions are less frequent than the core modules like Noun and Verb. So this can be done whenever you like. + + +## Symbol + +The Symbol module (exported in the API as Symbolic) is used for embedding symbolic notation in natural-language text, e.g. "level 4". This module is not a dependency of any other, and it mostly depends on Noun. So it can be done any time after the N-CN-NP cluster is solid. + +## Extend + +As the name suggests, this is an extension and not in the API. See [here](https://inariksit.github.io/gf/2021/02/15/rgl-api-core-extensions.html#extend) for more explanation. + +In my experience, the generalisations of VP are useful: `VPS` (VP with a tense and polarity), `VPI` (infinitival VP) and their transitive counterparts `VPS2` and `VPI2`. With these, you can do VP conjunctions, like "she runs and sings", "to eat and sleep". + +Extend is a rather large module, and not all funs have meaningful lins in all languages. So don't feel pressured to fill Extend all at once; often grammarians just add linearisations when the need arises for a particular structure. + +# Functions outside the API or otherwise lower priority + +What is low or high priority depends on the application. But if you want some general guidelines, these are usually less used, or not in the API at all. + +### Not in the API + +- The category DAP + its functions +- CountNP, PossNP, PartNP +- OrdNumeralSuperl +- List instance for CN +TODO: continue the list + +### Expensive + +- `SlashV2VNP` is often expensive, because it has so many arguments. + +For any function that turns out to be expensive, you can comment it out when implementing other parts of the grammar. + +### diff --git a/src/TEMPLATE/RelativeTMP.gf b/src/TEMPLATE/RelativeTMP.gf new file mode 100644 index 00000000..c6c41676 --- /dev/null +++ b/src/TEMPLATE/RelativeTMP.gf @@ -0,0 +1,24 @@ +concrete RelativeTMP of Relative = CatTMP ** open + ResTMP, Prelude in { + +{- +lin + -- : Cl -> RCl ; -- such that John loves her + RelCl cl = cl ** { + } ; + + -- : RP -> VP -> RCl ; + RelVP rp vp = { + } ; + + -- : RP -> ClSlash -> RCl ; -- who I went with + RelSlash rp cls = { + } ; + + -- : RP ; + IdRP = {s = "that"} ; + + -- : Prep -> NP -> RP -> RP ; -- the mother of whom + FunRP prep np rp = +-} +} diff --git a/src/TEMPLATE/ResTMP.gf b/src/TEMPLATE/ResTMP.gf new file mode 100644 index 00000000..7b42876f --- /dev/null +++ b/src/TEMPLATE/ResTMP.gf @@ -0,0 +1,296 @@ +resource ResTMP = open Prelude, Predef in { + +-------------------------------------------------------------------------------- +-- General notes + +-- ** Naming ** +{- +I'm using the naming scheme for lincats and opers as explained here: +https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#my-naming-scheme-for-lincats-and-opers +-} + +-- ** File structure ** +-- The rest of this module is organised as follows: + + ----------------------------- + -- Grammatical categor(y|ies) + + {- + General comments on the cat(s) + + params related to the cat(s) + + opers related to the cat(s) + -} + +-------------------------------------------------------------------------------- +-- Nouns + +{-The param Number comes from common/ParamX, and has the values Sg and Pl. + * If your language doesn't have number, remove Number from all records. + * If your language has number with more than 2 values, define your own number in this module + (e.g. uncomment line 56) and use that Number instead of Number. + + The param Gender is defined here, and has the values Gender1 and Gender2. + Currently it's only as a suggestion to be an inherent field in LinN. + * If your language doesn't have gender, remove Gender from all records. + * If your language has genders/noun classes, replace the placeholder Gender1 and Gender1 + with the actual values of your language (there can be more than 2!), and uncomment + the g : Gender field from the definition of LinN. + + If your nouns inflect in more things, like case, you can do one of the following + * Replace the placeholder cases on line 53 and make the table 2-dimensional, like this: + oper LinN : Type = {s : Number => Case => Str ; …} ; + * Make your own parameter that combines all the relevant features, like this: + param NForm = Whatever | You | Need | For | Noun | Inflection ; + oper LinN : Type = {s : NForm => Str ; …} ; + This can be a good idea, if your inflection table has some gaps, i.e. not all combinations are in use + See https://gist.github.com/inariksit/708ab9df2498e88bc63aedf5fc7be2f3#file-tables-gf-L48-L122 for explanation + -} + +param + Gender = Gender1 | Gender2 ; -- Just a placeholder, see lines 34-39 above + Case = Case1 | Case2 | Case3 ; -- Just a placeholder, see lines 41-48 above + Number = Sg + | Pl +-- | Dual -- If your language has numbers other than Sg and Pl, add them to the parameter + ; + Person = P1 | P2 | P3 ; + +oper + LinN : Type = { + s : +-- Case => -- uncomment if your language has case + Number => -- variable number: table {Sg => "house" ; Pl => "houses"} + Str ; + -- g : Gender ; -- inherent gender/noun class, if your language has that + } ; + + -- Most often, the lincat for CN is the same as N, with possibly some additional fields. + -- However, sometimes you need more fields than just the s field, e.g. to keep word order flexible, or to add clitics and make sure they attach to the head, not modifiers. + -- If you don't know what the previous line means, you can get started with just a single s field. + -- You'll notice later whether you need such a field or not. + LinCN : Type = LinN + -- ** {postmod/premod/… : Str} -- if needed + ; + + LinPN : Type = { + s : Str ; + n : Number ; -- Proper nouns often have already an inherent number; you don't usually say "a Paris / many Parises" + -- g : Gender ; -- inherent gender/noun class, if your language has that + } ; + + -- For inflection paradigms, see http://www.grammaticalframework.org/doc/tutorial/gf-tutorial.html#toc56 + mkNoun : Str -> LinN = \str -> { + s = table { + _ => str -- TODO: actual morphology + } ; + -- If your nouns have gender, it should come here as inherent field. + -- Usually you need to give the gender as an argument to mkNoun. + } ; + + linCN : LinCN -> Str = \cn -> cn.s ! Sg + -- ++ cn.postmod -- If there is another field, use here + ; + +--------------------------------------------- +-- Numeral + +-- Used in NumeralTMP + param + CardOrd = NCard | NOrd ; + + oper + LinNumeral : Type = {s : CardOrd => Str ; n : Number} ; + + mkNumeral : Str -> LinNumeral = \s -> { + s = table { + NCard => s ; + NOrd => s + "th" + } ; + n = Pl ; -- NB. probably singular for number 1 + } ; + +--------------------------------------------- +-- Pronoun + +{-The param Person comes from common/ParamX, and has the values P1, P2 and P3. + * If your language doesn't inflect in person, you may be able to remove Person from all records. + - However, consider if it's really never present? How about e.g. reflexive ("myself", "yourself" etc?) + * If your language is more fine-grained than {P1,P2,P3} x {Sg,Pl} (for instance gender and familiarity), + you can define your own param. We provide an example called Agr to take inspiration from—remove if + not needed, or use and refine if needed. +-} + +param + -- These params are just for inspiration, not used anywhere currently. + Agr = SgP1 -- I + | SgP2 Politeness -- e.g. tū, tum, āp (Hindi) — note that the verb really inflects differently for all three! + | SgP3 Gender -- e.g. he, she (verb inflects the same, but distinction in reflexive: himself / herself) + | FillInTheRestYourself ; + Politeness = Intimate | Familiar | Polite ; + +oper + LinPron : Type = { + s : Str ; + -- Alternative if your language has case and pronouns inflect in case (e.g. English I/me/my, she/her/hers) + -- s : Case => Str ; + n : Number ; + p : Person ; + -- Alternative to the `n` and `p` fields: + -- a : Agr -- sketched above, lines 97-103 + } ; + + mkPron : (_ : Str) -> Person -> Number -> LinPron = \str,per,num -> { + s = str ; + {- If there is case inflection, you need a table here + table { + _ => str -- Pronoun inflection is often irregular, so possibly this constructor requires several forms as argument, even if mkNoun is nice and regular + } ; + -} + p = per ; + n = num + } ; + +--------------------------------------------- +-- NP + +{- +In the RGL, a NP may come from a common noun, proper noun or pronoun. +Pronouns are the only ones that have an inherent person (nouns are almost always 3rd person! please give me counterexamples if you can think of any.) +So we can often say that NP's lincat is the same as Prons. + +NB. for later, when you want to make Pron into possessives, you may need more fields in LinPron than in LinNP. +That's why I'm copying over the definition below, instead of the neater `LinNP : Type = LinPron`. +-} + + LinNP : Type = { + s : Str ; + -- Alternative: If anything inflects in case (nouns, pronouns), NP has to also inflect in case! + -- s : Case => Str ; + n : Number ; + p : Person ; + -- Alternative to the `n` and `p` fields: + -- a : Agr -- sketched on lines 97-101 + } ; + + linNP : LinNP -> Str = \np -> np.s ; -- Change when you change LinNP + + emptyNP : LinNP = { -- Change when you change LinNP + s = [] ; + n = Sg ; + p = P3 ; + } ; + +-------------------------------------------------------------------------------- +-- Det, Quant, Card, Ord + + -- If your language has a number, it is very very very likely that + -- Quant has a variable number and Det has inherent number. + + LinQuant : Type = { + s, -- quantifier in a context, e.g. 'this (cat) (is nice)' + sp -- quantifier as standalone, e.g. 'this (is nice)' + : Number => Str ; + } ; + + LinDet : Type = { + s : Str ; + n : Number ; + } ; + + -- Can you reuse your mkNoun? Do nouns and quantifiers inflect the same way? + mkQuant : Str -> Str -> LinQuant = \this, these -> { + s, + sp = table { + Sg => this ; + Pl => these } ; + }; + + mkDet : Str -> Number -> LinDet = \str, num -> { + s = str ; + n = num + } ; + +-------------------------------------------------------------------------------- +-- Adpositions + +{- The main use of Prep is in the fun + + PrepNP : Prep -> NP -> Adv + + Despite the name of the RGL category, a 'Prep' can be a preposition, postposition, + or just an instruction to choose a particular case from the NP. + A language may use one, two or all these strategies. + +-} + +oper + LinPrep : Type = { + s : Str ; + + -- If your language has cases, and different prepositions choose different cases. + -- c2 : Case ; + + -- If your language has both pre- and postpositions, you need an inherent parameter in Prep to record which one a given Prep is. + -- position : PreOrPost ; + } ; + + +-------------------------------------------------------------------------------- +-- Adjectives + + LinA : Type = SS ; + LinA2 : Type = LinA ; + + mkAdj : Str -> LinA = \str -> {s = str} ; + + AdjPhrase : Type = LinA ; -- ** {compar : Str} ; +-------------------------------------------------------------------------------- +-- Verbs + +param + VForm = TODOVF Number Person ; + +oper + LinV : Type = { + s : VForm => Str + } ; + + LinV2 : Type = LinV ** { + c2 : LinPrep ; + } ; + + mkVerb : Str -> LinV = \str -> { + s = table { + _ => str + } + } ; + + copula : LinV = {s = \\_ => "TODO: copula"} ; -- often useful + +------------------ +-- VP + + LinVP : Type = { + s : VForm => Str ; + } ; + + LinVPSlash : Type = LinVP ** { + c2 : LinPrep ; + } ; + + linVP : LinVP -> Str = \vp -> vp.s ! TODOVF Sg P3 ; + +-------------------------------------------------------------------------------- +-- Cl, S + + -- Operations for clauses, sentences + LinCl : Type = { + subj : Str ; + pred : Str ; -- TODO: depend on Temp and Pol + } ; + + linCl : LinCl -> Str = \cl -> cl.subj ++ cl.pred ; + +} diff --git a/src/TEMPLATE/SentenceTMP.gf b/src/TEMPLATE/SentenceTMP.gf new file mode 100644 index 00000000..699c7577 --- /dev/null +++ b/src/TEMPLATE/SentenceTMP.gf @@ -0,0 +1,76 @@ + +concrete SentenceTMP of Sentence = CatTMP ** open + TenseX, ResTMP, (AM=AdverbTMP), Prelude in { + +flags optimize=all_subs ; + +lin + +--2 Clauses + + -- : NP -> VP -> Cl + PredVP np vp = { + subj = np.s ; -- ! Nom, if there are cases + pred = + -- table {something with tense+polarity => + vp.s ! TODOVF np.n np.p + -- TODO: all of the VP's tense and polarity should be open here! + -- PredVP only decides the subject. + -- } + } ; + +{- + -- : SC -> VP -> Cl ; -- that she goes is good + PredSCVP sc vp = ; + +--2 Clauses missing object noun phrases + -- : NP -> VPSlash -> ClSlash ; + SlashVP = + + -- : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today + AdvSlash cls adv = + + -- : Cl -> Prep -> ClSlash ; -- (with whom) he walks + SlashPrep cl prep = cl ** {c2 = prep} ; + +-- Imperatives + -- : VP -> Imp ; + ImpVP vp = + +--2 Embedded sentences + + -- : S -> SC ; + EmbedS s = + + -- : QS -> SC ; + EmbedQS qs = + + -- : VP -> SC ; + EmbedVP vp = +-} +--2 Sentences + + -- : Temp -> Pol -> Cl -> S ; + UseCl t p cl = { + s = cl.subj ++ t.s ++ p.s ++ cl.pred -- ! t.t ! p.p -- eventually + } ; +{- + -- : Temp -> Pol -> QCl -> QS ; + UseQCl t p cl = + + -- : Temp -> Pol -> RCl -> RS ; + UseRCl t p cl = + + -- AdvS : Adv -> S -> S ; -- then I will go home + AdvS adv s = + + -- ExtAdvS : Adv -> S -> S ; -- next week, I will go home + ExtAdvS adv s = + + -- : S -> Subj -> S -> S ; + SSubjS s1 subj s2 = + + -- : S -> RS -> S ; -- she sleeps, which is good + RelS sent rs = +-} +} diff --git a/src/TEMPLATE/StructuralTMP.gf b/src/TEMPLATE/StructuralTMP.gf new file mode 100644 index 00000000..a06c1f2c --- /dev/null +++ b/src/TEMPLATE/StructuralTMP.gf @@ -0,0 +1,171 @@ +concrete StructuralTMP of Structural = CatTMP ** + open Prelude, ResTMP, (Noun=NounTMP), ParadigmsTMP in { + +------- +-- Ad* +{- +lin almost_AdA = +lin almost_AdN = +lin at_least_AdN = +lin at_most_AdN = +lin so_AdA = +lin too_AdA = +lin very_AdA = + +lin as_CAdv = +lin less_CAdv = +lin more_CAdv = + +lin how8much_IAdv = +lin when_IAdv = + +lin how_IAdv = +lin where_IAdv = +lin why_IAdv = + +lin always_AdV = ss "" ; + +lin everywhere_Adv = ss "" ; +lin here7from_Adv = ss "" ; +lin here7to_Adv = ss "" ; +lin here_Adv = ss "" ; +lin quite_Adv = ss "" ; +lin somewhere_Adv = ss "" ; +lin there7from_Adv = ss "" ; +lin there7to_Adv = ss "" ; +lin there_Adv = ss "" ; + +-} +------- +-- Conj + +-- The lincat of Conj is Coordination.ConjunctionDistr ** {n:Number} +-- which means that there are two fields for the strings, and +-- n:Number which specifies the number of the resulting NP. + +lin and_Conj = {s1 = [] ; s2 = "and" ; n = Pl} ; +-- lin or_Conj = +-- lin if_then_Conj = +lin both7and_DConj = {s1 = "both" ; s2 = "and" ; n = Pl} ; +-- lin either7or_DConj = + +-- lin but_PConj = +-- lin otherwise_PConj = +-- lin therefore_PConj = + + +----------------- +-- *Det and Quant +{- +lin how8many_IDet = +lin every_Det = + +lin all_Predet = {s = ""} ; +lin not_Predet = { s = "" } ; +lin only_Predet = { s = "" } ; +lin most_Predet = {s = ""} ; + +lin few_Det = R.indefDet "" pl ; +lin many_Det = R.indefDet "" pl ; +lin much_Det = R.indefDet "" sg ; + +lin somePl_Det = +lin someSg_Det = + +lin no_Quant = +lin that_Quant = mkQuant "" ; +lin this_Quant = mkQuant "" ; +lin which_IQuant = mkQuant "" ; + +----- +-- NP + +lin somebody_NP = + + +lin everybody_NP = +lin everything_NP = +lin nobody_NP = +lin nothing_NP = +lin somebody_NP = +lin something_NP = + +------- +-- Prep + +lin above_Prep = mkPrep "" ; +lin after_Prep = mkPrep "" ; +lin before_Prep = mkPrep "" ; +lin behind_Prep = mkPrep "" ; +lin between_Prep = = mkPrep "" ; +lin by8agent_Prep = mkPrep "" ; +lin by8means_Prep = mkPrep "" ; +lin during_Prep = mkPrep "" ; +lin except_Prep = mkPrep "" ; +lin for_Prep = mkPrep "" ; +lin from_Prep = mkPrep "" ; +lin in8front_Prep = mkPrep "" ; +lin in_Prep = mkPrep "" ; +lin on_Prep = mkPrep "" ; +lin part_Prep = mkPrep ; +lin possess_Prep = mkPrep "" ; +lin through_Prep = mkPrep "" ; +lin to_Prep = mkPrep "k" ; +lin under_Prep = mkPrep "" ; +lin with_Prep = mkPrep "" ; +lin without_Prep = mkPrep "" ; + +------- +-- Pron + +-- Pronouns are closed class, no constructor in ParadigmsTMP. +lin it_Pron = +lin i_Pron = +lin youPol_Pron = +lin youSg_Pron = +lin he_Pron = +lin she_Pron = +lin we_Pron = +lin youPl_Pron = +lin they_Pron = + +lin whatPl_IP = +lin whatSg_IP = +lin whoPl_IP = +lin whoSg_IP = + +------- +-- Subj + +lin although_Subj = +lin because_Subj = +lin if_Subj = +lin that_Subj = +lin when_Subj = + + +------ +-- Utt + +lin language_title_Utt = ss "" ; +lin no_Utt = ss "" ; +lin yes_Utt = ss "" ; + + +------- +-- Verb + +lin have_V2 = + +lin can8know_VV = -- can (capacity) +lin can_VV = -- can (possibility) +lin must_VV = +lin want_VV = + +------ +-- Voc + +lin please_Voc = ss "" ; +-} + +} diff --git a/src/TEMPLATE/SymbolTMP.gf b/src/TEMPLATE/SymbolTMP.gf new file mode 100644 index 00000000..25d024ef --- /dev/null +++ b/src/TEMPLATE/SymbolTMP.gf @@ -0,0 +1,73 @@ +--# -path=.:../abstract:../common:../prelude + +concrete SymbolTMP of Symbol = CatTMP ** + open Prelude, ParadigmsTMP, ResTMP, (Noun=NounTMP) in { + +lin + + -- : Symb -> PN ; -- x + SymbPN i = mkPN_onRuntimeToken i.s ; + + -- : Int -> PN ; -- 27 + IntPN i = mkPN_onRuntimeToken i.s ; + + -- : Float -> PN ; -- 3.14159 + FloatPN i = mkPN_onRuntimeToken i.s ; + + -- : Card -> PN ; -- twelve [as proper name] + NumPN i = mkPN_onRuntimeToken (i.s ! NCard) ; + +lin +-- CNIntNP cn i = {} ; + + -- : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and y + CNSymbNP det cn xs = + let cnSymb : CN = cn ** {postmod = cn.postmod ++ xs.s} + in Noun.DetCN det cnSymb ; + + -- : CN -> Card -> NP ; -- level five ; level 5 + CNNumNP cn i = + let cnSymb : CN = cn ** {postmod = cn.postmod ++ i.s} + in Noun.MassNP cnSymb ; + + -- : Symb -> S ; + SymbS sy = sy ; + + -- : Symb -> Card ; + SymbNum sy = mkNumeral_onRuntimeToken sy.s ; + + -- : Symb -> Ord ; + SymbOrd sy = sy ; ---- TODO: nothing added to it. Lincat of Ord is just SS from the beginning. + + oper + -- To make Card or PN from a runtime argument, cannot use the single + operation. + -- See https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#unsupported-token-gluing + + mkNumeral_onRuntimeToken : Str -> LinNumeral = \str -> { + s = table { + NCard => str ; + NOrd => str ++ BIND ++ "th" + } ; + n = Pl ; -- NB. probably singular for number 1 + } ; + + mkPN_onRuntimeToken : Str -> LinPN = \str -> { + s = + -- table {_ => -- If lincat of PN changes so that it's an inflection table, uncomment this + str + -- } + ; + n = Sg ; + } ; + +lincat + Symb, [Symb] = SS ; + +lin + MkSymb s = s ; + + BaseSymb = infixSS "and" ; -- this comes between the last two ones + ConsSymb = infixSS "," ; + + +} diff --git a/src/TEMPLATE/VerbTMP.gf b/src/TEMPLATE/VerbTMP.gf new file mode 100644 index 00000000..413cff1d --- /dev/null +++ b/src/TEMPLATE/VerbTMP.gf @@ -0,0 +1,114 @@ +concrete VerbTMP of Verb = CatTMP ** open ResTMP, AdverbTMP, Prelude in { + + +lin + +----- +-- VP + -- : V -> VP + -- NB. assumes that lincat V = lincat VP + -- This will most likely change when you start working with VPs + UseV v = v ; + +{- + -- : V2 -> VP ; + PassV2 v2 = + + -- : VPSlash -> VP ; + ReflVP vps = + + -- : VV -> VP -> VP ; + ComplVV vv vp = + + -- : VS -> S -> VP ; + ComplVS vs s = + + -- : VQ -> QS -> VP ; + ComplVQ vq qs = + + -- : VA -> AP -> VP ; + ComplVA va ap = + + -- : Comp -> VP ; + UseComp comp = +-} +-------- +-- Slash +{- + -- : V2 -> VPSlash + SlashV2a v2 = + + -- : V3 -> NP -> VPSlash ; -- give it (to her) + Slash2V3 v3 dobj = + + -- : V3 -> NP -> VPSlash ; -- give (it) to her + Slash3V3 v3 iobj = + + SlashV2A v2 adj = + + -- : V2S -> S -> VPSlash ; -- answer (to him) that it is good + SlashV2S v2s s = + + -- : V2V -> VP -> VPSlash ; -- beg (her) to go + SlashV2V v2v vp = ; + + -- : V2Q -> QS -> VPSlash ; -- ask (him) who came + SlashV2Q v2q qs = ; + + -- : V2A -> AP -> VPSlash ; -- paint (it) red + SlashV2A v2a ap = ; + + + -- : VPSlash -> NP -> VP + -- Often VPSlash has a field called c2, which is used to pick right form of np complement + ComplSlash vps np = vps ** { + compl = np.s ! vps.c2 + } ; + + -- : VV -> VPSlash -> VPSlash ; + SlashVV vv vps = ComplVV vv vps ** { + } ; + + -- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy + SlashV2VNP v2v np vps = + + -- : VP -> Adv -> VP ; -- sleep here + AdvVP vp adv = + + -- : AdV -> VP -> VP ; -- always sleep + AdVVP adv vp = + + -- : VPSlash -> Adv -> VPSlash ; -- use (it) here + AdvVPSlash = insertAdv ; + + -- : VP -> Adv -> VP ; -- sleep , even though ... + ExtAdvVP vp adv = ; + + -- : AdV -> VPSlash -> VPSlash ; -- always use (it) + AdVVPSlash adv vps = vps ** { adv = adv.s ++ vps.adv } ; + + -- : VP -> Prep -> VPSlash ; -- live in (it) + VPSlashPrep vp prep = vp ** {c2 = prep} ; + + +--2 Complements to copula + +-- Adjectival phrases, noun phrases, and adverbs can be used. + + -- : AP -> Comp ; + CompAP ap = + + -- : CN -> Comp ; + CompCN cn = + + -- NP -> Comp ; + CompNP np = + + -- : Adv -> Comp ; + CompAdv adv = + + -- : VP -- Copula alone; + UseCopula = +-} + +} diff --git a/src/TEMPLATE/unittest/nouns.gftest b/src/TEMPLATE/unittest/nouns.gftest new file mode 100644 index 00000000..3fec5e0f --- /dev/null +++ b/src/TEMPLATE/unittest/nouns.gftest @@ -0,0 +1,9 @@ +----------------------------------- +-- Just some simple noun phrases -- +----------------------------------- + +Lang: DetCN (DetQuant IndefArt NumSg) (UseN blood_N) +LangTMP: a blood + +Lang: DetCN (DetQuant DefArt NumSg) (UseN blood_N) +LangTMP: the blood diff --git a/src/TEMPLATE/unittest/sentences.gftest b/src/TEMPLATE/unittest/sentences.gftest new file mode 100644 index 00000000..94b8dadd --- /dev/null +++ b/src/TEMPLATE/unittest/sentences.gftest @@ -0,0 +1,7 @@ +-------------------------------- +-- Just some simple sentences -- +-------------------------------- + +-- Replace with some tests that make sense for your language! +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN blood_N)) (UseV die_V)))) NoVoc +LangTMP: the blood die From a313207f49412d49640619e33748ac63d45a4e85 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 29 Aug 2023 09:33:52 +0200 Subject: [PATCH 057/129] added AdjLN --- src/swedish/NamesSwe.gf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/swedish/NamesSwe.gf b/src/swedish/NamesSwe.gf index b36acf3e..89ae35e4 100644 --- a/src/swedish/NamesSwe.gf +++ b/src/swedish/NamesSwe.gf @@ -32,6 +32,12 @@ lin FullName gn sn = { isPron = False } ; + AdjLN ap ln = ln ** { + s = \\c => preOrPost ap.isPre + (ap.s ! agrAdj (gennum (ngen2gen ln.g) ln.n) (DDef Def)) + (ln.s ! c) ; + } ; + InLN n = {s = "i" ++ n.s ! caseNP accusative} ; } From b72ea1e2f1dcdafacfd61aa7e6acb1c2008dcea9 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 29 Aug 2023 15:08:45 +0200 Subject: [PATCH 058/129] handle the full definitive article with Masc nouns --- src/bulgarian/CatBul.gf | 2 +- src/bulgarian/DocumentationBul.gf | 16 ++++++++++++++-- src/bulgarian/MorphoFunsBul.gf | 10 ++++++---- src/bulgarian/NamesBul.gf | 29 ++++++++++++++++++++++------- 4 files changed, 43 insertions(+), 14 deletions(-) diff --git a/src/bulgarian/CatBul.gf b/src/bulgarian/CatBul.gf index 08d922b9..9e9c9407 100644 --- a/src/bulgarian/CatBul.gf +++ b/src/bulgarian/CatBul.gf @@ -89,7 +89,7 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, ( N3 = {s : NForm => Str; rel : AForm => Str; relType : NRelType; g : AGender} ** {c2,c3 : Preposition} ; GN = {s : Str; g : Sex} ; SN = {s : Sex => Str; pl : Str} ; - LN = {s : Species => Str; onPrep : Bool; gn : GenNum} ; + LN = {s : Species => Str; defNom: Str; onPrep : Bool; hasArt : Bool; gn : GenNum} ; PN = {s : Str; gn : GenNum} ; lindef diff --git a/src/bulgarian/DocumentationBul.gf b/src/bulgarian/DocumentationBul.gf index 9f3c82c1..7b253ecc 100644 --- a/src/bulgarian/DocumentationBul.gf +++ b/src/bulgarian/DocumentationBul.gf @@ -69,7 +69,10 @@ lin tr (intagAttr "th" "rowspan=\"3\"" "ед.ч." ++ th "нечленувано" ++ td (n.s ! (NF Sg Indef))) ++ tr (th "членувано" ++ td (n.s ! (NF Sg Def))) ++ - tr (th "пълен член" ++ td (n.s ! NFSgDefNom)) ++ + (case n.g of { + AMasc _ => tr (th "пълен член" ++ td (n.s ! NFSgDefNom)) ; + _ => "" + }) ++ tr (intagAttr "th" "rowspan=\"2\"" "мн.ч." ++ th "нечленувано" ++ td (n.s ! (NF Pl Indef))) ++ tr (th "членувано" ++ td (n.s ! (NF Pl Def))) ++ @@ -101,7 +104,16 @@ lin GSg Neut => "(ср.р.)" ; GPl => "(мн.ч.)" }) ; - s2 = paragraph (n.s ! Indef) ++ + s2 = paragraph (case n.hasArt of { + True => frameTable ( + tr (th "нечленувано" ++ td (n.s ! Indef)) ++ + tr (th "членувано" ++ td (n.s ! Def)) ++ + (case n.gn of { + GSg Masc => tr (th "пълен член" ++ td n.defNom) ; + _ => "" + })) ; + False => n.s ! Indef + }) ++ heading1 ("Наречие") ++ paragraph (case n.onPrep of { True => linCase Dat Pos ; diff --git a/src/bulgarian/MorphoFunsBul.gf b/src/bulgarian/MorphoFunsBul.gf index 5aa59c45..fe1f077d 100644 --- a/src/bulgarian/MorphoFunsBul.gf +++ b/src/bulgarian/MorphoFunsBul.gf @@ -292,13 +292,15 @@ oper } ; mkLN = overload { - mkLN : Str -> LN = \s -> lin LN {s = \\_ => s; onPrep = False; gn = GSg Masc} ; + mkLN : Str -> LN = \s -> lin LN {s = \\_ => s; defNom=s; onPrep = False; hasArt = False; gn = GSg Masc} ; mkLN : Str -> Gender -> LN = - \s,g -> lin LN {s = \\_ => s; onPrep = False; gn = GSg g} ; + \s,g -> lin LN {s = \\_ => s; defNom=s; onPrep = False; hasArt = False; gn = GSg g} ; mkLN : Str -> GenNum -> LN = - \s,gn -> lin LN {s = \\_ => s; onPrep = False; gn = gn} ; + \s,gn -> lin LN {s = \\_ => s; defNom=s; onPrep = False; hasArt = False; gn = gn} ; mkLN : Str -> Str -> GenNum -> LN = - \s1,s2,gn -> lin LN {s = table Species [s2; s1]; onPrep = False; gn = gn} ; + \s1,s2,gn -> lin LN {s = table Species [s2; s1]; defNom=s2; onPrep = False; hasArt = True; gn = gn} ; + mkLN : Str -> Str -> Str -> LN = + \s1,s2,s3 -> lin LN {s = table Species [s3; s2]; defNom=s1; onPrep = False; hasArt = True; gn = GSg Masc} ; } ; onLN : LN -> LN = \n -> n ** {onPrep = True} ; diff --git a/src/bulgarian/NamesBul.gf b/src/bulgarian/NamesBul.gf index ea5c5901..d15a0950 100644 --- a/src/bulgarian/NamesBul.gf +++ b/src/bulgarian/NamesBul.gf @@ -36,9 +36,18 @@ lin FullName gn sn = { p = NounP3 Pos } ; -lin UseLN, PlainLN = \n -> { - s = table { RObj c => linCase c Pos ++ n.s ! Def ; - _ => n.s ! Def +lin UseLN = \n -> { + s = table { RSubj => n.defNom ; + RObj c => linCase c Pos ++ n.s ! Def ; + RVoc => n.s ! Indef + } ; + gn = n.gn ; + p = NounP3 Pos + } ; + +lin PlainLN = \n -> { + s = table { RObj c => linCase c Pos ++ n.s ! Indef ; + _ => n.s ! Indef } ; gn = n.gn ; p = NounP3 Pos @@ -53,10 +62,16 @@ lin UseLN, PlainLN = \n -> { } ; AdjLN ap n = n ** { - s = \\sp => case ap.isPre of { - True => ap.s ! aform n.gn sp RSubj ! P3 ++ n.s ! Indef ; - False => n.s ! sp ++ ap.s ! aform n.gn sp RSubj ! P3 - } + s = \\sp => case of { + => ap.s ! aform n.gn sp RSubj ! P3 ++ n.s ! Indef ; + => ap.s ! aform n.gn Indef RSubj ! P3 ++ n.s ! Indef ; + => n.s ! sp ++ ap.s ! aform n.gn Indef RSubj ! P3 + } ; + defNom = case of { + => ap.s ! ASgMascDefNom ! P3 ++ n.s ! Indef ; + => ap.s ! aform n.gn Indef RSubj ! P3 ++ n.s ! Indef ; + => n.defNom ++ ap.s ! aform n.gn Indef RSubj ! P3 + } ; } ; } From 28afb4d0dc618e8654b6b70e57747498812620d0 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 30 Aug 2023 21:03:37 +0200 Subject: [PATCH 059/129] added pot5art and fixed inflection for large numerals --- src/abstract/Numeral.gf | 1 + src/bulgarian/NumeralBul.gf | 10 +++++++--- src/english/NumeralEng.gf | 4 ++++ src/swedish/NumeralSwe.gf | 21 +++++++++++++++++++-- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/abstract/Numeral.gf b/src/abstract/Numeral.gf index be0d904e..a1af031b 100644 --- a/src/abstract/Numeral.gf +++ b/src/abstract/Numeral.gf @@ -63,6 +63,7 @@ data pot51 : Sub1000000000000 ; -- a billion instead of one billion pot5 : Sub1000 -> Sub1000000000000 ; -- m * 1000000000 + pot5art : Sub1000000000000 ; -- a/an instead of one pot5plus : Sub1000 -> Sub1000000000 -> Sub1000000000000 ; -- m * 1000000000 + n pot5decimal : Decimal -> Sub1000000000000 ; -- 3.5 billion diff --git a/src/bulgarian/NumeralBul.gf b/src/bulgarian/NumeralBul.gf index 149e2362..c9fa8060 100644 --- a/src/bulgarian/NumeralBul.gf +++ b/src/bulgarian/NumeralBul.gf @@ -112,7 +112,7 @@ lin pot41 = { lin pot4 n = { s = \\c,nf => case n.n of { Sg => mkCardOrd100 "милион" "милионите" "милионен" ! c ; - Pl => n.s ! NCard (CFFem Indef) ! nf ++ mkCardOrd100 "милиони" "милионите" "милионен" ! c + Pl => n.s ! NCard (CFFem Indef) ! nf ++ mkCardOrd100 "милиона" "милионите" "милионен" ! c } ; n = Pl } ; @@ -142,10 +142,14 @@ lin pot51 = { lin pot5 n = { s = \\c,nf => case n.n of { Sg => mkCardOrd100 "милиярд" "милиярдите" "милиярден" ! c ; - Pl => n.s ! NCard (CFFem Indef) ! nf ++ mkCardOrd100 "милиярд" "милиярдите" "милиярден" ! c + Pl => n.s ! NCard (CFFem Indef) ! nf ++ mkCardOrd100 "милиярда" "милиярдите" "милиярден" ! c } ; n = Pl } ; +lin pot5art = { + s = \\o,_ => "" ; + n = Sg + } ; lin pot5plus n1 n2 = { s = \\o,f => (pot5 n1).s ! o ! f ++ "и" ++ n2.s ! o ! f; n = Pl @@ -154,7 +158,7 @@ lin pot5decimal d = { s = \\c,nf => d.s ! NCard (CFFem Indef) ++ case d.n of { Sg => mkCardOrd100 "милиярд" "милиярда" "милиярден" ! c ; - Pl => mkCardOrd100 "милиярди" "милиярдите" "милиярден" ! c + Pl => mkCardOrd100 "милиярда" "милиярдите" "милиярден" ! c } ; n = Pl } ; diff --git a/src/english/NumeralEng.gf b/src/english/NumeralEng.gf index e71e80bd..1923aba1 100644 --- a/src/english/NumeralEng.gf +++ b/src/english/NumeralEng.gf @@ -86,6 +86,10 @@ lin pot5 n = { s = \\d,o,c => n.s ! d ! NCard ! Nom ++ pot51.s ! True ! o ! c ; n = Pl } ; +lin pot5art = { + s = \\d,o,c => case d of {True => []; False => artIndef}; + n = Sg + } ; lin pot5plus n1 n2 = { s = \\d,o,c => n1.s ! d ! NCard ! Nom ++ pot51.s ! True ! NCard ! Nom ++ "and" ++ n2.s ! True ! o ! c; n = Pl diff --git a/src/swedish/NumeralSwe.gf b/src/swedish/NumeralSwe.gf index 23e0d57e..ef20559f 100644 --- a/src/swedish/NumeralSwe.gf +++ b/src/swedish/NumeralSwe.gf @@ -52,7 +52,12 @@ lin pot41 = numPl (cardOrd "miljon" "miljonde") ; pot4 n = - numPl (\\g => n.s ! NCard Utr ++ cardOrd "miljon" "miljonde" ! g) ; + numPl (\\g => n.s ! NCard Utr ++ + cardOrd (case n.n of { + Sg => "miljon" ; + Pl => "miljoner" + }) + "miljonde" ! g) ; pot4plus n m = {s = \\g => n.s ! NCard Utr ++ BIND ++ "miljon" ++ m.s ! g ; n = Pl} ; pot4as5 n = n ; @@ -60,8 +65,20 @@ lin numPl (\\g => d.s ! NCard Utr ++ cardOrd "miljoner" "miljonde" ! g) ; pot51 = numPl (cardOrd "miljard" "miljarde") ; + pot5art = { + s = table { + NCard g => case g of {Neutr => "ett" ; _ => "en"} ; + _ => "första" + } ; + n = Sg + } ; pot5 n = - numPl (\\g => n.s ! NCard Utr ++ cardOrd "miljard" "miljarde" ! g) ; + numPl (\\g => n.s ! NCard Utr ++ + cardOrd (case n.n of { + Sg => "miljard" ; + Pl => "miljarder" + }) + "miljarde" ! g) ; pot5plus n m = {s = \\g => n.s ! NCard Utr ++ BIND ++ "miljard" ++ m.s ! g ; n = Pl} ; pot5decimal d = From f53b872b337d161750290ebb65d848c1cfd4954e Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 30 Aug 2023 21:35:03 +0200 Subject: [PATCH 060/129] revert the addition of pot5art --- src/abstract/Numeral.gf | 1 - src/bulgarian/NumeralBul.gf | 4 ---- src/english/NumeralEng.gf | 4 ---- src/swedish/NumeralSwe.gf | 7 ------- 4 files changed, 16 deletions(-) diff --git a/src/abstract/Numeral.gf b/src/abstract/Numeral.gf index a1af031b..be0d904e 100644 --- a/src/abstract/Numeral.gf +++ b/src/abstract/Numeral.gf @@ -63,7 +63,6 @@ data pot51 : Sub1000000000000 ; -- a billion instead of one billion pot5 : Sub1000 -> Sub1000000000000 ; -- m * 1000000000 - pot5art : Sub1000000000000 ; -- a/an instead of one pot5plus : Sub1000 -> Sub1000000000 -> Sub1000000000000 ; -- m * 1000000000 + n pot5decimal : Decimal -> Sub1000000000000 ; -- 3.5 billion diff --git a/src/bulgarian/NumeralBul.gf b/src/bulgarian/NumeralBul.gf index c9fa8060..d447f42a 100644 --- a/src/bulgarian/NumeralBul.gf +++ b/src/bulgarian/NumeralBul.gf @@ -146,10 +146,6 @@ lin pot5 n = { } ; n = Pl } ; -lin pot5art = { - s = \\o,_ => "" ; - n = Sg - } ; lin pot5plus n1 n2 = { s = \\o,f => (pot5 n1).s ! o ! f ++ "и" ++ n2.s ! o ! f; n = Pl diff --git a/src/english/NumeralEng.gf b/src/english/NumeralEng.gf index 1923aba1..e71e80bd 100644 --- a/src/english/NumeralEng.gf +++ b/src/english/NumeralEng.gf @@ -86,10 +86,6 @@ lin pot5 n = { s = \\d,o,c => n.s ! d ! NCard ! Nom ++ pot51.s ! True ! o ! c ; n = Pl } ; -lin pot5art = { - s = \\d,o,c => case d of {True => []; False => artIndef}; - n = Sg - } ; lin pot5plus n1 n2 = { s = \\d,o,c => n1.s ! d ! NCard ! Nom ++ pot51.s ! True ! NCard ! Nom ++ "and" ++ n2.s ! True ! o ! c; n = Pl diff --git a/src/swedish/NumeralSwe.gf b/src/swedish/NumeralSwe.gf index ef20559f..7e1d5e2e 100644 --- a/src/swedish/NumeralSwe.gf +++ b/src/swedish/NumeralSwe.gf @@ -65,13 +65,6 @@ lin numPl (\\g => d.s ! NCard Utr ++ cardOrd "miljoner" "miljonde" ! g) ; pot51 = numPl (cardOrd "miljard" "miljarde") ; - pot5art = { - s = table { - NCard g => case g of {Neutr => "ett" ; _ => "en"} ; - _ => "första" - } ; - n = Sg - } ; pot5 n = numPl (\\g => n.s ! NCard Utr ++ cardOrd (case n.n of { From 5f9322683cbebd175b09e7c35c4b0506f0761c9c Mon Sep 17 00:00:00 2001 From: aarneranta Date: Fri, 8 Sep 2023 13:10:49 +0200 Subject: [PATCH 061/129] added NamesAra --- src/arabic/CatAra.gf | 2 +- src/arabic/NamesAra.gf | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/arabic/NamesAra.gf diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 222c798b..5dba84f2 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -92,7 +92,7 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { N = ResAra.Noun ; N2 = ResAra.Noun2 ; N3 = ResAra.Noun3 ; - PN = {s : Case => Str; g : Gender; h : Species} ; + GN, SN, LN, PN = {s : Case => Str; g : Gender; h : Species} ; linref diff --git a/src/arabic/NamesAra.gf b/src/arabic/NamesAra.gf new file mode 100644 index 00000000..d8928696 --- /dev/null +++ b/src/arabic/NamesAra.gf @@ -0,0 +1,17 @@ +concrete NamesAra of Names = CatAra ** open ResAra, Prelude in { + +lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> emptyNP ** { + s = n.s ; + a = {pgn = Per3 n.g Sg ; isPron = False} ; + } ; +lin FullName gn sn = emptyNP ** { + s = \\c => gn.s ! c ++ sn.s ! c ; + a = {pgn = Per3 gn.g Sg ; isPron = False} ; + } ; + +lin UseLN pn = emptyNP ** { + s = pn.s ; + a = {pgn = Per3 pn.g Sg ; isPron = False} ; + } ; + +} From 03d3a8cbc25741bc3ec9038794a6cc11fb015d48 Mon Sep 17 00:00:00 2001 From: aarneranta Date: Fri, 8 Sep 2023 13:11:10 +0200 Subject: [PATCH 062/129] disambiguated Number in Slovenian --- src/slovenian/DocumentationSlv.gf | 18 +++++++++--------- src/slovenian/NamesSlv.gf | 6 +++--- src/slovenian/ParadigmsSlv.gf | 18 +++++++++--------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/slovenian/DocumentationSlv.gf b/src/slovenian/DocumentationSlv.gf index 345b480b..373d4935 100644 --- a/src/slovenian/DocumentationSlv.gf +++ b/src/slovenian/DocumentationSlv.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common concrete DocumentationSlv of Documentation = CatSlv ** open - ResSlv, ParamX, + ResSlv, (P=ParamX), HTML in { flags coding=utf8 ; @@ -73,8 +73,8 @@ lin t = "li" ; s1= heading1 ("Dano Ime"++ case n.g of { - Male => "(moški)" ; - Female => "(ženski)" + P.Male => "(moški)" ; + P.Female => "(ženski)" }) ; s2= frameTable ( tr (th "imen." ++ td (n.s!Nom))++ @@ -90,12 +90,12 @@ lin t = "li" ; s1= heading1 "Družinsko Ime" ; s2= frameTable ( - tr (th "imen." ++ td (n.s!Male!Nom))++ - tr (th "rod." ++ td (n.s!Male!Gen))++ - tr (th "daj." ++ td (n.s!Male!Dat))++ - tr (th "tož." ++ td (n.s!Male!Acc))++ - tr (th "mest." ++ td (n.s!Male!Loc))++ - tr (th "orod."++td (n.s!Male!Instr)) + tr (th "imen." ++ td (n.s!P.Male!Nom))++ + tr (th "rod." ++ td (n.s!P.Male!Gen))++ + tr (th "daj." ++ td (n.s!P.Male!Dat))++ + tr (th "tož." ++ td (n.s!P.Male!Acc))++ + tr (th "mest." ++ td (n.s!P.Male!Loc))++ + tr (th "orod."++td (n.s!P.Male!Instr)) ) } ; diff --git a/src/slovenian/NamesSlv.gf b/src/slovenian/NamesSlv.gf index 1b767352..87493039 100644 --- a/src/slovenian/NamesSlv.gf +++ b/src/slovenian/NamesSlv.gf @@ -1,4 +1,4 @@ -concrete NamesSlv of Names = CatSlv ** open ResSlv, ParamX, Prelude in { +concrete NamesSlv of Names = CatSlv ** open ResSlv, (P=ParamX), Prelude in { lin GivenName = \n -> { s = n.s; @@ -6,12 +6,12 @@ lin GivenName = \n -> { isPron = False } ; lin MaleSurname = \n -> { - s = n.s ! Male; + s = n.s ! P.Male; a = {g=Masc; n=Sg; p=P3}; isPron = False } ; lin FemaleSurname = \n -> { - s = n.s ! Female; + s = n.s ! P.Female; a = {g=Fem; n=Sg; p=P3}; isPron = False } ; diff --git a/src/slovenian/ParadigmsSlv.gf b/src/slovenian/ParadigmsSlv.gf index 54d0ab79..7cb1a45a 100644 --- a/src/slovenian/ParadigmsSlv.gf +++ b/src/slovenian/ParadigmsSlv.gf @@ -1,4 +1,4 @@ -resource ParadigmsSlv = open CatSlv, ResSlv, ParamX, Prelude, Predef in { +resource ParadigmsSlv = open CatSlv, ResSlv, (P=ParamX), Prelude, Predef in { oper nominative : Case = Nom ; @@ -16,12 +16,12 @@ oper feminine = AFem; neuter = ANeut; - male = Male ; - female = Female ; + male = P.Male ; + female = P.Female ; - singular : Number = Sg ; - dual : Number = Dl ; - plural : Number = Pl ; + singular : ResSlv.Number = ResSlv.Sg ; + dual : ResSlv.Number = Dl ; + plural : ResSlv.Number = ResSlv.Pl ; definite : Species = Def ; indefinite : Species = Indef ; @@ -45,7 +45,7 @@ oper --In case the genitive singular has an extra vowel in the end, it is dropped before coming here. mascAll : (_,_ : Str) -> Animacy -> N = \oce,ocet,anim -> - let accsg = case anim of {Animate => ocet + "a"; _ => oce}; --Special case: Masc Sg Acc Animate + let accsg = case anim of {Animate => ocet + "a"; _ => oce}; --Special case: Masc ResSlv.Sg Acc Animate oceto : Str = case ocet of { _ + ("c"|"j"|"ž"|"š"|"č") => ocet+"e" ; @@ -208,12 +208,12 @@ oper } ; mkGN = overload { - mkGN : Str -> Sex -> GN = + mkGN : Str -> P.Sex -> GN = \s,g -> lin GN { s = \\_ => s ; g = g }; - mkGN : (_,_,_,_,_,_ : Str) -> Sex -> GN = + mkGN : (_,_,_,_,_,_ : Str) -> P.Sex -> GN = \nom,gen,dat,acc,loc,instr,g -> lin GN { s = table { Nom => nom; From 3640421022e295f58edf4b636b9e3b92f3b155e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrea=20Carri=C3=B3n?= <62030163+guscarrian@users.noreply.github.com> Date: Tue, 12 Sep 2023 10:29:33 +0200 Subject: [PATCH 063/129] Updating romance langs (mkMU) (#442) * updating romance langs for percentage in Spa * Delete Setup_compare.hs --- src/catalan/CatCat.gf | 2 +- src/catalan/GrammarCat.gf | 2 +- src/catalan/ParadigmsCat.gf | 2 +- src/french/CatFre.gf | 2 +- src/french/GrammarFre.gf | 2 +- src/french/ParadigmsFre.gf | 2 +- src/italian/CatIta.gf | 2 +- src/italian/GrammarIta.gf | 2 +- src/italian/ParadigmsIta.gf | 2 +- src/portuguese/CatPor.gf | 2 +- src/portuguese/GrammarPor.gf | 2 +- src/portuguese/ParadigmsPor.gf | 2 +- src/romance/CatRomance.gf | 6 +++++- src/romance/NounRomance.gf | 7 +++++-- src/spanish/CatSpa.gf | 2 +- src/spanish/GrammarSpa.gf | 2 +- src/spanish/ParadigmsSpa.gf | 2 +- 17 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/catalan/CatCat.gf b/src/catalan/CatCat.gf index 74683631..3b097e8c 100644 --- a/src/catalan/CatCat.gf +++ b/src/catalan/CatCat.gf @@ -1,6 +1,6 @@ --# -path=.:../romance:../abstract:../common:prelude concrete CatCat of Cat = - CommonX - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol] ** + CommonX - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol,MU] ** CatRomance with -- JS restore TPast for notpresent (ResRomance = ResCat) ; diff --git a/src/catalan/GrammarCat.gf b/src/catalan/GrammarCat.gf index afd7472e..018253be 100644 --- a/src/catalan/GrammarCat.gf +++ b/src/catalan/GrammarCat.gf @@ -11,7 +11,7 @@ concrete GrammarCat of Grammar = RelativeCat, ConjunctionCat, PhraseCat, - TextX - [SC,Temp,Tense,Pol,PPos,PNeg], + TextX - [SC,Temp,Tense,Pol,PPos,PNeg,MU], IdiomCat, StructuralCat, TenseCat, diff --git a/src/catalan/ParadigmsCat.gf b/src/catalan/ParadigmsCat.gf index edf09edb..c60a4f27 100644 --- a/src/catalan/ParadigmsCat.gf +++ b/src/catalan/ParadigmsCat.gf @@ -588,6 +588,6 @@ oper mk2V2 : V -> Prep -> V2 ; dirV2 : V -> V2 ; - mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False; hasArt=False} ; } ; diff --git a/src/french/CatFre.gf b/src/french/CatFre.gf index 47d5b7d2..fe6d40ec 100644 --- a/src/french/CatFre.gf +++ b/src/french/CatFre.gf @@ -1,5 +1,5 @@ --# -path=.:../romance:../common:../abstract:../common:prelude -concrete CatFre of Cat = CommonX - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol] +concrete CatFre of Cat = CommonX - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol,MU] ** CatRomance with (ResRomance = ResFre) ; diff --git a/src/french/GrammarFre.gf b/src/french/GrammarFre.gf index 7fc42bd6..3de5bab5 100644 --- a/src/french/GrammarFre.gf +++ b/src/french/GrammarFre.gf @@ -11,7 +11,7 @@ concrete GrammarFre of Grammar = RelativeFre, ConjunctionFre, PhraseFre, - TextX - [SC,Temp,Tense,Pol,PPos,PNeg], + TextX - [SC,Temp,Tense,Pol,PPos,PNeg,MU], IdiomFre, StructuralFre, TenseFre, diff --git a/src/french/ParadigmsFre.gf b/src/french/ParadigmsFre.gf index fa11d608..6aceb83d 100644 --- a/src/french/ParadigmsFre.gf +++ b/src/french/ParadigmsFre.gf @@ -590,6 +590,6 @@ oper _ => VFalse -- prend-il } ; - mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False; hasArt=False} ; } ; diff --git a/src/italian/CatIta.gf b/src/italian/CatIta.gf index eb7aa842..3a2fd821 100644 --- a/src/italian/CatIta.gf +++ b/src/italian/CatIta.gf @@ -1,4 +1,4 @@ --# -path=.:../romance:../abstract:../common:prelude -concrete CatIta of Cat = CommonX - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol] ** CatRomance with +concrete CatIta of Cat = CommonX - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol,MU] ** CatRomance with (ResRomance = ResIta) ; diff --git a/src/italian/GrammarIta.gf b/src/italian/GrammarIta.gf index 773a2a17..4870434d 100644 --- a/src/italian/GrammarIta.gf +++ b/src/italian/GrammarIta.gf @@ -11,7 +11,7 @@ concrete GrammarIta of Grammar = RelativeIta, ConjunctionIta, PhraseIta, - TextX - [SC,Temp,Tense,Pol,PPos,PNeg,TPres,TPast,TFut,TCond], + TextX - [SC,Temp,Tense,Pol,PPos,PNeg,TPres,TPast,TFut,TCond,MU], IdiomIta, StructuralIta, TenseIta, diff --git a/src/italian/ParadigmsIta.gf b/src/italian/ParadigmsIta.gf index 2454bf15..22647496 100644 --- a/src/italian/ParadigmsIta.gf +++ b/src/italian/ParadigmsIta.gf @@ -589,6 +589,6 @@ oper mk2V2 : V -> Prep -> V2 ; dirV2 : V -> V2 ; - mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False; hasArt=False} ; } ; diff --git a/src/portuguese/CatPor.gf b/src/portuguese/CatPor.gf index 9c794dfc..faf439ba 100644 --- a/src/portuguese/CatPor.gf +++ b/src/portuguese/CatPor.gf @@ -1,5 +1,5 @@ --# -path=.:../romance:../abstract:../common:prelude concrete CatPor of Cat = CommonX - - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol] ** CatRomance with + [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol,MU] ** CatRomance with (ResRomance = ResPor) ; diff --git a/src/portuguese/GrammarPor.gf b/src/portuguese/GrammarPor.gf index 7e41abd2..cbdb545d 100644 --- a/src/portuguese/GrammarPor.gf +++ b/src/portuguese/GrammarPor.gf @@ -11,7 +11,7 @@ concrete GrammarPor of Grammar = RelativePor, ConjunctionPor, PhrasePor, - TextPor - [SC,Temp,Tense,Pol,PPos,PNeg], -- special punctuation + TextPor - [SC,Temp,Tense,Pol,PPos,PNeg,MU], -- special punctuation IdiomPor, StructuralPor, TensePor, diff --git a/src/portuguese/ParadigmsPor.gf b/src/portuguese/ParadigmsPor.gf index f59bc66b..d62697fd 100644 --- a/src/portuguese/ParadigmsPor.gf +++ b/src/portuguese/ParadigmsPor.gf @@ -598,7 +598,7 @@ oper reflVerboV : Verbum -> V = \ve -> reflV (lin V (verboV ve)) ; --% - mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False; hasArt=False} ; } ; diff --git a/src/romance/CatRomance.gf b/src/romance/CatRomance.gf index 034c5f73..14af013d 100644 --- a/src/romance/CatRomance.gf +++ b/src/romance/CatRomance.gf @@ -1,4 +1,4 @@ -incomplete concrete CatRomance of Cat = CommonX - [SC,Pol] +incomplete concrete CatRomance of Cat = CommonX - [SC,Pol,MU] ** open Prelude, CommonRomance, ResRomance, (R = ParamX) in { flags optimize=all_subs ; @@ -147,4 +147,8 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol] N = \n -> n.s ! Sg ; N2 = \n -> n.s ! Sg ++ n.c2.s ; N3 = \n -> n.s ! Sg ++ n.c2.s ++ n.c3.s ; + + lincat MU = {s : Str ; isPre : Bool ; hasArt : Bool} ; + + } diff --git a/src/romance/NounRomance.gf b/src/romance/NounRomance.gf index 6d6615de..721ffc19 100644 --- a/src/romance/NounRomance.gf +++ b/src/romance/NounRomance.gf @@ -208,9 +208,12 @@ incomplete concrete NounRomance of Noun = DetDAP det = det ; QuantityNP n m = heavyNPpol False { - s = \\c => preOrPost m.isPre m.s (n.s ! NCard Masc); + s = \\c => case of { + | => artDef False Masc Sg c ++ preOrPost m.isPre m.s (n.s ! NCard Masc); + _ => preOrPost m.isPre m.s (n.s ! NCard Masc)}; + a = agrP3 Masc n.n ; hasClit = False } ; + } -} diff --git a/src/spanish/CatSpa.gf b/src/spanish/CatSpa.gf index 816909b6..1f63e564 100644 --- a/src/spanish/CatSpa.gf +++ b/src/spanish/CatSpa.gf @@ -1,5 +1,5 @@ --# -path=.:../romance:../abstract:../common:prelude concrete CatSpa of Cat = CommonX - - [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol] ** CatRomance with + [SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol,MU] ** CatRomance with (ResRomance = ResSpa) ; diff --git a/src/spanish/GrammarSpa.gf b/src/spanish/GrammarSpa.gf index 01944052..bab5b7ea 100644 --- a/src/spanish/GrammarSpa.gf +++ b/src/spanish/GrammarSpa.gf @@ -11,7 +11,7 @@ concrete GrammarSpa of Grammar = RelativeSpa, ConjunctionSpa, PhraseSpa, - TextSpa - [SC,Temp,Tense,Pol,PPos,PNeg], -- special punctuation + TextSpa - [SC,Temp,Tense,Pol,PPos,PNeg,MU], -- special punctuation IdiomSpa, StructuralSpa, TenseSpa, diff --git a/src/spanish/ParadigmsSpa.gf b/src/spanish/ParadigmsSpa.gf index 5f850596..89c7f0f6 100644 --- a/src/spanish/ParadigmsSpa.gf +++ b/src/spanish/ParadigmsSpa.gf @@ -618,6 +618,6 @@ oper mk2V2 : V -> Prep -> V2 ; dirV2 : V -> V2 ; - mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ; + mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False ; hasArt=False} ; } ; From 6312624a5fa84d0076e46a44befbfccadb0538f0 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Tue, 12 Sep 2023 12:08:31 +0200 Subject: [PATCH 064/129] preparing to read Arabic morpholex from Wiktionary --- src/arabic/wiktionary/read_wiktionary.py | 97 ++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 src/arabic/wiktionary/read_wiktionary.py diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py new file mode 100644 index 00000000..48a2fca3 --- /dev/null +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -0,0 +1,97 @@ +import gzip +import json + +WIKTIONARY_DUMP = 'raw-wiktextract-data.json.gz' + + +def get_gzip_json(file, sample=100000, langs=[]): + with gzip.open(file) as decompressed: + n = 0 + for line in decompressed: + n += 1 + if n % sample == 0: + obj = json.loads(line) + if obj.get('lang', None) in langs: + print(line.decode("utf-8")) + print(n) + + +# get_gzip_json(WIKTIONARY_DUMP, 1, ['Arabic']) +# python3 read_wiktionary.py >wikt_arabic.jsonl +# 621-671 + +# https://en.wikipedia.org/wiki/Buckwalter_transliteration +buckwalter_dict = { + 0x621: "'", # ء + 0x622: '|', # آ + 0x623: '>', # أ + 0x624: '&', # ؤ + 0x625: '<', # إ + 0x626: '}', # ئ + 0x627: 'A', # ا + 0x628: 'b', # ب + 0x629: 'p', # ة + 0x62a: 't', # ت + 0x62b: 'v', # ث + 0x62c: 'j', # ج + 0x62d: 'H', # ح + 0x62e: 'x', # خ + 0x62f: 'd', # د + 0x630: '*', # ذ + 0x631: 'r', # ر + 0x632: 'z', # ز + 0x633: 's', # س + 0x634: '$', # ش + 0x635: 'S', # ص + 0x636: 'D', # ض + 0x637: 'T', # ط + 0x638: 'Z', # ظ + 0x639: 'E', # ع + 0x63a: 'g', # غ + 0x641: 'f', # ف + 0x642: 'q', # ق + 0x643: 'k', # ك + 0x644: 'l', # ل + 0x645: 'm', # م + 0x646: 'n', # ن + 0x647: 'h', # ه + 0x648: 'w', # و + 0x649: 'Y', # ى + 0x64a: 'y', # ي + 0x64b: 'F', # ً + 0x64c: 'N', # ٌ + 0x64d: 'K', # ٍ + 0x64e: 'a', # َ + 0x64f: 'u', # ُ + 0x650: 'i', # ِ + 0x651: '~', # ّ + 0x652: 'o', # ْ + 0x670: '`', # ' + 0x671: '{' # ٱ + } + +def to_buckwalter(s): + return ''.join(list(map(lambda c: buckwalter_dict.get(ord(c), '?'), s))) + + +def is_arabic(s): + return s and any(1574 <= ord(c) <= 1616 for c in s) + +""" +with open('wikt_arabic.jsonl') as file: + for line in file: + obj = json.loads(line) + if 'Arabic lemmas' in obj.get('categories', []): + entry = { + 'pos': obj['pos'], + 'forms': {form['form']: form.get('tags', []) for + form in obj.get('forms', []) if + 'romanization' not in form.get('tags', []) and + is_arabic(form['form']) + }, + 'senses': obj.get('senses', []) + } + entry['n_forms'] = len(entry['forms']) + print(entry['pos'], entry['n_forms']) +# print(json.dumps(entry, ensure_ascii=False)) +""" From ae1c7f0061ddec572b09acf0fe71b705d39fccb7 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Tue, 12 Sep 2023 16:35:21 +0200 Subject: [PATCH 065/129] extracting Arabic from Wiktionary, next step GF generation --- src/arabic/wiktionary/read_wiktionary.py | 106 ++++++++++++++++++++--- 1 file changed, 94 insertions(+), 12 deletions(-) diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index 48a2fca3..2520cf5f 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -2,6 +2,7 @@ import gzip import json WIKTIONARY_DUMP = 'raw-wiktextract-data.json.gz' +FILTERED_WIKT = 'wikt_arabic.jsonl' def get_gzip_json(file, sample=100000, langs=[]): @@ -71,27 +72,108 @@ buckwalter_dict = { } def to_buckwalter(s): - return ''.join(list(map(lambda c: buckwalter_dict.get(ord(c), '?'), s))) + return ''.join([buckwalter_dict.get(ord(c), '?') for c in s]) +def unvocalize(s): + return ''.join([c for c in s if 0x621 <= ord(c) <= 0x64a]) + def is_arabic(s): return s and any(1574 <= ord(c) <= 1616 for c in s) -""" -with open('wikt_arabic.jsonl') as file: + +def gf_fun(s, pos): + return ''.join(["'", s, "_", pos, "'"]) + + +def forms_for_pos(obj): + forms = { + form['form']: + form.get('tags', []) for + form in obj.get('forms', []) if + 'romanization' not in form.get('tags', []) and + is_arabic(form['form']) + }.items() + if obj['pos'] == 'noun': + lemma = [form[:-1] for form, descr in forms + if all([w in descr for w in ['construct', 'nominative', 'singular']])][:1] + return { + 'gf_fun': gf_fun(lemma[0], 'N') if lemma else None, + 'singular': lemma, + 'plural': [form[:-1] for form, descr in forms + if all([w in descr for w in ['construct', 'nominative', 'plural']])][:1], + 'gender': 'Fem' if 'Arabic feminine nouns' in obj['categories'] + else ('Masc' if 'Arabic masculine nouns' in obj['categories'] + else None) + } + elif obj['pos'] == 'verb': + lemma = [form for form, descr in forms + if all([w in descr for + w in ["active", "indicative", "masculine", "past", "perfective", "singular", "third-person"]])][:1] + return { + 'gf_fun': gf_fun(lemma[0], 'V') if lemma else None, + 'perfect': lemma, + 'imperfect': [form for form, descr in forms + if all([w in descr for + w in ["active", "indicative", "masculine", "non-past", "imperfective", "singular", "third-person"]])][:1], + 'verbclass': max([n for n in ['I', 'II','III','IV','V','VI','VII','VIII','IX','X','XI','XII',''] + if n in ' '.join([c for c in obj['categories'] if c.endswith('verbs') and any([n in c for n in 'IVX'])])], + key=len) + } + elif obj['pos'] == 'adj': + lemma = [form for form, descr in forms + if all([w in descr for w in ['indefinite', 'masculine', 'singular', 'informal']])][:1] + return { + 'gf_fun': gf_fun(lemma[0], 'A') if lemma else None, + 'masc_singular': lemma, + 'masc_plural': [form for form, descr in forms + if all([w in descr for w in ['indefinite', 'masculine', 'plural', 'informal']])][:1], + 'fem_singular': [form for form, descr in forms + if all([w in descr for w in ['indefinite', 'feminine', 'singular', 'informal']])][:1], + 'fem_plural': [form for form, descr in forms + if all([w in descr for w in ['indefinite', 'feminine', 'plural', 'informal']])][:1], + } + + else: + return {f: d for f, d in forms} + + +# "root": ["ش ر ح (š-r-ḥ)"] +def find_root(s): + return ''.join([c for c in s if is_arabic(c)]) + + + +with open(FILTERED_WIKT) as file: for line in file: obj = json.loads(line) if 'Arabic lemmas' in obj.get('categories', []): entry = { 'pos': obj['pos'], - 'forms': {form['form']: form.get('tags', []) for - form in obj.get('forms', []) if - 'romanization' not in form.get('tags', []) and - is_arabic(form['form']) - }, - 'senses': obj.get('senses', []) + 'root': [find_root(t['expansion']) for t in obj.get('etymology_templates', []) if t.get('name', None) =='ar-root'][:1], + 'forms': forms_for_pos(obj), + 'senses': [sense['glosses'] for sense in obj.get('senses', []) + if 'glosses' in sense] } - entry['n_forms'] = len(entry['forms']) - print(entry['pos'], entry['n_forms']) -# print(json.dumps(entry, ensure_ascii=False)) +# entry['n_forms'] = len(entry['forms']) +# print(entry['pos'], entry['n_forms']) + print(json.dumps(entry, ensure_ascii=False)) + + +""" +"senses": [ + {"examples": [ + {"text": "10th century, Al-Mutanabbi\nذُو الْعَقْلِ يَشْقَى فِي النَّعِيمِ بِعَقْلِهِ / وَأَخُو الْجَهَالَةِ فِي الشَّقَاوَةِ يَنْعَمُ\nḏū l-ʕaqli yašqā fī an-naʕīmi biʕaqlihi / waʔaḵū l-jahālati fī š-šaqāwati yanʕamu", "english": "(please add an English translation of this quotation)", "type": "quotation"}], + "links": [ + ["bliss", "bliss#English"], ["delight", "delight#English"]], + "categories": ["Arabic terms with quotations", "Requests for translations of Arabic quotations"], + "glosses": ["bliss, delight"] + }, + {"links": [ + ["heaven", "heaven"], ["Heaven", "Heaven"], ["paradise", "paradise"], ["Paradise", "Paradise"]], + "synonyms": [{"word": "فِرْدَوس"}, {"word": "جَنَّة"}], + "antonyms": [{"word": "سَعِير"}, {"word": "لَظَىٰ"}, {"word": "النَّار"}, {"word": "جَهَنَّم"}, {"word": "جَحِيم"}, {"word": "حُطَمَة"}, {"word": "سَقَر"}, {"word": "هَاوِيَة"}], + "raw_glosses": ["(figurative) heaven, the Heaven, paradise, the Paradise"], + "glosses": ["heaven, the Heaven, paradise, the Paradise"], + "tags": ["figuratively"]}] """ From 714d8abac026fd2ec61fa431a61108358a3ef68c Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Tue, 12 Sep 2023 17:04:50 +0200 Subject: [PATCH 066/129] GF abstract dict generation --- src/arabic/wiktionary/read_wiktionary.py | 46 ++++++++++++------------ 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index 2520cf5f..ac5ee59d 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -98,7 +98,8 @@ def forms_for_pos(obj): lemma = [form[:-1] for form, descr in forms if all([w in descr for w in ['construct', 'nominative', 'singular']])][:1] return { - 'gf_fun': gf_fun(lemma[0], 'N') if lemma else None, + 'gf_fun': gf_fun(lemma[0], 'N') if lemma else None, + 'gf_cat': 'N', 'singular': lemma, 'plural': [form[:-1] for form, descr in forms if all([w in descr for w in ['construct', 'nominative', 'plural']])][:1], @@ -111,7 +112,8 @@ def forms_for_pos(obj): if all([w in descr for w in ["active", "indicative", "masculine", "past", "perfective", "singular", "third-person"]])][:1] return { - 'gf_fun': gf_fun(lemma[0], 'V') if lemma else None, + 'gf_fun': gf_fun(lemma[0], 'V') if lemma else None, + 'gf_cat': 'V', 'perfect': lemma, 'imperfect': [form for form, descr in forms if all([w in descr for @@ -124,7 +126,8 @@ def forms_for_pos(obj): lemma = [form for form, descr in forms if all([w in descr for w in ['indefinite', 'masculine', 'singular', 'informal']])][:1] return { - 'gf_fun': gf_fun(lemma[0], 'A') if lemma else None, + 'gf_fun': gf_fun(lemma[0], 'A') if lemma else None, + 'gf_cat': 'A', 'masc_singular': lemma, 'masc_plural': [form for form, descr in forms if all([w in descr for w in ['indefinite', 'masculine', 'plural', 'informal']])][:1], @@ -142,9 +145,14 @@ def forms_for_pos(obj): def find_root(s): return ''.join([c for c in s if is_arabic(c)]) +import sys +MODE = sys.argv[1] +if MODE == 'gf': + print('abstract MorphoDictAraAbs = Cat ** {') with open(FILTERED_WIKT) as file: + seen_gf_funs = set() for line in file: obj = json.loads(line) if 'Arabic lemmas' in obj.get('categories', []): @@ -157,23 +165,17 @@ with open(FILTERED_WIKT) as file: } # entry['n_forms'] = len(entry['forms']) # print(entry['pos'], entry['n_forms']) - print(json.dumps(entry, ensure_ascii=False)) + if MODE == 'json': + print(json.dumps(entry, ensure_ascii=False)) - -""" -"senses": [ - {"examples": [ - {"text": "10th century, Al-Mutanabbi\nذُو الْعَقْلِ يَشْقَى فِي النَّعِيمِ بِعَقْلِهِ / وَأَخُو الْجَهَالَةِ فِي الشَّقَاوَةِ يَنْعَمُ\nḏū l-ʕaqli yašqā fī an-naʕīmi biʕaqlihi / waʔaḵū l-jahālati fī š-šaqāwati yanʕamu", "english": "(please add an English translation of this quotation)", "type": "quotation"}], - "links": [ - ["bliss", "bliss#English"], ["delight", "delight#English"]], - "categories": ["Arabic terms with quotations", "Requests for translations of Arabic quotations"], - "glosses": ["bliss, delight"] - }, - {"links": [ - ["heaven", "heaven"], ["Heaven", "Heaven"], ["paradise", "paradise"], ["Paradise", "Paradise"]], - "synonyms": [{"word": "فِرْدَوس"}, {"word": "جَنَّة"}], - "antonyms": [{"word": "سَعِير"}, {"word": "لَظَىٰ"}, {"word": "النَّار"}, {"word": "جَهَنَّم"}, {"word": "جَحِيم"}, {"word": "حُطَمَة"}, {"word": "سَقَر"}, {"word": "هَاوِيَة"}], - "raw_glosses": ["(figurative) heaven, the Heaven, paradise, the Paradise"], - "glosses": ["heaven, the Heaven, paradise, the Paradise"], - "tags": ["figuratively"]}] -""" + if MODE == 'gf': + + if 'gf_fun' in entry['forms'] and entry['forms']['gf_fun']: + if entry['forms']['gf_fun'] not in seen_gf_funs: + print('fun', entry['forms']['gf_fun'], ':', entry['forms']['gf_cat'], ';', '--', entry['senses']) + seen_gf_funs.add(entry['forms']['gf_fun']) + + # to do: rename duplicate function names: of 13762 names, 12946 are unique + +if MODE == 'gf': + print('}') From 8eceb53643a5a41d53ae61ce4ebb64f70b27010e Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Tue, 12 Sep 2023 19:38:14 +0200 Subject: [PATCH 067/129] compilable MorphoDictAra generation except for V, not yet using all forms --- src/arabic/wiktionary/read_wiktionary.py | 79 ++++++++++++++++-------- 1 file changed, 52 insertions(+), 27 deletions(-) diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index ac5ee59d..40d14b9f 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -82,8 +82,9 @@ def is_arabic(s): return s and any(1574 <= ord(c) <= 1616 for c in s) -def gf_fun(s, pos): - return ''.join(["'", s, "_", pos, "'"]) +def gf_fun(s, pos, disamb=0): + discrim = '_' + str(disamb) if disamb else '' + return ''.join(["'", s, discrim, "_", pos, "'"]) def forms_for_pos(obj): @@ -97,23 +98,25 @@ def forms_for_pos(obj): if obj['pos'] == 'noun': lemma = [form[:-1] for form, descr in forms if all([w in descr for w in ['construct', 'nominative', 'singular']])][:1] - return { - 'gf_fun': gf_fun(lemma[0], 'N') if lemma else None, - 'gf_cat': 'N', - 'singular': lemma, - 'plural': [form[:-1] for form, descr in forms - if all([w in descr for w in ['construct', 'nominative', 'plural']])][:1], - 'gender': 'Fem' if 'Arabic feminine nouns' in obj['categories'] + plural = [form[:-1] for form, descr in forms + if all([w in descr for w in ['construct', 'nominative', 'plural']])][:1] + gender = ('Fem' if 'Arabic feminine nouns' in obj['categories'] else ('Masc' if 'Arabic masculine nouns' in obj['categories'] - else None) + else None)) + gf_entry = { + 'cat': 'N', + 'lemma': lemma, + 'singular': lemma, + 'plural': plural, + 'gender': gender } elif obj['pos'] == 'verb': lemma = [form for form, descr in forms if all([w in descr for w in ["active", "indicative", "masculine", "past", "perfective", "singular", "third-person"]])][:1] - return { - 'gf_fun': gf_fun(lemma[0], 'V') if lemma else None, - 'gf_cat': 'V', + gf_entry = { + 'cat': 'V', + 'lemma': lemma, 'perfect': lemma, 'imperfect': [form for form, descr in forms if all([w in descr for @@ -125,9 +128,9 @@ def forms_for_pos(obj): elif obj['pos'] == 'adj': lemma = [form for form, descr in forms if all([w in descr for w in ['indefinite', 'masculine', 'singular', 'informal']])][:1] - return { - 'gf_fun': gf_fun(lemma[0], 'A') if lemma else None, - 'gf_cat': 'A', + gf_entry = { + 'cat': 'A', + 'lemma': lemma, 'masc_singular': lemma, 'masc_plural': [form for form, descr in forms if all([w in descr for w in ['indefinite', 'masculine', 'plural', 'informal']])][:1], @@ -138,9 +141,16 @@ def forms_for_pos(obj): } else: - return {f: d for f, d in forms} + gf_entry = {f: d for f, d in forms} + + if 'lemma' in gf_entry and gf_entry['lemma']: + gf_entry['lemma'] = gf_entry['lemma'][0] + form = gf_entry['imperfect'][0] if gf_entry['cat'] == 'V' and gf_entry['imperfect'] else gf_entry['lemma'] + gf_entry['lin'] = ''.join(['mk', gf_entry['cat'], ' "' + form + '"']) + return gf_entry + # "root": ["ش ر ح (š-r-ḥ)"] def find_root(s): return ''.join([c for c in s if is_arabic(c)]) @@ -148,17 +158,23 @@ def find_root(s): import sys MODE = sys.argv[1] -if MODE == 'gf': - print('abstract MorphoDictAraAbs = Cat ** {') +if MODE == 'gf-abs': + print('abstract MorphoDictAraAbs = Cat ** {') +if MODE == 'gf-cnc': + print('concrete MorphoDictAra of MorphoDictAraAbs = CatAra ** open ParadigmsAra in {') + with open(FILTERED_WIKT) as file: - seen_gf_funs = set() + seen_gf_funs = {} for line in file: obj = json.loads(line) + root = [find_root(t['expansion']) for + t in obj.get('etymology_templates', []) if + t.get('name', None) =='ar-root'][:1] if 'Arabic lemmas' in obj.get('categories', []): entry = { 'pos': obj['pos'], - 'root': [find_root(t['expansion']) for t in obj.get('etymology_templates', []) if t.get('name', None) =='ar-root'][:1], + 'root': root, 'forms': forms_for_pos(obj), 'senses': [sense['glosses'] for sense in obj.get('senses', []) if 'glosses' in sense] @@ -168,14 +184,23 @@ with open(FILTERED_WIKT) as file: if MODE == 'json': print(json.dumps(entry, ensure_ascii=False)) - if MODE == 'gf': + if MODE.startswith('gf'): - if 'gf_fun' in entry['forms'] and entry['forms']['gf_fun']: - if entry['forms']['gf_fun'] not in seen_gf_funs: - print('fun', entry['forms']['gf_fun'], ':', entry['forms']['gf_cat'], ';', '--', entry['senses']) - seen_gf_funs.add(entry['forms']['gf_fun']) + lemma = entry['forms'].get('lemma', None) + if lemma: + cat = entry['forms']['cat'] + lin = entry['forms']['lin'] + discrim = seen_gf_funs.get((lemma, cat), 0) + fun = gf_fun(lemma, cat, discrim) + + if MODE == 'gf-abs': + print('fun', fun, ':', cat, ';', '--', entry['senses']) + if MODE == 'gf-cnc': + print('lin', fun, '=', lin, ';') + + seen_gf_funs[(lemma, cat)] = discrim + 1 # to do: rename duplicate function names: of 13762 names, 12946 are unique -if MODE == 'gf': +if MODE.startswith('gf'): print('}') From afc84a61cbf2ac76e3ac3bf0f8d3654cb40c5c44 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Wed, 13 Sep 2023 09:06:02 +0200 Subject: [PATCH 068/129] arabic/wiktionary using paradigms with records as arguments to cope with heterogeneous information --- src/arabic/wiktionary/read_wiktionary.py | 43 +++++++++++++----------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index 40d14b9f..49d3a3c1 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -19,7 +19,6 @@ def get_gzip_json(file, sample=100000, langs=[]): # get_gzip_json(WIKTIONARY_DUMP, 1, ['Arabic']) # python3 read_wiktionary.py >wikt_arabic.jsonl -# 621-671 # https://en.wikipedia.org/wiki/Buckwalter_transliteration buckwalter_dict = { @@ -100,15 +99,17 @@ def forms_for_pos(obj): if all([w in descr for w in ['construct', 'nominative', 'singular']])][:1] plural = [form[:-1] for form, descr in forms if all([w in descr for w in ['construct', 'nominative', 'plural']])][:1] - gender = ('Fem' if 'Arabic feminine nouns' in obj['categories'] - else ('Masc' if 'Arabic masculine nouns' in obj['categories'] - else None)) + gender = (['Fem'] if 'Arabic feminine nouns' in obj['categories'] + else (['Masc'] if 'Arabic masculine nouns' in obj['categories'] + else [])) gf_entry = { 'cat': 'N', 'lemma': lemma, - 'singular': lemma, - 'plural': plural, - 'gender': gender + 'args': { + 'sg': lemma, + 'pl': plural, + 'g': gender + } } elif obj['pos'] == 'verb': lemma = [form for form, descr in forms @@ -117,13 +118,15 @@ def forms_for_pos(obj): gf_entry = { 'cat': 'V', 'lemma': lemma, - 'perfect': lemma, - 'imperfect': [form for form, descr in forms + 'args': { + 'perfect': lemma, + 'imperfect': [form for form, descr in forms if all([w in descr for w in ["active", "indicative", "masculine", "non-past", "imperfective", "singular", "third-person"]])][:1], - 'verbclass': max([n for n in ['I', 'II','III','IV','V','VI','VII','VIII','IX','X','XI','XII',''] + 'cls': [max([n for n in ['I', 'II','III','IV','V','VI','VII','VIII','IX','X','XI','XII','XIII', 'XIV', 'XV', ''] if n in ' '.join([c for c in obj['categories'] if c.endswith('verbs') and any([n in c for n in 'IVX'])])], - key=len) + key=len)] + } } elif obj['pos'] == 'adj': lemma = [form for form, descr in forms @@ -131,13 +134,15 @@ def forms_for_pos(obj): gf_entry = { 'cat': 'A', 'lemma': lemma, - 'masc_singular': lemma, - 'masc_plural': [form for form, descr in forms + 'args': { + 'masc_sg': lemma, + 'masc_pl': [form for form, descr in forms if all([w in descr for w in ['indefinite', 'masculine', 'plural', 'informal']])][:1], - 'fem_singular': [form for form, descr in forms + 'fem_sg': [form for form, descr in forms if all([w in descr for w in ['indefinite', 'feminine', 'singular', 'informal']])][:1], - 'fem_plural': [form for form, descr in forms + 'fem_pl': [form for form, descr in forms if all([w in descr for w in ['indefinite', 'feminine', 'plural', 'informal']])][:1], + } } else: @@ -145,11 +150,11 @@ def forms_for_pos(obj): if 'lemma' in gf_entry and gf_entry['lemma']: gf_entry['lemma'] = gf_entry['lemma'][0] - form = gf_entry['imperfect'][0] if gf_entry['cat'] == 'V' and gf_entry['imperfect'] else gf_entry['lemma'] - gf_entry['lin'] = ''.join(['mk', gf_entry['cat'], ' "' + form + '"']) + gf_entry['args']['root'] = obj['root'] + args = [r + ' = ' + '"' + x[0] + '"' for r, x in gf_entry['args'].items() if x] + gf_entry['lin'] = 'wmk' + gf_entry['cat'] + ' {' + ' ; '.join(args) + '}' return gf_entry - # "root": ["ش ر ح (š-r-ḥ)"] def find_root(s): @@ -171,10 +176,10 @@ with open(FILTERED_WIKT) as file: root = [find_root(t['expansion']) for t in obj.get('etymology_templates', []) if t.get('name', None) =='ar-root'][:1] + obj['root'] = root if 'Arabic lemmas' in obj.get('categories', []): entry = { 'pos': obj['pos'], - 'root': root, 'forms': forms_for_pos(obj), 'senses': [sense['glosses'] for sense in obj.get('senses', []) if 'glosses' in sense] From 3c0adada11f9c3055dedb5a26ef4d483585f8a15 Mon Sep 17 00:00:00 2001 From: aarneranta Date: Wed, 13 Sep 2023 15:29:28 +0200 Subject: [PATCH 069/129] new function in ParadigmsAra to deal with Wiktionary data; lots of untested guesses --- src/arabic/ParadigmsAra.gf | 67 ++++++++++++++++++++++++ src/arabic/wiktionary/read_wiktionary.py | 64 +++++++++++++++------- 2 files changed, 113 insertions(+), 18 deletions(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index ce479f94..20892fed 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -868,4 +868,71 @@ formV : (root : Str) -> VerbForm -> V = \s,f -> case f of { param VerbForm = FormI | FormII | FormIII | FormIV | FormV | FormVI | FormVII | FormVIII | FormX | FormXI ; +-- paradigms for Wiktionary extraction +---- TODO: better usage of information in Wiktionary + +oper + wmkN = overload { + wmkN : {sg, pl : Str ; g : Gender} -> N + = \r -> mkN r.sg r.pl r.g nohum ; --- hum/nohum not in Wikt + wmkN : {sg : Str} -> N + = \r -> smartN r.sg ; + wmkN : {sg : Str ; g : Gender ; root : Str} -> N + = \r -> smartN r.sg ** {g = r.g} ; ---- + wmkN : {sg : Str; g : Gender} -> N + = \r -> smartN r.sg ** {g = r.g} ; + wmkN : {sg : Str; pl : Str; g : Gender; root : Str} -> N + = \r -> mkN r.sg r.pl r.g nohum ; --- hum/nohum not in Wikt + wmkN : {sg : Str; pl : Str} -> N + = \r -> mkN r.sg r.pl masc nohum ; ---- ** {g = (smartN r.sg).g} ; + wmkN : {sg : Str; root : Str} -> N + = \r -> smartN r.sg ; + } ; + + wmkA = overload { + wmkA : {root : Str} -> A + = \r -> mkA r.root ; + mkA : {masc_sg : Str; fem_pl : Str; root : Str} -> A + = \r -> mkA r.root ; + mkA : {masc_sg : Str; fem_sg : Str; fem_pl : Str; root : Str} -> A + = \r -> mkA r.root ; + mkA : {masc_sg : Str; fem_sg: Str ; masc_pl : Str; fem_pl : Str; root : Str} -> A + = \r -> mkA r.root ; + mkA : {masc_sg : Str; fem_sg : Str; fem_pl : Str} -> A + = \r -> mkA r.masc_sg ; ---- + mkA : {masc_sg : Str; fem_sg : Str; root : Str} -> A + = \r -> mkA r.root ; + mkA : {masc_sg : Str; fem_sg : Str} -> A + = \r -> mkA r.masc_sg ; ---- + mkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str; fem_pl : Str} -> A + = \r -> mkA r.masc_sg ; ---- + mkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str; root : Str} -> A + = \r -> mkA r.root ; + mkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str} -> A + = \r -> mkA r.masc_sg ; ---- + mkA : {masc_sg : Str; masc_pl : Str; root : Str} -> A + = \r -> mkA r.root ; + mkA : {masc_sg : Str; masc_pl : Str} -> A + = \r -> mkA r.masc_sg ; ---- + mkA : {masc_sg : Str; root : Str} -> A + = \r -> mkA r.root ; + mkA : {masc_sg : Str} -> A + = \r -> mkA r.masc_sg ; ---- + } ; + + wmkV = overload { + wmkV : {perfect : Str; cls : VerbForm; root : Str} -> V + = \r -> mkV r.root r.cls ; ---- + wmkV : {perfect : Str; cls : VerbForm} -> V + = \r -> mkV r.perfect r.cls ; ---- + wmkV : {perfect : Str; imperfect : Str; cls : VerbForm; root : Str} -> V + = \r -> mkV r.root r.cls ; ---- + wmkV : {perfect : Str; imperfect : Str; cls : VerbForm} -> V + = \r -> variants {} ; ---- mkV r.imperfect ; ---- + wmkV : {root : Str ; cls : VerbForm} -> V + = \r -> mkV r.root r.cls ; + wmkV : {imperfect : Str} -> V + = \r -> variants {} ; ---- mkV r.imperfect ; + } ; + } ; diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index 49d3a3c1..ea8d805f 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -1,7 +1,22 @@ import gzip import json +import sys +# data from https://kaikki.org/dictionary/rawdata.html +# thanks Tatu Ylonen: Wiktextract: Wiktionary as Machine-Readable Structured Data, +# Proceedings of the 13th Conference on Language Resources and Evaluation (LREC), pp. 1317-1325, Marseille, 20-25 June 2022. + +if not sys.argv[1:]: + print('usage: read_wiktionary (raw | gf-cnc | gf-abs)') + exit() + +MODE = sys.argv[1] # + +# step 1: extract data from this file using the raw option WIKTIONARY_DUMP = 'raw-wiktextract-data.json.gz' + +# the following file is generated. +# in the sequel, use this file with gf-abs or gf-cnc option FILTERED_WIKT = 'wikt_arabic.jsonl' @@ -14,11 +29,12 @@ def get_gzip_json(file, sample=100000, langs=[]): obj = json.loads(line) if obj.get('lang', None) in langs: print(line.decode("utf-8")) - print(n) +# print(n) +if MODE == 'raw': + get_gzip_json(WIKTIONARY_DUMP, 1, ['Arabic']) -# get_gzip_json(WIKTIONARY_DUMP, 1, ['Arabic']) -# python3 read_wiktionary.py >wikt_arabic.jsonl +# python3 read_wiktionary.py raw >wikt_arabic.jsonl # https://en.wikipedia.org/wiki/Buckwalter_transliteration buckwalter_dict = { @@ -80,6 +96,12 @@ def unvocalize(s): def is_arabic(s): return s and any(1574 <= ord(c) <= 1616 for c in s) +# quote forms but not parameters +def quote_if(s, cond=is_arabic): + if cond(s): + return '"' + s + '"' + else: + return s def gf_fun(s, pos, disamb=0): discrim = '_' + str(disamb) if disamb else '' @@ -99,8 +121,8 @@ def forms_for_pos(obj): if all([w in descr for w in ['construct', 'nominative', 'singular']])][:1] plural = [form[:-1] for form, descr in forms if all([w in descr for w in ['construct', 'nominative', 'plural']])][:1] - gender = (['Fem'] if 'Arabic feminine nouns' in obj['categories'] - else (['Masc'] if 'Arabic masculine nouns' in obj['categories'] + gender = (['fem'] if 'Arabic feminine nouns' in obj['categories'] + else (['masc'] if 'Arabic masculine nouns' in obj['categories'] else [])) gf_entry = { 'cat': 'N', @@ -122,15 +144,20 @@ def forms_for_pos(obj): 'perfect': lemma, 'imperfect': [form for form, descr in forms if all([w in descr for - w in ["active", "indicative", "masculine", "non-past", "imperfective", "singular", "third-person"]])][:1], - 'cls': [max([n for n in ['I', 'II','III','IV','V','VI','VII','VIII','IX','X','XI','XII','XIII', 'XIV', 'XV', ''] - if n in ' '.join([c for c in obj['categories'] if c.endswith('verbs') and any([n in c for n in 'IVX'])])], - key=len)] + w in [ + "active", "indicative", "masculine", "non-past", + "imperfective", "singular", "third-person"]])][:1], + 'cls': ['Form' + max([n for n in [ + 'I', 'II','III','IV','V','VI','VII','VIII','IX','X','XI',''] + if n in ' '.join([c for c in obj['categories'] + if c.endswith('verbs') and any([n in c for n in 'IVX'])])], + key=len)] # max in RGL is XI, in Wikt XIII } } elif obj['pos'] == 'adj': lemma = [form for form, descr in forms - if all([w in descr for w in ['indefinite', 'masculine', 'singular', 'informal']])][:1] + if all([w in descr for w in [ + 'indefinite', 'masculine', 'singular', 'informal']])][:1] gf_entry = { 'cat': 'A', 'lemma': lemma, @@ -150,8 +177,9 @@ def forms_for_pos(obj): if 'lemma' in gf_entry and gf_entry['lemma']: gf_entry['lemma'] = gf_entry['lemma'][0] - gf_entry['args']['root'] = obj['root'] - args = [r + ' = ' + '"' + x[0] + '"' for r, x in gf_entry['args'].items() if x] + if obj['root']: + gf_entry['args']['root'] = obj['root'] + args = [r + ' = ' + quote_if(x[0]) for r, x in gf_entry['args'].items() if x] gf_entry['lin'] = 'wmk' + gf_entry['cat'] + ' {' + ' ; '.join(args) + '}' return gf_entry @@ -160,19 +188,19 @@ def forms_for_pos(obj): def find_root(s): return ''.join([c for c in s if is_arabic(c)]) -import sys -MODE = sys.argv[1] - if MODE == 'gf-abs': print('abstract MorphoDictAraAbs = Cat ** {') if MODE == 'gf-cnc': print('concrete MorphoDictAra of MorphoDictAraAbs = CatAra ** open ParadigmsAra in {') - -with open(FILTERED_WIKT) as file: +if MODE != 'raw': + with open(FILTERED_WIKT) as file: seen_gf_funs = {} for line in file: - obj = json.loads(line) + try: + obj = json.loads(line) + except: + continue root = [find_root(t['expansion']) for t in obj.get('etymology_templates', []) if t.get('name', None) =='ar-root'][:1] From 8e029bd8dd24f8bd76c46cc2f811041be9682ab5 Mon Sep 17 00:00:00 2001 From: aarneranta Date: Wed, 13 Sep 2023 17:24:21 +0200 Subject: [PATCH 070/129] Arabic Wiktionary: started comparing evaluation --- src/arabic/wiktionary/read_wiktionary.py | 85 ++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 5 deletions(-) diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index ea8d805f..574233dd 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -108,14 +108,76 @@ def gf_fun(s, pos, disamb=0): return ''.join(["'", s, discrim, "_", pos, "'"]) -def forms_for_pos(obj): - forms = { +rgl_features = { + # V + 'VPerf': 'perfective', + 'Act': 'active', + 'Pas': 'passive', + 'Per3': 'third-person', + 'Per2': 'second-person', + 'Masc': 'masculine', + 'Fem': 'feminine', + 'Sg': 'singular', + 'Pl': 'plural', + 'Dl': 'dual', + 'VImpf': 'imperfective', + 'Ind': 'indicative', + 'Cnj': 'subjunctive', + 'Jus': 'jussive', + 'VImp': 'imperative', + # N: also Sg, Pl, Dl + 'Def': 'definite', + 'Indef': 'indefinite', + 'Nom': 'nominative', + 'Acc': 'accusative', + 'Gen': 'genitive', +# 'Bare': +# 'Dat': + 'Const': 'construct', +# 'Poss': + #A: also N features + 'APosit': 'positive', + 'AComp': 'comparative' + } + + +# format of GF table: MorphoDictAra: s (VPerf Act (Per3 Masc Sg)) : أَجْرََ +def compare_tables(gf, wikt): + report = {} + for line in gf: + gf_form = line #''.join([c for c in line if 1574 <= ord(c) <= 1616]) + gf_tags = tuple(word for word in + line.replace('(', ' ').replace(')', ' ').split() + if word in rgl_features) + wikt_tags = {rgl_features[tag] for tag in gf_tags} + wikt_form = None + for form, descr in wikt: + if all([tag in descr for tag in wikt_tags]): + wikt_form = form + break + report[gf_tags] = { + 'gf_form': gf_form, + 'wikt_form': wikt_form + } + if wikt_form: + report[gf_tags]['voc_match'] = int(gf_form == wikt_form) + report[gf_tags]['unvoc_match'] = int(unvocalize(gf_form) == unvocalize(wikt_form)) + return report + + + +def wikt_forms_for_pos(obj): + return { form['form']: form.get('tags', []) for form in obj.get('forms', []) if 'romanization' not in form.get('tags', []) and is_arabic(form['form']) }.items() + + +def forms_for_pos(obj): + forms = wikt_forms_for_pos(obj) if obj['pos'] == 'noun': lemma = [form[:-1] for form, descr in forms if all([w in descr for w in ['construct', 'nominative', 'singular']])][:1] @@ -136,7 +198,8 @@ def forms_for_pos(obj): elif obj['pos'] == 'verb': lemma = [form for form, descr in forms if all([w in descr for - w in ["active", "indicative", "masculine", "past", "perfective", "singular", "third-person"]])][:1] + w in ["active", "indicative", "masculine", "past", + "perfective", "singular", "third-person"]])][:1] gf_entry = { 'cat': 'V', 'lemma': lemma, @@ -193,14 +256,16 @@ if MODE == 'gf-abs': if MODE == 'gf-cnc': print('concrete MorphoDictAra of MorphoDictAraAbs = CatAra ** open ParadigmsAra in {') -if MODE != 'raw': +if MODE not in ['raw', 'eval']: with open(FILTERED_WIKT) as file: seen_gf_funs = {} + number = 1 for line in file: try: obj = json.loads(line) except: continue + number += 1 root = [find_root(t['expansion']) for t in obj.get('etymology_templates', []) if t.get('name', None) =='ar-root'][:1] @@ -227,7 +292,7 @@ if MODE != 'raw': fun = gf_fun(lemma, cat, discrim) if MODE == 'gf-abs': - print('fun', fun, ':', cat, ';', '--', entry['senses']) + print('fun', fun, ':', cat, ';', '--', number, entry['senses']) if MODE == 'gf-cnc': print('lin', fun, '=', lin, ';') @@ -237,3 +302,13 @@ if MODE != 'raw': if MODE.startswith('gf'): print('}') + + +if MODE == 'eval': + with open('pot.gftbl') as file: + gf = [line.strip() for line in file] + with open('pot.json') as file: + wikt = wikt_forms_for_pos(json.loads(file.read())) + for line in compare_tables(gf, wikt).items(): + print(line) + From d5e6e7e38987ab98da7fa33b90428e446a730414 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Thu, 14 Sep 2023 12:21:48 +0200 Subject: [PATCH 071/129] Arabic Wiktionary: functions for normalization and evaluation --- src/arabic/wiktionary/read_wiktionary.py | 88 ++++++++++++++++++++---- 1 file changed, 75 insertions(+), 13 deletions(-) diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index 574233dd..bcf902b7 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -1,17 +1,21 @@ import gzip import json import sys +import unicodedata # data from https://kaikki.org/dictionary/rawdata.html # thanks Tatu Ylonen: Wiktextract: Wiktionary as Machine-Readable Structured Data, # Proceedings of the 13th Conference on Language Resources and Evaluation (LREC), pp. 1317-1325, Marseille, 20-25 June 2022. -if not sys.argv[1:]: - print('usage: read_wiktionary (raw | gf-cnc | gf-abs)') - exit() +MODE = '' -MODE = sys.argv[1] # +if __name__ == '__main__': + if not sys.argv[1:]: + print('usage: read_wiktionary (raw | gf-cnc | gf-abs | gf-map | eval | eval-verbose)') + exit() + MODE = sys.argv[1] # + # step 1: extract data from this file using the raw option WIKTIONARY_DUMP = 'raw-wiktextract-data.json.gz' @@ -19,6 +23,18 @@ WIKTIONARY_DUMP = 'raw-wiktextract-data.json.gz' # in the sequel, use this file with gf-abs or gf-cnc option FILTERED_WIKT = 'wikt_arabic.jsonl' +# map each successfully extracted GF function to its source record in Wiktionary +# created with option gf-map +FUNCTION_SOURCE_MAP = 'function_sources_arabic.jsonl' + + +def read_function_source_map(): + with open(FUNCTION_SOURCE_MAP) as file: + sourcemap = {} + for line in file: + obj = json.loads(line) + sourcemap[obj['fun']] = obj['source'] + def get_gzip_json(file, sample=100000, langs=[]): with gzip.open(file) as decompressed: @@ -86,16 +102,37 @@ buckwalter_dict = { 0x671: '{' # ٱ } +buckwalter_dict_rev = {b: chr(a) for a, b in buckwalter_dict.items()} + + def to_buckwalter(s): - return ''.join([buckwalter_dict.get(ord(c), '?') for c in s]) + return ''.join([buckwalter_dict.get(ord(c), c) for c in s]) + + +def from_buckwalter(s): + return ''.join([buckwalter_dict_rev.get(c, c) for c in s]) def unvocalize(s): return ''.join([c for c in s if 0x621 <= ord(c) <= 0x64a]) + def is_arabic(s): return s and any(1574 <= ord(c) <= 1616 for c in s) +def normal(s): + return unicodedata.normalize('NFD', s) + + +# Wikt uses vowel+shadda which is a Unicode normalization +# GF uses shadda+vowel which is linguistically correct +# see https://stackoverflow.com/questions/58559390/in-unicode-should-u0651-arabic-shadda-be-before-or-after-kasra +# unicodedata.normalize does this wrong, as noted by Ariel Gutman +## todo: more direct implementation +def reorder_shadda(s): + return from_buckwalter(to_buckwalter(s).replace('a~', '~a').replace('u~', '~u').replace('i~', '~i')) + + # quote forms but not parameters def quote_if(s, cond=is_arabic): if cond(s): @@ -115,8 +152,11 @@ rgl_features = { 'Pas': 'passive', 'Per3': 'third-person', 'Per2': 'second-person', + 'Per1': 'first-person', 'Masc': 'masculine', 'Fem': 'feminine', + 'Sing': 'singular', + 'Plur': 'plural', 'Sg': 'singular', 'Pl': 'plural', 'Dl': 'dual', @@ -142,26 +182,39 @@ rgl_features = { # format of GF table: MorphoDictAra: s (VPerf Act (Per3 Masc Sg)) : أَجْرََ +# coming from 'l -treebank -table' def compare_tables(gf, wikt): report = {} for line in gf: - gf_form = line #''.join([c for c in line if 1574 <= ord(c) <= 1616]) + gf_form = line.split()[-1] # ''.join([c for c in line if 1574 <= ord(c) <= 1616]) gf_tags = tuple(word for word in line.replace('(', ' ').replace(')', ' ').split() if word in rgl_features) + if not gf_tags: + continue wikt_tags = {rgl_features[tag] for tag in gf_tags} wikt_form = None + wikt_descr = None for form, descr in wikt: if all([tag in descr for tag in wikt_tags]): - wikt_form = form + wikt_form = reorder_shadda(form) + wikt_descr = descr break report[gf_tags] = { 'gf_form': gf_form, - 'wikt_form': wikt_form + 'wikt_form': wikt_form, + 'gf_form_rom': to_buckwalter(gf_form) if gf_form else None, + 'wikt_form_rom': to_buckwalter(wikt_form) if wikt_form else None, + 'wikt_descr': wikt_descr } if wikt_form: - report[gf_tags]['voc_match'] = int(gf_form == wikt_form) - report[gf_tags]['unvoc_match'] = int(unvocalize(gf_form) == unvocalize(wikt_form)) + report[gf_tags]['voc_match'] = int(normal(gf_form) == normal(wikt_form)) + report[gf_tags]['unvoc_match'] = int(normal(unvocalize(gf_form)) == normal(unvocalize(wikt_form))) + ritems = tuple(report.items()) # need an unmutable structure, because otherwise ints are added to items + report['fun'] = gf[0].split()[-1] + report['total_found'] = len([f for f, v in ritems if v['wikt_form'] is not None ]) + report['total_voc'] = sum([v.get('voc_match', 0) for f, v in ritems]) + report['total_unvoc'] = sum([v.get('unvoc_match', 0) for f, v in ritems]) return report @@ -295,6 +348,9 @@ if MODE not in ['raw', 'eval']: print('fun', fun, ':', cat, ';', '--', number, entry['senses']) if MODE == 'gf-cnc': print('lin', fun, '=', lin, ';') + if MODE == 'gf-map': + mapitem = {'fun': fun, 'source': obj} + print(json.dumps(mapitem, ensure_ascii=False)) seen_gf_funs[(lemma, cat)] = discrim + 1 @@ -304,11 +360,17 @@ if MODE.startswith('gf'): print('}') -if MODE == 'eval': +if MODE.startswith('eval'): with open('pot.gftbl') as file: gf = [line.strip() for line in file] with open('pot.json') as file: wikt = wikt_forms_for_pos(json.loads(file.read())) - for line in compare_tables(gf, wikt).items(): - print(line) + report = compare_tables(gf, wikt) + + if MODE == 'eval-verbose': + for line in report.items(): + print(line) + else: + print(report['fun'], 'forms', report['total_found'], + 'voc', report['total_voc'], 'unvoc', report['total_unvoc']) From 3e9be76e52be26e046910afbffa196e3f2d64826 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Thu, 14 Sep 2023 15:19:05 +0200 Subject: [PATCH 072/129] evaluation of generated lexicon --- src/arabic/wiktionary/read_wiktionary.py | 135 ++++++++++++++++++----- 1 file changed, 110 insertions(+), 25 deletions(-) diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index bcf902b7..6db526c3 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -2,10 +2,47 @@ import gzip import json import sys import unicodedata +import pgf + # data from https://kaikki.org/dictionary/rawdata.html # thanks Tatu Ylonen: Wiktextract: Wiktionary as Machine-Readable Structured Data, -# Proceedings of the 13th Conference on Language Resources and Evaluation (LREC), pp. 1317-1325, Marseille, 20-25 June 2022. +# Proceedings of the 13th Conference on Language Resources and Evaluation (LREC), pp. 1317-1325, Marseille, 20-25 June 2022. + +""" +This file converts Wiktionary data to GF morphological dictionary files. +It words for Arabic but some functionalities could be modified to other languges. + +The steps to take are the following: + +fetch data: + + raw-wiktextract-data.json.gz from https://kaikki.org/dictionary/rawdata.html + +filter Arabic entries: + + $ python3 read_wiktionary.py raw >wikt_arabic.jsonl + +create GF files: + + $ python3 read_wiktionary.py gf-abs >MorphoDictAraAbs.gf + $ python3 read_wiktionary.py gf-cnc >MorphoDictAra.gf + +automatic evaluation: + + $ gf -make MorphoDictAra.gf + $ python3 read_wiktionary.py gf-map >function_sources_arabic.jsonl + $ python3 read_wiktionary.py eval + +TODO: +- better generation of GF +- better paradigms to use Wiktionary data +- refactor the code so that it can be used for other languages + +""" + + + MODE = '' @@ -27,13 +64,20 @@ FILTERED_WIKT = 'wikt_arabic.jsonl' # created with option gf-map FUNCTION_SOURCE_MAP = 'function_sources_arabic.jsonl' +PGF_FILE = 'MorphoDictAraAbs.pgf' +CONCRETE_MODULE = 'MorphoDictAra' + def read_function_source_map(): with open(FUNCTION_SOURCE_MAP) as file: sourcemap = {} for line in file: - obj = json.loads(line) - sourcemap[obj['fun']] = obj['source'] + try: + obj = json.loads(line) + sourcemap[obj['fun']] = obj['source'] + except: + continue + return sourcemap def get_gzip_json(file, sample=100000, langs=[]): @@ -134,9 +178,9 @@ def reorder_shadda(s): # quote forms but not parameters -def quote_if(s, cond=is_arabic): +def quote_if(s, cond=is_arabic, change=reorder_shadda): if cond(s): - return '"' + s + '"' + return '"' + change(s) + '"' else: return s @@ -181,14 +225,19 @@ rgl_features = { } +# obsolote: # format of GF table: MorphoDictAra: s (VPerf Act (Per3 Masc Sg)) : أَجْرََ # coming from 'l -treebank -table' -def compare_tables(gf, wikt): +# now used: +# {'s (AComp Def Bare)': 'الأَيَُونَانِ'} +# coming from tabularLinearize + +def compare_tables(gf, wikt, fun): report = {} - for line in gf: - gf_form = line.split()[-1] # ''.join([c for c in line if 1574 <= ord(c) <= 1616]) + for pair in gf.items(): + gf_form = pair[1] gf_tags = tuple(word for word in - line.replace('(', ' ').replace(')', ' ').split() + pair[0].replace('(', ' ').replace(')', ' ').split() if word in rgl_features) if not gf_tags: continue @@ -211,7 +260,7 @@ def compare_tables(gf, wikt): report[gf_tags]['voc_match'] = int(normal(gf_form) == normal(wikt_form)) report[gf_tags]['unvoc_match'] = int(normal(unvocalize(gf_form)) == normal(unvocalize(wikt_form))) ritems = tuple(report.items()) # need an unmutable structure, because otherwise ints are added to items - report['fun'] = gf[0].split()[-1] + report['fun'] = fun report['total_found'] = len([f for f, v in ritems if v['wikt_form'] is not None ]) report['total_voc'] = sum([v.get('voc_match', 0) for f, v in ritems]) report['total_unvoc'] = sum([v.get('unvoc_match', 0) for f, v in ritems]) @@ -293,7 +342,7 @@ def forms_for_pos(obj): if 'lemma' in gf_entry and gf_entry['lemma']: gf_entry['lemma'] = gf_entry['lemma'][0] - if obj['root']: + if obj['root'] and obj['root'][0].strip(): gf_entry['args']['root'] = obj['root'] args = [r + ' = ' + quote_if(x[0]) for r, x in gf_entry['args'].items() if x] gf_entry['lin'] = 'wmk' + gf_entry['cat'] + ' {' + ' ; '.join(args) + '}' @@ -309,7 +358,8 @@ if MODE == 'gf-abs': if MODE == 'gf-cnc': print('concrete MorphoDictAra of MorphoDictAraAbs = CatAra ** open ParadigmsAra in {') -if MODE not in ['raw', 'eval']: + +if MODE.startswith('gf') or MODE=='json': with open(FILTERED_WIKT) as file: seen_gf_funs = {} number = 1 @@ -360,17 +410,52 @@ if MODE.startswith('gf'): print('}') -if MODE.startswith('eval'): - with open('pot.gftbl') as file: - gf = [line.strip() for line in file] - with open('pot.json') as file: - wikt = wikt_forms_for_pos(json.loads(file.read())) - report = compare_tables(gf, wikt) - - if MODE == 'eval-verbose': - for line in report.items(): - print(line) - else: - print(report['fun'], 'forms', report['total_found'], - 'voc', report['total_voc'], 'unvoc', report['total_unvoc']) +def eval_all(gr, funmap, concrete=CONCRETE_MODULE): + lang = gr.languages[CONCRETE_MODULE] + funs = gr.functions + reports = [] + for fun in funs: + funn = "'" + fun + "'" + if funn not in funmap: + print(funn, 'not found') + continue + wikt = wikt_forms_for_pos(funmap[funn]) + gf = lang.tabularLinearize(pgf.Expr(fun, [])) + report = compare_tables(gf, wikt, fun) + reports.append(report) + return reports + + +def first_error(report): + for f, v in report.items(): + if 'voc_match' in v: + if v['voc_match'] == 0: + return f, v + + +if MODE.startswith('eval'): + gr = pgf.readPGF(PGF_FILE) + print('using', PGF_FILE) + funmap = read_function_source_map() + print(len(funmap), 'functions') + for report in eval_all(gr, funmap): + + if MODE == 'eval-verbose': + for line in report.items(): + print(line) + else: + if report['total_found'] == 0: + verdict = 'NOT_FOUND' + elif report['total_found'] == report['total_voc']: + verdict = 'PERFECT' + elif report['total_found'] == report['total_unvoc']: + verdict = 'PERFECT_UNVOC ' + str(first_error(report)) + elif report['total_voc'] == 0: + verdict = 'TOTALLY_WRONG ' + str(first_error(report)) + else: + verdict = 'PARTIAL ' + str(first_error(report)) + print(report['fun'], 'forms', report['total_found'], + 'voc', report['total_voc'], 'unvoc', report['total_unvoc'], + verdict + ) From edecc3fe57cac46e5b03079d9e87674f73626acb Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Thu, 14 Sep 2023 18:21:18 +0200 Subject: [PATCH 073/129] a quick way to extract wordnet morphology --- src/arabic/wiktionary/to_wordnet.py | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/arabic/wiktionary/to_wordnet.py diff --git a/src/arabic/wiktionary/to_wordnet.py b/src/arabic/wiktionary/to_wordnet.py new file mode 100644 index 00000000..7496e769 --- /dev/null +++ b/src/arabic/wiktionary/to_wordnet.py @@ -0,0 +1,46 @@ +import csv +import json + +# to run: python3 to_wordnet.py >arabic-wn-morpho.jsonl +# the following are assumed + +WN_TSV = 'arabic.tsv' +MORPHO_GF = 'MorphoDictAraAbs.gf' + +def is_arabic(s): + return s and any(1574 <= ord(c) <= 1616 for c in s) + +def get_arabic(s): + return ''.join([c for c in s if is_arabic(c)]) + +def unvocalize(s): + return ''.join([c for c in s if 0x621 <= ord(c) <= 0x64a]) + + +# fun 'دُبُ_N' : N ; -- 10 [['bear']] +funmap = {} +with open(MORPHO_GF) as gffile: + for line in gffile: + line = line.split() + if line[2:] and line[0] == 'fun': + fun = line[1] + key = unvocalize(fun) + cat = line[3] + sense = ' '.join(line[6:]) + funmap[(key, cat)] = funmap.get((key, cat), []) + funmap[(key, cat)].append({'fun': fun, 'sense': sense}) + + +# abandon_1_V2 ParseAra ترك (1,1,1,3,322,3) +with open(WN_TSV) as wnfile: +## wnreader = csv.reader(wnfile, delimiter='\t') + for row in wnfile: +## word = row[-1].strip() # does not show tha arabic, but the second-last word + word = get_arabic(row) + wnfun = row.split()[0] + cat = [c for c in wnfun if c.isalpha()][-1] # the last letter; the dict only contains N, A, V + funs = funmap.get((word, cat), []) + result = {'wnfun': wnfun, 'sought': word, 'found': funs} + print(json.dumps(result, ensure_ascii=False)) + + From 73f0b8ef00d944580b793020ef9cc94a7064b622 Mon Sep 17 00:00:00 2001 From: aarneranta Date: Fri, 15 Sep 2023 14:48:23 +0200 Subject: [PATCH 074/129] commented and refactored read_wiktionary.py --- src/arabic/wiktionary/read_wiktionary.py | 213 ++++++++++++++--------- src/arabic/wiktionary/to_wordnet.py | 6 +- 2 files changed, 133 insertions(+), 86 deletions(-) diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index 6db526c3..6ee6e10e 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -31,7 +31,7 @@ create GF files: automatic evaluation: $ gf -make MorphoDictAra.gf - $ python3 read_wiktionary.py gf-map >function_sources_arabic.jsonl + $ python3 read_wiktionary.py gf-map >source_of_MorphoDictAra.jsonl $ python3 read_wiktionary.py eval TODO: @@ -42,8 +42,6 @@ TODO: """ - - MODE = '' if __name__ == '__main__': @@ -53,8 +51,9 @@ if __name__ == '__main__': MODE = sys.argv[1] # -# step 1: extract data from this file using the raw option +# step 1: extract Arabic data from this file using the raw option WIKTIONARY_DUMP = 'raw-wiktextract-data.json.gz' +EXTRACTED_LANGUAGE = 'Arabic' # the following file is generated. # in the sequel, use this file with gf-abs or gf-cnc option @@ -62,24 +61,18 @@ FILTERED_WIKT = 'wikt_arabic.jsonl' # map each successfully extracted GF function to its source record in Wiktionary # created with option gf-map -FUNCTION_SOURCE_MAP = 'function_sources_arabic.jsonl' +FUNCTION_SOURCE_MAP = 'source_of_MorphoDictAra.jsonl' +# created with $ gf -make MorphoDictAra.gf PGF_FILE = 'MorphoDictAraAbs.pgf' + +# module to linearize with CONCRETE_MODULE = 'MorphoDictAra' - -def read_function_source_map(): - with open(FUNCTION_SOURCE_MAP) as file: - sourcemap = {} - for line in file: - try: - obj = json.loads(line) - sourcemap[obj['fun']] = obj['source'] - except: - continue - return sourcemap - +# read a gzipped jsonl file (one object per line), +# showing lines where one of a list of languages is present +# This can be sampled to one of 100k lines by default, 1 for total recall. def get_gzip_json(file, sample=100000, langs=[]): with gzip.open(file) as decompressed: n = 0 @@ -91,10 +84,13 @@ def get_gzip_json(file, sample=100000, langs=[]): print(line.decode("utf-8")) # print(n) -if MODE == 'raw': - get_gzip_json(WIKTIONARY_DUMP, 1, ['Arabic']) +# to perform the first step of data extraction, pipe this into a file: # python3 read_wiktionary.py raw >wikt_arabic.jsonl +if MODE == 'raw': + get_gzip_json(WIKTIONARY_DUMP, 1, [EXTRACTED_LANGUAGE]) + exit() + # https://en.wikipedia.org/wiki/Buckwalter_transliteration buckwalter_dict = { @@ -177,19 +173,22 @@ def reorder_shadda(s): return from_buckwalter(to_buckwalter(s).replace('a~', '~a').replace('u~', '~u').replace('i~', '~i')) -# quote forms but not parameters +# quote word forms but not parameters def quote_if(s, cond=is_arabic, change=reorder_shadda): if cond(s): return '"' + change(s) + '"' else: return s + +# generate word_d_C functions starting with d=0, but show d only when >= 1 def gf_fun(s, pos, disamb=0): discrim = '_' + str(disamb) if disamb else '' return ''.join(["'", s, discrim, "_", pos, "'"]) -rgl_features = { +# mapping from GF to Wikt features +arabic_rgl_features = { # V 'VPerf': 'perfective', 'Act': 'active', @@ -224,62 +223,22 @@ rgl_features = { 'AComp': 'comparative' } - -# obsolote: -# format of GF table: MorphoDictAra: s (VPerf Act (Per3 Masc Sg)) : أَجْرََ -# coming from 'l -treebank -table' -# now used: -# {'s (AComp Def Bare)': 'الأَيَُونَانِ'} -# coming from tabularLinearize - -def compare_tables(gf, wikt, fun): - report = {} - for pair in gf.items(): - gf_form = pair[1] - gf_tags = tuple(word for word in - pair[0].replace('(', ' ').replace(')', ' ').split() - if word in rgl_features) - if not gf_tags: - continue - wikt_tags = {rgl_features[tag] for tag in gf_tags} - wikt_form = None - wikt_descr = None - for form, descr in wikt: - if all([tag in descr for tag in wikt_tags]): - wikt_form = reorder_shadda(form) - wikt_descr = descr - break - report[gf_tags] = { - 'gf_form': gf_form, - 'wikt_form': wikt_form, - 'gf_form_rom': to_buckwalter(gf_form) if gf_form else None, - 'wikt_form_rom': to_buckwalter(wikt_form) if wikt_form else None, - 'wikt_descr': wikt_descr - } - if wikt_form: - report[gf_tags]['voc_match'] = int(normal(gf_form) == normal(wikt_form)) - report[gf_tags]['unvoc_match'] = int(normal(unvocalize(gf_form)) == normal(unvocalize(wikt_form))) - ritems = tuple(report.items()) # need an unmutable structure, because otherwise ints are added to items - report['fun'] = fun - report['total_found'] = len([f for f, v in ritems if v['wikt_form'] is not None ]) - report['total_voc'] = sum([v.get('voc_match', 0) for f, v in ritems]) - report['total_unvoc'] = sum([v.get('unvoc_match', 0) for f, v in ritems]) - return report - - - -def wikt_forms_for_pos(obj): + +# the inflection forms in a wiktionary entry +def wikt_forms_from_obj(obj): return { form['form']: form.get('tags', []) for form in obj.get('forms', []) if 'romanization' not in form.get('tags', []) and is_arabic(form['form']) - }.items() + } +# selection of forms for a given POS from Wikt: noun, adj, or verb +# return a linearization function def forms_for_pos(obj): - forms = wikt_forms_for_pos(obj) + forms = wikt_forms_from_obj(obj).items() if obj['pos'] == 'noun': lemma = [form[:-1] for form, descr in forms if all([w in descr for w in ['construct', 'nominative', 'singular']])][:1] @@ -345,46 +304,60 @@ def forms_for_pos(obj): if obj['root'] and obj['root'][0].strip(): gf_entry['args']['root'] = obj['root'] args = [r + ' = ' + quote_if(x[0]) for r, x in gf_entry['args'].items() if x] - gf_entry['lin'] = 'wmk' + gf_entry['cat'] + ' {' + ' ; '.join(args) + '}' + gf_entry['lin'] = 'wmk' + gf_entry['cat'] + ' {' + ' ; '.join(sorted(args)) + '}' return gf_entry + # "root": ["ش ر ح (š-r-ḥ)"] def find_root(s): return ''.join([c for c in s if is_arabic(c)]) + +# GF code generation + +# start with the header of the desired GF module + if MODE == 'gf-abs': print('abstract MorphoDictAraAbs = Cat ** {') if MODE == 'gf-cnc': print('concrete MorphoDictAra of MorphoDictAraAbs = CatAra ** open ParadigmsAra in {') - +# go through the Arabic Wiktionary entries +# generate functions with unique names + if MODE.startswith('gf') or MODE=='json': with open(FILTERED_WIKT) as file: - seen_gf_funs = {} + seen_gf_funs = {} # to disambiguate names if needed number = 1 for line in file: try: obj = json.loads(line) except: continue - number += 1 + number += 1 # if you find the same word_C again, mark it word_1_C + + # the root (three radicals) is found in this place if at all root = [find_root(t['expansion']) for t in obj.get('etymology_templates', []) if t.get('name', None) =='ar-root'][:1] obj['root'] = root + + # only take entries that are marked as lemmas if 'Arabic lemmas' in obj.get('categories', []): entry = { 'pos': obj['pos'], 'forms': forms_for_pos(obj), + 'all_forms': wikt_forms_from_obj(obj), 'senses': [sense['glosses'] for sense in obj.get('senses', []) if 'glosses' in sense] } -# entry['n_forms'] = len(entry['forms']) -# print(entry['pos'], entry['n_forms']) + + # if you only want to see the Wikt information used GF generation if MODE == 'json': print(json.dumps(entry, ensure_ascii=False)) - + + # if you want to proceed to GF generation if MODE.startswith('gf'): lemma = entry['forms'].get('lemma', None) @@ -393,23 +366,74 @@ if MODE.startswith('gf') or MODE=='json': lin = entry['forms']['lin'] discrim = seen_gf_funs.get((lemma, cat), 0) fun = gf_fun(lemma, cat, discrim) - + + # abstract syntax, save in MorphoDictAraAbs.gf if MODE == 'gf-abs': print('fun', fun, ':', cat, ';', '--', number, entry['senses']) - if MODE == 'gf-cnc': + + # concrete syntax, save in MorphoDictAra.gf + elif MODE == 'gf-cnc': print('lin', fun, '=', lin, ';') - if MODE == 'gf-map': - mapitem = {'fun': fun, 'source': obj} + + # function-source map, save in source_of_MorphoDictAra.jsonl + elif MODE == 'gf-map': + mapitem = {'fun': fun, 'source': wikt_forms_from_obj(obj)} print(json.dumps(mapitem, ensure_ascii=False)) - seen_gf_funs[(lemma, cat)] = discrim + 1 + seen_gf_funs[(lemma, cat)] = discrim + 1 # next word_d_C will get a new number - # to do: rename duplicate function names: of 13762 names, 12946 are unique - -if MODE.startswith('gf'): +# terminate the GF file with a closing brace +if MODE in ['gf-abs', 'gf-cnc']: print('}') - + +# evaluation: +# linearize all words to tables +# compare them to the forms found in Wiktionary +# report on matches + +# format of GF table: +# {'s (AComp Def Bare)': 'الأَيَُونَانِ'} +# coming from pgf tabularLinearize + +def compare_tables(gf, wikt, fun, show_buckwalter=True): + report = {} + for pair in gf.items(): + gf_form = pair[1] + gf_params = pair[0] + gf_tags = tuple(word for word in + pair[0].replace('(', ' ').replace(')', ' ').split() + if word in arabic_rgl_features) + if not gf_tags: + continue # if gf_tags match no Wikt tags, do not include this form + wikt_tags = {arabic_rgl_features[tag] for tag in gf_tags} + wikt_form = None + wikt_descr = None + for form, descr in wikt: + if all([tag in descr for tag in wikt_tags]): + wikt_form = reorder_shadda(form) + wikt_descr = descr + break + report[gf_tags] = { # flat param description with only Wikt-relevant tags + 'gf_params': gf_params, # full param description + 'gf_form': gf_form, + 'wikt_form': wikt_form, + 'wikt_descr': wikt_descr + } + if show_buckwalter: + report[gf_tags]['gf_form_rom'] = to_buckwalter(gf_form) if gf_form else None, + report[gf_tags]['wikt_form_rom'] = to_buckwalter(wikt_form) if wikt_form else None, + if wikt_form: + report[gf_tags]['voc_match'] = int(normal(gf_form) == normal(wikt_form)) + report[gf_tags]['unvoc_match'] = int(normal(unvocalize(gf_form)) == normal(unvocalize(wikt_form))) + ritems = tuple(report.items()) # need an unmutable structure, because otherwise ints are added to items + report['fun'] = fun + report['total_found'] = len([f for f, v in ritems if v['wikt_form'] is not None ]) + report['total_voc'] = sum([v.get('voc_match', 0) for f, v in ritems]) + report['total_unvoc'] = sum([v.get('unvoc_match', 0) for f, v in ritems]) + return report + + def eval_all(gr, funmap, concrete=CONCRETE_MODULE): lang = gr.languages[CONCRETE_MODULE] funs = gr.functions @@ -419,13 +443,14 @@ def eval_all(gr, funmap, concrete=CONCRETE_MODULE): if funn not in funmap: print(funn, 'not found') continue - wikt = wikt_forms_for_pos(funmap[funn]) + wikt = funmap[funn].items() gf = lang.tabularLinearize(pgf.Expr(fun, [])) report = compare_tables(gf, wikt, fun) reports.append(report) return reports +# in the summary report: print the first error if anything gets wrong def first_error(report): for f, v in report.items(): if 'voc_match' in v: @@ -433,6 +458,20 @@ def first_error(report): return f, v +# having stored the Wiktionary object for each GF function +# read it back from a file +def read_function_source_map(): + with open(FUNCTION_SOURCE_MAP) as file: + sourcemap = {} + for line in file: + try: + obj = json.loads(line) + sourcemap[obj['fun']] = obj['source'] + except: + continue + return sourcemap + + if MODE.startswith('eval'): gr = pgf.readPGF(PGF_FILE) print('using', PGF_FILE) @@ -443,6 +482,10 @@ if MODE.startswith('eval'): if MODE == 'eval-verbose': for line in report.items(): print(line) + if MODE == 'eval-tables': + for gftags, value in report.items(): + if v := value['wikt_form']: + print(' ', value['gf_params'][2:], '=>', '"' + v + '" ;') else: if report['total_found'] == 0: verdict = 'NOT_FOUND' diff --git a/src/arabic/wiktionary/to_wordnet.py b/src/arabic/wiktionary/to_wordnet.py index 7496e769..144e4cc1 100644 --- a/src/arabic/wiktionary/to_wordnet.py +++ b/src/arabic/wiktionary/to_wordnet.py @@ -4,7 +4,11 @@ import json # to run: python3 to_wordnet.py >arabic-wn-morpho.jsonl # the following are assumed + +# from https://www.grammaticalframework.org/~krasimir/arabic.tsv.gz WN_TSV = 'arabic.tsv' + +# built as explained in ./read_wiktionary.py MORPHO_GF = 'MorphoDictAraAbs.gf' def is_arabic(s): @@ -36,7 +40,7 @@ with open(WN_TSV) as wnfile: ## wnreader = csv.reader(wnfile, delimiter='\t') for row in wnfile: ## word = row[-1].strip() # does not show tha arabic, but the second-last word - word = get_arabic(row) + word = unvocalize(get_arabic(row)) wnfun = row.split()[0] cat = [c for c in wnfun if c.isalpha()][-1] # the last letter; the dict only contains N, A, V funs = funmap.get((word, cat), []) From 9e8c5eaad5699ee2e45e269f2c27a28a36185dd1 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Mon, 18 Sep 2023 08:52:32 +0200 Subject: [PATCH 075/129] arabic/wiktionary: including root in the form list --- src/arabic/wiktionary/read_wiktionary.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index 6ee6e10e..9a1d76fe 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -226,19 +226,28 @@ arabic_rgl_features = { # the inflection forms in a wiktionary entry def wikt_forms_from_obj(obj): - return { + forms = { form['form']: form.get('tags', []) for form in obj.get('forms', []) if 'romanization' not in form.get('tags', []) and is_arabic(form['form']) } + # the root (three radicals) is found in this place if at all + root = [find_root(t['expansion']) for + t in obj.get('etymology_templates', []) if + t.get('name', None) =='ar-root'][:1] + if root and root[0].strip(): + forms['root'] = root[0].strip() + + return forms # selection of forms for a given POS from Wikt: noun, adj, or verb # return a linearization function def forms_for_pos(obj): - forms = wikt_forms_from_obj(obj).items() + dforms = wikt_forms_from_obj(obj) + forms = dforms.items() if obj['pos'] == 'noun': lemma = [form[:-1] for form, descr in forms if all([w in descr for w in ['construct', 'nominative', 'singular']])][:1] @@ -301,8 +310,8 @@ def forms_for_pos(obj): if 'lemma' in gf_entry and gf_entry['lemma']: gf_entry['lemma'] = gf_entry['lemma'][0] - if obj['root'] and obj['root'][0].strip(): - gf_entry['args']['root'] = obj['root'] + if 'root' in dforms: + gf_entry['args']['root'] = [dforms['root']] args = [r + ' = ' + quote_if(x[0]) for r, x in gf_entry['args'].items() if x] gf_entry['lin'] = 'wmk' + gf_entry['cat'] + ' {' + ' ; '.join(sorted(args)) + '}' @@ -337,12 +346,6 @@ if MODE.startswith('gf') or MODE=='json': continue number += 1 # if you find the same word_C again, mark it word_1_C - # the root (three radicals) is found in this place if at all - root = [find_root(t['expansion']) for - t in obj.get('etymology_templates', []) if - t.get('name', None) =='ar-root'][:1] - obj['root'] = root - # only take entries that are marked as lemmas if 'Arabic lemmas' in obj.get('categories', []): entry = { From abcb3a9f2aa7d421072ed26f171d2cfd46ca688e Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Wed, 20 Sep 2023 11:54:29 +0200 Subject: [PATCH 076/129] improving evaluation of wiktionary generated lexicon --- src/arabic/wiktionary/read_wiktionary.py | 186 ++++++++++++++--------- 1 file changed, 110 insertions(+), 76 deletions(-) diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index 9a1d76fe..43461723 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -69,6 +69,8 @@ PGF_FILE = 'MorphoDictAraAbs.pgf' # module to linearize with CONCRETE_MODULE = 'MorphoDictAra' +# concrete syntax file, to debug sources of linearizations +CONCRETE_FILE = CONCRETE_MODULE + '.gf' # read a gzipped jsonl file (one object per line), # showing lines where one of a list of languages is present @@ -144,6 +146,9 @@ buckwalter_dict = { buckwalter_dict_rev = {b: chr(a) for a, b in buckwalter_dict.items()} +arabic_vowels = {chr(c) for c in {0x64b, 0x64c, 0x64d, 0x64e, 0x64f, 0x650}} + +sound_consonants = {chr(c) for c in range(0x628, 0x648)} # excluding alif, waw, ya def to_buckwalter(s): return ''.join([buckwalter_dict.get(ord(c), c) for c in s]) @@ -157,12 +162,28 @@ def unvocalize(s): return ''.join([c for c in s if 0x621 <= ord(c) <= 0x64a]) +def drop_final_vowel(s): + if s[-1] in arabic_vowels: + return s[:-1] + else: + return s + + def is_arabic(s): return s and any(1574 <= ord(c) <= 1616 for c in s) def normal(s): return unicodedata.normalize('NFD', s) +# heuristic for finding the three radicals from certain forms +# works only for sound (strong) 3-radical roots, otherwise None +def get_sound_trigram_root(s): + sounds = [c for c in s if c in sound_consonants] + if len(sounds) == 3: + return ''.join(sounds) + else: + return None + # Wikt uses vowel+shadda which is a Unicode normalization # GF uses shadda+vowel which is linguistically correct @@ -216,18 +237,18 @@ arabic_rgl_features = { 'Gen': 'genitive', # 'Bare': # 'Dat': - 'Const': 'construct', + 'Const': 'construct' # 'Poss': - #A: also N features - 'APosit': 'positive', - 'AComp': 'comparative' + #A: also N features; degree features cannot be found +# 'APosit': 'positive', +# 'AComp': 'comparative' } # the inflection forms in a wiktionary entry def wikt_forms_from_obj(obj): forms = { - form['form']: + reorder_shadda(form['form']): form.get('tags', []) for form in obj.get('forms', []) if 'romanization' not in form.get('tags', []) and @@ -249,9 +270,9 @@ def forms_for_pos(obj): dforms = wikt_forms_from_obj(obj) forms = dforms.items() if obj['pos'] == 'noun': - lemma = [form[:-1] for form, descr in forms + lemma = [drop_final_vowel(form) for form, descr in forms if all([w in descr for w in ['construct', 'nominative', 'singular']])][:1] - plural = [form[:-1] for form, descr in forms + plural = [drop_final_vowel(form) for form, descr in forms if all([w in descr for w in ['construct', 'nominative', 'plural']])][:1] gender = (['fem'] if 'Arabic feminine nouns' in obj['categories'] else (['masc'] if 'Arabic masculine nouns' in obj['categories'] @@ -312,8 +333,11 @@ def forms_for_pos(obj): gf_entry['lemma'] = gf_entry['lemma'][0] if 'root' in dforms: gf_entry['args']['root'] = [dforms['root']] - args = [r + ' = ' + quote_if(x[0]) for r, x in gf_entry['args'].items() if x] - gf_entry['lin'] = 'wmk' + gf_entry['cat'] + ' {' + ' ; '.join(sorted(args)) + '}' + elif root := get_sound_trigram_root(gf_entry['lemma']): + gf_entry['args']['root'] = [root] + args = sorted([(r, quote_if(x[0])) for r, x in gf_entry['args'].items() if x]) + gf_entry['lin'] = 'wmk' + gf_entry['cat'] + ' {' + ' ; '.join([r + ' = ' + v for (r, v) in args]) + '}' + gf_entry['labels'] = ','.join([r for r, v in args]) return gf_entry @@ -367,6 +391,7 @@ if MODE.startswith('gf') or MODE=='json': if lemma: cat = entry['forms']['cat'] lin = entry['forms']['lin'] + labels = entry['forms']['labels'] discrim = seen_gf_funs.get((lemma, cat), 0) fun = gf_fun(lemma, cat, discrim) @@ -380,7 +405,9 @@ if MODE.startswith('gf') or MODE=='json': # function-source map, save in source_of_MorphoDictAra.jsonl elif MODE == 'gf-map': - mapitem = {'fun': fun, 'source': wikt_forms_from_obj(obj)} + source = wikt_forms_from_obj(obj) + source['gf_labels'] = labels + mapitem = {'fun': fun, 'source': source} print(json.dumps(mapitem, ensure_ascii=False)) seen_gf_funs[(lemma, cat)] = discrim + 1 # next word_d_C will get a new number @@ -399,6 +426,7 @@ if MODE in ['gf-abs', 'gf-cnc']: # {'s (AComp Def Bare)': 'الأَيَُونَانِ'} # coming from pgf tabularLinearize +# compare the table for one function, returning a report as a dict def compare_tables(gf, wikt, fun, show_buckwalter=True): report = {} for pair in gf.items(): @@ -412,7 +440,7 @@ def compare_tables(gf, wikt, fun, show_buckwalter=True): wikt_tags = {arabic_rgl_features[tag] for tag in gf_tags} wikt_form = None wikt_descr = None - for form, descr in wikt: + for form, descr in wikt.items(): if all([tag in descr for tag in wikt_tags]): wikt_form = reorder_shadda(form) wikt_descr = descr @@ -424,84 +452,90 @@ def compare_tables(gf, wikt, fun, show_buckwalter=True): 'wikt_descr': wikt_descr } if show_buckwalter: - report[gf_tags]['gf_form_rom'] = to_buckwalter(gf_form) if gf_form else None, - report[gf_tags]['wikt_form_rom'] = to_buckwalter(wikt_form) if wikt_form else None, + report[gf_tags]['gf_form_rom'] = to_buckwalter(gf_form) if gf_form else None + report[gf_tags]['wikt_form_rom'] = to_buckwalter(wikt_form) if wikt_form else None if wikt_form: report[gf_tags]['voc_match'] = int(normal(gf_form) == normal(wikt_form)) report[gf_tags]['unvoc_match'] = int(normal(unvocalize(gf_form)) == normal(unvocalize(wikt_form))) ritems = tuple(report.items()) # need an unmutable structure, because otherwise ints are added to items report['fun'] = fun + report['labels'] = wikt['gf_labels'] report['total_found'] = len([f for f, v in ritems if v['wikt_form'] is not None ]) report['total_voc'] = sum([v.get('voc_match', 0) for f, v in ritems]) report['total_unvoc'] = sum([v.get('unvoc_match', 0) for f, v in ritems]) return report -def eval_all(gr, funmap, concrete=CONCRETE_MODULE): - lang = gr.languages[CONCRETE_MODULE] - funs = gr.functions - reports = [] - for fun in funs: - funn = "'" + fun + "'" - if funn not in funmap: - print(funn, 'not found') - continue - wikt = funmap[funn].items() - gf = lang.tabularLinearize(pgf.Expr(fun, [])) - report = compare_tables(gf, wikt, fun) - reports.append(report) - return reports +# with a given grammar and function, prepare input for compare_tables +# and produce a report, possibly summarizing it +def eval_with_wikt(gr, lang, fun, wikt, verbose=False): + if fun not in gr.functions: + print(fun, 'not found in grammar') + return + gf = {p: s for (p, s) in lang.tabularLinearize(pgf.Expr(fun, [])).items() + if p.startswith('s ')} # require the s field, exclude s2 + report = compare_tables(gf, wikt, fun) + if verbose: + return report + else: + if report['total_found'] == 0: + verdict = 'NOT_FOUND' + flaws = False + elif report['total_found'] == report['total_voc']: + verdict = 'PERFECT' + flaws = False + elif report['total_found'] == report['total_unvoc']: + verdict = 'PERFECT_UNVOC' + flaws = True + elif report['total_voc'] == 0: + verdict = 'TOTALLY_WRONG' + flaws = True + else: + verdict = 'PARTIAL' + flaws = True + summary = { + 'fun': report['fun'], + 'forms': report['total_found'], + 'voc': report['total_voc'], + 'unvoc': report['total_unvoc'], + 'verdict': verdict, + 'labels': report['labels'] + } - -# in the summary report: print the first error if anything gets wrong -def first_error(report): - for f, v in report.items(): - if 'voc_match' in v: - if v['voc_match'] == 0: - return f, v - - -# having stored the Wiktionary object for each GF function -# read it back from a file -def read_function_source_map(): - with open(FUNCTION_SOURCE_MAP) as file: - sourcemap = {} - for line in file: - try: - obj = json.loads(line) - sourcemap[obj['fun']] = obj['source'] - except: - continue - return sourcemap + if flaws: + for f, v in report.items(): + if v.get('voc_match', 1) == 0: + summary['first_error'] = v + break + return summary +def eval_grammar(pgffile, concretename, mapfile, show=True, verbose=False): + gr = pgf.readPGF(pgffile) + concrete = gr.languages[concretename] + + totals = {'A': {}, 'N': {}, 'V': {}} + + with open(mapfile) as file: + for line in file: + obj = json.loads(line) + fun = obj['fun'][1:-1] + report = eval_with_wikt(gr, concrete, fun, obj['source'], verbose) + + cat = fun[-1] + if 'verdict' in report: + rep = report['verdict'] + totals[cat][rep] = totals[cat].get(rep, 0) + 1 + + if show: + print(report) + + print(totals) + + if MODE.startswith('eval'): - gr = pgf.readPGF(PGF_FILE) - print('using', PGF_FILE) - funmap = read_function_source_map() - print(len(funmap), 'functions') - for report in eval_all(gr, funmap): - - if MODE == 'eval-verbose': - for line in report.items(): - print(line) - if MODE == 'eval-tables': - for gftags, value in report.items(): - if v := value['wikt_form']: - print(' ', value['gf_params'][2:], '=>', '"' + v + '" ;') - else: - if report['total_found'] == 0: - verdict = 'NOT_FOUND' - elif report['total_found'] == report['total_voc']: - verdict = 'PERFECT' - elif report['total_found'] == report['total_unvoc']: - verdict = 'PERFECT_UNVOC ' + str(first_error(report)) - elif report['total_voc'] == 0: - verdict = 'TOTALLY_WRONG ' + str(first_error(report)) - else: - verdict = 'PARTIAL ' + str(first_error(report)) - print(report['fun'], 'forms', report['total_found'], - 'voc', report['total_voc'], 'unvoc', report['total_unvoc'], - verdict - ) + verbose = MODE=='eval-verbose' + show = verbose or MODE=='eval-funs' + eval_grammar(PGF_FILE, CONCRETE_MODULE, FUNCTION_SOURCE_MAP, show, verbose) + From 24199311058e87a72ecde6e9d8bd835a8c143e02 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Wed, 20 Sep 2023 11:54:59 +0200 Subject: [PATCH 077/129] some more paradigms for Arabic Wiktionary generation --- src/arabic/ParadigmsAra.gf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 20892fed..1b3cfc85 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -885,8 +885,10 @@ oper = \r -> mkN r.sg r.pl r.g nohum ; --- hum/nohum not in Wikt wmkN : {sg : Str; pl : Str} -> N = \r -> mkN r.sg r.pl masc nohum ; ---- ** {g = (smartN r.sg).g} ; + wmkN : {sg, pl : Str ; root : Str} -> N + = \r -> mkN r.sg r.pl masc nohum ; ---- wmkN : {sg : Str; root : Str} -> N - = \r -> smartN r.sg ; + = \r -> smartN r.sg ; } ; wmkA = overload { @@ -928,7 +930,7 @@ oper wmkV : {perfect : Str; imperfect : Str; cls : VerbForm; root : Str} -> V = \r -> mkV r.root r.cls ; ---- wmkV : {perfect : Str; imperfect : Str; cls : VerbForm} -> V - = \r -> variants {} ; ---- mkV r.imperfect ; ---- + = \r -> mkV r.perfect r.cls ; ---- wmkV : {root : Str ; cls : VerbForm} -> V = \r -> mkV r.root r.cls ; wmkV : {imperfect : Str} -> V From fdd7c9641ea6b14af6dfd0bf21456a7071b33332 Mon Sep 17 00:00:00 2001 From: aarneranta Date: Wed, 20 Sep 2023 16:05:46 +0200 Subject: [PATCH 078/129] Ara: improving Adj inflection by identifying fcl patterns from concrete forms --- src/arabic/MorphoAra.gf | 6 +++-- src/arabic/ParadigmsAra.gf | 32 +++++++++++++++++++++--- src/arabic/wiktionary/Makefile | 7 ++++++ src/arabic/wiktionary/read_wiktionary.py | 28 +++++++++++++++++++-- 4 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 src/arabic/wiktionary/Makefile diff --git a/src/arabic/MorphoAra.gf b/src/arabic/MorphoAra.gf index 808223b4..53f7a260 100644 --- a/src/arabic/MorphoAra.gf +++ b/src/arabic/MorphoAra.gf @@ -153,7 +153,8 @@ oper w + "ف" + x + "ع" + y + "ل" + z => { h = w ; m1 = x; m2 = y; t = z} ; w + "ف" + x + ("ع"|"ل") + y - => { h = w ; m1 = x; m2 = ""; t = y} + => { h = w ; m1 = x; m2 = ""; t = y} ; + _ => Predef.error("cannot get FCL pattern from" ++ pat) } ; --opers to interdigitize (make words out of roots and patterns: @@ -204,7 +205,8 @@ oper => mkAssimilated pat (mkRoot3 rS) ; ? + ? + _ => mkBilit pat (mkRoot2 rS) ; --2=> _=> error rS ---- AR error "expected 3--6" - } + } ; + _ => Predef.error("cannot get FCL pattern from" ++ pS) }; ----------------------------------------------------------------------------- diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 1b3cfc85..3d1623e1 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -898,12 +898,30 @@ oper = \r -> mkA r.root ; mkA : {masc_sg : Str; fem_sg : Str; fem_pl : Str; root : Str} -> A = \r -> mkA r.root ; - mkA : {masc_sg : Str; fem_sg: Str ; masc_pl : Str; fem_pl : Str; root : Str} -> A - = \r -> mkA r.root ; + mkA : {masc_sg, fem_sg, masc_pl, fem_pl, root, sg_patt, pl_patt : Str} -> A + = \r -> mkA r.root r.sg_patt r.pl_patt ; + mkA : {masc_sg, fem_sg, masc_pl, root, sg_patt, pl_patt : Str} -> A + = \r -> mkA r.root r.sg_patt r.pl_patt ; + mkA : {fem_pl : Str; fem_sg : Str; masc_sg : Str; root : Str; sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + mkA : {fem_pl : Str; fem_sg : Str; masc_sg, masc_pl, root, sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + mkA : {masc_sg, root, sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + mkA : {masc_sg, masc_pl, root, sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + mkA : {masc_sg, fem_sg, masc_pl, fem_pl, root, pl_patt : Str} -> A + = \r -> mkA r.root ; ---- + mkA : {masc_sg, fem_sg, masc_pl, fem_pl, root : Str} -> A + = \r -> mkA r.root ; ---- + mkA : {masc_sg, fem_sg, root : Str} -> A + = \r -> mkA r.root ; ---- + mkA : {masc_sg, fem_sg, masc_pl, fem_pl, pl_patt : Str} -> A + = \r -> mkA r.masc_sg ; ---- mkA : {masc_sg : Str; fem_sg : Str; fem_pl : Str} -> A = \r -> mkA r.masc_sg ; ---- - mkA : {masc_sg : Str; fem_sg : Str; root : Str} -> A - = \r -> mkA r.root ; + mkA : {masc_sg : Str; fem_sg : Str; root : Str ; sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; mkA : {masc_sg : Str; fem_sg : Str} -> A = \r -> mkA r.masc_sg ; ---- mkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str; fem_pl : Str} -> A @@ -914,8 +932,14 @@ oper = \r -> mkA r.masc_sg ; ---- mkA : {masc_sg : Str; masc_pl : Str; root : Str} -> A = \r -> mkA r.root ; + mkA : {masc_sg : Str; masc_pl, pl_patt : Str; root : Str} -> A + = \r -> mkA r.root ; + mkA : {masc_sg : Str; masc_pl, pl_patt, sg_patt : Str; root : Str} -> A + = \r -> mkA r.sg_patt r.pl_patt ; mkA : {masc_sg : Str; masc_pl : Str} -> A = \r -> mkA r.masc_sg ; ---- + mkA : {masc_sg : Str; masc_pl, pl_patt : Str} -> A + = \r -> mkA r.masc_sg ; ---- mkA : {masc_sg : Str; root : Str} -> A = \r -> mkA r.root ; mkA : {masc_sg : Str} -> A diff --git a/src/arabic/wiktionary/Makefile b/src/arabic/wiktionary/Makefile new file mode 100644 index 00000000..80e1da79 --- /dev/null +++ b/src/arabic/wiktionary/Makefile @@ -0,0 +1,7 @@ +all: + python3 read_wiktionary.py gf-abs >MorphoDictAraAbs.gf + python3 read_wiktionary.py gf-cnc >MorphoDictAra.gf + python3 read_wiktionary.py gf-map >source_of_MorphoDictAra.jsonl + gf -make MorphoDictAra.gf + python3 read_wiktionary.py eval-funs >1-eval.txt + python3 to_wordnet.py >wornet-arabic.jsonl diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index 43461723..960a592d 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -122,7 +122,7 @@ buckwalter_dict = { 0x638: 'Z', # ظ 0x639: 'E', # ع 0x63a: 'g', # غ - 0x641: 'f', # ف + 0x641: 'f', # ف 0x642: 'q', # ق 0x643: 'k', # ك 0x644: 'l', # ل @@ -144,6 +144,7 @@ buckwalter_dict = { 0x671: '{' # ٱ } + buckwalter_dict_rev = {b: chr(a) for a, b in buckwalter_dict.items()} arabic_vowels = {chr(c) for c in {0x64b, 0x64c, 0x64d, 0x64e, 0x64f, 0x650}} @@ -184,6 +185,24 @@ def get_sound_trigram_root(s): else: return None + +# reverse engineer fcl pattern from a given form, with a sound trigram root +# one more condition: each of the root letters occurs exactly ones +# TODO: better use the given root of the lex entry +def get_sound_fcl_pattern(s): + if root := get_sound_trigram_root(s): + if len([c in s for c in root]) == 3: + p = list(s) + r = s.find(root[0]) + p[r] = chr(0x641) + r += s[r+1:].find(root[1]) + 1 + p[r] = chr(0x639) + r += s[r+1:].find(root[2]) + 1 + p[r] = chr(0x644) + p = ''.join(p) +## print('---PATT', s, root, p) + return p + # Wikt uses vowel+shadda which is a Unicode normalization # GF uses shadda+vowel which is linguistically correct @@ -324,7 +343,12 @@ def forms_for_pos(obj): 'fem_pl': [form for form, descr in forms if all([w in descr for w in ['indefinite', 'feminine', 'plural', 'informal']])][:1], } - } + } + for patt in ['masc_sg', 'masc_pl']: + if patt in gf_entry['args']: + if form := gf_entry['args'][patt]: + if spatt := get_sound_fcl_pattern(form[0]): + gf_entry['args'][patt[5:]+'_patt'] = [spatt] # sg_patt, pl_patt else: gf_entry = {f: d for f, d in forms} From 7e383b746e81544dfeee9ae776fa84ac07e3c4f9 Mon Sep 17 00:00:00 2001 From: aarneranta Date: Thu, 21 Sep 2023 15:46:41 +0200 Subject: [PATCH 079/129] moved wikt-specific paradigms to a separate file (for the moment) --- src/arabic/ParadigmsAra.gf | 54 ++++++++++++------------ src/arabic/wiktionary/Makefile | 2 +- src/arabic/wiktionary/read_wiktionary.py | 21 +++++++-- 3 files changed, 47 insertions(+), 30 deletions(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 3d1623e1..80506ebb 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -868,6 +868,8 @@ formV : (root : Str) -> VerbForm -> V = \s,f -> case f of { param VerbForm = FormI | FormII | FormIII | FormIV | FormV | FormVI | FormVII | FormVIII | FormX | FormXI ; + +{- temporarily moved to wiktionary/MoreAra.gf -- paradigms for Wiktionary extraction ---- TODO: better usage of information in Wiktionary @@ -894,55 +896,55 @@ oper wmkA = overload { wmkA : {root : Str} -> A = \r -> mkA r.root ; - mkA : {masc_sg : Str; fem_pl : Str; root : Str} -> A + wmkA : {masc_sg : Str; fem_pl : Str; root : Str} -> A = \r -> mkA r.root ; - mkA : {masc_sg : Str; fem_sg : Str; fem_pl : Str; root : Str} -> A + wmkA : {masc_sg : Str; fem_sg : Str; fem_pl : Str; root : Str} -> A = \r -> mkA r.root ; - mkA : {masc_sg, fem_sg, masc_pl, fem_pl, root, sg_patt, pl_patt : Str} -> A + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, root, sg_patt, pl_patt : Str} -> A = \r -> mkA r.root r.sg_patt r.pl_patt ; - mkA : {masc_sg, fem_sg, masc_pl, root, sg_patt, pl_patt : Str} -> A + wmkA : {masc_sg, fem_sg, masc_pl, root, sg_patt, pl_patt : Str} -> A = \r -> mkA r.root r.sg_patt r.pl_patt ; - mkA : {fem_pl : Str; fem_sg : Str; masc_sg : Str; root : Str; sg_patt : Str} -> A + wmkA : {fem_pl : Str; fem_sg : Str; masc_sg : Str; root : Str; sg_patt : Str} -> A = \r -> mkA r.root r.sg_patt ; - mkA : {fem_pl : Str; fem_sg : Str; masc_sg, masc_pl, root, sg_patt : Str} -> A + wmkA : {fem_pl : Str; fem_sg : Str; masc_sg, masc_pl, root, sg_patt : Str} -> A = \r -> mkA r.root r.sg_patt ; - mkA : {masc_sg, root, sg_patt : Str} -> A + wmkA : {masc_sg, root, sg_patt : Str} -> A = \r -> mkA r.root r.sg_patt ; - mkA : {masc_sg, masc_pl, root, sg_patt : Str} -> A + wmkA : {masc_sg, masc_pl, root, sg_patt : Str} -> A = \r -> mkA r.root r.sg_patt ; - mkA : {masc_sg, fem_sg, masc_pl, fem_pl, root, pl_patt : Str} -> A + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, root, pl_patt : Str} -> A = \r -> mkA r.root ; ---- - mkA : {masc_sg, fem_sg, masc_pl, fem_pl, root : Str} -> A + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, root : Str} -> A = \r -> mkA r.root ; ---- - mkA : {masc_sg, fem_sg, root : Str} -> A + wmkA : {masc_sg, fem_sg, root : Str} -> A = \r -> mkA r.root ; ---- - mkA : {masc_sg, fem_sg, masc_pl, fem_pl, pl_patt : Str} -> A + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, pl_patt : Str} -> A = \r -> mkA r.masc_sg ; ---- - mkA : {masc_sg : Str; fem_sg : Str; fem_pl : Str} -> A + wmkA : {masc_sg : Str; fem_sg : Str; fem_pl : Str} -> A = \r -> mkA r.masc_sg ; ---- - mkA : {masc_sg : Str; fem_sg : Str; root : Str ; sg_patt : Str} -> A + wmkA : {masc_sg : Str; fem_sg : Str; root : Str ; sg_patt : Str} -> A = \r -> mkA r.root r.sg_patt ; - mkA : {masc_sg : Str; fem_sg : Str} -> A + wmkA : {masc_sg : Str; fem_sg : Str} -> A = \r -> mkA r.masc_sg ; ---- - mkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str; fem_pl : Str} -> A + wmkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str; fem_pl : Str} -> A = \r -> mkA r.masc_sg ; ---- - mkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str; root : Str} -> A + wmkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str; root : Str} -> A = \r -> mkA r.root ; - mkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str} -> A + wmkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str} -> A = \r -> mkA r.masc_sg ; ---- - mkA : {masc_sg : Str; masc_pl : Str; root : Str} -> A + wmkA : {masc_sg : Str; masc_pl : Str; root : Str} -> A = \r -> mkA r.root ; - mkA : {masc_sg : Str; masc_pl, pl_patt : Str; root : Str} -> A + wmkA : {masc_sg : Str; masc_pl, pl_patt : Str; root : Str} -> A = \r -> mkA r.root ; - mkA : {masc_sg : Str; masc_pl, pl_patt, sg_patt : Str; root : Str} -> A + wmkA : {masc_sg : Str; masc_pl, pl_patt, sg_patt : Str; root : Str} -> A = \r -> mkA r.sg_patt r.pl_patt ; - mkA : {masc_sg : Str; masc_pl : Str} -> A + wmkA : {masc_sg : Str; masc_pl : Str} -> A = \r -> mkA r.masc_sg ; ---- - mkA : {masc_sg : Str; masc_pl, pl_patt : Str} -> A + wmkA : {masc_sg : Str; masc_pl, pl_patt : Str} -> A = \r -> mkA r.masc_sg ; ---- - mkA : {masc_sg : Str; root : Str} -> A + wmkA : {masc_sg : Str; root : Str} -> A = \r -> mkA r.root ; - mkA : {masc_sg : Str} -> A + wmkA : {masc_sg : Str} -> A = \r -> mkA r.masc_sg ; ---- } ; @@ -960,5 +962,5 @@ oper wmkV : {imperfect : Str} -> V = \r -> variants {} ; ---- mkV r.imperfect ; } ; - +-} } ; diff --git a/src/arabic/wiktionary/Makefile b/src/arabic/wiktionary/Makefile index 80e1da79..58fcf2b6 100644 --- a/src/arabic/wiktionary/Makefile +++ b/src/arabic/wiktionary/Makefile @@ -4,4 +4,4 @@ all: python3 read_wiktionary.py gf-map >source_of_MorphoDictAra.jsonl gf -make MorphoDictAra.gf python3 read_wiktionary.py eval-funs >1-eval.txt - python3 to_wordnet.py >wornet-arabic.jsonl + python3 to_wordnet.py >wordnet-arabic.jsonl diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index 960a592d..69099294 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -71,6 +71,10 @@ CONCRETE_MODULE = 'MorphoDictAra' # concrete syntax file, to debug sources of linearizations CONCRETE_FILE = CONCRETE_MODULE + '.gf' + +# evaluation result file, created with mode eval-funs +EVAL_FILE = 'eval.jsonl' + # read a gzipped jsonl file (one object per line), # showing lines where one of a list of languages is present @@ -93,6 +97,17 @@ if MODE == 'raw': get_gzip_json(WIKTIONARY_DUMP, 1, [EXTRACTED_LANGUAGE]) exit() + +if MODE == 'error-analysis': + evals = {} + with open(EVAL_FILE) as file: + for line in file: + row = json.loads(line) + if labels := row.get('labels', None): + verdict = row['verdict'] + evals[(labels, verdict)] = evals.get((labels, verdict), 0) + 1 + for labverdict, n in sorted(list(evals.items())): + print(labverdict, n) # https://en.wikipedia.org/wiki/Buckwalter_transliteration buckwalter_dict = { @@ -378,7 +393,7 @@ def find_root(s): if MODE == 'gf-abs': print('abstract MorphoDictAraAbs = Cat ** {') if MODE == 'gf-cnc': - print('concrete MorphoDictAra of MorphoDictAraAbs = CatAra ** open ParadigmsAra in {') + print('concrete MorphoDictAra of MorphoDictAraAbs = CatAra ** open ParadigmsAra, MoreAra in {') # go through the Arabic Wiktionary entries # generate functions with unique names @@ -552,9 +567,9 @@ def eval_grammar(pgffile, concretename, mapfile, show=True, verbose=False): totals[cat][rep] = totals[cat].get(rep, 0) + 1 if show: - print(report) + print(json.dumps(report, ensure_ascii=False)) - print(totals) + print(json.dumps(totals, ensure_ascii=False)) if MODE.startswith('eval'): From aa1dff67026918764e0c3c03697120c828e6b4ea Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Thu, 21 Sep 2023 17:29:38 +0200 Subject: [PATCH 080/129] added MoreAra.gf --- src/arabic/wiktionary/Makefile | 3 +- src/arabic/wiktionary/MoreAra.gf | 98 ++++++++++++++++++++++++ src/arabic/wiktionary/read_wiktionary.py | 3 +- 3 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 src/arabic/wiktionary/MoreAra.gf diff --git a/src/arabic/wiktionary/Makefile b/src/arabic/wiktionary/Makefile index 58fcf2b6..a14e23e5 100644 --- a/src/arabic/wiktionary/Makefile +++ b/src/arabic/wiktionary/Makefile @@ -3,5 +3,6 @@ all: python3 read_wiktionary.py gf-cnc >MorphoDictAra.gf python3 read_wiktionary.py gf-map >source_of_MorphoDictAra.jsonl gf -make MorphoDictAra.gf - python3 read_wiktionary.py eval-funs >1-eval.txt + python3 read_wiktionary.py eval-funs >eval.jsonl python3 to_wordnet.py >wordnet-arabic.jsonl + python3 read_wiktionary.py error-analysis diff --git a/src/arabic/wiktionary/MoreAra.gf b/src/arabic/wiktionary/MoreAra.gf new file mode 100644 index 00000000..e45b49b5 --- /dev/null +++ b/src/arabic/wiktionary/MoreAra.gf @@ -0,0 +1,98 @@ +resource MoreAra = CatAra ** open ParadigmsAra in { + + +-- temporarily moved from ParadigmsAra +-- paradigms for Wiktionary extraction +---- TODO: better usage of information in Wiktionary + +oper + wmkN = overload { + wmkN : {sg, pl : Str ; g : Gender} -> N + = \r -> mkN r.sg r.pl r.g nohum ; --- hum/nohum not in Wikt + wmkN : {sg : Str} -> N + = \r -> smartN r.sg ; + wmkN : {sg : Str ; g : Gender ; root : Str} -> N + = \r -> smartN r.sg ** {g = r.g} ; ---- + wmkN : {sg : Str; g : Gender} -> N + = \r -> smartN r.sg ** {g = r.g} ; + wmkN : {sg : Str; pl : Str; g : Gender; root : Str} -> N + = \r -> mkN r.sg r.pl r.g nohum ; --- hum/nohum not in Wikt + wmkN : {sg : Str; pl : Str} -> N + = \r -> mkN r.sg r.pl masc nohum ; ---- ** {g = (smartN r.sg).g} ; + wmkN : {sg, pl : Str ; root : Str} -> N + = \r -> mkN r.sg r.pl masc nohum ; ---- + wmkN : {sg : Str; root : Str} -> N + = \r -> smartN r.sg ; + } ; + + wmkA = overload { + wmkA : {root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; fem_pl : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; fem_sg : Str; fem_pl : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, root, sg_patt, pl_patt : Str} -> A + = \r -> mkA r.root r.sg_patt r.pl_patt ; + wmkA : {masc_sg, fem_sg, masc_pl, root, sg_patt, pl_patt : Str} -> A + = \r -> mkA r.root r.sg_patt r.pl_patt ; + wmkA : {fem_pl : Str; fem_sg : Str; masc_sg : Str; root : Str; sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {fem_pl : Str; fem_sg : Str; masc_sg, masc_pl, root, sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {masc_sg, root, sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {masc_sg, masc_pl, root, sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, root, pl_patt : Str} -> A + = \r -> mkA r.root ; ---- + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, root : Str} -> A + = \r -> mkA r.root ; ---- + wmkA : {masc_sg, fem_sg, root : Str} -> A + = \r -> mkA r.root ; ---- + wmkA : {masc_sg, fem_sg, masc_pl, fem_pl, pl_patt : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; fem_sg : Str; fem_pl : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; fem_sg : Str; root : Str ; sg_patt : Str} -> A + = \r -> mkA r.root r.sg_patt ; + wmkA : {masc_sg : Str; fem_sg : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str; fem_pl : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; masc_pl : Str; fem_sg : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; masc_pl : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; masc_pl, pl_patt : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str; masc_pl, pl_patt, sg_patt : Str; root : Str} -> A + = \r -> mkA r.sg_patt r.pl_patt ; + wmkA : {masc_sg : Str; masc_pl : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; masc_pl, pl_patt : Str} -> A + = \r -> mkA r.masc_sg ; ---- + wmkA : {masc_sg : Str; root : Str} -> A + = \r -> mkA r.root ; + wmkA : {masc_sg : Str} -> A + = \r -> mkA r.masc_sg ; ---- + } ; + + wmkV = overload { + wmkV : {perfect : Str; cls : VerbForm; root : Str} -> V + = \r -> mkV r.root r.cls ; ---- + wmkV : {perfect : Str; cls : VerbForm} -> V + = \r -> mkV r.perfect r.cls ; ---- + wmkV : {perfect : Str; imperfect : Str; cls : VerbForm; root : Str} -> V + = \r -> mkV r.root r.cls ; ---- + wmkV : {perfect : Str; imperfect : Str; cls : VerbForm} -> V + = \r -> mkV r.perfect r.cls ; ---- + wmkV : {root : Str ; cls : VerbForm} -> V + = \r -> mkV r.root r.cls ; + wmkV : {imperfect : Str} -> V + = \r -> variants {} ; ---- mkV r.imperfect ; + } ; + +} \ No newline at end of file diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index 69099294..140852c7 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -104,8 +104,9 @@ if MODE == 'error-analysis': for line in file: row = json.loads(line) if labels := row.get('labels', None): + cat = row['fun'][-1] verdict = row['verdict'] - evals[(labels, verdict)] = evals.get((labels, verdict), 0) + 1 + evals[(cat, labels, verdict)] = evals.get((cat, labels, verdict), 0) + 1 for labverdict, n in sorted(list(evals.items())): print(labverdict, n) From 561a8c130d5b1f99e98a5ced819ff58f4858a65a Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Mon, 25 Sep 2023 08:22:47 +0200 Subject: [PATCH 081/129] to_wordnet applied to a new format of data --- src/arabic/wiktionary/to_wordnet.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/arabic/wiktionary/to_wordnet.py b/src/arabic/wiktionary/to_wordnet.py index 144e4cc1..b159c5f1 100644 --- a/src/arabic/wiktionary/to_wordnet.py +++ b/src/arabic/wiktionary/to_wordnet.py @@ -6,7 +6,8 @@ import json # from https://www.grammaticalframework.org/~krasimir/arabic.tsv.gz -WN_TSV = 'arabic.tsv' +# WN_TSV = 'arabic.tsv' # Krasimir +WN_TSV = 'ar2en_words_gf.csv' # Zarzoura # built as explained in ./read_wiktionary.py MORPHO_GF = 'MorphoDictAraAbs.gf' @@ -41,7 +42,7 @@ with open(WN_TSV) as wnfile: for row in wnfile: ## word = row[-1].strip() # does not show tha arabic, but the second-last word word = unvocalize(get_arabic(row)) - wnfun = row.split()[0] + wnfun = row.split()[-1] # 0 in Krasimir cat = [c for c in wnfun if c.isalpha()][-1] # the last letter; the dict only contains N, A, V funs = funmap.get((word, cat), []) result = {'wnfun': wnfun, 'sought': word, 'found': funs} From 1c355ce9dd49d1fd59090bb41a91a573cc9ce1c1 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Mon, 25 Sep 2023 09:22:21 +0200 Subject: [PATCH 082/129] factored out arabic_utilities.py as a separate file --- src/arabic/wiktionary/arabic_utilities.py | 169 ++++++++++++++++++++++ src/arabic/wiktionary/read_wiktionary.py | 128 +--------------- src/arabic/wiktionary/to_wordnet.py | 11 +- 3 files changed, 172 insertions(+), 136 deletions(-) create mode 100644 src/arabic/wiktionary/arabic_utilities.py diff --git a/src/arabic/wiktionary/arabic_utilities.py b/src/arabic/wiktionary/arabic_utilities.py new file mode 100644 index 00000000..29a15f10 --- /dev/null +++ b/src/arabic/wiktionary/arabic_utilities.py @@ -0,0 +1,169 @@ +# utilities for Arabic script +# in the main mode, converts string literals in stdin 'to' or 'from' Buckwalter +# as specified by the command line argument: +# +# % python3 arabic_utilities.py to b.tmp +# % diff MorphoDictAra.gf b.tmp +# % + +def is_arabic(s): + return s and any(1574 <= ord(c) <= 1616 for c in s) + + +def get_arabic(s): + return ''.join([c for c in s if is_arabic(c)]) + + +def unvocalize(s): + return ''.join([c for c in s if 0x621 <= ord(c) <= 0x64a]) + + +# https://en.wikipedia.org/wiki/Buckwalter_transliteration +buckwalter_dict = { + 0x621: "'", # ء + 0x622: '|', # آ + 0x623: '>', # أ + 0x624: '&', # ؤ + 0x625: '<', # إ + 0x626: '}', # ئ + 0x627: 'A', # ا + 0x628: 'b', # ب + 0x629: 'p', # ة + 0x62a: 't', # ت + 0x62b: 'v', # ث + 0x62c: 'j', # ج + 0x62d: 'H', # ح + 0x62e: 'x', # خ + 0x62f: 'd', # د + 0x630: '*', # ذ + 0x631: 'r', # ر + 0x632: 'z', # ز + 0x633: 's', # س + 0x634: '$', # ش + 0x635: 'S', # ص + 0x636: 'D', # ض + 0x637: 'T', # ط + 0x638: 'Z', # ظ + 0x639: 'E', # ع + 0x63a: 'g', # غ + 0x641: 'f', # ف + 0x642: 'q', # ق + 0x643: 'k', # ك + 0x644: 'l', # ل + 0x645: 'm', # م + 0x646: 'n', # ن + 0x647: 'h', # ه + 0x648: 'w', # و + 0x649: 'Y', # ى + 0x64a: 'y', # ي + 0x64b: 'F', # ً + 0x64c: 'N', # ٌ + 0x64d: 'K', # ٍ + 0x64e: 'a', # َ + 0x64f: 'u', # ُ + 0x650: 'i', # ِ + 0x651: '~', # ّ + 0x652: 'o', # ْ + 0x670: '`', # ' + 0x671: '{' # ٱ + } + + +buckwalter_dict_rev = {b: chr(a) for a, b in buckwalter_dict.items()} + +arabic_vowels = {chr(c) for c in {0x64b, 0x64c, 0x64d, 0x64e, 0x64f, 0x650}} + +sound_consonants = {chr(c) for c in range(0x628, 0x648)} # excluding alif, waw, ya + +def to_buckwalter(s): + return ''.join([buckwalter_dict.get(ord(c), c) for c in s]) + + +def from_buckwalter(s): + return ''.join([buckwalter_dict_rev.get(c, c) for c in s]) + + +def drop_final_vowel(s): + if s[-1] in arabic_vowels: + return s[:-1] + else: + return s + + +def normal(s): + return unicodedata.normalize('NFD', s) + +# heuristic for finding the three radicals from certain forms +# works only for sound (strong) 3-radical roots, otherwise None +def get_sound_trigram_root(s): + sounds = [c for c in s if c in sound_consonants] + if len(sounds) == 3: + return ''.join(sounds) + else: + return None + + +# reverse engineer fcl pattern from a given form, with a sound trigram root +# one more condition: each of the root letters occurs exactly ones +# TODO: better use the given root of the lex entry +def get_sound_fcl_pattern(s): + if root := get_sound_trigram_root(s): + if len([c in s for c in root]) == 3: + p = list(s) + r = s.find(root[0]) + p[r] = chr(0x641) + r += s[r+1:].find(root[1]) + 1 + p[r] = chr(0x639) + r += s[r+1:].find(root[2]) + 1 + p[r] = chr(0x644) + p = ''.join(p) +## print('---PATT', s, root, p) + return p + + +# Wikt uses vowel+shadda which is a Unicode normalization +# GF uses shadda+vowel which is linguistically correct +# see https://stackoverflow.com/questions/58559390/in-unicode-should-u0651-arabic-shadda-be-before-or-after-kasra +# unicodedata.normalize does this wrong, as noted by Ariel Gutman +## todo: more direct implementation +def reorder_shadda(s): + return from_buckwalter(to_buckwalter(s).replace('a~', '~a').replace('u~', '~u').replace('i~', '~i')) + + +# quote word forms but not parameters +def quote_if(s, cond=is_arabic, change=reorder_shadda): + if cond(s): + return '"' + change(s) + '"' + else: + return s + + +# for a string, change each string literal in "..." with a change function +# leaving other characters as they are; print the string to stdout as you go +def change_literals(s, change): + inliteral = False + literal = '' + for c in s: + if c == '"' and inliteral: + print('"'+change(literal)+'"', end='') + inliteral = False + literal = '' + elif c == '"': + inliteral = True + elif inliteral: + literal += c + else: + print(c, end='') + + +# convert literals in stdin 'to' or 'from' Buckwalter +if __name__ == '__main__': + import sys + mode = sys.argv[1] + for line in sys.stdin: + if mode == 'from': + change_literals(line, from_buckwalter) + elif mode == 'to': + change_literals(line, to_buckwalter) + + diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index 140852c7..edfa6960 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -3,7 +3,7 @@ import json import sys import unicodedata import pgf - +from arabic_utilities import * # data from https://kaikki.org/dictionary/rawdata.html # thanks Tatu Ylonen: Wiktextract: Wiktionary as Machine-Readable Structured Data, @@ -110,132 +110,6 @@ if MODE == 'error-analysis': for labverdict, n in sorted(list(evals.items())): print(labverdict, n) -# https://en.wikipedia.org/wiki/Buckwalter_transliteration -buckwalter_dict = { - 0x621: "'", # ء - 0x622: '|', # آ - 0x623: '>', # أ - 0x624: '&', # ؤ - 0x625: '<', # إ - 0x626: '}', # ئ - 0x627: 'A', # ا - 0x628: 'b', # ب - 0x629: 'p', # ة - 0x62a: 't', # ت - 0x62b: 'v', # ث - 0x62c: 'j', # ج - 0x62d: 'H', # ح - 0x62e: 'x', # خ - 0x62f: 'd', # د - 0x630: '*', # ذ - 0x631: 'r', # ر - 0x632: 'z', # ز - 0x633: 's', # س - 0x634: '$', # ش - 0x635: 'S', # ص - 0x636: 'D', # ض - 0x637: 'T', # ط - 0x638: 'Z', # ظ - 0x639: 'E', # ع - 0x63a: 'g', # غ - 0x641: 'f', # ف - 0x642: 'q', # ق - 0x643: 'k', # ك - 0x644: 'l', # ل - 0x645: 'm', # م - 0x646: 'n', # ن - 0x647: 'h', # ه - 0x648: 'w', # و - 0x649: 'Y', # ى - 0x64a: 'y', # ي - 0x64b: 'F', # ً - 0x64c: 'N', # ٌ - 0x64d: 'K', # ٍ - 0x64e: 'a', # َ - 0x64f: 'u', # ُ - 0x650: 'i', # ِ - 0x651: '~', # ّ - 0x652: 'o', # ْ - 0x670: '`', # ' - 0x671: '{' # ٱ - } - - -buckwalter_dict_rev = {b: chr(a) for a, b in buckwalter_dict.items()} - -arabic_vowels = {chr(c) for c in {0x64b, 0x64c, 0x64d, 0x64e, 0x64f, 0x650}} - -sound_consonants = {chr(c) for c in range(0x628, 0x648)} # excluding alif, waw, ya - -def to_buckwalter(s): - return ''.join([buckwalter_dict.get(ord(c), c) for c in s]) - - -def from_buckwalter(s): - return ''.join([buckwalter_dict_rev.get(c, c) for c in s]) - - -def unvocalize(s): - return ''.join([c for c in s if 0x621 <= ord(c) <= 0x64a]) - - -def drop_final_vowel(s): - if s[-1] in arabic_vowels: - return s[:-1] - else: - return s - - -def is_arabic(s): - return s and any(1574 <= ord(c) <= 1616 for c in s) - -def normal(s): - return unicodedata.normalize('NFD', s) - -# heuristic for finding the three radicals from certain forms -# works only for sound (strong) 3-radical roots, otherwise None -def get_sound_trigram_root(s): - sounds = [c for c in s if c in sound_consonants] - if len(sounds) == 3: - return ''.join(sounds) - else: - return None - - -# reverse engineer fcl pattern from a given form, with a sound trigram root -# one more condition: each of the root letters occurs exactly ones -# TODO: better use the given root of the lex entry -def get_sound_fcl_pattern(s): - if root := get_sound_trigram_root(s): - if len([c in s for c in root]) == 3: - p = list(s) - r = s.find(root[0]) - p[r] = chr(0x641) - r += s[r+1:].find(root[1]) + 1 - p[r] = chr(0x639) - r += s[r+1:].find(root[2]) + 1 - p[r] = chr(0x644) - p = ''.join(p) -## print('---PATT', s, root, p) - return p - - -# Wikt uses vowel+shadda which is a Unicode normalization -# GF uses shadda+vowel which is linguistically correct -# see https://stackoverflow.com/questions/58559390/in-unicode-should-u0651-arabic-shadda-be-before-or-after-kasra -# unicodedata.normalize does this wrong, as noted by Ariel Gutman -## todo: more direct implementation -def reorder_shadda(s): - return from_buckwalter(to_buckwalter(s).replace('a~', '~a').replace('u~', '~u').replace('i~', '~i')) - - -# quote word forms but not parameters -def quote_if(s, cond=is_arabic, change=reorder_shadda): - if cond(s): - return '"' + change(s) + '"' - else: - return s - # generate word_d_C functions starting with d=0, but show d only when >= 1 def gf_fun(s, pos, disamb=0): diff --git a/src/arabic/wiktionary/to_wordnet.py b/src/arabic/wiktionary/to_wordnet.py index b159c5f1..2aae047d 100644 --- a/src/arabic/wiktionary/to_wordnet.py +++ b/src/arabic/wiktionary/to_wordnet.py @@ -1,6 +1,8 @@ import csv import json +from arabic_utilities import * + # to run: python3 to_wordnet.py >arabic-wn-morpho.jsonl # the following are assumed @@ -12,15 +14,6 @@ WN_TSV = 'ar2en_words_gf.csv' # Zarzoura # built as explained in ./read_wiktionary.py MORPHO_GF = 'MorphoDictAraAbs.gf' -def is_arabic(s): - return s and any(1574 <= ord(c) <= 1616 for c in s) - -def get_arabic(s): - return ''.join([c for c in s if is_arabic(c)]) - -def unvocalize(s): - return ''.join([c for c in s if 0x621 <= ord(c) <= 0x64a]) - # fun 'دُبُ_N' : N ; -- 10 [['bear']] funmap = {} From 195064569da54f6518e5419cca079dd6cabc2744 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 26 Sep 2023 10:45:36 +0200 Subject: [PATCH 083/129] UseLN/PlainLN were missing the contracting prepositions --- src/spanish/NamesSpa.gf | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/spanish/NamesSpa.gf b/src/spanish/NamesSpa.gf index 3940d26a..dba32bee 100644 --- a/src/spanish/NamesSpa.gf +++ b/src/spanish/NamesSpa.gf @@ -13,28 +13,19 @@ lin FullName gn sn = pn2np { } ; lin PlainLN n = heavyNP { - s = \\c => n.s; + s = \\c => prepCase c ++ n.s; a = {g = n.g ; n = n.num ; p = P3} } ; lin UseLN n = heavyNP { s = \\c => case n.art of { - UseArt => case n.g of { - Fem => case n.num of { - Sg => "la" ++ n.s; - Pl => "las" ++ n.s} ; - Masc => case n.num of { - Sg => "el" ++ n.s; - Pl => "los" ++ n.s - } - } ; - NoArt => n.s - } ; + UseArt => artDef False n.g n.num c ++ n.s; + NoArt => prepCase c ++ n.s + } ; a = {g = n.g ; n = n.num ; p = P3} } ; - lin InLN n = { s = "en" ++ case n.art of { From fdd9b986012424bd1f4acf5fbaf16788114ac924 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 26 Sep 2023 10:46:50 +0200 Subject: [PATCH 084/129] PlainLN was missing prepositions --- src/french/NamesFre.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/french/NamesFre.gf b/src/french/NamesFre.gf index 77637c84..dc935ba6 100644 --- a/src/french/NamesFre.gf +++ b/src/french/NamesFre.gf @@ -13,7 +13,7 @@ lin FullName gn sn = pn2np { } ; lin PlainLN n = heavyNP { - s = \\c => n.s; + s = \\c => prepCase c ++ n.s; a = {g = n.g ; n = n.num ; p = P3} } ; From 6e0d281fe074e7cfe5737d81ba506affca7b85bf Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 26 Sep 2023 10:49:49 +0200 Subject: [PATCH 085/129] fix the repeating dot in Spanish --- src/spanish/NumeralSpa.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spanish/NumeralSpa.gf b/src/spanish/NumeralSpa.gf index 139dee15..dff59581 100644 --- a/src/spanish/NumeralSpa.gf +++ b/src/spanish/NumeralSpa.gf @@ -143,7 +143,7 @@ param if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ i.s ! o ; n = Pl ; - hasDot=False + hasDot=True } ; oper From f19dcc01f99252feb79823830863389e6cf0fc7f Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Wed, 27 Sep 2023 12:23:43 +0200 Subject: [PATCH 086/129] import of unicodedata in arabic_utilities --- src/arabic/wiktionary/MoreAra.gf | 6 +++--- src/arabic/wiktionary/arabic_utilities.py | 4 +++- src/arabic/wiktionary/read_wiktionary.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/arabic/wiktionary/MoreAra.gf b/src/arabic/wiktionary/MoreAra.gf index e45b49b5..f91a73d4 100644 --- a/src/arabic/wiktionary/MoreAra.gf +++ b/src/arabic/wiktionary/MoreAra.gf @@ -84,15 +84,15 @@ oper wmkV : {perfect : Str; cls : VerbForm; root : Str} -> V = \r -> mkV r.root r.cls ; ---- wmkV : {perfect : Str; cls : VerbForm} -> V - = \r -> mkV r.perfect r.cls ; ---- + = \r -> mkV r.perfect r.cls ; ---- expects root wmkV : {perfect : Str; imperfect : Str; cls : VerbForm; root : Str} -> V = \r -> mkV r.root r.cls ; ---- wmkV : {perfect : Str; imperfect : Str; cls : VerbForm} -> V - = \r -> mkV r.perfect r.cls ; ---- + = \r -> mkV r.perfect r.cls ; ---- expects root wmkV : {root : Str ; cls : VerbForm} -> V = \r -> mkV r.root r.cls ; wmkV : {imperfect : Str} -> V - = \r -> variants {} ; ---- mkV r.imperfect ; + = \r -> variants {} ; ---- mkV r.imperfect ; -- expects cls I } ; } \ No newline at end of file diff --git a/src/arabic/wiktionary/arabic_utilities.py b/src/arabic/wiktionary/arabic_utilities.py index 29a15f10..8be78bf8 100644 --- a/src/arabic/wiktionary/arabic_utilities.py +++ b/src/arabic/wiktionary/arabic_utilities.py @@ -4,7 +4,9 @@ # # % python3 arabic_utilities.py to b.tmp # % diff MorphoDictAra.gf b.tmp -# % +# % + +import unicodedata def is_arabic(s): return s and any(1574 <= ord(c) <= 1616 for c in s) diff --git a/src/arabic/wiktionary/read_wiktionary.py b/src/arabic/wiktionary/read_wiktionary.py index edfa6960..da6389e3 100644 --- a/src/arabic/wiktionary/read_wiktionary.py +++ b/src/arabic/wiktionary/read_wiktionary.py @@ -46,7 +46,7 @@ MODE = '' if __name__ == '__main__': if not sys.argv[1:]: - print('usage: read_wiktionary (raw | gf-cnc | gf-abs | gf-map | eval | eval-verbose)') + print('usage: read_wiktionary (raw | gf-cnc | gf-abs | gf-map | eval | eval-funs | eval-verbose | error-analysis)') exit() MODE = sys.argv[1] # From d1ff26f3cee08973e2c0ed95d3fc96efccd5b1f9 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 28 Sep 2023 10:06:17 +0200 Subject: [PATCH 087/129] (Fin) add ApposNP, PresPartAP, PastPartAP --- src/finnish/ExtendFin.gf | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/finnish/ExtendFin.gf b/src/finnish/ExtendFin.gf index fe7d41b0..0ff848d0 100644 --- a/src/finnish/ExtendFin.gf +++ b/src/finnish/ExtendFin.gf @@ -10,6 +10,8 @@ concrete ExtendFin of Extend = ,CardCNCard ,UttAccNP ,AdjAsCN, AdjAsNP + ,ApposNP + ,PresPartAP, PastPartAP ] with (Grammar = GrammarFin) ** @@ -240,5 +242,16 @@ lin CardCNCard card cn = { lin UttAccNP np = {s = P.addNegation np.isNeg ++ np.s ! NPAcc} ; lin AdjAsCN ap = {s = ap.s ! True ; postmod = \\_ => ap.p ; h = Back} ; ---- Harmony just a guess lin AdjAsNP ap = MassNP (AdjAsCN ap) ; +lin ApposNP np1 np2 = np1 ** {s = \\npf => np1.s ! npf ++ np2.s ! NPSep} ; +lin PresPartAP vp = { + s = \\_,nf => vp.s.s ! PresPartAct (AN nf) ; + p = [] ; + hasPrefix = False + } ; +lin PastPartAP vps = { + s = \\_,nf => vps.s.s ! PastPartAct (AN nf) ; + p = vps.c2.s.p1 ; + hasPrefix = False + } ; } From 5f4bb014b84e4a84ff48a900bcaf63a9aac4c909 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 28 Sep 2023 10:09:16 +0200 Subject: [PATCH 088/129] (Fin) weak grade of "-hka" in paradigms 9A and 10A --- src/finnish/Kotus.gf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/finnish/Kotus.gf b/src/finnish/Kotus.gf index ccf325d9..153bad07 100644 --- a/src/finnish/Kotus.gf +++ b/src/finnish/Kotus.gf @@ -44,6 +44,7 @@ oper = \s -> case s of { x + "aaka" => dSilakka s (x+"aa'an") (x+"aakoja") ; x + "aika" => dSilakka s (x+"ajan") (x+"aikoja") ; -- lots of compound words in NewDictFin that end in aika, but are not analysed as compounds + x + "ahka" => dSilakka s (x+"ahan") (x+"ahkoja") ; -- nahka~nahan not covered by weakGrade _ => let a = last s in dSilakka s (weakGrade s + "n") @@ -55,7 +56,10 @@ oper _ => dSilakka s (s + "n") (init s + "i" + vowelHarmony (last s)) } ; d10A : Str -> NForms -- 284 änkkä - = \s -> dSilakka s (weakGrade s + "n") (init s + "i" + vowelHarmony (last s)) ; + = \s -> case s of { + x + "hka" => dSilakka s (x+"han") (x+"hkia") ; -- tuhka, uhka + _ => dSilakka s (weakGrade s + "n") (init s + "i" + vowelHarmony (last s)) + } ; d11 : Str -> NForms -- 46 ödeema = \s -> dSilakka s (weakGrade s + "n") (init s + "i" + vowelHarmony (last s)) ; d12 : Str -> NForms -- 1125 örinä From 67d1e247611a95176815d1b0e9bb506cd89acc45 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Thu, 28 Sep 2023 16:18:23 +0200 Subject: [PATCH 089/129] producing a compilable WordNetAra.gf, with a lot of junk --- src/arabic/wiktionary/Makefile | 2 +- src/arabic/wiktionary/to_wordnet.py | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/arabic/wiktionary/Makefile b/src/arabic/wiktionary/Makefile index a14e23e5..90dcf30a 100644 --- a/src/arabic/wiktionary/Makefile +++ b/src/arabic/wiktionary/Makefile @@ -4,5 +4,5 @@ all: python3 read_wiktionary.py gf-map >source_of_MorphoDictAra.jsonl gf -make MorphoDictAra.gf python3 read_wiktionary.py eval-funs >eval.jsonl - python3 to_wordnet.py >wordnet-arabic.jsonl + python3 to_wordnet.py >WordNetAra.gf python3 read_wiktionary.py error-analysis diff --git a/src/arabic/wiktionary/to_wordnet.py b/src/arabic/wiktionary/to_wordnet.py index 2aae047d..df82b20d 100644 --- a/src/arabic/wiktionary/to_wordnet.py +++ b/src/arabic/wiktionary/to_wordnet.py @@ -1,3 +1,4 @@ +import sys import csv import json @@ -6,7 +7,6 @@ from arabic_utilities import * # to run: python3 to_wordnet.py >arabic-wn-morpho.jsonl # the following are assumed - # from https://www.grammaticalframework.org/~krasimir/arabic.tsv.gz # WN_TSV = 'arabic.tsv' # Krasimir WN_TSV = 'ar2en_words_gf.csv' # Zarzoura @@ -31,6 +31,9 @@ with open(MORPHO_GF) as gffile: # abandon_1_V2 ParseAra ترك (1,1,1,3,322,3) with open(WN_TSV) as wnfile: + print('--# -path=.:../gf-wordnet') + print('concrete WordNetAra of WordNet = CatAra ** open MorphoDictAra, MoreAra, ParadigmsAra in {') + ## wnreader = csv.reader(wnfile, delimiter='\t') for row in wnfile: ## word = row[-1].strip() # does not show tha arabic, but the second-last word @@ -38,7 +41,19 @@ with open(WN_TSV) as wnfile: wnfun = row.split()[-1] # 0 in Krasimir cat = [c for c in wnfun if c.isalpha()][-1] # the last letter; the dict only contains N, A, V funs = funmap.get((word, cat), []) - result = {'wnfun': wnfun, 'sought': word, 'found': funs} - print(json.dumps(result, ensure_ascii=False)) + mk = 'mkV2 ' if wnfun.endswith('V2') else '' + results = [' '.join(['lin', wnfun, '=', mk + fs['fun'], ';', '--', str(fs['sense'])]) + for fs in funs] + if results: + print(results[0]) + for r in results[1:]: + print('--', r) + else: + if (cat := wnfun[-2:]) in ['_A', '_N', '_V']: + lin = 'mk' + cat[-1] + ' "' + word + '"' + else: + lin = 'variants {}' + print(' '.join(['lin', wnfun, '=', lin, ';', '---', 'guess from', word])) + print('}') From 7827e892d99f8663baf1b9338cc91ddea22ad519 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 29 Sep 2023 09:38:36 +0200 Subject: [PATCH 090/129] (Fin) fix bug in PresPartAP and PastPartAP --- src/finnish/ExtendFin.gf | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/finnish/ExtendFin.gf b/src/finnish/ExtendFin.gf index 0ff848d0..10689d76 100644 --- a/src/finnish/ExtendFin.gf +++ b/src/finnish/ExtendFin.gf @@ -244,14 +244,22 @@ lin AdjAsCN ap = {s = ap.s ! True ; postmod = \\_ => ap.p ; h = Back} ; ---- Har lin AdjAsNP ap = MassNP (AdjAsCN ap) ; lin ApposNP np1 np2 = np1 ** {s = \\npf => np1.s ! npf ++ np2.s ! NPSep} ; lin PresPartAP vp = { - s = \\_,nf => vp.s.s ! PresPartAct (AN nf) ; + s = \\_,nf => preCompVP vp (PresPartAct (AN nf)) ; p = [] ; hasPrefix = False } ; lin PastPartAP vps = { - s = \\_,nf => vps.s.s ! PastPartAct (AN nf) ; + s = \\_,nf => preCompVP (PastPartAct (AN nf)) ; p = vps.c2.s.p1 ; hasPrefix = False } ; +oper + -- ruohoa syövä, Ranskassa valmistettu + preCompVP : S.VP -> VForm -> Str = \vp, vform -> + vp.s2 ! True ! Pos ! agrP3 Sg ++ + vp.adv ! Pos ++ + vp.s.s ! vform ++ + vp.ext ; + } From af6edf2e6ea74d7cb67be3b8c97ff63179e634cb Mon Sep 17 00:00:00 2001 From: aarneranta Date: Fri, 29 Sep 2023 10:44:57 +0200 Subject: [PATCH 091/129] saved WordNetAra for post-editing --- src/arabic/wiktionary/Makefile | 2 +- src/arabic/wiktionary/WordNetAra.gf | 530 ++++++++++++++++++++++++++++ 2 files changed, 531 insertions(+), 1 deletion(-) create mode 100644 src/arabic/wiktionary/WordNetAra.gf diff --git a/src/arabic/wiktionary/Makefile b/src/arabic/wiktionary/Makefile index 90dcf30a..00777b20 100644 --- a/src/arabic/wiktionary/Makefile +++ b/src/arabic/wiktionary/Makefile @@ -4,5 +4,5 @@ all: python3 read_wiktionary.py gf-map >source_of_MorphoDictAra.jsonl gf -make MorphoDictAra.gf python3 read_wiktionary.py eval-funs >eval.jsonl - python3 to_wordnet.py >WordNetAra.gf + python3 to_wordnet.py >next_WordNetAra.gf python3 read_wiktionary.py error-analysis diff --git a/src/arabic/wiktionary/WordNetAra.gf b/src/arabic/wiktionary/WordNetAra.gf new file mode 100644 index 00000000..992775b6 --- /dev/null +++ b/src/arabic/wiktionary/WordNetAra.gf @@ -0,0 +1,530 @@ +--# -path=.:../gf-wordnet +concrete WordNetAra of WordNet = CatAra ** open MorphoDictAra, MoreAra, ParadigmsAra in { +lin en = variants {} ; --- guess from +lin absolute_3_A = 'مُطْلَق_A' ; -- 4578 [['absolute, utter, very, unlimited, unrestricted'], ['downright'], ['sovereign'], ['liberated, free'], ['implicit']] +-- lin absolute_3_A = 'مُطَلَّق_A' ; -- 8217 [['divorced']] +lin administrative_A = mkA "داري" ; --- guess from داري +lin afghani_1_N = mkN "فغاني" ; --- guess from فغاني +lin afrikaans_N = mkN "لغةفريكانية" ; --- guess from لغةفريكانية +lin age_1_N = 'سِنّ_N' ; -- 480 [['tooth, tusk, fang'], ['point or tip'], ['a spearhead or arrowhead'], ['age (years of life)'], ['cog, sprocket, prong']] +-- lin age_1_N = 'سَنّ_N' ; -- 86682 [['verbal noun of سَنَّ (sanna) (form I)'], ['prescription, introduction, enactment']] +lin akan_N = mkN "الكانية" ; --- guess from الكانية +lin alabama_4_N = mkN "لاباما" ; --- guess from لاباما +lin albanian_2_N = mkN "اللبانية" ; --- guess from اللبانية +lin aleut_N = mkN "الليوتية" ; --- guess from الليوتية +lin amharic_N = mkN "المهرية" ; --- guess from المهرية +lin amir_N = mkN "مير" ; --- guess from مير +lin amount_to_2_V2 = variants {} ; --- guess from يصللى +lin arabic_A = 'عَرَبِي_A' ; -- 2706 [['Arab'], ['Arabic'], ['Arabian']] +lin arabic_N = mkN "العربية" ; --- guess from العربية +lin arapaho_N = mkN "الراباهو" ; --- guess from الراباهو +lin arawak_N = mkN "راواك" ; --- guess from راواك +lin area_6_N = 'مِنْطَقَة_N' ; -- 5712 [['belt, girdle'], ['zone'], ['vicinity, range, district, area, territory, sphere'], ['military sector'], ['area, an administrative subdivision of Kuwait'], ['province']] +-- lin area_6_N = 'مَنْطِقَة_N' ; -- 19267 [['zone'], ['vicinity, range, district, area, territory, sphere'], ['military sector'], ['area, an administrative subdivision of Kuwait'], ['province']] +-- lin area_6_N = 'مَنْطَقَة_N' ; -- 118100 [['verbal noun of مَنْطَقَ (manṭaqa) (form Iq)']] +lin armenian_2_N = mkN "ارمينية" ; --- guess from ارمينية +lin assamese_N = mkN "السامية" ; --- guess from السامية +lin assyrian_2_N = mkN "شوري" ; --- guess from شوري +lin authoritarian_1_A = mkA "استبدادي" ; --- guess from استبدادي +lin average_1_N = mkN "متوسط" ; --- guess from متوسط +lin avestan_N = mkN "الفستية" ; --- guess from الفستية +lin azerbaijani_N = mkN "الذرية" ; --- guess from الذرية +lin balboa_1_N = mkN "بلبوا" ; --- guess from بلبوا +lin balinese_N = mkN "اللغةالبالية" ; --- guess from اللغةالبالية +lin baltic_2_A = mkA "بلطيق" ; --- guess from بلطيق +lin ban_2_N = 'مَنْع_N' ; -- 118052 [['verbal noun of مَنَعَ (manaʕa) (form I)'], ['prevention']] +lin ban_3_N = 'نَهْي_N' ; -- 122876 [['verbal noun of نَهَى (nahā) (form I)'], ['an order not to do something, a prohibition, a proscription'], ['negative imperative, prohibitive; expressing a prohibition with the particle لَا (lā) and the jussive']] +lin bata_N = mkN "باتا" ; --- guess from باتا +lin belarusian_N = 'بِيلَارُوسِيّ_N' ; -- 2861 [['Belarusian (person)']] +lin bengali_3_N = mkN "البنغالية" ; --- guess from البنغالية +lin birr_1_N = 'بَرّ_N' ; -- 128073 [['land, dry land (as opposed to sea)'], ['outside, field']] +-- lin birr_1_N = 'بِرّ_N' ; -- 128094 [['verbal noun of بَرَّ (barra) (form I)'], ['faith, godliness, piety'], ['respectfulness'], ['kindness']] +lin blackfoot_N = mkN "بلاكفوت" ; --- guess from بلاكفوت +lin bole_3_N = 'جِذْع_N' ; -- 18227 [['a tree trunk, body, stock, torso']] +-- lin bole_3_N = 'جَذَع_N' ; -- 19252 [['youth, animal old enough to use (of livestock as well as humans)']] +lin boliviano_N = mkN "بوليفيانو" ; --- guess from بوليفيانو +lin book_1_N = 'كُتَّاب_N' ; -- 2089 [["a traditional school for teaching Qur'an"]] +-- lin book_1_N = 'كِتَاب_N' ; -- 111971 [['verbal noun of كَتَبَ (kataba) (form I)'], ['verbal noun of كَاتَبَ (kātaba) (form III)'], ['letter, note, paper, piece of writing, message'], ['book'], ["the Scripture, the Qur'an or the Bible"], ['record, document, deed, contract'], ['a marriage contract.']] +lin border_1_N = 'حَدّ_N' ; -- 66721 [['verbal noun of حَدَّ (ḥadda) (form I)'], ['limit'], ['boundary, border'], ['frontier'], ['term'], ['end, goal, aim'], ['district'], ['reach, sphere of action'], ['difference'], ['definition'], ['rule'], ['punishment'], ['edge, point'], ['passion'], ['intoxicating strength of liquors'], ['strength, bravery'], ['energy'], ['manner, way'], ['hindrance'], ['side']] +lin breton_N = mkN "البريتونية" ; --- guess from البريتونية +lin bulgarian_N = 'بُلْغارِيّ_N' ; -- 2929 [['Bulgarian (native or inhabitant of Bulgaria)']] +lin burmese_2_N = mkN "البورمية" ; --- guess from البورمية +lin caddo_N = mkN "الكادو" ; --- guess from الكادو +lin cantonese_N = mkN "الكنتونية" ; --- guess from الكنتونية +lin capital_3_N = mkN "عاصمة" ; --- guess from عاصمة +lin captain_1_N = 'نَقِيب_N' ; -- 12918 [['captain'], ['leader, chief'], ['magistrate, head of a community'], ['prefect, governor'], ['intelligent man'], ['master of ceremonies'], ['tongue of a balance'], ['pipe, flute']] +lin carib_N = mkN "الكاريبية" ; --- guess from الكاريبية +lin catalan_N = mkN "القطلونية" ; --- guess from القطلونية +lin catawba_N = mkN "كاتاوبا" ; --- guess from كاتاوبا +lin catering_N = mkN "خدمةغذائية" ; --- guess from خدمةغذائية +lin catholicism_N = mkN "المذهبالكاثوليكي" ; --- guess from المذهبالكاثوليكي +lin cayuga_N = mkN "الكايوجية" ; --- guess from الكايوجية +lin cebuano_N = mkN "السيبونية" ; --- guess from السيبونية +lin chairman_N = 'رَئِيس_N' ; -- 5965 [['boss, chief, leader'], ['director'], ['headmaster, principal'], ['chairman'], ['governor'], ['president'], ['manager, superintendent'], ['conductor'], ['captain']] +lin chancellor_2_N = mkN "مستشار" ; --- guess from مستشار +lin chechen_N = mkN "شيشاني" ; --- guess from شيشاني +lin cherokee_N = mkN "شيروكي" ; --- guess from شيروكي +lin chetrum_N = mkN "نغولترمبوتاني" ; --- guess from نغولترمبوتاني +lin cheyenne_N = mkN "الشايان" ; --- guess from الشايان +lin child_1_N = 'طِفْل_N' ; -- 6665 [['child (a minor)'], ['children (a minor)']] +lin child_2_N = 'طِفْل_N' ; -- 6665 [['child (a minor)'], ['children (a minor)']] +lin chinese_N = 'صِينِيَّة_N' ; -- 2999 [['Chinese language']] +-- lin chinese_N = 'صِينِيَّة_1_N' ; -- 3000 [['Chinese porcelain, china'], ['plate'], ['dish'], ['tray']] +-- lin chinese_N = 'صِينِيَّة_2_N' ; -- 94044 [['feminine singular of صِينِيّ (ṣīniyy, “Chinese person”)']] +lin chinook_4_N = mkN "سالمون" ; --- guess from سالمون +lin chinook_jargon_N = mkN "الشينوكجارجون" ; --- guess from الشينوكجارجون +lin chipewyan_N = mkN "الشيباوايان" ; --- guess from الشيباوايان +lin chippewa_N = mkN "شيبيوا" ; --- guess from شيبيوا +lin choctaw_N = mkN "الشوكتو" ; --- guess from الشوكتو +lin christianity_1_N = 'مَسِيحِيَّة_N' ; -- 3072 [['Christianity'], ['female equivalent of مَسِيحِيّ (masīḥiyy)']] +lin chukchi_N = mkN "لغةتشوكشي" ; --- guess from لغةتشوكشي +lin chuvash_N = mkN "التشوفاشي" ; --- guess from التشوفاشي +lin city_1_N = 'مَدِينَة_N' ; -- 18135 [['town, city'], ['jurisdiction']] +lin coat_of_arms_N = mkN "شعارالنبالة" ; --- guess from شعارالنبالة +lin colon_3_N = mkN "قولون" ; --- guess from قولون +lin commonwealth_3_N = mkN "كومنولث" ; --- guess from كومنولث +lin communist_A = 'شُيُوعِي_A' ; -- 7022 [['communist'], ['Communist'], ['communal']] +lin consider_6_V3 = variants {} ; --- guess from نظراخذبعينالاعتبار +lin constitutional_2_A = 'دُسْتُورِي_A' ; -- 1506 [['constitutional']] +lin coptic_N = mkN "القبطية" ; --- guess from القبطية +lin cordoba_N = mkN "كوردوبا" ; --- guess from كوردوبا +lin cornish_N = mkN "الكورنية" ; --- guess from الكورنية +lin council_1_N = 'مَجْلِس_N' ; -- 15878 [['seat'], ['place of meeting; seat of an assembling body; conference room; court; tribunal'], ['session, sitting, meeting, party'], ['council, college, collegium, board, committee, commission'], ['husainiya']] +lin country_1_N = 'دَوْلَة_N' ; -- 16961 [['state (sovereign polity)'], ['alternation, change']] +lin country_2_N = 'بَلَد_N' ; -- 7321 [['country, land, homeland'], ['town, city'], ['place, village, community']] +lin cree_N = mkN "الكرى" ; --- guess from الكرى +lin crow_6_N = mkN "الغراب" ; --- guess from الغراب +lin culture_6_N = 'ثَقَافَة_N' ; -- 61562 [['verbal noun of ثَقُفَ (ṯaqufa) (form I)'], ['sagacity, intelligence, wit, refinement, culture'], ['culture (civilization)'], ['education, literacy']] +lin currency_1_N = 'عُمْلَة_N' ; -- 7550 [['currency, standardized money']] +-- lin currency_1_N = 'عَمْلَة_N' ; -- 8932 [['evil deed, perfidy']] +-- lin currency_1_N = 'عِمْلَة_N' ; -- 13013 [['mode of acting, manner of service, wise of working on a thing']] +lin current_A = mkA "جار" ; --- guess from جار +lin czech_3_N = mkN "التشيكية" ; --- guess from التشيكية +lin dakota_3_N = mkN "الداكوتا" ; --- guess from الداكوتا +lin dalasi_N = mkN "دلاسى" ; --- guess from دلاسى +lin danish_1_N = mkN "دانماركية" ; --- guess from دانماركية +lin dari_N = mkN "دري" ; --- guess from دري +lin decentralization_2_N = mkN "لامركزية" ; --- guess from لامركزية +lin decline_1_N = 'نَقْص_N' ; -- 122335 [['verbal noun of نَقَصَ (naqaṣa) (form I)'], ['reduction'], ['lack']] +lin delaware_5_N = mkN "الديلوير" ; --- guess from الديلوير +lin democracy_2_N = 'جُمْهُورِيَّة_N' ; -- 15302 [['republicanism'], ['republic']] +-- lin democracy_2_N = 'جُمْهُورِيَّة_1_N' ; -- 65212 [['female equivalent of جُمْهُورِيّ (jumhūriyy)']] +lin democratic_1_A = 'دِيمُقْرَاطِي_A' ; -- 7835 [['democratic']] +lin demographic_N = mkN "ديموغرافي" ; --- guess from ديموغرافي +lin designate_4_V2 = mkV2 'صَمَّمَ_V' ; -- 7721 [['to deafen [+accusative]', 'to deafen'], ['to resolve, to become bent on [+ عَلَى (object)]', 'to resolve, to become bent on'], ['to design, to configure, to devise, to contrive, to fix [+accusative]', 'to design, to configure, to devise, to contrive, to fix']] +lin development_2_N = mkN "تطوير" ; --- guess from تطوير +lin dictatorship_N = mkN "استبدادية" ; --- guess from استبدادية +lin dinar_1_N = mkN "دينار" ; --- guess from دينار +lin dinar_3_N = mkN "دينار" ; --- guess from دينار +lin dinar_5_N = mkN "دينار" ; --- guess from دينار +lin dinar_6_N = mkN "دينار" ; --- guess from دينار +lin dinar_7_N = mkN "دينار" ; --- guess from دينار +lin dinar_8_N = mkN "دينار" ; --- guess from دينار +lin dinar_9_N = mkN "دينار" ; --- guess from دينار +lin dinka_N = mkN "الدنكا" ; --- guess from الدنكا +lin dirham_2_N = mkN "درهم" ; --- guess from درهم +lin dirham_3_N = mkN "درهم" ; --- guess from درهم +lin distribution_1_N = mkN "توزيع" ; --- guess from توزيع +lin dobra_N = mkN "دوبرا" ; --- guess from دوبرا +lin domestic_1_A = mkA "داخلى" ; --- guess from داخلى +lin dong_N = mkN "دونغ" ; --- guess from دونغ +lin dram_3_N = mkN "دراخما" ; --- guess from دراخما +lin drinking_water_N = mkN "ماشرب" ; --- guess from ماشرب +lin dutch_N = 'هُولَنْدِيّ_N' ; -- 3835 [['Netherlander, Dutchman']] +lin east_4_N = 'شَرْق_N' ; -- 8514 [['east; Orient']] +-- lin east_4_N = 'شَرَق_N' ; -- 89149 [['verbal noun of شَرِقَ (šariqa) (form I)']] +lin eastern_4_A = 'شَرْقِي_A' ; -- 8518 [['eastern'], ['Eastern, Oriental']] +lin economy_1_N = 'اِقْتِصَاد_N' ; -- 44555 [['verbal noun of اِقْتَصَدَ (iqtaṣada) (form VIII)'], ['economy (“frugal use of resources”)'], ['economy (“system of production and distribution”)'], ['economics']] +lin education_1_N = 'تَعْلِيم_N' ; -- 100950 [['verbal noun of عَلَّمَ (ʕallama) (form II)'], ['teaching, education']] +lin emperor_1_N = mkN "مبراطور" ; --- guess from مبراطور +lin english_N = mkN "النجليزية" ; --- guess from النجليزية +lin equality_1_N = 'مُسَاوَاة_N' ; -- 84036 [['verbal noun of سَاوَى (sāwā) (form III)'], ['equality, equivalence'], ['equal rights'], ['settlement (of a bill)']] +lin escudo_2_N = mkN "سكودو" ; --- guess from سكودو +lin esperanto_N = mkN "سبرانتو" ; --- guess from سبرانتو +lin estonian_N = mkN "الستونية" ; --- guess from الستونية +lin evenki_N = mkN "اللغةاليفينكية" ; --- guess from اللغةاليفينكية +lin ewe_2_N = mkN "اليوي" ; --- guess from اليوي +lin extreme_1_A = mkA "قصى" ; --- guess from قصى +lin fang_1_N = mkN "الفانج" ; --- guess from الفانج +lin faroese_N = mkN "لغةفاروية" ; --- guess from لغةفاروية +lin father_1_N = 'وَالِد_N' ; -- 9224 [['father'], ['parent'], ['paternal relatives']] +lin federal_4_A = mkA "فيدرالي" ; --- guess from فيدرالي +lin fertility_1_N = mkN "معدلالمواليد" ; --- guess from معدلالمواليد +lin fijian_2_N = mkN "الفيجية" ; --- guess from الفيجية +lin filipino_2_N = mkN "الفلبينية" ; --- guess from الفلبينية +lin finnish_N = mkN "الفنلندية" ; --- guess from الفنلندية +lin firewood_N = mkN "حطب" ; --- guess from حطب +lin flag_1_N = 'عَلَم_N' ; -- 16266 [['sign, token, mark, badge'], ['harelip'], ['road sign, guidepost'], ['flag, banner'], ['authority, luminary, star, personage, distinguished man'], ['a mountain'], ['proper noun']] +-- lin flag_1_N = 'عِلْم_N' ; -- 101070 [['verbal noun of عَلِمَ (ʕalima) (form I)'], ['knowledge, learning, lore'], ['cognition, acquaintance'], ['information'], ['perception, knowledge'], ['(plural عُلُوم (ʕulūm)) science', 'science']] +lin flaw_3_N = 'خَلَل_N' ; -- 9954 [['gap, breach, interstice, interspace, chink'], ['flaw, imbalance, bug, disturbance, trait of disorder']] +lin flemish_2_N = mkN "الفلمنكية" ; --- guess from الفلمنكية +lin flour_N = 'دَقِيق_N' ; -- 9558 [['flour, meal']] +lin following_2_A = mkA "تال" ; --- guess from تال +lin food_1_N = 'طَعَام_N' ; -- 265 [['food'], ['food', 'prepared meal'], ['feeding'], ['wheat'], ['grain, cereal']] +lin forint_N = mkN "فورنتمجري" ; --- guess from فورنتمجري +lin former_3_A = 'سَابِق_A' ; -- 14587 [['preceding, previous'], ['former'], ['active participle of سَبَقَ (sabaqa).']] +lin formula_6_N = mkN "صيغ" ; --- guess from صيغ +lin fox_7_N = mkN "الثعلب" ; --- guess from الثعلب +lin free_1_A = 'حُرّ_A' ; -- 9798 [['free'], ['unimpeded'], ['set free, freedman'], ['born free and noble'], ['virtuous, genuine, true, pure, good'], ['unmixed']] +lin freedom_1_N = 'حُرِّيَّة_N' ; -- 67184 [['verbal noun of حَرَّ (ḥarra) (form I)'], ['freedom, liberty']] +lin french_N = 'فَرَنْسِيَّة_N' ; -- 104633 [['female equivalent of فَرَنْسِيّ (faransiyy, “a Frenchman”): a Frenchwoman'], ['the French language, French']] +lin friulian_N = mkN "الفريلايان" ; --- guess from الفريلايان +lin fula_N = mkN "الفلة" ; --- guess from الفلة +lin full_3_A = mkA "ممتلئ" ; --- guess from ممتلئ +lin galician_N = mkN "الجاليكية" ; --- guess from الجاليكية +lin garment_N = mkN "لباس" ; --- guess from لباس +lin georgian_3_N = mkN "الجورجية" ; --- guess from الجورجية +lin german_N = mkN "المانية" ; --- guess from المانية +lin gikuyu_N = mkN "الكيكيو" ; --- guess from الكيكيو +lin gondi_N = mkN "الجندي" ; --- guess from الجندي +lin gourde_N = mkN "غورد" ; --- guess from غورد +lin government_1_N = 'حُكُومَة_N' ; -- 69517 [['verbal noun of حَكَمَ (ḥakama) (form I)'], ['government'], ['authority, dominion'], ['empire, state'], ['jurisdiction'], ['sentence, judgment']] +lin greek_N = mkN "يونانية" ; --- guess from يونانية +lin gross_1_A = mkA "جمالي" ; --- guess from جمالي +lin growth_3_N = 'زِيَادَة_N' ; -- 81582 [['verbal noun of زَادَ (zāda) (form I)'], ['increase, surplus, addition']] +lin guarani_1_N = mkN "الجواراني" ; --- guess from الجواراني +lin guarani_3_N = mkN "الجوارانى" ; --- guess from الجوارانى +lin gujarati_N = mkN "الغوجاراتية" ; --- guess from الغوجاراتية +lin haida_N = mkN "الهيدا" ; --- guess from الهيدا +lin haitian_creole_N = mkN "الهايتية" ; --- guess from الهايتية +lin hakka_N = mkN "الهاكا" ; --- guess from الهاكا +lin haler_2_N = mkN "معافى" ; --- guess from معافى +lin hani_N = mkN "هاني" ; --- guess from هاني +lin hausa_N = mkN "الهوسا" ; --- guess from الهوسا +lin have_1_V2 = mkV2 'مَلَّكَ_V' ; -- 13781 [['to make the owner'], ['to put in possession'], ['to transfer ownership, to assign, to make over, to convey'], ['to make king']] +-- lin have_1_V2 = mkV2 'مَلَكَ_V' ; -- 14483 [['to take in possession, to take over, to acquire, to seize'], ['to possess, to lay hold, to own, to have, to be the owner'], ['to dominate, to control'], ['to be the master'], ['to be capable, to be able, to be in a position to'], ['to rule, to reign, to exercise authority, to hold sway, to lord over']] +lin hawaiian_N = mkN "لغةهلالهاواي" ; --- guess from لغةهلالهاواي +lin head_4_N = 'شَيْخ_N' ; -- 13596 [['old man'], ['elderly gentleman, elder'], ['sheik, chief, chieftain, patriarch'], ['senator'], ['sheik; Dr.; professor (title of professors and spiritual leaders)'], ['sir (respectful title of address)'], ['master (someone outstanding or excellent)']] +lin healthcare_2_N = mkN "رعايةصحية" ; --- guess from رعايةصحية +lin hereditary_2_A = mkA "موروث" ; --- guess from موروث +lin herero_N = mkN "الهيريرو" ; --- guess from الهيريرو +lin hidatsa_N = mkN "هيداتسا" ; --- guess from هيداتسا +lin high_1_A = mkA "عال" ; --- guess from عال +lin hindi_N = mkN "هندية" ; --- guess from هندية +lin hopi_N = mkN "هوبي" ; --- guess from هوبي +lin hotel_N = 'فُنْدُق_N' ; -- 11607 [['inn'], ['hotel']] +-- lin hotel_N = 'فُنْدُق_1_N' ; -- 50563 [['Alternative form of بُنْدُق (bunduq)']] +lin hryvnia_N = mkN "هريفنا" ; --- guess from هريفنا +lin human_N = 'بَشْر_N' ; -- 49147 [['verbal noun of بَشَرَ (bašara) (form I)']] +-- lin human_N = 'بَشَر_N' ; -- 49243 [['verbal noun of بَشِرَ (bašira) (form I)'], ['verbal noun of بَشَرَ (bašara) (form I)']] +lin hungarian_2_N = mkN "الهنغارية" ; --- guess from الهنغارية +lin hupa_N = mkN "الهبا" ; --- guess from الهبا +lin hybrid_A = mkA "هجن" ; --- guess from هجن +lin icelandic_N = mkN "اليسلندية" ; --- guess from اليسلندية +lin income_N = 'دَخَل_N' ; -- 8181 [['disturbance, imbalance, derangement, disorder, mental defect'], ['defect, infirmity']] +-- lin income_N = 'دَخْل_N' ; -- 11518 [['income'], ['revenues, receipts, returns'], ['interference, intervention'], ['doubt, misgiving']] +lin index_2_N = 'دَلِيل_N' ; -- 123 [['sign, indication, proof, demonstration, evidence, argument'], ['syllogism'], ['road sign'], ['road, street'], ['guidebook'], ['index (alphabetical listing)']] +-- lin index_2_N = 'دَلِيل_1_N' ; -- 8080 [['director'], ['guide'], ['indicator (person who indicates)'], ['discoverer']] +lin individual_4_A = 'شَخْصِي_A' ; -- 13778 [['own'], ['personal'], ['personal']] +lin indonesian_2_N = mkN "الندونيسية" ; --- guess from الندونيسية +lin inequality_N = 'تَفَاوُت_N' ; -- 57194 [['verbal noun of تَفَاوَتَ (tafāwata) (form VI)']] +lin inflation_1_N = 'تَضَخُّم_N' ; -- 55857 [['verbal noun of تَضَخَّمَ (taḍaḵḵama) (form V)'], ['inflation (“increase in prices”)']] +lin ingrian_N = mkN "لغةنغرية" ; --- guess from لغةنغرية +lin inhabitant_1_N = 'مُوَاطِن_N' ; -- 6746 [['citizen; national'], ['countryman, compatriot, fellow citizen']] +lin irish_3_N = mkN "اليرلندية" ; --- guess from اليرلندية +lin islam_2_N = mkN "السلام" ; --- guess from السلام +lin islamic_A = mkA "سلامي" ; --- guess from سلامي +lin island_1_N = 'جَزِيرَة_N' ; -- 11757 [['island'], ['peninsula'], ['area, region, territory, section, district; any separated location, especially one delimited by natural boundaries']] +lin italian_N = mkN "يطالية" ; --- guess from يطالية +lin japanese_N = mkN "اليابانية" ; --- guess from اليابانية +lin javanese_2_N = mkN "الجاوية" ; --- guess from الجاوية +lin kamba_N = mkN "الكامبا" ; --- guess from الكامبا +lin kannada_N = mkN "الكانادا" ; --- guess from الكانادا +lin kansas_4_N = mkN "كانزاس" ; --- guess from كانزاس +lin karakalpak_N = mkN "الكاراكالباك" ; --- guess from الكاراكالباك +lin karelian_N = mkN "الكاريلية" ; --- guess from الكاريلية +lin kashmiri_2_N = mkN "الكشميرية" ; --- guess from الكشميرية +lin kazakh_N = mkN "الكازاخستانية" ; --- guess from الكازاخستانية +lin khanty_N = mkN "خانتي" ; --- guess from خانتي +lin khmer_1_N = mkN "الخميرية" ; --- guess from الخميرية +lin khowar_N = mkN "كهوار" ; --- guess from كهوار +lin kickapoo_N = mkN "كيكابو" ; --- guess from كيكابو +lin kilometre_1_N = 'كَمّ_N' ; -- 647 [['quantity, multitude'], ['quantum']] +-- lin kilometre_1_N = 'كِمّ_N' ; -- 6304 [['calyx of a flower, the envelope or spathe of a palm-tree or the like']] +-- lin kilometre_1_N = 'كُمّ_N' ; -- 16436 [['sleeve of a garment']] +lin kina_N = mkN "كينا" ; --- guess from كينا +lin king_1_N = 'مَلَك_N' ; -- 1462 [['angel']] +-- lin king_1_N = 'مَلِك_N' ; -- 11923 [['king, sovereign, monarch']] +-- lin king_1_N = 'مَلَك_1_N' ; -- 14484 [['possession, property'], ['food and water, resources; anything which regulates, maintains, or sustains; essentials, supplies, utilities'], ['foundation of ones existence'], ['foundation of ones existence', 'agent or effective cause']] +-- lin king_1_N = 'مِلْك_N' ; -- 117902 [['verbal noun of مَلَكَ (malaka) (form I)'], ['property, possession, goods and chattels, fortune, wealth'], ['estate'], ['real estate, landed property']] +-- lin king_1_N = 'مُلْك_N' ; -- 117903 [['verbal noun of مَلَكَ (malaka) (form I)'], ['rule, reign, supreme authority, dominion, dominance, sway, power'], ['sovereignty, kingship, royalty'], ['monarchy']] +-- lin king_1_N = 'مَلْك_N' ; -- 117904 [['verbal noun of مَلَكَ (malaka) (form I)']] +lin kinyarwanda_N = mkN "الكينيارواندا" ; --- guess from الكينيارواندا +lin kip_2_N = mkN "كيب" ; --- guess from كيب +lin koasati_N = mkN "كواساتي" ; --- guess from كواساتي +lin kobo_N = mkN "نيره" ; --- guess from نيره +lin kola_2_N = mkN "كولا" ; --- guess from كولا +lin komi_N = mkN "الكومي" ; --- guess from الكومي +lin kongo_N = mkN "الكونغو" ; --- guess from الكونغو +lin korean_2_N = mkN "الكورية" ; --- guess from الكورية +lin krona_1_N = mkN "كورونا" ; --- guess from كورونا +lin krona_2_N = mkN "كورونا" ; --- guess from كورونا +lin krone_1_N = mkN "كورونا" ; --- guess from كورونا +lin krone_2_N = mkN "كورونا" ; --- guess from كورونا +lin kurdish_N = mkN "الكردية" ; --- guess from الكردية +lin kwacha_1_N = mkN "كواشا" ; --- guess from كواشا +lin kwacha_2_N = mkN "كواشا" ; --- guess from كواشا +lin kwanza_1_N = mkN "كوانزا" ; --- guess from كوانزا +lin kyat_N = mkN "كيات" ; --- guess from كيات +lin ladin_N = mkN "اللغةاللادنية" ; --- guess from اللغةاللادنية +lin language_1_N = 'لُغَة_N' ; -- 12037 [['language'], ['dialect, vernacular'], ['jargon'], ['a variant'], ['Classical Arabic'], ['lexicography, lexicographic literature, lexicographers']] +lin lao_2_N = mkN "اللاوية" ; --- guess from اللاوية +lin large_1_A = 'كَبِير_A' ; -- 1433 [['big, large'], ['great, great importance'], ['old (for a person)']] +lin lari_1_N = mkN "لارى" ; --- guess from لارى +lin latvian_N = 'لَاتْفِيّ_N' ; -- 2513 [['Latvian man']] +lin leader_1_N = 'رَئِيس_N' ; -- 5965 [['boss, chief, leader'], ['director'], ['headmaster, principal'], ['chairman'], ['governor'], ['president'], ['manager, superintendent'], ['conductor'], ['captain']] +lin lempira_N = mkN "لمبيرا" ; --- guess from لمبيرا +lin leone_N = mkN "ليون" ; --- guess from ليون +lin library_1_N = 'مَكْتَبَة_N' ; -- 12230 [['library'], ['bookstore'], ['bookcase'], ['desk'], ['literature']] +lin literacy_N = mkN "محوالمية" ; --- guess from محوالمية +lin lithuanian_N = mkN "الليتوانية" ; --- guess from الليتوانية +lin livonian_N = mkN "ليفونية" ; --- guess from ليفونية +lin low_1_A = 'مُنْخَفِض_A' ; -- 599 [['low (altitude, frequency, price, etc.)'], ['soft, low, subdued, muffled']] +lin low_german_N = mkN "اللمانيةالسفلى" ; --- guess from اللمانيةالسفلى +lin luo_N = mkN "اللو" ; --- guess from اللو +lin macedonian_2_N = mkN "المقدونية" ; --- guess from المقدونية +lin malay_2_N = mkN "الملايو" ; --- guess from الملايو +lin malayalam_N = mkN "الماليالام" ; --- guess from الماليالام +lin malaysian_2_N = mkN "الملايو" ; --- guess from الملايو +lin malt_3_N = mkN "شرابالشعيرجعة" ; --- guess from شرابالشعيرجعة +lin maltese_2_N = mkN "المالطية" ; --- guess from المالطية +lin manat_2_N = mkN "مانات" ; --- guess from مانات +lin manchu_N = mkN "المانشو" ; --- guess from المانشو +lin mandarin_6_N = mkN "يوسفي" ; --- guess from يوسفي +lin mansi_N = mkN "مانسية" ; --- guess from مانسية +lin maori_2_N = mkN "الماورية" ; --- guess from الماورية +lin marathi_N = mkN "الماراثي" ; --- guess from الماراثي +lin margarine_N = mkN "مارغرين" ; --- guess from مارغرين +lin mari_N = mkN "الماري" ; --- guess from الماري +lin median_3_A = 'مُتَوَسِّط_A' ; -- 12899 [['being in the middle, mediating'], ['middle, central'], ['medium'], ['average, middling, indifferent']] +lin medication_1_N = mkN "دوا" ; --- guess from دوا +lin medium_1_A = 'مُتَوَسِّط_A' ; -- 12899 [['being in the middle, mediating'], ['middle, central'], ['medium'], ['average, middling, indifferent']] +lin member_4_N = 'عُضْو_N' ; -- 13692 [['organ'], ['member'], ['limb'], ['branch, piece, section']] +lin menominee_N = mkN "مينوميني" ; --- guess from مينوميني +lin metical_N = mkN "متيكال" ; --- guess from متيكال +lin military_2_A = 'عَسْكَرِي_A' ; -- 614 [['military']] +lin moderate_1_A = 'مُعْتَدِل_A' ; -- 17086 [['straight, even, proportionate'], ['temperate, mild, moderate']] +lin modern_greek_N = mkN "اللغةاليونانيةالحديثة" ; --- guess from اللغةاليونانيةالحديثة +lin mohawk_2_N = mkN "الموهوك" ; --- guess from الموهوك +lin mon_3_N = mkN "الاثنين" ; --- guess from الاثنين +lin monarchy_N = 'مَلَكِيَّة_N' ; -- 13048 [['monarchy']] +-- lin monarchy_N = 'مِلْكِيَّة_N' ; -- 13782 [['ownership, property']] +lin mongolian_2_N = mkN "المنغولية" ; --- guess from المنغولية +lin mother_1_N = mkN "م" ; --- guess from م +lin muslim_A = 'مُسْلِم_A' ; -- 3785 [['Muslim'], ['submitting, accepting, believing.']] +-- lin muslim_A = 'مُسَلَّم_A' ; -- 18466 [['unimpaired, intact, unblemished, flawless'], ['accepted, uncontested, incontestable, indisputable, incontrovertible']] +lin nahuatl_N = mkN "الناهيوتل" ; --- guess from الناهيوتل +lin nanticoke_N = mkN "نانتيكوك" ; --- guess from نانتيكوك +lin navajo_N = mkN "النافاجو" ; --- guess from النافاجو +lin nenets_N = mkN "لغاتالنينيتس" ; --- guess from لغاتالنينيتس +lin nepali_N = mkN "النيبالية" ; --- guess from النيبالية +lin newspaper_3_N = 'جَرِيدَة_N' ; -- 63831 [['singulative of جَرِيد (jarīd, “defoliated palm”)'], ['detachment of horsemen'], ['newspaper']] +lin nganasan_N = mkN "لغةنجاناسان" ; --- guess from لغةنجاناسان +lin nordic_2_A = mkA "شمالي" ; --- guess from شمالي +lin north_3_N = 'شِمَال_N' ; -- 6426 [['case, sheath, wrapping']] +-- lin north_3_N = 'شِمَال_1_N' ; -- 12168 [['left hand'], ['left side'], ['bad omen'], ['handful of ears']] +-- lin north_3_N = 'شَمَال_N' ; -- 13431 [['north wind']] +-- lin north_3_N = 'شَمَال_1_N' ; -- 13432 [['north']] +lin northeast_1_N = mkN "شماليشرقي" ; --- guess from شماليشرقي +lin northwest_3_N = mkN "شماليجنوبي" ; --- guess from شماليجنوبي +lin norwegian_N = mkN "النرويجية" ; --- guess from النرويجية +lin nyamwezi_N = mkN "النيامويزي" ; --- guess from النيامويزي +lin nynorsk_N = mkN "النينورسكالنرويجي" ; --- guess from النينورسكالنرويجي +lin obligatory_1_A = mkA "مفروضواجب" ; --- guess from مفروضواجب +lin occitan_N = mkN "الوكيتانية" ; --- guess from الوكيتانية +lin office_4_N = 'مَكْتَب_N' ; -- 12603 [['maktab, elementary school'], ['desk'], ['office'], ['bureau'], ['study']] +lin official_1_A = 'رَسْمِي_A' ; -- 13575 [['official, legitimate'], ['formal'], ['normal'], ['conventional, according to rule'], ['ceremonial']] +lin official_3_A = 'رَسْمِي_A' ; -- 13575 [['official, legitimate'], ['formal'], ['normal'], ['conventional, according to rule'], ['ceremonial']] +lin oneida_N = mkN "لغةالونيدا" ; --- guess from لغةالونيدا +lin orthodox_3_A = mkA "رثوذكسي" ; --- guess from رثوذكسي +lin osage_N = mkN "الوساج" ; --- guess from الوساج +lin ouguiya_N = mkN "وقية" ; --- guess from وقية +lin paanga_N = mkN "بانجاتونجي" ; --- guess from بانجاتونجي +lin parliamentary_2_A = 'بَرْلَمَانِي_A' ; -- 13881 [['parliamentary']] +lin pashto_1_N = mkN "بشتو" ; --- guess from بشتو +lin periodical_N = mkN "دورية" ; --- guess from دورية +lin persian_N = mkN "الفارسية" ; --- guess from الفارسية +lin peso_1_N = mkN "بيزو" ; --- guess from بيزو +lin peso_2_N = mkN "بيزو" ; --- guess from بيزو +lin peso_3_N = mkN "بيزو" ; --- guess from بيزو +lin peso_5_N = mkN "بيزو" ; --- guess from بيزو +lin peso_6_N = mkN "بيزو" ; --- guess from بيزو +lin peso_7_N = mkN "بيزو" ; --- guess from بيزو +lin peso_8_N = mkN "بيزو" ; --- guess from بيزو +lin plant_2_N = mkN "نبات" ; --- guess from نبات +lin point_10_N = 'نُقْطَة_N' ; -- 8264 [['dot, point'], ['period (punctuation mark)'], ['spot (stain, tarnish)'], ['drop']] +lin polish_4_N = mkN "بولندية" ; --- guess from بولندية +lin politics_2_N = 'سِيَاسَة_N' ; -- 83564 [['verbal noun of سَاسَ (sāsa) (form I)'], ['administration, management'], ['policy'], ['politics'], ['political government (as opposed to رِئَاسَة (riʔāsa, “ecclesiastical government”))']] +lin population_1_N = mkN "سكانعددالسكان" ; --- guess from سكانعددالسكان +lin portuguese_1_N = mkN "برتغالية" ; --- guess from برتغالية +lin position_6_N = mkN "منصبموقع" ; --- guess from منصبموقع +lin potawatomi_N = mkN "بوتاواتومي" ; --- guess from بوتاواتومي +lin pound_2_N = mkN "جنيه" ; --- guess from جنيه +lin pound_4_N = mkN "جنيه" ; --- guess from جنيه +lin pound_5_N = mkN "جنيه" ; --- guess from جنيه +lin pound_6_N = mkN "جنيه" ; --- guess from جنيه +lin pound_8_N = mkN "جنيه" ; --- guess from جنيه +lin powhatan_N = mkN "بوهاتان" ; --- guess from بوهاتان +lin premier_2_N = mkN "رئيسالوزرارائد" ; --- guess from رئيسالوزرارائد +lin presidentFem_3_N = mkN "رئيسرئيسة" ; --- guess from رئيسرئيسة +lin presidentMasc_3_N = 'رَئِيس_N' ; -- 5965 [['boss, chief, leader'], ['director'], ['headmaster, principal'], ['chairman'], ['governor'], ['president'], ['manager, superintendent'], ['conductor'], ['captain']] +lin presidential_1_A = mkA "رياسي" ; --- guess from رياسي +lin prime_minister_2_N = mkN "رئيسالوزرا" ; --- guess from رئيسالوزرا +lin prince_N = mkN "مير" ; --- guess from مير +lin product_2_N = mkN "نتاج" ; --- guess from نتاج +lin prussian_N = mkN "بروسي" ; --- guess from بروسي +lin pula_N = mkN "بولا" ; --- guess from بولا +lin quechua_N = mkN "كيشوا" ; --- guess from كيشوا +lin queen_2_N = 'مَلَكَة_N' ; -- 14486 [['possession'], ['acquisition'], ['attainment, acquired skill or quality, talent, virtue'], ['habit, custom'], ['slavery']] +-- lin queen_2_N = 'مَلِكَة_N' ; -- 14927 [['queen']] +lin quetzal_1_N = mkN "كتزال" ; --- guess from كتزال +lin rand_1_N = mkN "راند" ; --- guess from راند +lin rank_2_V2 = mkV2 'وَضَعَ_V' ; -- 1785 [['to put; to lay; to place; to set; to position; to install; to implant'], ['to lump, to group; to put together'], ['to lump, to group; to put together', 'to lay and cluster (eggs) in a nest'], ['to store away, to stow away, to deposit; to put down, to lay down'], ['to stop holding or using (a tool or an instrument, such as a weapon), to put away or down, to lay down; to put aside', 'to cancel (a law, a regulation, and so on), to abrogate; to set aside'], ['to stop holding or using (a tool or an instrument, such as a weapon), to put away or down, to lay down; to put aside', 'to remove (clothes); to put off or down, to lay off or down, to doff; to take off'], ['to stop holding or using (a tool or an instrument, such as a weapon), to put away or down, to lay down; to put aside', 'to give birth to (a baby), to deliver, to bear'], ['to posit (a law, a regulation, and so on); to impose; to set down, to lay down'], ['to posit (a law, a regulation, and so on); to impose; to set down, to lay down', 'to posit (an explanation, a theory, and so on); to propose, to set forth; to put down'], ['to add'], ['to add', 'to interpose (something, as in a text or a literature, especially falsely), to insert; to interpolate; to put in'], ['to see or treat as lowly, to demean']] +lin rate_2_N = 'سِعْر_N' ; -- 14666 [['price'], ['quote (a summary of work to be done with a set price)']] +-- lin rate_2_N = 'سُعْر_N' ; -- 18715 [['voracious hunger'], ['infection']] +lin rate_4_N = 'مُعَدَّل_N' ; -- 15035 [['rate'], ['average']] +lin real_2_N = mkN "حقيقي" ; --- guess from حقيقي +lin regent_1_N = mkN "قيم" ; --- guess from قيم +lin regime_1_N = mkN "حكومةنطام" ; --- guess from حكومةنطام +lin religion_2_N = 'دَيْن_N' ; -- 74728 [['verbal noun of دَانَ (dāna) (form I)'], ['debt, debit, liability, pecuniary, obligation, financial claim']] +-- lin religion_2_N = 'دِين_N' ; -- 74729 [['verbal noun of دَانَ (dāna, “to be religious”) (form I)'], ['religion, creed, credo, faith, conviction, belief, tenet, rite'], ['conformism, conformance, conformity, compliance, fealty, obedience; God-fearingness, godliness, religiosity, devoutness'], ['law, obligations, duty'], ['custom, habit'], ['judgement, decision, ruling', 'requital, compensation, indemnification'], ['judgement, decision, ruling', 'credit, obligation, account, falling due of a debt']] +lin rental_2_N = mkN "يجار" ; --- guess from يجار +lin representative_3_A = mkA "مندوبممثل" ; --- guess from مندوبممثل +lin republic_2_N = 'جُمْهُورِيَّة_N' ; -- 15302 [['republicanism'], ['republic']] +-- lin republic_2_N = 'جُمْهُورِيَّة_1_N' ; -- 65212 [['female equivalent of جُمْهُورِيّ (jumhūriyy)']] +lin reserve_2_N = mkN "احتياط" ; --- guess from احتياط +lin result_in_V2 = variants {} ; --- guess from سفرعن +lin rial_1_N = 'رِيَال_N' ; -- 918 [['riyal (the official currency of Saudi Arabia and Qatar).'], ['rial (the official currency of Oman, Yemen, and Iran).'], ['real (the official currency of Brazil).'], ['real (any of a number of defunct currencies in the former Spanish and Portuguese Empires)']] +lin rial_2_N = 'رِيَال_N' ; -- 918 [['riyal (the official currency of Saudi Arabia and Qatar).'], ['rial (the official currency of Oman, Yemen, and Iran).'], ['real (the official currency of Brazil).'], ['real (any of a number of defunct currencies in the former Spanish and Portuguese Empires)']] +lin ringgit_N = mkN "رينغيت" ; --- guess from رينغيت +lin riyal_1_N = 'رِيَال_N' ; -- 918 [['riyal (the official currency of Saudi Arabia and Qatar).'], ['rial (the official currency of Oman, Yemen, and Iran).'], ['real (the official currency of Brazil).'], ['real (any of a number of defunct currencies in the former Spanish and Portuguese Empires)']] +lin riyal_2_N = 'رِيَال_N' ; -- 918 [['riyal (the official currency of Saudi Arabia and Qatar).'], ['rial (the official currency of Oman, Yemen, and Iran).'], ['real (the official currency of Brazil).'], ['real (any of a number of defunct currencies in the former Spanish and Portuguese Empires)']] +lin romanian_N = mkN "الرومانية" ; --- guess from الرومانية +lin romansh_N = mkN "الرومانشية" ; --- guess from الرومانشية +lin ron_N = mkN "رون" ; --- guess from رون +lin ruble_2_N = mkN "روبل" ; --- guess from روبل +lin rupee_1_N = mkN "روبية" ; --- guess from روبية +lin rupee_2_N = mkN "روبية" ; --- guess from روبية +lin rupee_3_N = mkN "روبية" ; --- guess from روبية +lin rupee_5_N = mkN "روبية" ; --- guess from روبية +lin rupee_6_N = mkN "روبية" ; --- guess from روبية +lin rupiah_N = mkN "روبية" ; --- guess from روبية +lin russian_N = 'رُوسِيّ_N' ; -- 4075 [['Russian']] +lin sango_N = mkN "السانجو" ; --- guess from السانجو +lin sanskrit_N = mkN "السنسكريتية" ; --- guess from السنسكريتية +lin sardinian_N = mkN "السردينية" ; --- guess from السردينية +lin scots_N = mkN "السكتلندية" ; --- guess from السكتلندية +lin scottish_gaelic_N = mkN "السكتلنديةالغالية" ; --- guess from السكتلنديةالغالية +lin selkup_N = mkN "السيلكب" ; --- guess from السيلكب +lin seneca_N = mkN "السنيكا" ; --- guess from السنيكا +lin serbo_croat_N = mkN "صربوـكرواتي" ; --- guess from صربوـكرواتي +lin serer_N = mkN "السرر" ; --- guess from السرر +lin shariah_1_N = 'شَرِيعَة_N' ; -- 18835 [['way, path'], ['law and legislation'], ['sharia, law']] +lin shilling_1_N = mkN "شلن" ; --- guess from شلن +lin shilling_2_N = mkN "شلن" ; --- guess from شلن +lin shilling_3_N = mkN "شلن" ; --- guess from شلن +lin shilling_4_N = mkN "شلن" ; --- guess from شلن +lin shina_N = mkN "شينا" ; --- guess from شينا +lin shona_N = mkN "الشونا" ; --- guess from الشونا +lin show_2_V2 = mkV2 'عَرَضَ_V' ; -- 5092 [['to appear'], ['to happen, to occur'], ['to show, to display, to present'], ['to expose']] +-- lin show_2_V2 = mkV2 'عَرَّضَ_V' ; -- 6113 [['to broaden, to widen, to enlarge'], ['to place one thing opposite another'], ['to offer, to expose, to hand, to exchange'], ['to write indistinctly, illegibly, to merely hint, to speak obscurely, to write phrases susceptible to multiple meanings or to write letters not distinct'], ['to defame, to slander, to abuse'], ['to underdo the meat'], ['to mark the camel at the hoof'], ['to circumcise children'], ['to become possessed by power of speech, to be eloquent']] +-- lin show_2_V2 = mkV2 'عَرُضَ_V' ; -- 18990 [['to be or become wide']] +lin sindhi_N = mkN "السندية" ; --- guess from السندية +lin sinhala_N = mkN "السنهالية" ; --- guess from السنهالية +lin skagit_N = mkN "سكاكيت" ; --- guess from سكاكيت +lin slovak_2_N = mkN "السلوفاكية" ; --- guess from السلوفاكية +lin slovenian_N = mkN "السلوفينية" ; --- guess from السلوفينية +lin sokoro_N = mkN "سوكورو" ; --- guess from سوكورو +lin som_1_N = mkN "سوم" ; --- guess from سوم +lin som_2_N = mkN "سوم" ; --- guess from سوم +lin somali_N = mkN "الصومالية" ; --- guess from الصومالية +lin sotho_2_N = mkN "السوتوالجنوبية" ; --- guess from السوتوالجنوبية +lin south_3_N = 'جَنُوب_N' ; -- 16691 [['south']] +-- lin south_3_N = 'جُنُوب_N' ; -- 64537 [['verbal noun of جَنَبَ (janaba) (form I)']] +lin southeast_1_N = mkN "جنوبيشرقي" ; --- guess from جنوبيشرقي +lin southwest_1_N = mkN "جنوبيغربي" ; --- guess from جنوبيغربي +lin soviet_A = mkA "سوفييتي" ; --- guess from سوفييتي +lin spanish_N = mkN "سباني" ; --- guess from سباني +lin speak_3_V2 = variants {} ; --- guess from تحدثتكلم +lin spoken_A = mkA "منطوقملفوظ" ; --- guess from منطوقملفوظ +lin sport_1_N = 'رِيَاضَة_N' ; -- 16827 [['sport (physical activity)'], ['mathematics']] +lin square_1_A = 'مُرَبَّع_A' ; -- 12741 [['square, quadratic'], ['fourfold, quadruple'], ['tetragonal, quadrangular']] +lin starch_1_N = mkN "نشا" ; --- guess from نشا +lin state_4_N = mkN "دولةولاية" ; --- guess from دولةولاية +lin succeed_V2 = variants {} ; --- guess from نجحخلف +lin sundanese_N = mkN "السوندانية" ; --- guess from السوندانية +lin supreme_2_A = mkA "عليا" ; --- guess from عليا +lin swahili_N = mkN "السواحيلية" ; --- guess from السواحيلية +lin swazi_2_N = mkN "السواتي" ; --- guess from السواتي +lin swedish_N = mkN "السويدية" ; --- guess from السويدية +lin swiss_N = mkN "سويسري" ; --- guess from سويسري +lin system_1_N = mkN "منظومة" ; --- guess from منظومة +lin system_4_N = 'نِظَام_N' ; -- 17630 [['system'], ['regularity'], ['order'], ['method'], ['rule'], ['regime: perhaps short for نِظَام الْحُكْم (niẓām al-ḥukm, “system of rule”)']] +lin tajik_N = mkN "الطاجيكية" ; --- guess from الطاجيكية +lin taka_N = mkN "تاكا" ; --- guess from تاكا +lin take_12_V2 = variants {} ; --- guess from اخذ +lin tala_N = mkN "تالة" ; --- guess from تالة +lin tamil_2_N = mkN "التاميلية" ; --- guess from التاميلية +lin tampon_N = mkN "سدادةقطنية" ; --- guess from سدادةقطنية +lin tatar_N = mkN "التتارية" ; --- guess from التتارية +lin tax_N = 'رَسْم_N' ; -- 79916 [['verbal noun of رَسَمَ (rasama) (form I)'], ['sketch, drawing, painting, picture, portrait, outline, chart'], ['pattern, structure, design'], ['rasm (Arabic writing without dots)'], ['trace, spoor'], ['tradition, custom'], ['rate, levy, imposition']] +lin telugu_N = mkN "التيلجو" ; --- guess from التيلجو +lin tenge_1_N = mkN "تنغى" ; --- guess from تنغى +lin terrorist_N = mkN "رهابي" ; --- guess from رهابي +lin thai_N = 'تَايْلَانْدِيّ_N' ; -- 4301 [['Thai language']] +-- lin thai_N = 'تَايْلَانْدِيّ_1_N' ; -- 4302 [['Thai man']] +lin tibetan_1_N = mkN "التبتية" ; --- guess from التبتية +lin ticket_1_N = 'تَذْكِرَة_N' ; -- 77511 [['verbal noun of ذَكَّرَ (ḏakkara) (form II)'], ['memorandum, admonition'], ['collection, precepts, summa'], ['ticket']] +lin tlingit_N = mkN "التلينغيتية" ; --- guess from التلينغيتية +lin toda_N = mkN "تودا" ; --- guess from تودا +lin tonga_N = mkN "تونجاجزرتونجا" ; --- guess from تونجاجزرتونجا +lin total_1_A = 'مَجْمُوع_A' ; -- 18478 [['united'], ['reconciled']] +lin transitional_A = mkA "انتقالي" ; --- guess from انتقالي +lin transport_1_N = mkN "وسيلةنقل" ; --- guess from وسيلةنقل +lin tsimshian_N = mkN "التسيمشيان" ; --- guess from التسيمشيان +lin tswana_2_N = mkN "التسوانية" ; --- guess from التسوانية +lin tugrik_1_N = mkN "توغروغ" ; --- guess from توغروغ +lin tulu_N = mkN "لغةتولو" ; --- guess from لغةتولو +lin turkish_N = 'تُرْكِيَّة_N' ; -- 4359 [['Turkish language']] +-- lin turkish_N = 'تُرْكِيَّة_1_N' ; -- 60870 [['female equivalent of تُرْكِيّ (turkiyy, “Turk”):', 'female equivalent of تُرْكِيّ (turkiyy, “Turk”)'], ['female equivalent of تُرْكِيّ (turkiyy, “Turk”):', 'Turkish woman']] +lin turkmen_N = mkN "التركمانية" ; --- guess from التركمانية +lin tuscarora_N = mkN "توسكارورانيفادا" ; --- guess from توسكارورانيفادا +lin udmurt_N = mkN "الدمرت" ; --- guess from الدمرت +lin ukrainian_N = mkN "اوكرانية" ; --- guess from اوكرانية +lin umbundu_N = mkN "المبندو" ; --- guess from المبندو +lin unemployment_N = 'بِطَالَة_N' ; -- 11385 [['idleness'], ['unemployment']] +lin unit_3_N = 'وَحْدَة_N' ; -- 18471 [['unit (a standard measure of a quantity)'], ['unit (a group within an organization that has been assigned a specific duty or function)'], ['unit; module (part of a book or educational course)'], ['union, unity; oneness (the state of being united as one)'], ['loneliness (a feeling of depression resulting from being alone)']] +lin unitary_3_A = mkA "توحيدي" ; --- guess from توحيدي +lin urdu_N = mkN "الردية" ; --- guess from الردية +lin uzbek_N = mkN "الوزبكية" ; --- guess from الوزبكية +lin vat_1_N = mkN "ضريبةالقيمةالمضافة" ; --- guess from ضريبةالقيمةالمضافة +lin veps_N = mkN "فيبسية" ; --- guess from فيبسية +lin vietnamese_2_N = mkN "الفيتنامية" ; --- guess from الفيتنامية +lin walloon_N = mkN "الوالون" ; --- guess from الوالون +lin water_1_N = mkN "ما" ; --- guess from ما +lin welsh_2_N = mkN "لغةويلزية" ; --- guess from لغةويلزية +lin west_2_N = 'غَرَب_N' ; -- 8110 [['the disease of an abscess in the canthus of the eye, lachrymal fistula']] +-- lin west_2_N = 'غَرْب_N' ; -- 102364 [['verbal noun of غَرَبَ (ḡaraba) (form I)'], ['west, occident'], ['vehemence, violence, tempestuousness']] +-- lin west_2_N = 'غَرَب_1_N' ; -- 128137 [['Euphrates poplar (Populus euphratica)'], ['willow (Salix spp.)']] +lin winnebago_N = mkN "وينيباكو" ; --- guess from وينيباكو +lin wolof_N = mkN "الولوف" ; --- guess from الولوف +lin woman_1_N = 'مَرَّة_N' ; -- 926 [['a time, instance, occurrence'], ['Ellipsis of اِسْمُ مَرَّةٍ (ismu marratin).']] +-- lin woman_1_N = 'مِرَّة_N' ; -- 128434 [] +lin won_2_N = mkN "ون" ; --- guess from ون +lin world_1_N = 'عَالِم_N' ; -- 15804 [['scholar, man of letters, scientist'], ['knowledgeable person, savant']] +-- lin world_1_N = 'عَالَم_N' ; -- 19120 [['world'], ['universe, cosmos, existence'], ['world, hereunder, worldly life'], ['things, creation, that which exists before you'], ['nation, people, group, type, or kind']] +lin world_5_N = 'عَالِم_N' ; -- 15804 [['scholar, man of letters, scientist'], ['knowledgeable person, savant']] +-- lin world_5_N = 'عَالَم_N' ; -- 19120 [['world'], ['universe, cosmos, existence'], ['world, hereunder, worldly life'], ['things, creation, that which exists before you'], ['nation, people, group, type, or kind']] +lin xhosa_N = mkN "الخوسا" ; --- guess from الخوسا +lin year_1_N = 'سُنَّة_N' ; -- 1703 [['a usual, recurrent, continual, determinable, or constant thing', 'a common, habitual, popularized, or enforced practice; a custom, convention, or ritual; a social norm or standard'], ['a usual, recurrent, continual, determinable, or constant thing', 'the conduct, habits, behavior, or mannerisms of a person (viewed collectively)'], ['a usual, recurrent, continual, determinable, or constant thing', 'a determinate or predetermined universal law (either normative or historical)'], ['a narrative attributed to an Islamic religious figure (typically Prophet Muhammad), a tradition; a hadith'], ['a narrative attributed to an Islamic religious figure (typically Prophet Muhammad), a tradition; a hadith', 'the body of narratives attributed to Islamic religious figures (viewed collectively)'], ['a religiously canonized tradition or practice', 'the set of canonical traditions whence orthodoxy and orthopraxy are derived (viewed collectively)'], ['a religiously canonized tradition or practice', 'adherence to the religious traditions, traditionalism; orthodoxy and orthopraxy'], ['a religiously canonized tradition or practice', 'a traditional religious practice for which there is a divine reward but for whose omission there is no punishment, a commendable supererogatory act often done as an expression of faith, a religious work of supererogation'], ['the Sunni sect or the adherents thereof (viewed collectively); Sunnism'], ['an image, a form, an appearance, a look']] +-- lin year_1_N = 'سِنَة_N' ; -- 8368 [['drowsiness'], ['slumber; nap']] +-- lin year_1_N = 'سَنَة_N' ; -- 19200 [['year']] +lin yen_2_N = mkN "ين" ; --- guess from ين +lin yiddish_N = mkN "اليديشية" ; --- guess from اليديشية +lin yoruba_N = mkN "اليوروبية" ; --- guess from اليوروبية +lin yuan_N = mkN "يوان" ; --- guess from يوان +lin zapotec_N = mkN "الزابوتيك" ; --- guess from الزابوتيك +lin zhuang_N = mkN "الزهيونج" ; --- guess from الزهيونج +lin zloty_N = mkN "زلوطي" ; --- guess from زلوطي +lin zulu_N = mkN "الزولو" ; --- guess from الزولو +} From 1cf64968838c91b59f0d77a7fe9066b6c3b559f7 Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Sat, 30 Sep 2023 23:28:42 +0200 Subject: [PATCH 092/129] (Ger) Shrink Agr = Ag Gender Number Person from 3*2*3 = 18 values to 2+3+1+3+1 = 10 by Agr = AgSgP1 | AgSgP2 | AgSgP3 Gender | AgSgP3Gen | AgPl Person | AgPlPol ; with AgSgP3Gen resp. AgPlPol used for reflexive,possessive forms of "man", "Sie". Compiles AllGer from src in 162sec with 15M VerbGer.gfo vs. 380sec with 17M VerbGer.gfo --- src/german/AdjectiveGer.gf | 18 +- src/german/AdverbGer.gf | 6 +- src/german/CatGer.gf | 16 +- src/german/ConjunctionGer.gf | 22 +- src/german/ConstructionGer.gf | 202 ++++-------------- src/german/DocumentationGerFunctor.gf | 62 +----- src/german/ExtendGer.gf | 143 +++++++++++-- src/german/ExtraGer.gf | 79 ++++--- src/german/ExtraGerAbs.gf | 3 +- src/german/GrammarGer.gf | 6 +- src/german/IdiomGer.gf | 19 +- src/german/LexiconGer.gf | 14 +- src/german/MakeStructuralGer.gf | 12 +- src/german/MarkupGer.gf | 4 +- src/german/MorphoGer.gf | 13 +- src/german/NounGer.gf | 127 +++++------ src/german/ParadigmsGer.gf | 121 ++++------- src/german/PhraseGer.gf | 1 - src/german/QuestionGer.gf | 8 +- src/german/RelativeGer.gf | 4 +- src/german/ResGer.gf | 291 ++++++++++++++------------ src/german/SentenceGer.gf | 31 +-- src/german/StructuralGer.gf | 42 ++-- src/german/SymbolGer.gf | 12 +- src/german/VerbGer.gf | 35 ++-- 25 files changed, 623 insertions(+), 668 deletions(-) diff --git a/src/german/AdjectiveGer.gf b/src/german/AdjectiveGer.gf index 3504a8f0..9d44194d 100644 --- a/src/german/AdjectiveGer.gf +++ b/src/german/AdjectiveGer.gf @@ -40,27 +40,27 @@ concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in { -- $SuperlA$ belongs to determiner syntax in $Noun$. - ComplA2 a np = + ComplA2 a np = let CExt = case a.c2.isPrep of { - isCase => ; - _ => <[], appPrepNP a.c2 np> } -- HL: check 7/22 + isCase => ; + _ => <[], appPrepNP a.c2 np> } in { - s = a.s ! Posit ; - isPre = True ; - c = CExt ; - ext = [] + s = a.s ! Posit ; + isPre = True ; + c = CExt ; + ext = [] } ; ReflA2 a = let compl = appPrep a.c2 (reflPron ! agrP3 Sg) ; CExt = case a.c2.isPrep of - {isCase => ; _ => <[], compl> } + {isCase => ; _ => <[], compl> } in { s = a.s ! Posit ; isPre = True ; c = CExt ; - ext = [] + ext = [] } ; SentAP ap sc = ap ** { diff --git a/src/german/AdverbGer.gf b/src/german/AdverbGer.gf index 29bf0d2b..6cf2673d 100644 --- a/src/german/AdverbGer.gf +++ b/src/german/AdverbGer.gf @@ -3,10 +3,8 @@ 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 - { - s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ nps + ComparAdvAdj cadv a np = { + s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ np.s ! False ! Nom ++ bigNP np } ; 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 5082cf56..72a55eb3 100644 --- a/src/german/CatGer.gf +++ b/src/german/CatGer.gf @@ -58,18 +58,15 @@ concrete CatGer of Cat = adv : Str ; -- Haus [adv auf dem Hügel] g : Gender } ; - Pron = {s : NPForm => Str ; a : Agr} ; - - -- 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 } ; - + Pron = {s : NPForm => Str ; a : Agr} ; + 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 ; + Quant = { + s, sp : Bool => Bool => Number => Gender => Case => Str ; a : Adjf ; aPl : Adjf ; --- to distinguish "meine guten Freunde" / "gute Freunde" hasDefArt : Bool @@ -145,4 +142,5 @@ concrete CatGer of Cat = 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 9abc56ed..22f7181d 100644 --- a/src/german/ConjunctionGer.gf +++ b/src/german/ConjunctionGer.gf @@ -9,11 +9,15 @@ concrete ConjunctionGer of Conjunction = ConjAdv conj ss = conjunctDistrSS 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 = [] } ; + ConjNP conj ss = heavyNP ( + {s = \\_ => (conjunctDistrTable Case conj ss).s ; + a = let n : Number = (conjNumber conj.n (numberAgr ss.a)) ; + p : Person = personAgr ss.a ; + agr : Agr = case of { => AgPl q ; + => AgSgP3 Neutr ; + => AgSgP1 ; + => AgSgP2 } + in (conjAgr agr ss.a) }) ; ConjAP conj ss = conjunctDistrTable AForm conj ss ** { isPre = ss.isPre ; c = ss.c ; ext = ss.ext} ; @@ -48,13 +52,13 @@ concrete ConjunctionGer of Conjunction = s1 = \\c => xs.s ! False ! c ++ bigNP xs ++ comma ++ x.s1 ! c ; s2 = x.s2 ; a = conjAgr xs.a x.a } ; - BaseAP x y = lin AP { + BaseAP x y = { s1 = bigAP x ; s2 = bigAP y ; isPre = andB x.isPre y.isPre ; c = <[],[]> ; ext = []} ; - ConsAP xs x = lin AP { + ConsAP xs x = { s1 = \\a => (bigAP xs) ! a ++ comma ++ x.s1 ! a ; s2 = x.s2 ; isPre = andB x.isPre xs.isPre ; @@ -62,12 +66,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 = lin CN { + BaseCN x y = { s1 = bigCN x ; s2 = bigCN y ; g = x.g ; --- gender of first CN, used e.g. in articles } ; - ConsCN x xs = lin CN { + ConsCN x xs = { 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 diff --git a/src/german/ConstructionGer.gf b/src/german/ConstructionGer.gf index 95e5b0c1..7f592750 100644 --- a/src/german/ConstructionGer.gf +++ b/src/german/ConstructionGer.gf @@ -1,42 +1,28 @@ --# -path=.:../abstract -concrete ConstructionGer of Construction = CatGer ** - open SyntaxGer, SymbolicGer, (P = 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 ; -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 (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") ; + 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") ; 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)) (P.mkA "verheiratet") ; + mkCl (mkNP and_Conj (lin NP x) (lin NP y)) (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 (P.mkAdv "alt")) (mkCl (lin NP x) G.UseCopula) ; ---- + how_old_QCl x = mkQCl (E.IAdvAdv (ParadigmsGer.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 @@ -45,24 +31,12 @@ 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_units_AP card cn a = mkAP (lin AdA (mkUtt (mkNP card cn))) a ; + 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_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) ; + 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" "Gläser" neuter)) np ; -- spatial deixis and motion verbs where_go_QCl np = mkQCl (lin IAdv (ss "wohin")) (mkCl np (mkVP L.go_V)) ; @@ -72,103 +46,15 @@ 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 = SyntaxGer.mkVP (SyntaxGer.mkVP L.go_V) (ParadigmsGer.mkAdv "hin") ; + go_there_VP = mkVP (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 @@ -177,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 ! True ! 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 ! True ! dative ++ BIND ++ "." ++ m.s ! R.Sg ! R.Nom ++ y.s ! False ! 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 ! True ! accusative) ; -- am 17. Mai 2013 intYear = symb ; intMonthday = symb ; @@ -192,45 +78,37 @@ lin weekdayN w = w ; monthN m = m ; - weekdayPN w = P.mkPN w ; - monthPN m = P.mkPN m ; + weekdayPN w = mkPN w ; + monthPN m = mkPN m ; languageNP l = mkNP l ; languageCN l = mkCN l ; -oper mkLanguage : Str -> N = \s -> P.mkN s neuter ; ---- produces Neuter +oper mkLanguage : Str -> N = \s -> mkN s neuter ; ---- produces Neuter ---------------------------------------------- ---- lexicon of special names -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 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 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 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 afrikaans_Language = mkLanguage "Afrikaans" ; lin amharic_Language = mkLanguage "Amharisch" ; diff --git a/src/german/DocumentationGerFunctor.gf b/src/german/DocumentationGerFunctor.gf index 0ec5665f..eedea374 100644 --- a/src/german/DocumentationGerFunctor.gf +++ b/src/german/DocumentationGerFunctor.gf @@ -40,66 +40,6 @@ lin ) } ; - InflectionPN = \pn -> { - t = "pn" ; - s1 = heading1 ("Eigenname" ++ - "("+case of { - => heading masculine_Parameter ; - => heading feminine_Parameter ; - => heading neuter_Parameter ; - <_,Pl> => heading plural_Parameter - } ++")") ; - s2 = frameTable ( - tr (th (heading nominative_Parameter) ++ td (pn.s ! Nom)) ++ - tr (th (heading genitive_Parameter) ++ td (pn.s ! Gen)) ++ - tr (th (heading dative_Parameter) ++ td (pn.s ! Dat)) ++ - tr (th (heading accusative_Parameter) ++ td (pn.s ! Acc)) - ) - } ; - - InflectionGN = \gn -> { - t = "vn" ; - s1 = heading1 ("Vorname" ++ - case gn.g of { - Male => "(männlich)" ; - Female => "(weiblich)" - }) ; - s2 = frameTable ( - tr (th (heading nominative_Parameter) ++ td (gn.s ! Nom)) ++ - tr (th (heading genitive_Parameter) ++ td (gn.s ! Gen)) ++ - tr (th (heading dative_Parameter) ++ td (gn.s ! Dat)) ++ - tr (th (heading accusative_Parameter) ++ td (gn.s ! Acc)) - ) ; - } ; - - InflectionSN = \sn -> { - t = "fn" ; - s1 = heading1 ("Familienname") ; - s2 = frameTable ( - tr (th (heading nominative_Parameter) ++ td (sn.s ! Male ! Nom)) ++ - tr (th (heading genitive_Parameter) ++ td (sn.s ! Male ! Gen)) ++ - tr (th (heading dative_Parameter) ++ td (sn.s ! Male ! Dat)) ++ - tr (th (heading accusative_Parameter) ++ td (sn.s ! Male ! Acc)) - ) ; - } ; - - InflectionLN = \ln -> { - t = "pn" ; - s1 = heading1 ("Standortnamen" ++ - "("+case of { - => heading masculine_Parameter ; - => heading feminine_Parameter ; - => heading neuter_Parameter ; - <_,Pl> => heading plural_Parameter - } ++")") ; - s2 = frameTable ( - tr (th (heading nominative_Parameter) ++ td (ln.s ! Strong ! Nom)) ++ - tr (th (heading genitive_Parameter) ++ td (ln.s ! Strong ! Gen)) ++ - tr (th (heading dative_Parameter) ++ td (ln.s ! Strong ! Dat)) ++ - tr (th (heading accusative_Parameter) ++ td (ln.s ! Strong ! Acc)) - ) - } ; - InflectionA, InflectionA2 = \adj -> let gforms : Degree -> ResGer.Case -> Str = \d,c -> @@ -223,7 +163,7 @@ oper let vfin : VForm -> Str = \f -> verb.s ! f ++ verb.prefix ; - gforms : ParadigmsGer.Number -> Person -> Str = \n,p -> + gforms : 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/ExtendGer.gf b/src/german/ExtendGer.gf index b600ecdc..ddfa488d 100644 --- a/src/german/ExtendGer.gf +++ b/src/german/ExtendGer.gf @@ -4,10 +4,11 @@ concrete ExtendGer of Extend = CatGer ** ExtendFunctor - [ InOrderToVP, - VPS, ListVPS, VPI, ListVPI, + VPS, ListVPS, VPI, ListVPI, RNP, RNPList, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, - GenModNP, + ComplSlashPartLast, + Base_nr_RNP, Base_rn_RNP, Base_rr_RNP, Conj_RNP, CardCNCard, CompoundN, PassVPSlash, PassAgentVPSlash, PastPartAP, PastPartAgentAP ] @@ -26,9 +27,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 ; @@ -70,7 +71,7 @@ concrete ExtendGer of Extend = t = tm.t ; m = tm.m ; subj = [] ; - verb = vps.s ! ord ! agr ! VPFinite m t a ; + verb = vps.s ! ord ! agr2vagr agr ! VPFinite m t a ; haben = verb.inf2 ; neg = tm.s ++ p.s ++ vp.a1 ++ negation ! b ; -- HL 8/19 ++ vp.a1 ! b ; -- obj1 = (vp.nn ! agr).p1 ; @@ -123,25 +124,25 @@ concrete ExtendGer of Extend = } ; UseDAPMasc det = { - s = \\_,c => det.sp ! Masc ! c ; + s = \\b,c => det.sp ! Masc ! c ; a = agrP3 det.n ; w = WLight ; rc, ext = [] } ; UseDAPFem det = { - s = \\_,c => det.sp ! Fem ! c ; + s = \\b,c => det.sp ! Fem ! c ; a = agrP3 det.n ; w = WLight ; rc, ext = [] } ; - CardCNCard card cn = { - s = \\g,c => - (Grammar.DetCN (Grammar.DetQuant Grammar.IndefArt (Grammar.NumCard card)) cn).s ! False ! c ; - n = Pl - } ; - +lin + CardCNCard card cn = { + s = \\g,c => + (Grammar.DetCN (Grammar.DetQuant Grammar.IndefArt (Grammar.NumCard card)) cn).s ! False ! c ; + n = Pl + } ; lin PassVPSlash vp = insertObj (\\_ => (PastPartAP vp).s ! APred) (predV werdenPass) ** @@ -167,7 +168,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 ! GPl -- 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 = <[],[]> ; @@ -186,4 +187,118 @@ lin CompoundN a x = g = x.g } ; + +-- Reflexive noun phrases -- (HL 5/2022: improved and completed, RNPList added) + + lincat + RNP = {s : Agr => Case => Str ; rc,ext : Str ; isPron : Bool} ; -- Case, not PCase !!! + RNPList = {s1,s2 : Agr => Case => Str} ; + + linref + RNP = \rnp -> rnp.s ! AgSgP3 Masc ! Acc ++ rnp.ext ++ rnp.rc ; + + lin + ReflRNP vps rnp = + insertObjReflNP rnp vps ; + + ReflPron = { -- with personal pronoun nominative + s = ResGer.reflPron ; rc,ext = [] ; isPron = True } ; + + -- We might define ReflPron by the stronger reflPronSelf below, using "selbst" + -- to distinguish personal pronoun from reflexive pronoun: + -- du kennst mich vs. ich kenne mich selbst + -- er kennt ihn vs. er kennt sich (selbst) + -- sie kennen sich (selbst) =/= sie kennen einander + + ReflPoss num cn = + {s = \\a,c => let adjf = case num.n of {Sg => Strong ; Pl => Weak} -- Duden 477, HL 5/2022 + in possPron a num.n cn.g c ++ num.s ! cn.g ! c -- HL 5/2022: meine wenigstens 3 cn, + ++ cn.s ! adjfCase adjf c ! num.n ! c -- not: wenigstens 3 meine cn + ++ cn.adv ; + ext = cn.ext ; rc = cn.rc ! num.n ; + isPron = False} ; + + -- We might define ReflPoss by the stronger reflPossPron below, using "eigen(er)" + -- to distinguish possessive pronoun from reflexive possessive pronoun: + -- du kennst meine Fehler vs. ich kenne meine eigenen Fehler + -- er|sie|es kennt seine|ihre Fehler vs. er|sie|es kennt seine|ihre|seine eigenen Fehler + + PredetRNP pred rnp = rnp ** { -- HL 5/2022 + s = \\a,c => let n : Number = case pred.a of {PAg n => n ; _ => numberAgr a} ; + g : Gender = genderAgr a ; + d = case pred.c.k of {NoCase => c ; PredCase k => (prepC k).c} ; + in case rnp.isPron of { + 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 ! 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 = 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 = 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>} ; + ext = rnp.ext ++ rnp.rc + } ; + + PossPronRNP pron num cn rnp = + GrammarGer.DetCN (GrammarGer.DetQuant (GrammarGer.PossPron pron) num) + (GrammarGer.PossNP cn (lin NP {s = \\pc => -- usePrepC pc (\c -> rnp.s ! pron.a ! c) ; + rnp.s ! pron.a ! pc ; + a = pron.a ; + w = WLight ; + ext = rnp.ext ; + rc = rnp.rc})) ; + + -- AdvRVP : VP -> Prep -> RNP -> VP not implemented, as the reflexive adverb (Prep + RNP): Agr => Str + -- could only be added to vp.a2:Str with fixed agreement, but can depend on nominal subject or object, + -- e.g. "er spricht mit ihr über sein Kind" vs. "er spricht mit ihr über ihr Kind". +-} + ConjRNP conj rnps = conjunctDistrTable2 Agr Case conj rnps + ** {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 ! 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 ! False ! c ++ x.ext ++ x.rc} xs ; +{- + oper +-- reflPronSelf : Agr => Case => Str = \\a => \\c => reflPron ! a ! c ++ "selbst" ; + + -- reflPossPron : Agr -> Number -> Gender -> Case -> Str = + -- let eigen = adjForms "eigen" "eigen" in + -- \a,n,g,c -> possPron a n g c ++ (eigen ! (AMod (gennum g n) c)) ; + + insertObjReflNP : RNP -> ResGer.VPSlash -> ResGer.VP = -- HL 5/2022 + \rnp,vp -> insertObjRNP rnp vp.c2 vp ; + + insertObjRNP : RNP -> Preposition -> ResGer.VPSlash -> ResGer.VP = -- HL 5/2022 + \rnp,prep,vp -> -- 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 + 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 + } ; +-} } diff --git a/src/german/ExtraGer.gf b/src/german/ExtraGer.gf index 14eae0be..e25757d8 100644 --- a/src/german/ExtraGer.gf +++ b/src/german/ExtraGer.gf @@ -1,6 +1,5 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** open ResGer, Coordination, Prelude, IrregGer, (P = ParadigmsGer), (N = NounGer) in { - flags coding=utf8 ; lincat @@ -30,21 +29,21 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** ICompAP ap = {s = \\_ => "wie" ++ ap.s ! APred ; ext = ap.c.p1 ++ ap.c.p2 ++ ap.ext} ; - CompIQuant iq = {s = table {Ag g n p => iq.s ! n ! g ! Nom} ; ext = ""} ; + CompIQuant iq = {s = table {a => iq.s ! numberAgr a ! genderAgr a ! Nom} ; ext = ""} ; IAdvAdv adv = {s = "wie" ++ adv.s} ; DetNPMasc det = { s = \\b,c => det.sp ! b ! Masc ! c ; a = agrgP3 Masc det.n ; - w = case det.isDef of { True => WLight ; _ => WHeavy } ; + w = WLight ; 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 = WLight ; ext, rc = [] } ; @@ -55,10 +54,8 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** } ; PassVPSlash vp = - 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 + insertObj (\\_ => (PastPartAP vp).s ! APred) (predV werdenPass) ** + { c1 = subjPrep vp.c2 } ; -- this also gives "mit dir wird gerechnet" ; -- the alternative linearisation ("es wird mit dir gerechnet") is not implemented @@ -85,7 +82,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** 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 ! GPl -- 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 = <[],[]> ; @@ -122,12 +119,13 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** Sub => True ; -- glue prefix to verb _ => False } ; + vagr = agr2vagr agr ; b = p.p ; a = tm.a ; t = tm.t ; m = tm.m ; subj = [] ++ tm.s ++ p.s ; - verb = vps.s ! ord ! agr ! VPFinite m t a ; + verb = vps.s ! ord ! vagr ! VPFinite m t a ; haben = verb.inf2 ; neg = tm.s ++ p.s ++ vp.a1 ++ negation ! b ; -- HL 8/19 ++ vp.a1 ! b ; -- obj1 = (vp.nn ! agr).p1 ; @@ -179,13 +177,13 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** RNPList = {s1,s2 : Agr => Case => Str} ; linref - RNP = \rnp -> rnp.s ! (Ag Masc Sg P3) ! Acc ++ rnp.ext ++ rnp.rc ; + RNP = \rnp -> rnp.s ! AgSgP3 Masc ! Acc ++ rnp.ext ++ rnp.rc ; lin ReflRNP vps rnp = - insertObj (\\a => appPrep vps.c2 (rnp.s ! a)) vps ; + insertObjReflNP rnp vps ; - ReflPron = { -- personal pronoun, with "sich" in P3 Sg + ReflPron = { -- with personal pronoun nominative s = ResGer.reflPron ; rc,ext = [] ; isPron = True } ; -- We might define ReflPron by the stronger reflPronSelf below, using "selbst" @@ -208,11 +206,12 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** -- er|sie|es kennt seine|ihre Fehler vs. er|sie|es kennt seine|ihre|seine eigenen Fehler PredetRNP pred rnp = rnp ** { -- HL 5/2022 - s = \\a,c => let n = case pred.a of {PAg n => n ; _ => numberAgr a} ; - g = genderAgr a ; + s = \\a,c => let n : Number = case pred.a of {PAg n => n ; _ => numberAgr a} ; + g : Gender = genderAgr a ; d = case pred.c.k of {NoCase => c ; PredCase k => k} ; in case rnp.isPron of { - True => pred.s ! Pl ! Masc ! c ++ "von" ++ rnp.s ! a ! Dat ; + 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} ; @@ -229,11 +228,11 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** ReflA2RNP adj rnp = -- would need AP.c : Agr => Str*Str, not AP.c : Str*Str let -- as we have no reflexive AP, - compl = appPrep 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 {isCase => ; _ => <[], compl>} ; + c = case adj.c2.isPrep of {isPrep => <[], compl> ; _ => } ; ext = rnp.ext ++ rnp.rc } ; @@ -253,7 +252,7 @@ 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 ! False ! c ++ x.ext ++ x.rc} y ; + Base_nr_RNP x y = twoTable2 Agr Case {s = \\a,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 ; @@ -266,10 +265,13 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** let eigen = adjForms "eigen" "eigen" in \a,n,g,c -> possPron a n g c ++ (eigen ! (AMod (gennum g n) c)) ; - insertObjReflNP : ResGer.VPSlash -> RNP -> ResGer.VP = -- HL 5/2022 - \vp,rnp -> -- generalize ResGer.insertObjRefl - let prep = vp.c2 ; - c = case prep.isPrep of { isCase => prep.c ; _ => Acc } ; -- put rnp.ext ++ rnp.rc to vp.ext ? + insertObjReflNP : RNP -> ResGer.VPSlash -> ResGer.VP = -- HL 5/2022 + \rnp,vp -> insertObjRNP rnp vp.c2 vp ; + + insertObjRNP : RNP -> Preposition -> ResGer.VPSlash -> ResGer.VP = -- HL 5/2022 + \rnp,prep,vp -> -- generalize ResGer.insertObjRefl + let -- prep = vp.c2 ; + c : Case = case prep.c of { cc => cc ; _ => 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 => @@ -280,7 +282,20 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** => ; -- < non-pron nominal <_,_,_> => } -- or prepositional } ; - +{- insertObjRNP : RNP -> Preposition -> ResGer.VPSlash -> ResGer.VPSlash = -- HL 8/2023 + \rnp,prep,vp -> -- generalize ResGer.insertObjNP + let c = case prep.c of { NPC cc => cc ; _ => Acc } ; + obj : Agr => Str = \\a => prep.s ++ 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 + } ; +-} -- SS: implementation of some of the relevant Foc rules from Extra lincat @@ -325,19 +340,19 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** -- "es wird gelacht"; generating formal sentences lincat - FClause = ResGer.VP ** {subj : ResGer.NP ; lock_FClause : {}} ; + FClause = ResGer.VP ** {subj : ResGer.NP} ; lin VPass v = let vp = predV werdenPass - in lin FClause (vp ** {subj = esSubj ; - inf = vp.inf ** {s = v.s ! VPastPart APred } }) ; -- construct the formal clause + in vp ** {subj = esSubj ; + inf = vp.inf ** {s = v.s ! VPastPart APred } } ; -- construct the formal clause AdvFor adv fcl = fcl ** {a2 = adv.s} ; - FtoCl cl = - let subj = mkSubject cl.subj cl.c1 - in DisToCl subj.s subj.a cl ; + FtoCl cl = + let subj = mkSubject cl.subj cl.c1 + in DisToCl subj.s subj.a cl ; oper -- extra operations for ExtraGer @@ -348,7 +363,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** esSubj : CatGer.NP = lin NP { s = \\_,_ => "es" ; rc, ext = [] ; - a = Ag Neutr Sg P3 ; + a = AgSgP3 Neutr ; w = WPron } ; @@ -360,7 +375,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** Sub => True ; -- glue prefix to verb _ => False } ; - verb = vps.s ! ord ! agr ! VPFinite m t a ; + verb = vps.s ! ord ! agr2vagr agr ! VPFinite m t a ; neg = vp.a1 ++ negation ! b ; -- HL 8/19 vp.a1 ! b ; obj1 = (vp.nn ! agr).p1 ; obj2 = (vp.nn ! agr).p2 ++ (vp.nn ! agr).p3 ; diff --git a/src/german/ExtraGerAbs.gf b/src/german/ExtraGerAbs.gf index 54c29f61..e63d0115 100644 --- a/src/german/ExtraGerAbs.gf +++ b/src/german/ExtraGerAbs.gf @@ -29,7 +29,7 @@ abstract ExtraGerAbs = Extra [ Pass3V3 : V3 -> VPSlash ; -- wir bekommen den Beweis erklärt - -- further constructions usin RNP, declared in abstract/Extra.gf: + -- further constructions using RNP, declared in abstract/Extra.gf or Extend.gf: AdvRNP : NP -> Prep -> RNP -> RNP ; -- a dispute with his wife AdvRVP : VP -> Prep -> RNP -> VP ; -- lectured about her travels @@ -39,4 +39,5 @@ abstract ExtraGerAbs = Extra [ -- NOTE: generalizes ReflA2 PossPronRNP : Pron -> Num -> CN -> RNP -> NP ; -- his abandonment of his wife and children + } diff --git a/src/german/GrammarGer.gf b/src/german/GrammarGer.gf index 410c401f..5e2a85c2 100644 --- a/src/german/GrammarGer.gf +++ b/src/german/GrammarGer.gf @@ -1,7 +1,7 @@ --# -path=.:../abstract:../common:prelude -concrete GrammarGer of Grammar = - NounGer, +concrete GrammarGer of Grammar = + NounGer, VerbGer, AdjectiveGer, AdverbGer, @@ -13,7 +13,7 @@ concrete GrammarGer of Grammar = PhraseGer, TextX - [Tense,Temp], IdiomGer, - StructuralGer, -- AR: keep for BW comp - [part_Prep,possess_Prep], -- use PartNP, PossNP instead + StructuralGer, TenseGer, NamesGer ** { diff --git a/src/german/IdiomGer.gf b/src/german/IdiomGer.gf index fd39f1c7..a2b7b081 100644 --- a/src/german/IdiomGer.gf +++ b/src/german/IdiomGer.gf @@ -8,24 +8,25 @@ 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 ! False ! rs.c ++ bigNP np)) (predV MorphoGer.sein_V))) ; --HL + (insertObj (\\_ => np.s ! False ! rs.c ++ bigNP np) (predV MorphoGer.sein_V))) ; - 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) + 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 ; @@ -53,7 +54,7 @@ concrete IdiomGer of Idiom = CatGer ** ProgrVP = insertAdv "eben" ; ---- ImpPl1 vp = {s = - (mkClause "wir" (Ag Fem Pl P1) vp).s ! + (mkClause "wir" (AgPl P1) vp).s ! MConjunct ! Pres ! Simul ! Pos ! Inv } ; @@ -65,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 ! False ! c ++ "selbst" ++ bigNP np ; + s = \\b,c => np.s ! b ! c ++ "selbst" ++ bigNP np ; isPron = False ; } ; diff --git a/src/german/LexiconGer.gf b/src/german/LexiconGer.gf index e0e5f03f..93a39cac 100644 --- a/src/german/LexiconGer.gf +++ b/src/german/LexiconGer.gf @@ -13,7 +13,6 @@ 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" ; @@ -59,7 +58,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 = mk3A "kalt" "kälter" "kälteste" ; + cold_A = regA "kalt" ; come_V = seinV (mk6V "kommen" "kommt" "komm" "kam" "käme" "gekommen") ; computer_N = reg2N "Rechner" "Rechner" masculine ; country_N = reg2N "Land" "Länder" neuter ; @@ -186,8 +185,7 @@ 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 "Stern" ; -- HL 7/22 + star_N = mkN "Sterne" ; steel_N = mkN "Stahl" ; stone_N = mkN "Stein" ; stop_V = seinV Irreg.halten_V ; @@ -213,9 +211,7 @@ 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" "auf den" "auf die" "aufs" accusative) | (mkPrep "auf" accusative)); - wait_V2 = prepV2 (regV "warten") (mkPrep "auf" "auf den" "auf die" ("aufs" | "auf das") accusative); + wait_V2 = prepV2 (regV "warten") (mkPrep "auf" accusative) ; walk_V = seinV Irreg.gehen_V ; warm_A = mk3A "warm" "wärmer" "wärmste" ; war_N = mkN "Krieg" ; @@ -239,14 +235,14 @@ lin dry_A = regA "trocken" ; dull_A = regA "stumpf" ; full_A = regA "voll" ; - heavy_A = mkA "schwer" "schwerer" "schwerste" ; + heavy_A = mkA "schwer" "schwere" "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 = mk4A "naß" "nass" "nasser" "nasseste" ; + wet_A = regA "naß" ; 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 ff2ec97d..be9dab51 100644 --- a/src/german/MakeStructuralGer.gf +++ b/src/german/MakeStructuralGer.gf @@ -5,7 +5,7 @@ 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 = <>} ; @@ -13,16 +13,16 @@ oper mkPredet = overload { mkPredet : A -> Predet = \a -> lin Predet { - s = appAdj a ; + 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} - } + } } ; -- e.g. das selbe diff --git a/src/german/MarkupGer.gf b/src/german/MarkupGer.gf index b3e410cd..54cd352e 100644 --- a/src/german/MarkupGer.gf +++ b/src/german/MarkupGer.gf @@ -1,6 +1,6 @@ ---# -path=.:../abstract:../common:../prelude: +--# -path=.:../abstract:../common -concrete MarkupGer of Markup = CatGer, MarkHTMLX ** open Prelude in { +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 diff --git a/src/german/MorphoGer.gf b/src/german/MorphoGer.gf index dc46adc7..438cb62c 100644 --- a/src/german/MorphoGer.gf +++ b/src/german/MorphoGer.gf @@ -20,20 +20,21 @@ 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 = [] ; + ext, rc = [] ; 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 : Gender => Case => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> {s,sp = appAdj (regDetA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index 9de307d2..843398b0 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -1,31 +1,27 @@ ---# -path=.:../abstract:../common: 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 ; + 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 - -- 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 } ; + -- 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 => case det.hasDefArt of {True => WDefArt ; + _ => WLight } ; _ => WHeavy } ; - rc = cn.rc ! det.n ; - ext = cn.ext + rc = cn.rc ! det.n ; + ext = cn.ext } ; - DetNP det = { -- more genders in ExtraGer -- HL: der+er,den+en ; der drei,den drei+en - s = \\b,c => det.sp ! b ! Neutr ! c ; + DetNP det = { + s = \\b,c => det.sp ! b ! Neutr ! c ; -- more genders in ExtraGer -- HL: der+er,den+en ; der drei,den drei+en 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 = [] @@ -33,13 +29,13 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { 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 - rc, ext = [] -- Pron => Light HL 6/2019: to regulate Pron/NonPronNP order + a = agrgP3 pn.g pn.n ; + 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 = [] @@ -55,45 +51,45 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { } ; PPartNP np v2 = np ** { - s = \\b,c => np.s ! b ! c ++ (embedInCommas (v2.s ! VPastPart APred)) ; --- invar part - w = WHeavy + s = \\b,c => np.s ! b ! c ++ embedInCommas (v2.s ! VPastPart APred) ; --- invar part + 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 + s = \\b,c => np.s ! b ! c ++ embedInCommas adv.s ; + w = WHeavy } ; DetQuantOrd quant num ord = - let + let n = num.n ; a = quant.a in { - 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 ; + 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} ; hasDefArt = quant.hasDefArt ; } ; - DetQuant quant num = - let + DetQuant quant num = + let n = num.n ; a = quant.a ; - b = andB quant.hasDefArt (case num.n of {Sg => True ; _ => False}) ; + b = andB quant.hasDefArt (case num.n of {Sg => True ; _ => False}) in { - 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 ; + 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} ; @@ -101,6 +97,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { hasDefArt = quant.hasDefArt ; } ; + PossPron p = { s = \\_,_,n,g,c => p.s ! NPPoss (gennum g n) c ; sp = \\_,_,n,g,c => p.s ! NPPoss (gennum g n) c ; @@ -117,7 +114,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; - NumDecimal numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; + NumFloat dig1 dig2 = {s = \\g,c => dig1.s ! invNum ++ BIND ++ "." ++ BIND ++ dig2.s ! NCard g c ; n = Pl } ; NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdNumeral numeral = {s = \\af => numeral.s ! NOrd af} ; @@ -129,20 +126,21 @@ 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 = table{True => \\_,n,g,c => [] ; -- defart dropped + s = table{True => \\_,n,g,c => [] ; -- definite article 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 } ; + => "denen" ; -- HL 6/2019 + => "derer" ; -- HL 6/2019 + _ => artDef ! (gennum g n) ! c } ; -- von den+en a, aPl = Weak ; - hasDefArt = True + hasDefArt = True } ; + IndefArt = { s = \\_ => table { True => \\_,_,c => [] ; False => table { - Sg => \\g,c => "ein" + pronEnding ! GSg g ! c ; + Sg => \\g,c => "ein" + pronEnding ! GSg g ! c ; Pl => \\_,c => [] } } ; @@ -160,7 +158,9 @@ 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 ; - w = WLight ; -- ich trinke Bier nicht vs. ich trinke kein Bier + -- isLight = True ; -- ich trinke Bier nicht vs. ich trinke kein Bier + -- isPron = False ; + w = WLight ; rc = cn.rc ! Sg ; ext = cn.ext ; hasDefArt = False @@ -176,8 +176,8 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { ComplN2 f x = { s = \\_,n,c => f.s ! n ! c ++ appPrepNP f.c2 x ; g = f.g ; - rc = \\_ => [] ; - ext,adv = [] + rc = \\_ => [] ; + ext,adv = [] } ; ComplN3 f x = { @@ -187,7 +187,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { 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 ; } ; @@ -197,11 +197,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) ; @@ -214,7 +214,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} ; @@ -224,35 +224,34 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { ApposCN cn np = let g = cn.g in cn ** { 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 } ; 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 + _ => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! False ! Gen ++ np.ext ++ np.rc} }; -- glass of wine 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 + let g : Gender = genderAgr np.a 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 } ; rc = np.rc ; - ext = np.ext + ext = np.ext } ; 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 ; + {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} ; + 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 + } ; QuantityNP dig m = { s = \\_,c => preOrPost m.isPre m.s (dig.s ! invNum) ; @@ -262,4 +261,12 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { ext = "" ; } ; + QuantityFloatNP dig1 dig2 m = { + s = \\_,c => preOrPost m.isPre m.s (dig1.s ! invNum ++ BIND ++ "." ++ BIND ++ dig2.s ! invNum) ; + a = agrP3 Pl ; + w = WLight ; + rc = "" ; + ext = "" ; + } ; + } diff --git a/src/german/ParadigmsGer.gf b/src/german/ParadigmsGer.gf index e083dbd3..f45498c6 100644 --- a/src/german/ParadigmsGer.gf +++ b/src/german/ParadigmsGer.gf @@ -2,7 +2,7 @@ --1 German Lexical Paradigms -- --- Aarne Ranta, Harald Hammarström and Björn Bringert2003--2007 +-- Aarne Ranta, Harald Hammarström and Björn Bringert 2003--2007 -- -- This is an API for the user of the resource grammar -- for adding lexical items. It gives functions for forming @@ -141,7 +141,6 @@ mkN : overload { } ; - mkGN : overload { mkGN : Str -> Sex -> GN ; -- regular name with genitive in "s" mkGN : (nom,gen : Str) -> Sex -> GN ; -- name with other genitive @@ -160,36 +159,10 @@ mkN : overload { mkSN : (nom,acc,dat,gen : Str) -> GN ; -- name with all case forms } ; - mkLN = overload { - mkLN : Str -> LN = \s -> regLN s Masc ; -- regular name with genitive in "s", masculine - mkLN : Str -> Number -> LN = \s,n -> regLN s Masc ** {n=n} ; -- regular name with genitive in "s", masculine - mkLN : Str -> Gender -> LN = regLN ; -- regular name with genitive in "s" - --- If only the genitive differs, two strings are needed. - - mkLN : (nom,gen : Str) -> Gender -> LN = mk2LN ; -- name with other genitive - --- In the worst case, all four forms are needed. - - mkLN : (nom,acc,dat,gen : Str) -> Gender -> LN = \nom,acc,dat,gen,g -> - lin LN {s = \\a => table {Nom => nom ; Acc => acc ; Dat => dat ; Gen => gen} ; - g = g ; n = Sg ; - hasArt = False} - - } ; - - defLN : LN -> LN = \n -> n ** {hasArt = True} ; - - mk2LN : (karolus, karoli : Str) -> Gender -> LN = \karolus, karoli, g -> - lin LN {s = \\a => table {Gen => karoli ; _ => karolus} ; g = g ; n = Sg ; - hasArt = False} ; - regLN : (horst : Str) -> Gender -> LN = \horst, g -> - mk2LN horst (ifTok Tok (Predef.dp 1 horst) "s" horst (horst + "s")) g ; - -- To extract the number of a noun phrase - -- ifPluralNP : NP -> Bool - -- = \np -> case (numberAgr np.a) of {Sg => False ; Pl => True} ; + ifPluralNP : CatGer.NP -> Bool + = \np -> case (numberAgr np.a) of {Sg => False ; Pl => True} ; --2 Adjectives @@ -234,9 +207,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: + -- for prepositions glued with DefArt in singular -- e.g. "auf" "auf den" "auf die" "aufs" + accusative - mkPrep : Str -> Str -> Str -> Str-> Case -> Prep ; + mkPrep : Str -> Str -> Str -> Str -> Case -> Prep ; mkPrep : Case -> Prep ; -- convert case to preposition } ; @@ -246,15 +219,14 @@ mkN : overload { datPrep : Prep ; -- no string, just dative case genPrep : Prep ; -- no string, just genitive case --- A couple of common prepositions (the first three always with the dative). +-- 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 - 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 + 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 + anAcc_Prep : Prep ; -- an + accusative, with contraction ans + inAcc_Prep : Prep ; -- in + accusative, with contraction ins --2 Verbs @@ -337,12 +309,12 @@ mkV2 : overload { -- Three-place (ditransitive) verbs need two prepositions, of which -- 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) + accdatV3 : V -> V3 ; -- geben + dat(c2) + acc(c3) (Eng: give sb sth) + dirV3 : V -> Prep -> V3 ; -- senden + acc(c2) + nach(c3) 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(c2) + über(c3) } ; --3 Other complement patterns @@ -353,39 +325,39 @@ mkV2 : overload { mkV0 : V -> V0 ; --% mkVS : V -> VS ; - mkV2V : overload { -- with zu; object-control - mkV2V : V -> V2V ; - mkV2V : V -> Prep -> V2V ; + mkV2V : overload { -- with zu + mkV2V : V -> V2V ; -- object-control verb (zu-inf), e.g. bitte jmdn, sich auszuruhen + mkV2V : V -> Prep -> V2V ; -- object-control verb with prep, e.g. appelliere an jmdn, zu schweigen } ; auxV2V : overload { -- without zu - auxV2V : V -> V2V ; + auxV2V : V -> V2V ; -- object-control auxiliary, e.g. lasse jmdn sich ausruhen auxV2V : V -> Prep -> V2V ; } ; - subjV2V : V2V -> V2V ; -- force subject-control + subjV2V : V2V -> V2V ; -- force subject-control, e.g. verspreche jmdm, mich auszuruhen mkV2A : overload { - mkV2A : V -> V2A ; + mkV2A : V -> V2A ; -- e.g. male etwas blau mkV2A : V -> Prep -> V2A ; } ; mkV2S : overload { - mkV2S : V -> V2S ; - mkV2S : V -> Prep -> V2S ; + mkV2S : V -> V2S ; -- e.g. antworte jmdm, dass S + mkV2S : V -> Prep -> V2S ; -- e.g. berichte an jmdn, dass S } ; mkV2Q : overload { - mkV2Q : V -> V2Q ; + mkV2Q : V -> V2Q ; -- e.g. frage jmdn, ob S mkV2Q : V -> Prep -> V2Q ; } ; - mkVV : V -> VV ; -- with zu - auxVV : V -> VV ; -- without zu + mkVV : V -> VV ; -- with zu, e.g. versuche, zu schlafen + auxVV : V -> VV ; -- without zu, e.g. will schlafen mkVA : overload { - mkVA : V -> VA ; + mkVA : V -> VA ; -- e.g. bleibe gesund mkVA : V -> Prep -> VA ; } ; - mkVQ : V -> VQ ; + mkVQ : V -> VQ ; -- e.g. frage mich, ob S mkAS : A -> AS ; --% @@ -411,9 +383,8 @@ mkV2 : overload { -- hidden from the document. Gender = MorphoGer.Gender ; - Case = MorphoGer.Case ; + Case = MorphoGer.Case ; Number = MorphoGer.Number ; - masculine = Masc ; feminine = Fem ; neuter = Neutr ; @@ -566,7 +537,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" | "au" | "eu") => 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") } ; @@ -582,27 +553,24 @@ mkV2 : overload { 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 = 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 = <>} ; + {s = \\_ => [] ; s2 = [] ; c = c ; isPrep = isCase ; lock_Prep = <>} } ; - + accPrep = mkPrep accusative ; datPrep = mkPrep dative ; genPrep = mkPrep genitive ; - --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 @@ -672,7 +640,7 @@ mkV2 : overload { = \v,c,d -> lin V3 (v ** {c2 = c ; c3 = d}) ; } ; - dirV3 v p = mkV3 v accPrep p ; + dirV3 v p = mkV3 v accPrep p ; -- accPrep sets isPrep=False 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 = <>} ; @@ -687,34 +655,35 @@ 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 = <>} ; } ; diff --git a/src/german/PhraseGer.gf b/src/german/PhraseGer.gf index 36c1d4e3..28e03ae2 100644 --- a/src/german/PhraseGer.gf +++ b/src/german/PhraseGer.gf @@ -1,4 +1,3 @@ ---# -path=.:../abstract:../common:prelude -- HL concrete PhraseGer of Phrase = CatGer ** open Prelude, ResGer in { flags optimize=all_subs ; diff --git a/src/german/QuestionGer.gf b/src/german/QuestionGer.gf index e5d660fb..547eafda 100644 --- a/src/german/QuestionGer.gf +++ b/src/german/QuestionGer.gf @@ -14,14 +14,14 @@ concrete QuestionGer of Question = CatGer ** open ResGer in { } ; QuestVP ip vp = { - s = \\m,t,a,p => + 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 - } + QDir => cl ! Main ; + QIndir => cl ! Sub + } } ; QuestSlash ip slash = { diff --git a/src/german/RelativeGer.gf b/src/german/RelativeGer.gf index f961cb12..48521cbb 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 ResGer, Prelude in { flags optimize=all_subs ; @@ -18,7 +18,7 @@ concrete RelativeGer of Relative = CatGer ** open Prelude, ResGer in { } ; agr = case rp.a of { RNoAg => agrP3 (numGenNum gn) ; - RAg n p => Ag Neutr n p + RAg n p => case n of {Sg => AgSgP3 Neutr ; Pl => AgPl p} } ; cl = mkClause (rp.s ! rgn ! Nom) agr vp in diff --git a/src/german/ResGer.gf b/src/german/ResGer.gf index 660b0d4e..fc5d1096 100644 --- a/src/german/ResGer.gf +++ b/src/german/ResGer.gf @@ -35,16 +35,41 @@ resource ResGer = ParamX ** open Prelude in { GenNum = GSg Gender | GPl ; RelGenNum = RGenNum GenNum | RSentence ; --- Agreement of $NP$ has three parts. +-- Agreement of $NP$ has three parts: gender, number and person. - Agr = Ag Gender Number Person ; + -- These 3*2*3 = 18 values can be reduced to 8, since gender is used only + -- in 3rd person singular. To select reflexive and possessive forms for "Sie" + -- in (mkClause str agr vp), add a value AgPlPol, for "man", add AgSgP3Gen. HL 29.9.2023 + + Agr = AgSgP1 | AgSgP2 | AgSgP3 Gender | AgSgP3Gen | AgPl Person | AgPlPol ; oper - mkAgr : {g : Gender ; n : Number ; p : Person} -> Agr = \r -> - Ag r.g r.n r.p ; - genderAgr : Agr -> Gender = \r -> case r of {Ag g _ _ => g} ; - numberAgr : Agr -> Number = \r -> case r of {Ag _ n _ => n} ; - personAgr : Agr -> Person = \r -> case r of {Ag _ _ p => p} ; + genderAgr : Agr -> Gender = \r -> case r of {AgSgP3 g => g ; _ => Masc} ; + + numberAgr = overload { + numberAgr : Agr -> Number = \r -> case r of { + AgSgP1 | AgSgP2 | AgSgP3 _ | AgSgP3Gen => Sg ; + AgPl _ | AgPlPol => Pl + } ; + numberAgr : VAgr -> Number = \r -> case r of {VAg n _ => n} ; + } ; + personAgr = overload { + personAgr : Agr -> Person = \r -> case r of { + AgSgP1 | AgPl P1 => P1 ; + AgSgP2 | AgPl P2 => P2 ; + AgSgP3 _ | AgSgP3Gen => P3 ; + AgPl P3 | AgPlPol => P3 + } ; + personAgr : VAgr -> Person = \r -> case r of {VAg _ p => p} + } ; + + conjAgr : Agr -> Agr -> Agr = \a,b -> + let n : Number = conjNumber (numberAgr a) (numberAgr b) ; + p : Person = conjPerson (personAgr a) (personAgr b) + in case of { => AgPl p ; + => AgSgP3 Neutr ; + => AgSgP1 ; + => AgSgP2 } ; -- Pronouns are the worst-case noun phrases, which have both case -- and possessive forms. @@ -58,16 +83,14 @@ resource ResGer = ParamX ** open Prelude in { 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 - Weight = WPron | WLight | WHeavy | WDefArt ; -- HL: may need WIndefArt for nicht+ein => kein - oper -- to handle clause negation properly + Weight = WPron | WLight | WHeavy | WDefArt ; + oper isPron : {w : Weight} -> Bool = \np -> case np.w of {WPron => True ; _ => False} ; isLight : {w : Weight} -> Bool = \np -> @@ -82,6 +105,9 @@ resource ResGer = ParamX ** open Prelude in { --2 For $Verb$ + param VAgr = -- Gender is irrelevant for verb forms, HL 8/2023 + VAg Number Person ; -- except participles + param VForm = VInf Bool -- True = with the particle "zu" | VFin Bool VFormFin -- True = prefix glued to verb @@ -130,8 +156,10 @@ resource ResGer = ParamX ** open Prelude in { oper agrP3 : Number -> Agr = agrgP3 Neutr ; - agrgP3 : Gender -> Number -> Agr = \g,n -> - Ag g n P3 ; + agrgP3 : Gender -> Number -> Agr = \g,n -> case n of { + Sg => AgSgP3 g ; + Pl => AgPl P3 -- no gender in Pl + } ; gennum : Gender -> Number -> GenNum = \g,n -> case n of { @@ -172,10 +200,10 @@ resource ResGer = ParamX ** open Prelude in { _ => Weak } ; - vFin : Bool -> Mood -> Tense -> Agr -> VForm = \b,m,t,a -> + vFin : Bool -> Mood -> Tense -> VAgr -> VForm = \b,m,t,a -> let - an = numberAgr a ; - ap = personAgr a ; + an : Number = numberAgr a ; + ap : Person = personAgr a ; in case of { => VFin b (VPresInd an ap) ; @@ -186,11 +214,15 @@ resource ResGer = ParamX ** open Prelude in { _ => VInf False --# notpresent } ; - conjAgr : Agr -> Agr -> Agr = \a,b -> mkAgr { - g = Neutr ; ---- - n = conjNumber (numberAgr a) (numberAgr b) ; - p = conjPerson (personAgr a) (personAgr b) - } ; + agr2vagr : Agr -> VAgr = \r -> case r of { + AgSgP1 => VAg Sg P1 ; + AgSgP2 => VAg Sg P2 ; + AgSgP3 _ | AgSgP3Gen => VAg Sg P3 ; + AgPl p => VAg Pl p ; + AgPlPol => VAg Pl P3 + } ; + + vagrP3 : Number -> VAgr = \n -> VAg n P3 ; -------------------------------------------- --TYPE DEFINITIONS + WORST-CASE CONSTRUCTORS @@ -415,51 +447,44 @@ resource ResGer = ParamX ** open Prelude in { -- To apply a preposition to a complement. appPrep : Preposition -> (Case => Str) -> Str = \prep,arg -> - prep.s ! GPl ++ arg ! prep.c ++ prep.s2 ; + prep.s ! GPl ++ arg ! prep.c ++ prep.s2 ; appPrepNP : Preposition -> NP -> Str = \prep,np -> let - g = (genderAgr np.a) ; - n = (numberAgr np.a) ; + g : Gender = genderAgr np.a ; + n : Number = numberAgr np.a ; glues = case of { => True ; _ => False} ; nps = np.s ! glues ! prep.c in 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 - } ; -{- - -- 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 ; + _ => prep.s ! GPl ++ nps ++ np.ext ++ prep.s2 ++ np.rc + } ; + +{- -- Simplify to test the effect on grammar compilation complexity (without SlashV2VNP): + -- with glues = False: 27096 msec, 3,2M VerbGer.gfo, 854 SentenceGer.gfo + -- and SlashV2VNP:102597 msec, 16 M VerbGer.gfo, 854 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: no longer used in RGL + + noPreposition : Case -> Preposition = \c -> + {s = \\_ => [] ; s2 = [] ; c = c ; isPrep = isCase} ; + -- To build a preposition from just a case. -- HL 9/19: moved to mkPrep in ParadigmsGer PrepNom : Preposition = {s = \\_ => []; isPrep = isCase ; c = Nom ; s2 = []} ; 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"; 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} ; -- To build passive: accusative object -> nom subject; others -> same case or prep @@ -473,8 +498,8 @@ resource ResGer = ParamX ** open Prelude in { -- Here we define personal and relative pronouns. -- All personal pronouns, except "ihr", conform to the simple pattern $mkPronPers$. - mkPronPers : (x1,_,_,_,x5 : Str) -> Gender -> Number -> Person -> - {s : NPForm => Str ; a : Agr} = + mkPronPers : (x1,_,_,_,x5 : Str) -> Gender -> Number -> Person -> + {s : NPForm => Str ; a : Agr} = \ich,mich,mir,meiner,mein,g,n,p -> { s = table { NPCase c => caselist ich mich mir meiner ! c ; @@ -486,7 +511,12 @@ resource ResGer = ParamX ** open Prelude in { } } } ; - a = Ag g n p + a = case of { + <_,Pl,p > => AgPl p ; + => AgSgP3 g ; + <_,Sg,P1> => AgSgP1 ; + <_,Sg,P2> => AgSgP2 -- for "man", "Sie", set in StructuralGer HL + } } ; pronEnding : GenNum => Case => Str = table { @@ -503,30 +533,14 @@ 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 { - => "am" ; - => "ins" ; - => "im" ; - => "zum" ; - => "zum" ; - => "zur" ; - => "vom" ; - _ => 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 => Case => Str = \adj -> let - ad : GenNum -> Case -> Str = \gn,c -> + 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} ; + \\n,g,c => case n of {Sg => ad (GSg g) c ; _ => ad GPl c} ; -- This auxiliary gives the forms in each degree of adjectives. @@ -559,7 +573,7 @@ resource ResGer = ParamX ** open Prelude in { -- For $Verb$. VPC : Type = { - s : Bool => Agr => VPForm => { -- True = prefix glued to verb + s : Bool => VAgr => VPForm => { -- True = prefix glued to verb fin : Str ; -- wird inf, inf2 : Str -- lesen,[] | gelesen,haben | können,haben (= gekonnt,haben) } -- HL 11/6/2019 Fut Anter: lesen gekonnt haben => haben lesen können @@ -575,8 +589,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 -- objCtrl distinguishes object-control from subject-control verb v:V2V in VP.s: @@ -587,26 +602,26 @@ resource ResGer = ParamX ** open Prelude in { let isAux = vp.isAux ; verb = vp.s ; - vfin : Bool -> Mood -> Tense -> Agr -> Str = \b,m,t,a -> + vfin : Bool -> Mood -> Tense -> VAgr -> Str = \b,m,t,a -> verb.s ! vFin b m t a ; vinf = verb.s ! VInf False ; vpart = if_then_Str isAux vinf (verb.s ! VPastPart APred) ; vHaben = auxPerfect verb ; - hat : Mood -> Tense -> Agr -> Str = \m,t,a -> + hat : Mood -> Tense -> VAgr -> Str = \m,t,a -> vHaben ! vFin False m t a ; haben : Str = vHaben ! VInf False ; - wird : Mood -> Agr -> Str = \m,a -> + wird : Mood -> VAgr -> Str = \m,a -> let - an = numberAgr a ; - ap = personAgr a ; + an : Number = numberAgr a ; + ap : Person = personAgr a ; in case m of { - MIndic => werden_V.s ! VFin False (VPresInd an ap) ; + MIndic => werden_V.s ! VFin False (VPresInd an ap) ; MConjunct => werden_V.s ! VFin False (VPresSubj an ap) - } ; - wuerde : Agr -> Str = \a -> --# notpresent + } ; + wuerde : VAgr -> Str = \a -> --# notpresent werden_V.s ! VFin False (VImpfSubj (numberAgr a) (personAgr a)) ; --# notpresent auf = verb.prefix ; @@ -730,10 +745,10 @@ resource ResGer = ParamX ** open Prelude in { insertObjNP : NP -> Preposition -> VPSlash -> VPSlash = \np,prep,vp -> let obj = appPrepNP prep np ; - b : Bool = case prep.isPrep of {isPrep | isPrepDefArt => True ; _ => False} ; + b : Bool = case isPrep of {isPrep | isPrepDefArt => True ; _ => False} ; w = np.w ; c = prep.c - in insertObj' obj b w c vp ; + in insertObj' obj b w c vp ; insertObj' : Str -> Bool -> Weight -> Case -> VPSlash -> VPSlash = \obj,isPrep,w,c,vp -> vp ** { @@ -759,10 +774,9 @@ 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) - 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 ! GPl ++ reflPron ! a ! prep.c ++ prep.s2 ; + let prep = vp.c2 ; + obj : Agr => Str = \\a => prep.s ! GPl ++ reflPron ! a ! prep.c ++ prep.s2 in vp ** { nn = \\a => let vpnn = vp.nn ! a in @@ -837,14 +851,15 @@ resource ResGer = ParamX ** open Prelude in { } ; mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> - let vps = useVP vp in { + let vagr = agr2vagr agr ; + vps = useVP vp in { s = \\m,t,a,b,o => let ord = case o of { Sub => True ; -- glue prefix to verb _ => False } ; - verb = vps.s ! ord ! agr ! VPFinite m t a ; + verb = vps.s ! ord ! vagr ! VPFinite m t a ; haben = verb.inf2 ; neg = negation ! b ; obj1 = (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ; -- refl ++ pronouns ++ light nps @@ -912,7 +927,7 @@ resource ResGer = ParamX ** open Prelude in { in < \\agr => (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ++ (vp.nn ! agr).p3 ++ (vp.nn ! agr).p4 ++ vp.a2, - vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! agrP3 Sg ! VPInfinit Simul).inf, -- vp.a1 ! Pos + vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! vagrP3 Sg ! VPInfinit Simul).inf, -- vp.a1 ! Pos vp.inf.inpl.p2, -- ! HL infExt ++ vp.ext > ; @@ -923,7 +938,7 @@ resource ResGer = ParamX ** open Prelude in { { objs = \\agr => (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ++ negation ! pol ++ (vp.nn ! agr).p3 ++ vp.a2 ++ (vp.nn ! agr).p4 ; -- objects + predicative A|CN|NP - pred = vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! agrP3 Sg ! VPInfinit ant).inf ; + pred = vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! vagrP3 Sg ! VPInfinit ant).inf ; -- inplace and extracted parts of vp.inf: inpl = vp.inf.inpl ; extr = vp.inf.extr @@ -934,7 +949,7 @@ resource ResGer = ParamX ** open Prelude in { \isAux, ant, pol, vp -> let vps = useVP vp in { objs = \\agr => (vp.nn ! agr).p1 ++ (vp.nn ! agr).p2 ++ negation ! pol ++ (vp.nn ! agr).p3 ++ vp.a2 ++ (vp.nn ! agr).p4 ; -- objects + predicative A|CN|NP - pred = vp.inf.inpl.p2 ++ vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! agrP3 Sg ! VPInfinit ant).inf ; + pred = vp.inf.inpl.p2 ++ vp.a1 ++ vp.adj ++ (vps.s ! (notB isAux) ! vagrP3 Sg ! VPInfinit ant).inf ; -- inplace and extracted parts of vp.inf: inpl = ; -- move the predicate part to pred extr = vp.inf.extr @@ -945,7 +960,7 @@ resource ResGer = ParamX ** open Prelude in { -- let vpi = infVP isAux vp in -- vpi.p1 ! agrP3 Sg ++ vpi.p3 ++ vpi.p2 ++ vpi.p4 ; let vpi = infVP isAux Simul Pos vp ; -- HL 3/2022 - agr : Agr = (Ag Masc Sg P3) ; + agr : Agr = AgSgP3Gen ; -- HL 17.8.2023 glue : (Agr => Str)*Str -> Str = \i -> i.p1!agr ++ i.p2 in glue (embedInf vpi.inpl ) ++ vpi.extr!agr ++ vp.ext ; @@ -953,47 +968,64 @@ resource ResGer = ParamX ** open Prelude in { -- The nominative case is not used as reflexive, but defined here -- so that we can reuse this in personal pronouns. - reflPron : Agr => Case => Str = table { - Ag _ Sg P1 => caselist "ich" "mich" "mir" "meiner" ; - Ag _ Sg P2 => caselist "du" "dich" "dir" "deiner" ; - Ag Masc Sg P3 => caselist "er" "sich" "sich" "seiner" ; - Ag Fem Sg P3 => caselist "sie" "sich" "sich" "ihrer" ; - Ag Neutr Sg P3 => caselist "es" "sich" "sich" "seiner" ; - Ag _ Pl P1 => caselist "wir" "uns" "uns" "unser" ; - Ag _ Pl P2 => caselist "ihr" "euch" "euch" "euer" ; - Ag _ Pl P3 => caselist "sie" "sich" "sich" "ihrer" + reflPron : Agr => Case => Str = table { -- with persPron nominative + AgSgP1 => caselist "ich" "mich" "mir" "meiner" ; + AgSgP2 => caselist "du" "dich" "dir" "deiner" ; + AgSgP3 Masc => caselist "er" "sich" "sich" "seiner" ; + AgSgP3 Fem => caselist "sie" "sich" "sich" "ihrer" ; + AgSgP3 Neutr => caselist "es" "sich" "sich" "seiner" ; + AgSgP3Gen => caselist "man selbst" "sich" "sich" "seiner" ; -- älter als man selbst sein + AgPl P1 => caselist "wir" "uns" "uns" "unser" ; + AgPl P2 => caselist "ihr" "euch" "euch" "euer" ; + AgPl P3 => caselist "sie" "sich" "sich" "ihrer" ; + AgPlPol => caselist "Sie" "sich" "sich" "Ihrer" -- HL 8/2023 + -- ; AgPlReci => caselist "man" "einander" "einander" "einander" -- reciPron ? } ; possPron : Agr -> Number -> Gender -> Case -> Str = \a,n,g,c -> case of { - => caselist "mein" "meinen" "meinem" "meines" ! c ; - => caselist "meine" "meine" "meiner" "meiner" ! c ; - => caselist "mein" "mein" "meinem" "meines" ! c ; - => caselist "meine" "meine" "meinen" "meiner" ! c ; - => caselist "dein" "deinen" "deinem" "deines" ! c ; - => caselist "deine" "deine" "deiner" "deiner" ! c ; - => caselist "dein" "dein" "deinem" "deines" ! c ; - => caselist "deine" "deine" "deinen" "deiner" ! c ; - - => caselist "sein" "seinen" "seinem" "seines" ! c ; - => caselist "seine" "seine" "seiner" "seiner" ! c ; - => caselist "sein" "sein" "seinem" "seines" ! c ; - => caselist "seine" "seine" "seinen" "seiner" ! c ; + => caselist "mein" "meinen" "meinem" "meines" ! c ; + => caselist "meine" "meine" "meiner" "meiner" ! c ; + => caselist "mein" "mein" "meinem" "meines" ! c ; + => caselist "meine" "meine" "meinen" "meiner" ! c ; + => caselist "dein" "deinen" "deinem" "deines" ! c ; + => caselist "deine" "deine" "deiner" "deiner" ! c ; + => caselist "dein" "dein" "deinem" "deines" ! c ; + => caselist "deine" "deine" "deinen" "deiner" ! c ; - => caselist "ihr" "ihren" "ihrem" "ihres" ! c ; - => caselist "ihre" "ihre" "ihrer" "ihrer" ! c ; - => caselist "ihr" "ihr" "ihrem" "ihres" ! c ; - => caselist "ihre" "ihre" "ihren" "ihrer" ! c ; + => caselist "ihr" "ihren" "ihrem" "ihres" ! c ; + => caselist "ihre" "ihre" "ihrer" "ihrer" ! c ; + => caselist "ihr" "ihr" "ihrem" "ihres" ! c ; + => caselist "ihre" "ihre" "ihren" "ihrer" ! c ; - => caselist "unser" "unseren" "unserem" "unseres" ! c ; - => caselist "unsere" "unsere" "unserer" "unserer" ! c ; - => caselist "unser" "unser" "unserem" "unseres" ! c ; - => caselist "unsere" "unsere" "unseren" "unserer" ! c ; - - => caselist "euer" "euren" "eurem" "eures" ! c ; - => caselist "eure" "eure" "eurer" "eurer" ! c ; - => caselist "euer" "euer" "eurem" "eures" ! c ; - => caselist "eure" "eure" "euren" "eurer" ! c - + => caselist "sein" "seinen" "seinem" "seines" ! c ; + => caselist "seine" "seine" "seiner" "seiner" ! c ; + => caselist "sein" "sein" "seinem" "seines" ! c ; + => caselist "seine" "seine" "seinen" "seiner" ! c ; + + => caselist "sein" "seinen" "seinem" "seines" ! c ; + => caselist "seine" "seine" "seiner" "seiner" ! c ; + => caselist "sein" "sein" "seinem" "seines" ! c ; + => caselist "seine" "seine" "seinen" "seiner" ! c ; + + => caselist "unser" "unseren" "unserem" "unseres" ! c ; + => caselist "unsere" "unsere" "unserer" "unserer" ! c ; + => caselist "unser" "unser" "unserem" "unseres" ! c ; + => caselist "unsere" "unsere" "unseren" "unserer" ! c ; + + => caselist "euer" "euren" "eurem" "eures" ! c ; + => caselist "eure" "eure" "eurer" "eurer" ! c ; + => caselist "euer" "euer" "eurem" "eures" ! c ; + => caselist "eure" "eure" "euren" "eurer" ! c ; + + => caselist "ihr" "ihren" "ihrem" "ihres" ! c ; + => caselist "ihre" "ihre" "ihrer" "ihrer" ! c ; + => caselist "ihr" "ihr" "ihrem" "ihres" ! c ; + => caselist "ihre" "ihre" "ihren" "ihrer" ! c ; + + => caselist "Ihr" "Ihren" "Ihrem" "Ihres" ! c ; + => caselist "Ihre" "Ihre" "Ihrer" "Ihrer" ! c ; + => caselist "Ihr" "Ihr" "Ihrem" "Ihres" ! c ; + => caselist "Ihre" "Ihre" "Ihren" "Ihrer" ! c } ; conjThat : Str = "dass" ; @@ -1022,11 +1054,10 @@ resource ResGer = ParamX ** open Prelude in { } ; -- Function that allows the construction of non-nominative subjects. - mkSubject : NP -> Preposition -> {s:Str ; a:Agr} = \np, prep -> let - subj = appPrepNP prep np ; - agr = case prep.c of { Nom => np.a ; _ => Ag Masc Sg P3 } + agr = case prep.c of { Nom => np.a ; _ => AgSgP3 Masc } ; + subj = appPrepNP prep np in {s = subj ; a = agr} ; sex2gender : Sex -> Gender = \g -> diff --git a/src/german/SentenceGer.gf b/src/german/SentenceGer.gf index 353256a6..4340b4ab 100644 --- a/src/german/SentenceGer.gf +++ b/src/german/SentenceGer.gf @@ -21,17 +21,22 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { s = \\pol,n => let ps = case n of { - ImpF _ True => ; -- setzen Sie sich - _ => - } ; - agr = Ag Fem (numImp n) ps.p1 ; --- g does not matter - verb = vps.s ! False ! agr ! VPImperat ps.p3 ; - neg = negation ! pol ; + ImpF _ True => ; -- setzen Sie sich Ihren Hut auf + _ => -- but: nimm [ihren | deinen | *Ihren] Hut + } ; -- vp should be reflexive, ComplRSlash + vagr = VAg (numImp n) ps.p1 ; + verb = vps.s ! False ! vagr ! VPImperat ps.p3 ; + agr = case of { + <_, P3,True> => AgPlPol ; -- sich | Ihr- + => AgSgP2 ; -- dich | dein- + => AgPl P2 ; -- euch | euer- + _ => AgSgP1 -- default, does not occur + } ; inf = vp.inf.inpl.p2 ++ verb.inf ; -- HL .s/.inpl.p2 - obj = (vp.nn ! agr).p2 ++ (vp.nn ! agr).p3 ++ (vp.nn ! agr).p4 ++ vp.adj + obj = (vp.nn ! agr).p2 ++ (vp.nn ! agr).p3 ++ (vp.nn ! agr).p4 in - verb.fin ++ ps.p2 ++ (vp.nn ! agr).p1 ++ vp.a1 ++ neg ++ obj ++ vp.a2 ++ inf ++ vp.ext - } ; + verb.fin ++ ps.p2 ++ (vp.nn ! agr).p1 ++ vp.a1 ++ negation ! pol ++ obj ++ vp.a2 ++ inf ++ vp.ext + } ; AdvImp adv imp = { s = \\pol,impform => adv.s ++ imp.s ! pol ! impform @@ -42,9 +47,9 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { -- + 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 + 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 @@ -54,7 +59,7 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { SlashVS np vs slash = let subj = mkSubject np PrepNom ; - vp = (insertExtrapos (conjThat ++ slash.s ! Sub) (predV vs)) + vp = insertExtrapos (conjThat ++ slash.s ! Sub) (predV vs) in mkClause subj.s subj.a vp ** {c2 = slash.c2} ; EmbedS s = {s = conjThat ++ s.s ! Sub} ; -- no leading comma, if sentence-initial diff --git a/src/german/StructuralGer.gf b/src/german/StructuralGer.gf index 3c64a7d6..2e52ad83 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, (R = ResGer) in { @@ -52,13 +52,13 @@ 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 = P.inDat_Prep ; -- HL 7/2022 + in_Prep = P.inDat_Prep ; 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 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 = { -- HL 5/2022 s = \\n,g,c => let gn = R.gennum g n ; adj = (P.mkA "viel" "mehr" "meiste").s ! Superl @@ -67,7 +67,7 @@ concrete StructuralGer of Structural = CatGer ** c = {p = [] ; k = PredCase Gen} ; a = PAg Pl} ; much_Det = {s = asQuant (\\_,_ => "viel") ; sp = asQuant (\\_,_ => "vieles") ; - n = Sg ; a = Weak ; isDef = False ; hasDefArt = False} ; + n = Sg ; a = Weak ; isDef = False ; hasDefArt = False} ; must_VV = auxVV (mkV "müssen" "muss" "musst" "muss" "müsst" "müss" @@ -81,26 +81,27 @@ concrete StructuralGer of Structural = CatGer ** 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 + part_Prep = P.von_Prep ; -- obsolete, better use PartNP cn np please_Voc = ss "bitte" ; - possess_Prep = P.von_Prep ; -- obsolete, use PossNP cn np + possess_Prep = P.von_Prep ; -- obsolete, better use PossNP cn np 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 - in {s,sp = asQuant tab ; isDef = True ; n = Pl ; a = Weak ; hasDefArt = False} ; + in {s,sp = asQuant tab ; n = Pl ; a = Weak ; isDef = True ; hasDefArt = False} ; someSg_Det = { s,sp = asQuant (\\g,c => "ein" + pronEnding ! GSg g ! c) ; ---- einer,eines n = Sg ; a = Strong ; hasNum = True ; - isDef = False ; hasDefArt = False + isDef = False ; + hasDefArt = False } ; 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 Neutr {s = caselist "das" "das" "dem" "dessen"} ; ---- there_Adv = ss "da" ; --- no variants in the rgl | ss "dort" ; @@ -110,7 +111,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 Neutr {s = caselist "dies" "dies" "diesem" "dieses"} ; ---- ---b those_NP = {s = caselist "jene" "jene" "jenen" "jener" ; a = agrP3 Pl} ; @@ -142,7 +143,7 @@ concrete StructuralGer of Structural = CatGer ** with_Prep = mkPrep "mit" P.dative ; youSg_Pron = mkPronPers "du" "dich" "dir" "deiner" "dein" Fem Sg P2 ; youPl_Pron = mkPronPers "ihr" "euch" "euch" "eurer" "euer" Fem Pl P2 ; ---- poss - youPol_Pron = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Fem Pl P3 ; + youPol_Pron = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Fem Pl P3 ** {a = AgPlPol} ; yes_Utt = ss "ja" ; not_Predet = {s = \\_,_,_ => "nicht" ; c = noCase ; a = PAgNone} ; @@ -168,15 +169,14 @@ concrete StructuralGer of Structural = CatGer ** lin language_title_Utt = ss "Deutsch" ; - oper - 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}) - = \qt,nt -> \\g,c => {quant = qt ! g ! c; num = nt ! g ! c} ; - - appAdjDegAdjf : Adjective -> Degree -> Adjf -> Number => Gender => Case => Str = - \adj,deg,adjf -> \\n,g,c => adj.s ! deg ! (agrAdj g adjf n c) ; +oper + 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}) + = \qt,nt -> \\g,c => {quant = qt ! g ! c; num = nt ! g ! c} ; + appAdjDegAdjf : Adjective -> Degree -> Adjf -> Number => Gender => Case => Str = + \adj,deg,adjf -> \\n,g,c => adj.s ! deg ! (agrAdj g adjf n c) ; } diff --git a/src/german/SymbolGer.gf b/src/german/SymbolGer.gf index d1c6da49..42b22432 100644 --- a/src/german/SymbolGer.gf +++ b/src/german/SymbolGer.gf @@ -9,7 +9,7 @@ lin NumPN i = {s = i.s ! Neutr ; g = Neutr ; n = Sg} ; --- c CNIntNP cn i = { - s = \\b,c => cn.s ! Weak ! Sg ! Nom ++ i.s ; + s = \\_,c => cn.s ! Weak ! Sg ! Nom ++ i.s ; a = agrP3 Sg ; w = WLight ; ext,rc = [] -- added @@ -21,11 +21,11 @@ lin 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 ; - ext,rc = [] + s = \\b,c => case b of {True => [] ; False => artDef ! (GSg cn.g) ! c} + ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! c ; + a = agrgP3 cn.g Sg ; -- HL 27.9.2023 + w = WDefArt ; -- im Haus 14 + ext,rc = [] -- added } ; SymbS sy = {s = \\_ => sy.s} ; diff --git a/src/german/VerbGer.gf b/src/german/VerbGer.gf index f397ecf7..7e381a18 100644 --- a/src/german/VerbGer.gf +++ b/src/german/VerbGer.gf @@ -21,14 +21,13 @@ 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 = -- (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 @@ -40,14 +39,12 @@ 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 (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 let vp = case vps.objCtrl of { True => objAgr np vps ; _ => vps } ** { c2 = vps.c2 ; objCtrl = vps.objCtrl } ; 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 @@ -92,17 +89,18 @@ 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 - -- 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 ; + -- to save a lot compile time and memory, avoid insertObjNP with glueing of prep+DefArt: + -- + SlashV2VNP 110.592.000 (46080,240) + 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 @@ -130,8 +128,7 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { AdvVPSlash vp adv = vp ** insertAdv adv.s vp ; AdVVPSlash adv vp = vp ** insertAdv adv.s vp ; - -- ReflVP vp = insertObj (\\a => appPrep vp.c2 - -- (\\k => usePrepC k (\c -> reflPron ! a ! c))) vp ; + -- ReflVP vp = insertObj (\\a => appPrep vp.c2 (reflPron ! a)) vp ; ReflVP vp = insertObjRefl vp ; -- HL, 19/06/2019 PassV2 v = -- acc object -> nom subject; all others: same PCase @@ -161,6 +158,6 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { (ist verheiratet:VP mit:Prep):VPSlash, ComplA2 is used to parse "sie ist verheiratet mit mir" -} - VPSlashPrep vp prep = vp ** {c2 = prep ; objCtrl = False} ; + VPSlashPrep vp prep = vp ** {c2 = prep ; objCtrl = False} ; -- HL 7.8.23 } From e200403cf88941f211ed1d562e44270da092f5fd Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Sun, 1 Oct 2023 23:46:57 +0200 Subject: [PATCH 093/129] Add forgotten hunks of branch master to smallAgr --- src/german/ConjunctionGer.gf | 8 +- src/german/ConstructionGer.gf | 195 +++++++++++++++++++++----- src/german/DocumentationGerFunctor.gf | 72 +++++++++- src/german/ExtraGer.gf | 15 +- src/german/IdiomGer.gf | 3 +- src/german/LexiconGer.gf | 14 +- src/german/MarkupGer.gf | 4 +- src/german/MorphoGer.gf | 13 +- src/german/NounGer.gf | 30 ++-- src/german/ParadigmsGer.gf | 75 +++++++--- src/german/ResGer.gf | 4 +- src/german/SentenceGer.gf | 5 +- src/german/VerbGer.gf | 2 +- 13 files changed, 325 insertions(+), 115 deletions(-) diff --git a/src/german/ConjunctionGer.gf b/src/german/ConjunctionGer.gf index 22f7181d..790461bd 100644 --- a/src/german/ConjunctionGer.gf +++ b/src/german/ConjunctionGer.gf @@ -52,13 +52,13 @@ concrete ConjunctionGer of Conjunction = 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 ; @@ -66,12 +66,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 diff --git a/src/german/ConstructionGer.gf b/src/german/ConstructionGer.gf index 7f592750..7f43a4a2 100644 --- a/src/german/ConstructionGer.gf +++ b/src/german/ConstructionGer.gf @@ -1,42 +1,65 @@ --# -path=.:../abstract -concrete ConstructionGer of Construction = CatGer ** - open SyntaxGer, SymbolicGer, ParadigmsGer, +concrete ConstructionGer of Construction = CatGer ** + 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 weather_adjCl ap = mkCl (mkVP (lin AP ap)) ; - is_right_VP = mkVP have_V2 (mkNP (ParadigmsGer.mkN "Recht")) ; - is_wrong_VP = mkVP have_V2 (mkNP (ParadigmsGer.mkN "Unrecht")) ; + is_right_VP = mkVP have_V2 (mkNP (P.mkN "Recht")) ; + is_wrong_VP = mkVP have_V2 (mkNP (P.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 ; - 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" "Gläser" neuter)) np ; + 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 +69,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 +189,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/DocumentationGerFunctor.gf b/src/german/DocumentationGerFunctor.gf index eedea374..13b24527 100644 --- a/src/german/DocumentationGerFunctor.gf +++ b/src/german/DocumentationGerFunctor.gf @@ -25,13 +25,13 @@ oper lin InflectionN, InflectionN2, InflectionN3 = \noun -> { t = "s" ; - s1 = heading1 (heading noun_Category ++ + s1 = heading1 (heading noun_Category ++ case noun.g of { - Masc => "("+heading masculine_Parameter+")" ; + Masc => "("+heading masculine_Parameter+")" ; Fem => "("+heading feminine_Parameter+")" ; Neutr => "("+heading neuter_Parameter+")" }) ; - s2 = frameTable ( + s2 = frameTable ( tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter) ) ++ tr (th (heading nominative_Parameter) ++ td (noun.s ! Sg ! Nom) ++ td (noun.s ! Pl ! Nom)) ++ tr (th (heading genitive_Parameter) ++ td (noun.s ! Sg ! Gen) ++ td (noun.s ! Pl ! Gen)) ++ @@ -40,6 +40,66 @@ lin ) } ; + InflectionPN = \pn -> { + t = "pn" ; + s1 = heading1 ("Eigenname" ++ + "("+case of { + => heading masculine_Parameter ; + => heading feminine_Parameter ; + => heading neuter_Parameter ; + <_,Pl> => heading plural_Parameter + } ++")") ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (pn.s ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (pn.s ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (pn.s ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (pn.s ! Acc)) + ) + } ; + + InflectionGN = \gn -> { + t = "vn" ; + s1 = heading1 ("Vorname" ++ + case gn.g of { + Male => "(männlich)" ; + Female => "(weiblich)" + }) ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (gn.s ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (gn.s ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (gn.s ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (gn.s ! Acc)) + ) ; + } ; + + InflectionSN = \sn -> { + t = "fn" ; + s1 = heading1 ("Familienname") ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (sn.s ! Male ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (sn.s ! Male ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (sn.s ! Male ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (sn.s ! Male ! Acc)) + ) ; + } ; + + InflectionLN = \ln -> { + t = "pn" ; + s1 = heading1 ("Standortnamen" ++ + "("+case of { + => heading masculine_Parameter ; + => heading feminine_Parameter ; + => heading neuter_Parameter ; + <_,Pl> => heading plural_Parameter + } ++")") ; + s2 = frameTable ( + tr (th (heading nominative_Parameter) ++ td (ln.s ! Strong ! Nom)) ++ + tr (th (heading genitive_Parameter) ++ td (ln.s ! Strong ! Gen)) ++ + tr (th (heading dative_Parameter) ++ td (ln.s ! Strong ! Dat)) ++ + tr (th (heading accusative_Parameter) ++ td (ln.s ! Strong ! Acc)) + ) + } ; + InflectionA, InflectionA2 = \adj -> let gforms : Degree -> ResGer.Case -> Str = \d,c -> @@ -48,8 +108,8 @@ lin td (adj.s ! d ! (AMod (GSg Neutr) c)) ++ td (adj.s ! d ! (AMod GPl c)) ; dtable : Parameter -> Degree -> Str = \s,d -> - paragraph (heading2 (heading s) ++ frameTable ( - tr (th [] ++ th (heading masculine_Parameter) ++ th (heading feminine_Parameter) ++ th (heading neuter_Parameter) ++ + paragraph (heading2 (heading s) ++ frameTable ( + tr (th [] ++ th (heading masculine_Parameter) ++ th (heading feminine_Parameter) ++ th (heading neuter_Parameter) ++ th (heading plural_Parameter)) ++ tr (th (heading nominative_Parameter) ++ gforms d Nom) ++ tr (th (heading genitive_Parameter) ++ gforms d Gen) ++ @@ -163,7 +223,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 e25757d8..7772ea5b 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 = WLight ; + 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 = WLight ; + w = case det.isDef of {True => WLight ; _ => WHeavy} ;--WLight ; ext, rc = [] } ; @@ -207,11 +207,10 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** PredetRNP pred rnp = rnp ** { -- HL 5/2022 s = \\a,c => let n : Number = case pred.a of {PAg n => n ; _ => numberAgr a} ; - g : Gender = genderAgr a ; + g = genderAgr a ; d = case pred.c.k of {NoCase => c ; PredCase k => k} ; in case rnp.isPron of { - True => pred.s ! Pl ! Masc ! c - ++ "von" ++ rnp.s ! a ! Dat ; + 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} ; @@ -228,11 +227,11 @@ concrete ExtraGer of ExtraGerAbs = CatGer ** ReflA2RNP adj rnp = -- would need AP.c : Agr => Str*Str, not AP.c : Str*Str let -- as we have no reflexive AP, - compl = appPrep 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 {isPrep => <[], compl> ; _ => } ; + c = case adj.c2.isPrep of {isCase => ; _ => <[], compl>} ; ext = rnp.ext ++ rnp.rc } ; @@ -252,7 +251,7 @@ 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 = \\a,c => x.s ! False ! c ++ x.ext ++ x.rc} y ; + 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 ; diff --git a/src/german/IdiomGer.gf b/src/german/IdiomGer.gf index a2b7b081..0d8d65fa 100644 --- a/src/german/IdiomGer.gf +++ b/src/german/IdiomGer.gf @@ -25,8 +25,7 @@ concrete IdiomGer of Idiom = CatGer ** ExistIP ip = { s = \\m,t,a,p => let - cls = - (mkClause "es" (agrP3 Sg) (predV geben)).s ! m ! t ! a ! p ; + cls = (mkClause "es" (agrP3 Sg) (predV geben)).s ! m ! t ! a ! p ; who = ip.s ! Acc in table { QDir => who ++ cls ! Inv ; diff --git a/src/german/LexiconGer.gf b/src/german/LexiconGer.gf index 93a39cac..8c2714a7 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" ; @@ -58,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 ; @@ -185,7 +186,7 @@ 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 "Stern" ; steel_N = mkN "Stahl" ; stone_N = mkN "Stein" ; stop_V = seinV Irreg.halten_V ; @@ -211,7 +212,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" | "auf das") accusative); walk_V = seinV Irreg.gehen_V ; warm_A = mk3A "warm" "wärmer" "wärmste" ; war_N = mkN "Krieg" ; @@ -235,14 +237,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" ; @@ -295,7 +297,7 @@ lin sand_N = mkN "Sand" ; seed_N = mkN "Same" ; skin_N = mkN "Haut" "Häute" feminine ; - sky_N = mkN "Himmel" ; ---- pl + sky_N = mkN "Himmel" ; smoke_N = mkN "Rauch" ; snow_N = mkN "Schnee" "Schneen" masculine ; ---- pl stick_N = mkN "Stock" "Stöcke" masculine ; diff --git a/src/german/MarkupGer.gf b/src/german/MarkupGer.gf index 54cd352e..b3e410cd 100644 --- a/src/german/MarkupGer.gf +++ b/src/german/MarkupGer.gf @@ -1,6 +1,6 @@ ---# -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 diff --git a/src/german/MorphoGer.gf b/src/german/MorphoGer.gf index 438cb62c..dc46adc7 100644 --- a/src/german/MorphoGer.gf +++ b/src/german/MorphoGer.gf @@ -20,21 +20,20 @@ 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 = [] ; + ext,rc = [] ; 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 : Gender => Case => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> {s,sp = appAdj (regDetA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index 843398b0..558ab8a1 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -1,27 +1,28 @@ +--# -path=.:../abstract:../common: concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { flags optimize=all_subs ; --- Remark: np.isLight makes ResGer.insertObjNP expensive, for ComplSlash, SlashVP + -- 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 ; + 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 => case det.hasDefArt of {True => WDefArt ; - _ => WLight } ; + -- 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 } ; - rc = cn.rc ! det.n ; - ext = cn.ext + rc = cn.rc ! det.n ; + ext = cn.ext } ; - DetNP det = { - s = \\b,c => det.sp ! b ! 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 = \\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 = [] @@ -115,6 +116,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; NumFloat dig1 dig2 = {s = \\g,c => dig1.s ! invNum ++ BIND ++ "." ++ BIND ++ dig2.s ! NCard g c ; n = Pl } ; + NumDecimal numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdNumeral numeral = {s = \\af => numeral.s ! NOrd af} ; @@ -158,9 +160,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 f45498c6..6190f011 100644 --- a/src/german/ParadigmsGer.gf +++ b/src/german/ParadigmsGer.gf @@ -2,7 +2,7 @@ --1 German Lexical Paradigms -- --- Aarne Ranta, Harald Hammarström and Björn Bringert 2003--2007 +-- Aarne Ranta, Harald Hammarström and Björn Bringert2003--2007 -- -- This is an API for the user of the resource grammar -- for adding lexical items. It gives functions for forming @@ -141,6 +141,7 @@ mkN : overload { } ; + mkGN : overload { mkGN : Str -> Sex -> GN ; -- regular name with genitive in "s" mkGN : (nom,gen : Str) -> Sex -> GN ; -- name with other genitive @@ -159,10 +160,36 @@ mkN : overload { mkSN : (nom,acc,dat,gen : Str) -> GN ; -- name with all case forms } ; + mkLN = overload { + mkLN : Str -> LN = \s -> regLN s Masc ; -- regular name with genitive in "s", masculine + mkLN : Str -> Number -> LN = \s,n -> regLN s Masc ** {n=n} ; -- regular name with genitive in "s", masculine + mkLN : Str -> Gender -> LN = regLN ; -- regular name with genitive in "s" + +-- If only the genitive differs, two strings are needed. + + mkLN : (nom,gen : Str) -> Gender -> LN = mk2LN ; -- name with other genitive + +-- In the worst case, all four forms are needed. + + mkLN : (nom,acc,dat,gen : Str) -> Gender -> LN = \nom,acc,dat,gen,g -> + lin LN {s = \\a => table {Nom => nom ; Acc => acc ; Dat => dat ; Gen => gen} ; + g = g ; n = Sg ; + hasArt = False} + + } ; + + defLN : LN -> LN = \n -> n ** {hasArt = True} ; + + mk2LN : (karolus, karoli : Str) -> Gender -> LN = \karolus, karoli, g -> + lin LN {s = \\a => table {Gen => karoli ; _ => karolus} ; g = g ; n = Sg ; + hasArt = False} ; + regLN : (horst : Str) -> Gender -> LN = \horst, g -> + mk2LN horst (ifTok Tok (Predef.dp 1 horst) "s" horst (horst + "s")) g ; + -- To extract the number of a noun phrase - ifPluralNP : CatGer.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 @@ -219,14 +246,16 @@ 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 - anAcc_Prep : Prep ; -- an + accusative, with contraction ans - 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 + anAcc_Prep : Prep ; -- an + accusative, with contraction ans + 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 @@ -383,8 +412,9 @@ mkV2 : overload { -- hidden from the document. Gender = MorphoGer.Gender ; - Case = MorphoGer.Case ; + Case = MorphoGer.Case ; Number = MorphoGer.Number ; + masculine = Masc ; feminine = Fem ; neuter = Neutr ; @@ -537,7 +567,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" | "au" | "eu") => 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") } ; @@ -567,10 +597,12 @@ mkV2 : overload { 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 @@ -655,35 +687,34 @@ 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 = <>} ; } ; diff --git a/src/german/ResGer.gf b/src/german/ResGer.gf index fc5d1096..a56dbe43 100644 --- a/src/german/ResGer.gf +++ b/src/german/ResGer.gf @@ -745,10 +745,10 @@ resource ResGer = ParamX ** open Prelude in { insertObjNP : NP -> Preposition -> VPSlash -> VPSlash = \np,prep,vp -> let obj = appPrepNP prep np ; - b : Bool = case isPrep of {isPrep | isPrepDefArt => True ; _ => False} ; + b : Bool = case prep.isPrep of {isPrep | isPrepDefArt => True ; _ => False} ; w = np.w ; c = prep.c - in insertObj' obj b w c vp ; + in insertObj' obj b w c vp ; insertObj' : Str -> Bool -> Weight -> Case -> VPSlash -> VPSlash = \obj,isPrep,w,c,vp -> vp ** { diff --git a/src/german/SentenceGer.gf b/src/german/SentenceGer.gf index 4340b4ab..04247b7b 100644 --- a/src/german/SentenceGer.gf +++ b/src/german/SentenceGer.gf @@ -32,10 +32,11 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in { => AgPl P2 ; -- euch | euer- _ => AgSgP1 -- default, does not occur } ; + 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 ++ 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 = { diff --git a/src/german/VerbGer.gf b/src/german/VerbGer.gf index 7e381a18..f24dda48 100644 --- a/src/german/VerbGer.gf +++ b/src/german/VerbGer.gf @@ -158,6 +158,6 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in { (ist verheiratet:VP mit:Prep):VPSlash, ComplA2 is used to parse "sie ist verheiratet mit mir" -} - VPSlashPrep vp prep = vp ** {c2 = prep ; objCtrl = False} ; -- HL 7.8.23 + VPSlashPrep vp prep = vp ** {c2 = prep ; objCtrl = False} ; } From 8d25422c79e72d2cd576fabadbce105f52b3356b Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 5 Oct 2023 10:12:46 +0200 Subject: [PATCH 094/129] =?UTF-8?q?(Fin)=20Fix=20bug=20in=20c65:=20k=C3=A4?= =?UTF-8?q?yty,=20not=20*k=C3=A4ytty?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/finnish/Kotus.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/finnish/Kotus.gf b/src/finnish/Kotus.gf index 153bad07..962c7625 100644 --- a/src/finnish/Kotus.gf +++ b/src/finnish/Kotus.gf @@ -262,7 +262,7 @@ oper c65 : Str -> VForms -- 1 käydä = \s -> let kay = Predef.tk 2 s ; kavi = init kay + "vi" in vForms12 s (kay + "n") kay (kay + "vät") (kay + "kää") (kay + "dään") - (kavi + "n") kavi (kavi + "si") (kay + "nyt") (kay + "tty") + (kavi + "n") kavi (kavi + "si") (kay + "nyt") (kay + "ty") (kay + "nee") ; -- just one verb c66 : Str -> VForms -- 268 öristä = \s -> cKuunnella s (Predef.tk 2 s + "in") ; From 297f396bd217355cc4c308ba5b54c191ccf4a913 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sun, 8 Oct 2023 19:46:32 +0200 Subject: [PATCH 095/129] fix PassVPSlash/PassAgentVPSlash when the Slash category contain an adverb --- src/french/ExtendFre.gf | 6 ++++-- src/romance/ExtendRomanceFunctor.gf | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/french/ExtendFre.gf b/src/french/ExtendFre.gf index 3c3f209d..02b2915e 100644 --- a/src/french/ExtendFre.gf +++ b/src/french/ExtendFre.gf @@ -5,7 +5,7 @@ concrete ExtendFre of Extend = [ ---- iFem_Pron, youFem_Pron, weFem_Pron, youPlFem_Pron, theyFem_Pron, youPolFem_Pron, youPolPl_Pron, youPolPlFem_Pron, ExistCN, ExistMassCN, ExistPluralCN, - PassVPSlash, PassAgentVPSlash, ApposNP + PassVPSlash, PassAgentVPSlash, ApposNP, CompoundN ] -- put the names of your own definitions here with (Grammar = GrammarFre) ** @@ -50,7 +50,7 @@ oper vps ** { s = auxvp.s ; agr = auxvp.agr ; - comp = \\a => vps.comp ! a ++ (let agr = complAgr a in vps.s.s ! VPart agr.g agr.n) ++ agent ; + comp = \\a => (let agr = complAgr a in vps.s.s ! VPart agr.g agr.n) ++ vps.comp ! a ++ agent ; } ; lin ApposNP np1 np2 = np1 ** { -- guessed by KA @@ -59,4 +59,6 @@ lin ApposNP np1 np2 = np1 ** { -- guessed by KA } ; } ; +lin CompoundN a b = lin N {s = \\n => b.s ! n ++ a.s ! Sg ; g = b.g} ; -- connessione internet = internet connection + } diff --git a/src/romance/ExtendRomanceFunctor.gf b/src/romance/ExtendRomanceFunctor.gf index fc4f206e..0f2ba9c3 100644 --- a/src/romance/ExtendRomanceFunctor.gf +++ b/src/romance/ExtendRomanceFunctor.gf @@ -302,7 +302,7 @@ incomplete concrete ExtendRomanceFunctor of Extend = vps ** { s = auxvp.s ; agr = auxvp.agr ; - comp = \\a => vps.comp ! a ++ (let agr = complAgr a in vps.s.s ! VPart agr.g agr.n) ++ agent ; + comp = \\a => (let agr = complAgr a in vps.s.s ! VPart agr.g agr.n) ++ vps.comp ! a ++ agent ; } ; } ; From ff32e9e75c307dbd310a0fce06c18150ff3bf405 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 9 Oct 2023 15:25:28 +0200 Subject: [PATCH 096/129] include the preposition in QuantityNP --- src/romance/NounRomance.gf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/romance/NounRomance.gf b/src/romance/NounRomance.gf index 721ffc19..d35f04cd 100644 --- a/src/romance/NounRomance.gf +++ b/src/romance/NounRomance.gf @@ -210,8 +210,7 @@ incomplete concrete NounRomance of Noun = QuantityNP n m = heavyNPpol False { s = \\c => case of { | => artDef False Masc Sg c ++ preOrPost m.isPre m.s (n.s ! NCard Masc); - _ => preOrPost m.isPre m.s (n.s ! NCard Masc)}; - + c => prepCase c.p1 ++ preOrPost m.isPre m.s (n.s ! NCard Masc)}; a = agrP3 Masc n.n ; hasClit = False } ; From 88fe3e5a2574640071a4d2e5ebd16e60a2c60593 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 9 Oct 2023 16:21:11 +0200 Subject: [PATCH 097/129] remove the old parse grammar --- src/chinese/ParseChi.gf | 162 -------------------------------- src/french/ParseEngFre.gf | 110 ---------------------- src/french/ParseFre.gf | 189 -------------------------------------- src/hindi/ParseHin.gf | 158 ------------------------------- src/spanish/ParseSpa.gf | 158 ------------------------------- src/urdu/ParseUrd.gf | 161 -------------------------------- 6 files changed, 938 deletions(-) delete mode 100644 src/chinese/ParseChi.gf delete mode 100644 src/french/ParseEngFre.gf delete mode 100644 src/french/ParseFre.gf delete mode 100644 src/hindi/ParseHin.gf delete mode 100644 src/spanish/ParseSpa.gf delete mode 100644 src/urdu/ParseUrd.gf diff --git a/src/chinese/ParseChi.gf b/src/chinese/ParseChi.gf deleted file mode 100644 index 77144279..00000000 --- a/src/chinese/ParseChi.gf +++ /dev/null @@ -1,162 +0,0 @@ ---# -path=.:../english:../abstract:../translator - -concrete ParseChi of ParseEngAbs = - TenseChi, ---- CatChi, - NounChi - [PPartNP], - AdjectiveChi, - NumeralChi, - SymbolChi [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP], - ConjunctionChi, - VerbChi - [SlashV2V, PassV2, UseCopula, ComplVV, CompAP, AdvVP], - AdverbChi, - PhraseChi, - SentenceChi, - QuestionChi - [QuestCl], - RelativeChi, - IdiomChi [NP, VP, Tense, Cl, ProgrVP, ExistNP, SelfAdvVP, SelfAdVVP, SelfNP], - ConstructionChi, - DocumentationChi, - ExtraChi [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash, PassAgentVPSlash, - Temp, Pol, Conj, VPS, ListVPS, S, Num, CN, RP, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, GenRP, - VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, - ClSlash, RCl, EmptyRelSlash, ListCN, ConjCN, BaseCN, ConsCN], - - DictionaryChi - - ** -open ResChi, ParadigmsChi, SyntaxChi, Prelude, (G = GrammarChi), (E = ExtraChi) in { - -flags - literal=Symb ; - coding = utf8 ; - - --- Chinese-specific overrides - -lin - CompAP = G.CompAP | E.CompBareAP ; -- he is good | he good - - AdvVP vp adv = E.TopicAdvVP vp adv | G.AdvVP vp adv ; -- he *today* here sleeps | *today* he here sleeps - - QuestCl cl = G.QuestCl cl | E.QuestRepV cl ; -- he comes 'ma' | he come not come - -lin - - EmptyRelSlash slash = mkRCl ; - - that_RP = which_RP ; - --- lexical entries - --- another_Quant = mkQuantifier "otro" "otra" "otros" "otras" ; --- some_Quant = mkQuantifier "algún" "alguna" "algunos" "algunas" ; --- anySg_Det = mkDeterminer "algún" "alguna" Sg False ; ---- also meaning "whichever" ? --- each_Det = SyntaxChi.every_Det ; - --- but_Subj = {s = "pero" ; m = Indic} ; ---- strange to have this as Subj - -{- - myself_NP = regNP "myself" singular ; - yourselfSg_NP = regNP "yourself" singular ; - himself_NP = regNP "himself" singular ; - herself_NP = regNP "herself" singular ; - itself_NP = regNP "itself" singular ; - ourself_NP = regNP "ourself" plural ; - yourselfPl_NP = regNP "yourself" plural ; - themself_NP = regNP "themself" plural ; - themselves_NP = regNP "themselves" plural ; --} - -CompoundCN num noun cn = {s = num.s ++ noun.s ++ cn.s ; c = cn.c} ; ---- -DashCN noun cn = {s = noun.s ++ cn.s ; c = cn.c} ; ---- - -{- - DashCN noun1 noun2 = { - s = \\n,c => noun1.s ! Sg ! Nom ++ "-" ++ noun2.s ! n ! c ; - g = noun2.g - } ; --} - - GerundN v = { - s = v.s ; - c = ge_s ---- ge - } ; - - GerundAP v = { - s = v.s ++ de_s ; ---- - monoSyl = False ; - hasAdA = True ; --- - } ; - - PastPartAP v = { - s = v.s ++ de_s ; - monoSyl = False ; - hasAdA = True ; --- - } ; - - ----- PastPartAP v = v ; ---- - -{- - OrdCompar a = {s = \\c => a.s ! AAdj Compar c } ; --} - - PositAdVAdj a = {s = a.s} ; - - - UseQuantPN q pn = {s = q.s ++ ge_s ++ pn.s} ; ---- ge - - SlashV2V v a p vp = - insertObj (ResChi.mkNP (a.s ++ p.s ++ useVerb vp.verb ! p.p ! APlain ++ vp.compl)) - (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ; ---- aspect - -{- - SlashVPIV2V v p vpi = insertObjc (\\a => p.s ++ - v.c3 ++ - vpi.s ! VVAux ! a) - (predVc v) ; --} - ----- TODO: find proper expressions for OSV and OVS in Chi - PredVPosv np vp = PredVP np vp ; ---- (lin NP np) (lin VP vp) ; ---- - PredVPovs np vp = PredVP np vp ; ---- (lin NP np) (lin VP vp) ; ---- - - - CompS s = insertObj s (predV copula []) ; ---- - - - CompQS qs = insertObj qs (predV copula []) ; ---- - CompVP ant p vp = insertObj (ss (infVP vp)) (predV copula []) ; ---- - -{- - VPSlashVS vs vp = - insertObj (\\a => infVP VVInf vp Simul CPos a) (predV vs []) ** - {c2 = ""; gapInMiddle = False} ; - --} - - PastPartRS ant pol vp = { ---- copied from PresPartRS - s = ant.s ++ pol.s ++ vp.prePart ++ useVerb vp.verb ! pol.p ! APlain ++ vp.compl ++ which_RP.s ---- aspect - } ; ---- ?? - - - PresPartRS ant pol vp = { ---- copied from RelVP - s = ant.s ++ pol.s ++ vp.prePart ++ useVerb vp.verb ! pol.p ! APlain ++ vp.compl ++ which_RP.s ---- aspect - } ; ---- ?? - - ComplVV v a p vp = { - verb = v ; - compl = a.s ++ p.s ++ vp.topic ++ vp.prePart ++ useVerb vp.verb ! p.p ! APlain ++ vp.compl ; ---- aspect - prePart, topic = [] - } ; - - ApposNP np1 np2 = { - s = np1.s ++ chcomma ++ np2.s - } ; - - AdAdV = cc2 ; - - UttAdV adv = adv; - -} diff --git a/src/french/ParseEngFre.gf b/src/french/ParseEngFre.gf deleted file mode 100644 index b6b36e4f..00000000 --- a/src/french/ParseEngFre.gf +++ /dev/null @@ -1,110 +0,0 @@ ---# -path=alltenses:.:../english -concrete ParseEngFre of ParseEngAbs = - TenseFre, - NounFre - [PPartNP], - AdjectiveFre, - NumeralFre, - SymbolFre [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP], - ConjunctionFre, - VerbFre - [SlashV2V, PassV2, UseCopula, ComplVV], - AdverbFre, - PhraseFre, - SentenceFre, - QuestionFre, - RelativeFre, - IdiomFre [NP, VP, Tense, Cl, ProgrVP, ExistNP], - ExtraFre [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash, - Temp, Pol, Conj, VPS, ListVPS, S, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, - VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, - ClSlash, RCl, EmptyRelSlash], - - DictEngFre ** -open MorphoFre, ResFre, ParadigmsFre, SyntaxFre, Prelude, (CR = CommonRomance) in { - -flags literal=Symb ; coding = utf8 ; - -lin - ComplVV v ant p vp = insertComplement - (\\a => prepCase v.c2.c ++ specVP vp ant p a) (predV v) ; - - PPartNP np vp = heavyNP { - s = \\c => (np.s ! c).comp ++ - (vp.s).s ! CR.VPart np.a.g np.a.n ++ - vp.comp ! np.a ++ vp.ext ! RPos ; - a = np.a - } ; - - CompoundCN num noun cn = { - s = \\n => num.s ! noun.g ++ glue (noun.s ! num.n) (cn.s ! n) ; - g = cn.g - } ; - - - DashCN noun1 noun2 = { - s = \\n => noun1.s ! Sg ++ "-" ++ noun2.s ! n ; - g = noun2.g - } ; - - GerundN v = { - s = \\n => v.s ! VGer ; - g = CR.Masc - } ; - - GerundAP v = { - s = \\c => case c of - {CR.AF gg nn => v.s ! CR.VGer; - _ => "NONEXISTENT" }; - isPre = False} ; - - PastPartAP v = { - s = \\c => case c of - {CR.AF gg nn => v.s ! CR.VPart gg nn ; - _ => v.s ! CR.VPart CR.Masc Sg}; - isPre = False} ; - - OrdCompar a = {s = \\c => a.s ! Compar ! AF c.g c.n} ; - - PositAdVAdj a = {s = a.s ! Posit ! AA } ; - - UseQuantPN q pn = heavyNP{ - s = \\c => q.s ! False ! Sg ! pn.g ! c ++ - pn.s ; - a = CR.agrP3 pn.g Sg} ; - - - SlashV2V v ant p vp = - (insertComplement - (\\a => prepCase v.c3.c ++ specVP vp ant p a) - (predV v)) ** {c2 = v.c2} ; - - -- PredVPosV np vp - -- PredVPosv np vp TO DO : ask what they are ? - - - - CompS s = {s = \\_ => "que" ++ s.s ! CR.Indic} ; - CompVP ant pol vp = {s = \\a => specVP vp ant pol a} ; - - -lin - that_RP = which_RP ; - - UttAdV adv = adv; - -oper - specVP : VP -> Ant -> Pol -> Agr -> Str = \vp,ant,pp,agr -> - let - iform = False ; ---- meaning: no clitics - pol : CR.RPolarity = CR.RPos; - inf = vp.s.s ! VInfin iform ; -- TO DO: fix anteriority - neg = vp.neg ! pol ; --- Neg not in API - obj = neg.p2 ++ vp.comp ! agr ++ vp.ext ! pol ; ---- pol - refl = case vp.s.vtyp of { - VRefl => reflPron agr.n agr.p Acc ; ---- case ? - _ => [] - } ; - in - neg.p1 ++ clitInf iform (refl ++ vp.clit1 ++ vp.clit2 ++ vp.clit3) inf ++ obj ; - - -} diff --git a/src/french/ParseFre.gf b/src/french/ParseFre.gf deleted file mode 100644 index a19fc4a3..00000000 --- a/src/french/ParseFre.gf +++ /dev/null @@ -1,189 +0,0 @@ ---# -path=.:../english/:../abstract:../romance:alltenses:../translator -concrete ParseFre of ParseEngAbs = - TenseFre, --- CatFre, - NounFre - [PPartNP], - AdjectiveFre, - NumeralFre, - SymbolFre [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP], - ConjunctionFre, - VerbFre - [SlashV2V, PassV2, UseCopula, ComplVV], - AdverbFre, - PhraseFre, - SentenceFre, - QuestionFre - [QuestCl, QuestIAdv], -- more variants here - RelativeFre, - IdiomFre [NP, VP, Tense, Cl, ProgrVP, ExistNP, SelfAdvVP, SelfAdVVP, SelfNP], - ConstructionFre, - DocumentationFre, - ExtraFre [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash, PassAgentVPSlash, - Temp, Pol, Conj, VPS, ListVPS, S, Num, CN, RP, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, GenRP, - VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, - ClSlash, RCl, EmptyRelSlash], - - DictionaryFre ** -open PhonoFre, MorphoFre, ResFre, CommonRomance, ParadigmsFre, SyntaxFre, Prelude, (G = GrammarFre) in { - -flags - literal=Symb ; - coding = utf8 ; - --- overrides from Lang - -lin - QuestCl cl = - {s = \\t,a,p => -- est-ce qu'il dort ? - let cls = cl.s ! DDir ! t ! a ! p - in table { - QDir => "est-ce" ++ elisQue ++ cls ! Indic ; - QIndir => subjIf ++ cls ! Indic - } - } - | {s = \\t,a,p => -- dort-il ? - let cls = cl.s ! DInv ! t ! a ! p - in table { - QDir => cls ! Indic ; - QIndir => subjIf ++ cls ! Indic - } - } - | G.QuestCl cl -- il dort ? - ; - - - QuestIAdv iadv cl = - G.QuestIAdv iadv cl -- où dort-il - | {s = \\t,a,p,q => -- où est-ce qu'il dort - let - ord = DDir ; - cls = cl.s ! ord ! t ! a ! p ! Indic ; - why = iadv.s - in why ++ "est-ce" ++ elisQue ++ cls - } ; - -lin --- missing from ExtraFre; should not really be there either - - GenNP np = - let denp = (np.s ! ResFre.genitive).ton in { - s = \\_,_,_,_ => [] ; - sp = \\_,_,_ => denp ; - s2 = denp ; - isNeg = False ; - } ; - - EmptyRelSlash slash = mkRCl which_RP (lin ClSlash slash) ; - - that_RP = which_RP ; - - UncNeg = negativePol ; - --- lexical entries - ----- another_Quant = mkQuantifier "autre" "autre" "autres" "autres" ; ----- some_Quant = mkQuantifier "quelqu'un" "quelqu'une" "quelques-uns" "quelques-unes" ; ----- anySg_Det = mkDeterminer "n'importe quel" "n'importe quelle" Sg False ; ---- also meaning "whichever" ? --- each_Det = SyntaxFre.every_Det ; - - but_Subj = {s = "mais" ; m = Indic} ; ---- strange to have this as Subj - -{- - myself_NP = regNP "myself" singular ; - yourselfSg_NP = regNP "yourself" singular ; - himself_NP = regNP "himself" singular ; - herself_NP = regNP "herself" singular ; - itself_NP = regNP "itself" singular ; - ourself_NP = regNP "ourself" plural ; - yourselfPl_NP = regNP "yourself" plural ; - themself_NP = regNP "themself" plural ; - themselves_NP = regNP "themselves" plural ; --} - - CompoundCN num noun cn = { - s = \\n => cn.s ! n ++ elisDe ++ noun.s ! num.n ; - g = cn.g - } ; - -{- - DashCN noun1 noun2 = { - s = \\n,c => noun1.s ! Sg ! Nom ++ "-" ++ noun2.s ! n ! c ; - g = noun2.g - } ; - - GerundN v = { - s = \\n,c => v.s ! VPresPart ; - g = Neutr - } ; - - GerundAP v = { - s = \\agr => v.s ! VPresPart ; - isPre = True - } ; --} - - PastPartAP v = { - s = table { - AF g n => v.s ! VPart g n ; - _ => v.s ! VPart Masc Sg ---- the adverb form - } ; - isPre = True - } ; - -{- - OrdCompar a = {s = \\c => a.s ! AAdj Compar c } ; --} - - PositAdVAdj a = {s = a.s ! Posit ! AA} ; - -{- - UseQuantPN q pn = {s = \\c => q.s ! False ! Sg ++ pn.s ! npcase2case c ; a = agrgP3 Sg pn.g} ; - - SlashV2V v ant p vp = insertObjc (\\a => v.c3 ++ ant.s ++ p.s ++ - infVP v.typ vp ant.a p.p a) - (predVc v) ; - - SlashVPIV2V v p vpi = insertObjc (\\a => p.s ++ - v.c3 ++ - vpi.s ! VVAux ! a) - (predVc v) ; --} - ComplVV v a p vp = - insertComplement (\\a => prepCase v.c2.c ++ infVP vp a) (predV v) ; ---- a,p - ----- TODO: find proper expressions for OSV and OVS in Fre - PredVPosv np vp = mkCl (lin NP np) (lin VP vp) ; - PredVPovs np vp = mkCl (lin NP np) (lin VP vp) ; - - - CompS s = {s = \\_ => "de" ++ "que" ++ s.s ! Indic} ; ---- de ? - -{- - CompQS qs = {s = \\_ => qs.s ! QIndir} ; - CompVP ant p vp = {s = \\a => ant.s ++ p.s ++ - infVP VVInf vp ant.a p.p a} ; - - VPSlashVS vs vp = - insertObj (\\a => infVP VVInf vp Simul CPos a) (predV vs) ** - {c2 = ""; gapInMiddle = False} ; - - PastPartRS ant pol vps = { - s = \\agr => vps.ad ++ vps.ptp ++ vps.s2 ! agr ; - c = npNom - } ; - - PresPartRS ant pol vp = { - s = \\agr => vp.ad ++ vp.prp ++ vp.s2 ! agr ; - c = npNom - } ; - - ApposNP np1 np2 = { - s = \\c => np1.s ! c ++ "," ++ np2.s ! npNom ; - a = np1.a - } ; - - AdAdV = cc2 ; - - UttAdV adv = adv; - --} - -} diff --git a/src/hindi/ParseHin.gf b/src/hindi/ParseHin.gf deleted file mode 100644 index e31df6ff..00000000 --- a/src/hindi/ParseHin.gf +++ /dev/null @@ -1,158 +0,0 @@ ---# -path=.:../abstract:../english:../hindustani:../translator -concrete ParseHin of ParseEngAbs = - TenseX - [AdN,Adv,SC,PPos,PNeg], --- TextX - [AdN,Adv,SC], - CatHin, - NounHin - [PPartNP], - AdjectiveHin, - NumeralHin, - ConjunctionHin, - VerbHin - [SlashV2V, PassV2, UseCopula, ComplVV, VPSlashPrep], - AdverbHin, - PhraseHin, - SentenceHin, - RelativeHin, - QuestionHin, - SymbolHin [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP], --- StructuralHin, - IdiomHin [NP, VP, Tense, Cl, ProgrVP, ExistNP], - ExtraHin [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash,Temp,Pol,Conj,VPS,ListVPS,S,Num, CN, - RP, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, GenRP,VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, - VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV,ClSlash, RCl, EmptyRelSlash], - DocumentationHin, - DictionaryHin ** -open MorphoHin, ResHin, ParadigmsHin,CommonX, CommonHindustani, Prelude in { - -flags - literal=Symb ; - coding=utf8 ; - -lin - myself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers1 }; - yourselfSg_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers2_Respect }; --regNP "yourself" singular ; - himself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers3_Distant }; --regNP "himself" singular ; - herself_NP = {s = \\_ => kwd ; a = Ag Fem Sg Pers3_Distant }; --regNP "herself" singular ; - itself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers3_Near }; --regNP "itself" singular ; - ourself_NP = {s = \\_ => kwd ; a = Ag Masc Pl Pers1 }; --regNP "ourself" plural ; - yourselfPl_NP = {s = \\_ => kwd ; a = Ag Masc Pl Pers2_Respect }; --regNP "yourself" plural ; - themselves_NP = {s = \\_ => kwd ; a = Ag Masc Pl Pers3_Distant }; --regNP "themself" plural ; - themself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers3_Distant }; --regNP "themself" plural ; - - CompoundCN num noun cn = { - s = \\n,c => num.s ++ cn.s ! n ! c ++ noun.s ! num.n ! Dir; - g = cn.g - } ; - - DashCN noun1 noun2 = { - s = \\n,c => noun1.s ! n ! Dir ++ "-" ++ noun2.s ! n ! c ; - g = noun2.g - } ; - - GerundN v = { - s = \\n,c => v.cvp ++ v.s ! Inf ; -- v.s ! VF Imperf Pers2_Casual n Masc ++ hwa (Ag Masc n Pers2_Casual) ; --the main verb of compound verbs - g = Masc - } ; - - GerundAP v = { - s = \\n,g,_,_ => v.cvp ++ v.s ! VF Imperf Pers2_Casual n g ++ hwa (Ag g n Pers2_Casual) ; - } ; - - PastPartAP v = { - s = \\n,g,_,_ => v.cvp ++ v.s ! VF Imperf Pers2_Casual n g ; -- the main verb of compound versb needs to be attached here - } ; - - OrdCompar a = {s = a.s ! Sg ! Masc ! Dir ! Compar ; n = Sg } ; - - PositAdVAdj a = {s = a.s ! Sg ! Masc ! Dir ! Posit} ; ---------------- ---SlashV2V v p vp = insertVV (infV2V v.isAux vp) (predV v) vp.embComp ** {c2 = {s = sE ; c = VTrans}}; -- changed from VTransPost -ComplVV v a p vp = insertTrans (insertVV (infVV v.isAux vp) (predV v) vp.embComp ) VTrans; -- changed from VTransPost ---------------- - - - UseQuantPN q pn = {s = \\c => q.s ! Sg ! pn.g ! Dir ++ pn.s ! Dir ; a = agrP3 pn.g Sg} ; - -PredVPosv np vp = mkClause np vp ; --{ -{- s = \\t,a,b,o => - let - verb = vp.s ! t ! a ! b ! o ! np.a ; - compl = vp.s2 ! np.a - in - case o of { - ODir => compl ++ "," ++ np.s ! npNom ++ verb.aux ++ vp.ad ++ verb.fin ++ verb.adv ++ verb.inf ; - OQuest => verb.aux ++ compl ++ "," ++ np.s ! npNom ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf - } - } ; --} - PredVPovs np vp = mkClause np vp ; --{ -{- s = \\t,a,b,o => - let - verb = vp.s ! t ! a ! b ! o ! np.a ; - compl = vp.s2 ! np.a - in - case o of { - ODir => compl ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ np.s ! npNom ; - OQuest => verb.aux ++ compl ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ np.s ! npNom - } - } ; --} - -{- - SlashV2V v p vp = insertObjc (\\a => p.s ++ case p.p of {CPos => ""; _ => "not"} ++ - v.c3 ++ - infVP v.typ vp a) - (predVc v) ; - - ComplPredVP np vp = { - s = \\t,a,b,o => - let - verb = vp.s ! t ! a ! b ! o ! np.a ; - compl = vp.s2 ! np.a - in - case o of { - ODir => compl ++ "," ++ np.s ! npNom ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ; - OQuest => verb.aux ++ compl ++ "," ++ np.s ! npNom ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf - } - } ; --} -CompVP ant p vp = {s = \\a => ant.s ++ p.s ++ - infVP False vp a} ; -- check for vp.isAux - - that_RP = { - s = \\_,_ => "कि" ; - a = RNoAg - } ; - --no_RP = { - -- s = \\_,_ => "" ; - -- a = RNoAg - -- } ; - - CompS s = {s = \\_ => "कि" ++ s.s} ; --- CompVP vp = {s = \\a => infVP VVInf vp a} ; - -lin - PPos = {s = [] ; p = Pos} ; - PNeg = {s = [] ; p = Neg} ; - - VPSlashPrep vp p = vp ** {c2 = {s = p.s!Masc ; c = VTrans}} ; - - PastPartRS ant pol vps = { - s = \\agr => (vps.s!VPTense VPPast agr).inf ; - c = Dir - } ; - - PresPartRS ant pol vp = { - s = \\agr => (vp.s!VPTense VPPres agr).inf ; - c = Dir - } ; - - ApposNP np1 np2 = { - s = \\c => np1.s!NPC Dir ++ "," ++ np2.s ! c ; - a = np2.a - } ; - - AdAdV = cc2 ; - - UttAdV adv = adv; - -} diff --git a/src/spanish/ParseSpa.gf b/src/spanish/ParseSpa.gf deleted file mode 100644 index 7b17e50f..00000000 --- a/src/spanish/ParseSpa.gf +++ /dev/null @@ -1,158 +0,0 @@ ---# -path=alltenses -concrete ParseSpa of ParseEngAbs = - TenseSpa, --- CatSpa, - NounSpa - [PPartNP], - AdjectiveSpa, - NumeralSpa, - SymbolSpa [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP], - ConjunctionSpa, - VerbSpa - [SlashV2V, PassV2, UseCopula, ComplVV], - AdverbSpa, - PhraseSpa, - SentenceSpa, - QuestionSpa, - RelativeSpa, - IdiomSpa [NP, VP, Tense, Cl, ProgrVP, ExistNP], - ExtraSpa [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash, - Temp, Pol, Conj, VPS, ListVPS, S, Num, CN, RP, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, GenRP, - VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, - ClSlash, RCl, EmptyRelSlash], - - DictEngSpa ** -open MorphoSpa, ResSpa, ParadigmsSpa, SyntaxSpa, Prelude in { - -flags - literal=Symb ; - coding = utf8 ; - - -lin --- missing from ExtraSpa; should not really be there either - - GenNP np = - let denp = (np.s ! ResSpa.genitive).ton in { - s = \\_,_,_,_ => [] ; - sp = \\_,_,_ => denp ; - s2 = denp ; - isNeg = False ; - } ; - - EmptyRelSlash slash = mkRCl which_RP (lin ClSlash slash) ; - - that_RP = which_RP ; - - UncNeg = negativePol ; - --- lexical entries - - another_Quant = mkQuantifier "otro" "otra" "otros" "otras" ; - some_Quant = mkQuantifier "algún" "alguna" "algunos" "algunas" ; - anySg_Det = mkDeterminer "algún" "alguna" Sg False ; ---- also meaning "whichever" ? - each_Det = SyntaxSpa.every_Det ; - - but_Subj = {s = "pero" ; m = Indic} ; ---- strange to have this as Subj - -{- - myself_NP = regNP "myself" singular ; - yourselfSg_NP = regNP "yourself" singular ; - himself_NP = regNP "himself" singular ; - herself_NP = regNP "herself" singular ; - itself_NP = regNP "itself" singular ; - ourself_NP = regNP "ourself" plural ; - yourselfPl_NP = regNP "yourself" plural ; - themself_NP = regNP "themself" plural ; - themselves_NP = regNP "themselves" plural ; --} - - CompoundCN num noun cn = { - s = \\n => cn.s ! n ++ "de" ++ noun.s ! num.n ; - g = cn.g - } ; - -{- - DashCN noun1 noun2 = { - s = \\n,c => noun1.s ! Sg ! Nom ++ "-" ++ noun2.s ! n ! c ; - g = noun2.g - } ; - - GerundN v = { - s = \\n,c => v.s ! VPresPart ; - g = Neutr - } ; - - GerundAP v = { - s = \\agr => v.s ! VPresPart ; - isPre = True - } ; --} - - PastPartAP v = { - s = table { - ASg g _ => v.s ! VPart g Sg ; - APl g _ => v.s ! VPart g Pl ; - _ => v.s ! VPart Masc Sg ---- the adverb form - } ; - isPre = True - } ; - -{- - OrdCompar a = {s = \\c => a.s ! AAdj Compar c } ; --} - - PositAdVAdj a = {s = a.s ! Posit ! AA} ; - -{- - UseQuantPN q pn = {s = \\c => q.s ! False ! Sg ++ pn.s ! npcase2case c ; a = agrgP3 Sg pn.g} ; - - SlashV2V v ant p vp = insertObjc (\\a => v.c3 ++ ant.s ++ p.s ++ - infVP v.typ vp ant.a p.p a) - (predVc v) ; - - SlashVPIV2V v p vpi = insertObjc (\\a => p.s ++ - v.c3 ++ - vpi.s ! VVAux ! a) - (predVc v) ; - ComplVV v a p vp = insertObj (\\agr => a.s ++ p.s ++ - infVP v.typ vp a.a p.p agr) - (predVV v) ; --} - ----- TODO: find proper expressions for OSV and OVS in Spa - PredVPosv np vp = mkCl (lin NP np) (lin VP vp) ; - PredVPovs np vp = mkCl (lin NP np) (lin VP vp) ; - - - CompS s = {s = \\_ => "de" ++ "que" ++ s.s ! Indic} ; ---- de ? - -{- - CompQS qs = {s = \\_ => qs.s ! QIndir} ; - CompVP ant p vp = {s = \\a => ant.s ++ p.s ++ - infVP VVInf vp ant.a p.p a} ; - - VPSlashVS vs vp = - insertObj (\\a => infVP VVInf vp Simul CPos a) (predV vs) ** - {c2 = ""; gapInMiddle = False} ; - - PastPartRS ant pol vps = { - s = \\agr => vps.ad ++ vps.ptp ++ vps.s2 ! agr ; - c = npNom - } ; - - PresPartRS ant pol vp = { - s = \\agr => vp.ad ++ vp.prp ++ vp.s2 ! agr ; - c = npNom - } ; - - ApposNP np1 np2 = { - s = \\c => np1.s ! c ++ "," ++ np2.s ! npNom ; - a = np1.a - } ; - - AdAdV = cc2 ; - - UttAdV adv = adv; - --} - -} diff --git a/src/urdu/ParseUrd.gf b/src/urdu/ParseUrd.gf deleted file mode 100644 index 5c4c3347..00000000 --- a/src/urdu/ParseUrd.gf +++ /dev/null @@ -1,161 +0,0 @@ ---# -path=.:../abstract:../english:../hindustani -concrete ParseUrd of ParseEngAbs = - TenseX - [AdN,Adv,SC,PPos,PNeg], --- TextX - [AdN,Adv,SC], - CatUrd, - NounUrd - [PPartNP], - AdjectiveUrd, - NumeralUrd, - ConjunctionUrd, - VerbUrd - [PassV2,ComplVV], - AdverbUrd, - PhraseUrd, - SentenceUrd, - RelativeUrd, - QuestionUrd, - SymbolUrd [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP], --- StructuralUrd, - IdiomUrd [NP, VP, Tense, Cl, ProgrVP, ExistNP], - ExtraUrd [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash,Temp,Pol,Conj,VPS,ListVPS,S,Num, CN, - RP, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, GenRP,VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, - VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV,ClSlash, RCl, EmptyRelSlash], - DictEngUrd ** --- UNDictUrd ** -open MorphoUrd, ResUrd, ParadigmsUrd,CommonX, CommonHindustani, Prelude in { - -flags - literal=Symb ; - coding=utf8 ; - -lin - myself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers1 }; - yourselfSg_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers2_Respect }; --regNP "yourself" singular ; - himself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers3_Distant }; --regNP "himself" singular ; - herself_NP = {s = \\_ => kwd ; a = Ag Fem Sg Pers3_Distant }; --regNP "herself" singular ; - itself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers3_Near }; --regNP "itself" singular ; - ourself_NP = {s = \\_ => kwd ; a = Ag Masc Pl Pers1 }; --regNP "ourself" plural ; - yourselfPl_NP = {s = \\_ => kwd ; a = Ag Masc Pl Pers2_Respect }; --regNP "yourself" plural ; - themselves_NP = {s = \\_ => kwd ; a = Ag Masc Pl Pers3_Distant }; --regNP "themself" plural ; - themself_NP = {s = \\_ => kwd ; a = Ag Masc Sg Pers3_Distant }; --regNP "themself" plural ; - - CompoundCN num noun cn = { - s = \\n,c => num.s ++ cn.s ! n ! c ++ noun.s ! num.n ! Dir; - g = cn.g - } ; - - DashCN noun1 noun2 = { - s = \\n,c => noun1.s ! n ! Dir ++ "-" ++ noun2.s ! n ! c ; - g = noun2.g - } ; - - GerundN v = { - s = \\n,c => v.cvp ++ v.s ! Inf ; -- v.s ! VF Imperf Pers2_Casual n Masc ++ hwa (Ag Masc n Pers2_Casual) ; --the main verb of compound verbs - g = Masc - } ; - - GerundAP v = { - s = \\n,g,_,_ => v.cvp ++ v.s ! VF Imperf Pers2_Casual n g ++ hwa (Ag g n Pers2_Casual) ; - } ; - - PastPartAP v = { - s = \\n,g,_,_ => v.cvp ++ v.s ! VF Imperf Pers2_Casual n g ; -- the main verb of compound versb needs to be attached here - } ; - --- OrdCompar a = {s = \\c => a.s ! AAdj Compar c } ; - - PositAdVAdj a = {s = a.s ! Sg ! Masc ! Dir ! Posit} ; ---------------- ---SlashV2V v p vp = insertVV (infV2V v.isAux vp) (predV v) vp.embComp ** {c2 = {s = sE ; c = VTrans}}; -- changed from VTransPost -ComplVV v a p vp = insertTrans (insertVV (infVV v.isAux vp) (predV v) vp.embComp ) VTrans; -- changed from VTransPost ---------------- - - - UseQuantPN q pn = {s = \\c => q.s ! Sg ! pn.g ! Dir ++ pn.s ! Dir ; a = agrP3 pn.g Sg} ; - -PredVPosv np vp = mkClause np vp ; --{ -{- s = \\t,a,b,o => - let - verb = vp.s ! t ! a ! b ! o ! np.a ; - compl = vp.s2 ! np.a - in - case o of { - ODir => compl ++ "," ++ np.s ! npNom ++ verb.aux ++ vp.ad ++ verb.fin ++ verb.adv ++ verb.inf ; - OQuest => verb.aux ++ compl ++ "," ++ np.s ! npNom ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf - } - } ; --} - PredVPovs np vp = mkClause np vp ; --{ -{- s = \\t,a,b,o => - let - verb = vp.s ! t ! a ! b ! o ! np.a ; - compl = vp.s2 ! np.a - in - case o of { - ODir => compl ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ np.s ! npNom ; - OQuest => verb.aux ++ compl ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ np.s ! npNom - } - } ; --} - -{- - SlashV2V v p vp = insertObjc (\\a => p.s ++ case p.p of {CPos => ""; _ => "not"} ++ - v.c3 ++ - infVP v.typ vp a) - (predVc v) ; - - ComplPredVP np vp = { - s = \\t,a,b,o => - let - verb = vp.s ! t ! a ! b ! o ! np.a ; - compl = vp.s2 ! np.a - in - case o of { - ODir => compl ++ "," ++ np.s ! npNom ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ; - OQuest => verb.aux ++ compl ++ "," ++ np.s ! npNom ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf - } - } ; --} -CompVP ant p vp = {s = \\a => ant.s ++ p.s ++ - infVP False vp a} ; -- check for vp.isAux - - that_RP = { - s = \\_,_ => "کہ" ; - a = RNoAg - } ; - --no_RP = { - -- s = \\_,_ => "" ; - -- a = RNoAg - -- } ; - - CompS s = {s = \\_ => "کہ" ++ s.s} ; --- CompVP vp = {s = \\a => infVP VVInf vp a} ; - -lin - PPos = {s = [] ; p = Pos} ; - PNeg = {s = [] ; p = Neg} ; -- contracted: don't - UncNeg = {s = [] ; p = Neg} ; - - --VPSlashPrep vp p = vp ** {c2 = {s = p.s!Masc ; c = VTrans}} ; - - PastPartRS ant pol vps = { - s = \\agr => (vps.s!VPTense VPPast agr).inf ; - c = Dir - } ; - - PresPartRS ant pol vp = { - s = \\agr => (vp.s!VPTense VPPres agr).inf ; - c = Dir - } ; - - ApposNP np1 np2 = { - s = \\c => np1.s!NPC Dir ++ "," ++ np2.s ! c ; - a = np2.a - } ; - - AdAdV = cc2 ; - - UttAdV adv = adv; - - CompQS qs = {s = \\_ => qs.s ! QIndir} ; - -} From ca7d7d8fde96982b07ff7c42cc763fce3cb9982f Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 10 Oct 2023 08:54:23 +0200 Subject: [PATCH 098/129] move TPasseSimple to Extend --- src/abstract/Extend.gf | 3 +++ src/common/ExtendFunctor.gf | 2 ++ src/czech/ExtendCze.gf | 1 + src/romance/ExtendRomanceFunctor.gf | 2 ++ src/slovak/ExtendSlo.gf | 1 + 5 files changed, 9 insertions(+) diff --git a/src/abstract/Extend.gf b/src/abstract/Extend.gf index a5eb3e24..7e46ecc0 100644 --- a/src/abstract/Extend.gf +++ b/src/abstract/Extend.gf @@ -302,4 +302,7 @@ fun fun AnaphPron : NP -> Pron ; +fun + TPasseSimple : Tense ; + } diff --git a/src/common/ExtendFunctor.gf b/src/common/ExtendFunctor.gf index 1b78fd20..4025e4dc 100644 --- a/src/common/ExtendFunctor.gf +++ b/src/common/ExtendFunctor.gf @@ -127,6 +127,8 @@ lin UttDatIP ip = UttAccIP (lin IP ip) ; -- whom (dative) ; DEFAULT who UttVPShort = UttVP ; -- have fun, as opposed to "to have fun" ; DEFAULT UttVP + TPasseSimple = Grammar.TPast ; --# notpresent + SQuestVPS = variants {} ; -- : NP -> VPS -> QS ; -- has she walked QuestVPS = variants {} ; -- : IP -> VPS -> QS ; -- who has walked diff --git a/src/czech/ExtendCze.gf b/src/czech/ExtendCze.gf index de797dd6..9bd5d869 100644 --- a/src/czech/ExtendCze.gf +++ b/src/czech/ExtendCze.gf @@ -27,6 +27,7 @@ concrete ExtendCze of Extend = CatCze ** ,CompBareCN ,PiedPipingQuestSlash ,PiedPipingRelSlash + ,TPasseSimple ] with (Grammar = GrammarCze) ** diff --git a/src/romance/ExtendRomanceFunctor.gf b/src/romance/ExtendRomanceFunctor.gf index 0f2ba9c3..d4367425 100644 --- a/src/romance/ExtendRomanceFunctor.gf +++ b/src/romance/ExtendRomanceFunctor.gf @@ -278,6 +278,8 @@ incomplete concrete ExtendRomanceFunctor of Extend = UttDatIP ip = UttAccIP (lin IP ip) ; -- whom (dative) ; DEFAULT who UttVPShort = UttVP ; + TPasseSimple = {s = []} ** {t = RPasse} ; --# notpresent + oper quoted : Str -> Str = \s -> "\"" ++ s ++ "\"" ; ---- TODO bind ; move to Prelude? diff --git a/src/slovak/ExtendSlo.gf b/src/slovak/ExtendSlo.gf index 86732cb0..eb1121e8 100644 --- a/src/slovak/ExtendSlo.gf +++ b/src/slovak/ExtendSlo.gf @@ -27,6 +27,7 @@ concrete ExtendSlo of Extend = CatSlo ** ,CompBareCN ,PiedPipingQuestSlash ,PiedPipingRelSlash + ,TPasseSimple ] with (Grammar = GrammarSlo) ** From e22bb13eda39233ca92f8b2a55294acd1b23851a Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 10 Oct 2023 09:32:56 +0200 Subject: [PATCH 099/129] use SOFT_BIND in front of comma --- src/romance/PhraseRomance.gf | 2 +- src/romance/SentenceRomance.gf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/romance/PhraseRomance.gf b/src/romance/PhraseRomance.gf index 5dab8209..45c7866f 100644 --- a/src/romance/PhraseRomance.gf +++ b/src/romance/PhraseRomance.gf @@ -26,6 +26,6 @@ incomplete concrete PhraseRomance of Phrase = PConjConj conj = {s = conj.s2} ; NoVoc = {s = []} ; - VocNP np = {s = "," ++ (np.s ! Nom).ton} ; + VocNP np = {s = SOFT_BIND ++ "," ++ (np.s ! Nom).ton} ; } diff --git a/src/romance/SentenceRomance.gf b/src/romance/SentenceRomance.gf index 9d3fa8a9..19127bd0 100644 --- a/src/romance/SentenceRomance.gf +++ b/src/romance/SentenceRomance.gf @@ -175,12 +175,12 @@ incomplete concrete SentenceRomance of Sentence = } ; AdvS a s = {s = \\o => a.s ++ s.s ! o} ; - ExtAdvS a s = {s = \\o => a.s ++ "," ++ s.s ! o} ; + ExtAdvS a s = {s = \\o => a.s ++ SOFT_BIND ++ "," ++ s.s ! o} ; SSubjS a s b = {s = \\m => a.s ! m ++ s.s ++ b.s ! s.m} ; RelS s r = { - s = \\o => s.s ! o ++ "," ++ partQIndir ++ r.s ! Indic ! agrP3 Masc Sg + s = \\o => s.s ! o ++ SOFT_BIND ++ "," ++ partQIndir ++ r.s ! Indic ! agrP3 Masc Sg } ; } From af1010da710d4bfdd56048abe068dca8733c3f56 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 10 Oct 2023 13:38:30 +0200 Subject: [PATCH 100/129] TPasseSimple unlock four more tenses in Bulgarian as well --- src/bulgarian/CatBul.gf | 7 +++++-- src/bulgarian/ExtendBul.gf | 2 ++ src/bulgarian/GrammarBul.gf | 2 +- src/bulgarian/IdiomBul.gf | 17 ++++++++++------- src/bulgarian/ResBul.gf | 30 +++++++++++++++++++++--------- src/bulgarian/TenseBul.gf | 9 +++++++++ 6 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 src/bulgarian/TenseBul.gf diff --git a/src/bulgarian/CatBul.gf b/src/bulgarian/CatBul.gf index 9e9c9407..783ebc37 100644 --- a/src/bulgarian/CatBul.gf +++ b/src/bulgarian/CatBul.gf @@ -1,5 +1,5 @@ --# -coding=utf8 -concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, (R = ParamX) in { +concrete CatBul of Cat = CommonX - [Temp,Tense,IAdv,AdV] ** open ResBul, Prelude, Predef, (R = ParamX) in { lincat -- Tensed/Untensed @@ -11,6 +11,9 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, ( -- Sentence + Temp = {s : Str ; t : ResBul.Tense ; a : R.Anteriority} ; + Tense = {s : Str ; t : ResBul.Tense} ; + Cl = {s : ResBul.Tense => Anteriority => Polarity => Order => Str} ; ClSlash = { s : Agr => ResBul.Tense => Anteriority => Polarity => Order => Str ; @@ -115,7 +118,7 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, ( linref SSlash = \ss -> ss.s ! agrP3 (GSg Masc) ++ ss.c2.s; - ClSlash = \cl -> cl.s ! agrP3 (GSg Masc) ! Pres ! Simul ! Pos ! Main ++ cl.c2.s; + ClSlash = \cl -> cl.s ! agrP3 (GSg Masc) ! VPresent ! Simul ! Pos ! Main ++ cl.c2.s; VP = \vp -> linrefVP vp; VPSlash = \vps -> let vp : ResBul.VP diff --git a/src/bulgarian/ExtendBul.gf b/src/bulgarian/ExtendBul.gf index bae3834d..19f9a990 100644 --- a/src/bulgarian/ExtendBul.gf +++ b/src/bulgarian/ExtendBul.gf @@ -317,5 +317,7 @@ lin AnaphPron np = => they_Pron } ; +lin TPasseSimple = {s = []} ** {t = VPastSimple} ; --# notpresent + } diff --git a/src/bulgarian/GrammarBul.gf b/src/bulgarian/GrammarBul.gf index 39adaefe..971d0ca2 100644 --- a/src/bulgarian/GrammarBul.gf +++ b/src/bulgarian/GrammarBul.gf @@ -15,7 +15,7 @@ concrete GrammarBul of Grammar = TextBul, StructuralBul, IdiomBul, - TenseX - [CAdv,IAdv,AdV,SC], + TenseBul, NamesBul ** { flags coding=utf8 ; diff --git a/src/bulgarian/IdiomBul.gf b/src/bulgarian/IdiomBul.gf index c8cd86c2..34bd8dbb 100644 --- a/src/bulgarian/IdiomBul.gf +++ b/src/bulgarian/IdiomBul.gf @@ -29,6 +29,7 @@ concrete IdiomBul of Idiom = CatBul ** open Prelude, ParadigmsBul, ResBul in { present = verb ! (VPres (numGenNum agr.gn) agr.p) ; aorist = verb ! (VAorist (numGenNum agr.gn) agr.p) ; + imperfect = verb ! (VImperfect (numGenNum agr.gn) agr.p) ; perfect = verb ! (VPerfect (aform agr.gn Indef (RObj Acc))) ; auxPres = auxBe ! VPres (numGenNum agr.gn) agr.p ; @@ -37,14 +38,16 @@ concrete IdiomBul of Idiom = CatBul ** open Prelude, ParadigmsBul, ResBul in { v : {aux1:Str; aux2:Str; main:Str} = case of { - => {aux1=[]; aux2=[]; main=present} + => {aux1=[]; aux2=[]; main=present} ; --# notpresent - => {aux1=[]; aux2=auxPres; main=perfect} ; --# notpresent - => {aux1=[]; aux2=[]; main=aorist} ; --# notpresent - => {aux1=[]; aux2=auxAorist; main=perfect} ; --# notpresent - => {aux1="ще"; aux2=[]; main=present} ; --# notpresent - => {aux1="ще"++auxPres; aux2=[]; main=perfect} ; --# notpresent - => {aux1=auxCondS; aux2=[]; main=perfect} --# notpresent + => {aux1=[]; aux2=auxPres; main=perfect} ; --# notpresent + => {aux1=[]; aux2=[]; main=aorist} ; --# notpresent + => {aux1=[]; aux2=auxAorist; main=perfect} ; --# notpresent + => {aux1=[]; aux2=[]; main=imperfect} ; --# notpresent + => {aux1=[]; aux2=auxAorist; main=perfect} ; --# notpresent + => {aux1="ще"; aux2=[]; main=present} ; --# notpresent + => {aux1="ще"++auxPres; aux2=[]; main=perfect} ; --# notpresent + => {aux1=auxCondS; aux2=[]; main=perfect} --# notpresent } ; in case o of { diff --git a/src/bulgarian/ResBul.gf b/src/bulgarian/ResBul.gf index e869807c..f3d665f8 100644 --- a/src/bulgarian/ResBul.gf +++ b/src/bulgarian/ResBul.gf @@ -8,7 +8,7 @@ -- implement $Test$, it moreover contains regular lexical -- patterns needed for $Lex$. -resource ResBul = ParamX ** open Prelude, Predef in { +resource ResBul = ParamX - [Tense,Pres,Past,Fut,Cond] ** open Prelude, Predef in { flags coding=utf8 ; optimize=all ; @@ -68,7 +68,7 @@ resource ResBul = ParamX ** open Prelude, Predef in { | VNoun NForm | VGerund ; - + VType = VNormal | VMedial Case @@ -77,6 +77,14 @@ resource ResBul = ParamX ** open Prelude, Predef in { VVType = VVInf Aspect | VVGerund ; + Tense = + VPresent + | VPastSimple --# notpresent + | VPastImperfect --# notpresent + | VFut --# notpresent + | VCond --# notpresent + ; + -- The order of sentence is needed already in $VP$. Order = Main | Inv | Quest ; @@ -533,10 +541,12 @@ resource ResBul = ParamX ** open Prelude, Predef in { present = verb.s ! asp ! (VPres (numGenNum clitic.agr.gn) clitic.agr.p) ; presentImperf = verb.s ! Imperf ! (VPres (numGenNum clitic.agr.gn) clitic.agr.p) ; aorist = verb.s ! asp ! (VAorist (numGenNum clitic.agr.gn) clitic.agr.p) ; + imperfect = verb.s ! asp ! (VImperfect (numGenNum clitic.agr.gn) clitic.agr.p) ; perfect = verb.s ! asp ! (VPerfect (aform clitic.agr.gn Indef (RObj Acc))) ; auxPres = auxBe ! VPres (numGenNum clitic.agr.gn) clitic.agr.p ; auxAorist = auxBe ! VAorist (numGenNum clitic.agr.gn) clitic.agr.p ; + auxImperf = auxBe ! VImperfect (numGenNum clitic.agr.gn) clitic.agr.p ; auxCondS = auxCond ! numGenNum clitic.agr.gn ! clitic.agr.p ; apc : Str -> Str = \s -> @@ -580,14 +590,16 @@ resource ResBul = ParamX ** open Prelude, Predef in { verbs : {aux:{s1:Str; s2:Str}; main:Str} = case of { - => {aux=vf2 clitic.s; main=presentImperf} + => {aux=vf2 clitic.s; main=presentImperf} ; --# notpresent - => {aux=vf1 clitic.s; main=perfect} ; --# notpresent - => {aux=vf2 clitic.s; main=aorist} ; --# notpresent - => {aux=vf4 auxAorist; main=perfect} ; --# notpresent - => {aux=vf3 clitic.s; main=present} ; --# notpresent - => {aux=vf3 (apc []); main=perfect} ; --# notpresent - => {aux=vf4 auxCondS; main=perfect} --# notpresent + => {aux=vf1 clitic.s; main=perfect} ; --# notpresent + => {aux=vf2 clitic.s; main=aorist} ; --# notpresent + => {aux=vf4 auxAorist; main=perfect} ; --# notpresent + => {aux=vf2 clitic.s; main=imperfect} ; --# notpresent + => {aux=vf4 auxImperf; main=perfect} ; --# notpresent + => {aux=vf3 clitic.s; main=present} ; --# notpresent + => {aux=vf3 (apc []); main=perfect} ; --# notpresent + => {aux=vf4 auxCondS; main=perfect} --# notpresent } in verb.ad.s ++ li0 ++ verbs.aux.s1 ++ verbs.main ++ verbs.aux.s2 ; diff --git a/src/bulgarian/TenseBul.gf b/src/bulgarian/TenseBul.gf new file mode 100644 index 00000000..295d2be9 --- /dev/null +++ b/src/bulgarian/TenseBul.gf @@ -0,0 +1,9 @@ +concrete TenseBul of Tense = CatBul [Tense,Temp], TenseX - [Temp,Tense,TPres,TPast,TFut,TCond,IAdv,AdV,SC] ** open ResBul in { + +lin + TPres = {s = []} ** {t = VPresent} ; + TPast = {s = []} ** {t = VPastImperfect} ; --# notpresent + TFut = {s = []} ** {t = VFut} ; --# notpresent + TCond = {s = []} ** {t = VCond} ; --# notpresent + +} From 140b59dd704110bb8c98459275f6fa9027cfb492 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 10 Oct 2023 13:53:39 +0200 Subject: [PATCH 101/129] fix the aspect for TPast --- src/bulgarian/ResBul.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bulgarian/ResBul.gf b/src/bulgarian/ResBul.gf index f3d665f8..306eb65a 100644 --- a/src/bulgarian/ResBul.gf +++ b/src/bulgarian/ResBul.gf @@ -541,7 +541,7 @@ resource ResBul = ParamX - [Tense,Pres,Past,Fut,Cond] ** open Prelude, Predef in present = verb.s ! asp ! (VPres (numGenNum clitic.agr.gn) clitic.agr.p) ; presentImperf = verb.s ! Imperf ! (VPres (numGenNum clitic.agr.gn) clitic.agr.p) ; aorist = verb.s ! asp ! (VAorist (numGenNum clitic.agr.gn) clitic.agr.p) ; - imperfect = verb.s ! asp ! (VImperfect (numGenNum clitic.agr.gn) clitic.agr.p) ; + imperfect = verb.s ! Imperf ! (VImperfect (numGenNum clitic.agr.gn) clitic.agr.p) ; perfect = verb.s ! asp ! (VPerfect (aform clitic.agr.gn Indef (RObj Acc))) ; auxPres = auxBe ! VPres (numGenNum clitic.agr.gn) clitic.agr.p ; From 9570ff202aeb8799b8b3e6d96f7fa8f6c7c7f42c Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 10 Oct 2023 13:57:12 +0200 Subject: [PATCH 102/129] rename TPasseSimple to TPastSimple in Extend --- src/abstract/Extend.gf | 2 +- src/bulgarian/ExtendBul.gf | 2 +- src/common/ExtendFunctor.gf | 2 +- src/czech/ExtendCze.gf | 2 +- src/romance/ExtendRomanceFunctor.gf | 2 +- src/slovak/ExtendSlo.gf | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/abstract/Extend.gf b/src/abstract/Extend.gf index 7e46ecc0..2aaac7b2 100644 --- a/src/abstract/Extend.gf +++ b/src/abstract/Extend.gf @@ -303,6 +303,6 @@ fun AnaphPron : NP -> Pron ; fun - TPasseSimple : Tense ; + TPastSimple : Tense ; } diff --git a/src/bulgarian/ExtendBul.gf b/src/bulgarian/ExtendBul.gf index 19f9a990..085284af 100644 --- a/src/bulgarian/ExtendBul.gf +++ b/src/bulgarian/ExtendBul.gf @@ -317,7 +317,7 @@ lin AnaphPron np = => they_Pron } ; -lin TPasseSimple = {s = []} ** {t = VPastSimple} ; --# notpresent +lin TPastSimple = {s = []} ** {t = VPastSimple} ; --# notpresent } diff --git a/src/common/ExtendFunctor.gf b/src/common/ExtendFunctor.gf index 4025e4dc..cdbfa7df 100644 --- a/src/common/ExtendFunctor.gf +++ b/src/common/ExtendFunctor.gf @@ -127,7 +127,7 @@ lin UttDatIP ip = UttAccIP (lin IP ip) ; -- whom (dative) ; DEFAULT who UttVPShort = UttVP ; -- have fun, as opposed to "to have fun" ; DEFAULT UttVP - TPasseSimple = Grammar.TPast ; --# notpresent + TPastSimple = Grammar.TPast ; --# notpresent SQuestVPS = variants {} ; -- : NP -> VPS -> QS ; -- has she walked QuestVPS = variants {} ; -- : IP -> VPS -> QS ; -- who has walked diff --git a/src/czech/ExtendCze.gf b/src/czech/ExtendCze.gf index 9bd5d869..9d094ebc 100644 --- a/src/czech/ExtendCze.gf +++ b/src/czech/ExtendCze.gf @@ -27,7 +27,7 @@ concrete ExtendCze of Extend = CatCze ** ,CompBareCN ,PiedPipingQuestSlash ,PiedPipingRelSlash - ,TPasseSimple + ,TPastSimple ] with (Grammar = GrammarCze) ** diff --git a/src/romance/ExtendRomanceFunctor.gf b/src/romance/ExtendRomanceFunctor.gf index d4367425..03c24e01 100644 --- a/src/romance/ExtendRomanceFunctor.gf +++ b/src/romance/ExtendRomanceFunctor.gf @@ -278,7 +278,7 @@ incomplete concrete ExtendRomanceFunctor of Extend = UttDatIP ip = UttAccIP (lin IP ip) ; -- whom (dative) ; DEFAULT who UttVPShort = UttVP ; - TPasseSimple = {s = []} ** {t = RPasse} ; --# notpresent + TPastSimple = {s = []} ** {t = RPasse} ; --# notpresent oper quoted : Str -> Str = \s -> "\"" ++ s ++ "\"" ; ---- TODO bind ; move to Prelude? diff --git a/src/slovak/ExtendSlo.gf b/src/slovak/ExtendSlo.gf index eb1121e8..4c85232c 100644 --- a/src/slovak/ExtendSlo.gf +++ b/src/slovak/ExtendSlo.gf @@ -27,7 +27,7 @@ concrete ExtendSlo of Extend = CatSlo ** ,CompBareCN ,PiedPipingQuestSlash ,PiedPipingRelSlash - ,TPasseSimple + ,TPastSimple ] with (Grammar = GrammarSlo) ** From da608c20845293d2e5cc618f429491b7282f9e22 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 10 Oct 2023 15:49:43 +0200 Subject: [PATCH 103/129] fix ia2e for monosillable verbs --- src/bulgarian/ResBul.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bulgarian/ResBul.gf b/src/bulgarian/ResBul.gf index 306eb65a..7a10e08f 100644 --- a/src/bulgarian/ResBul.gf +++ b/src/bulgarian/ResBul.gf @@ -477,7 +477,7 @@ resource ResBul = ParamX - [Tense,Pres,Past,Fut,Cond] ** open Prelude, Predef in ia2e : Str -> Str = -- to be used when the next syllable has vowel different from "а","ъ","о" or "у" \s -> case s of { - x + "я" + y@(["бвгджзклмнпрстфхцчш"]*) + x@(?+_) + "я" + y@(["бвгджзклмнпрстфхцчш"]*) => x+"е"+y; _ => s }; From 17da1893d71de039bbb95f5841b3f15b5e49e4c7 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 16 Oct 2023 16:20:42 +0200 Subject: [PATCH 104/129] esto/isto in Spanish/Portuguese --- src/catalan/StructuralCat.gf | 32 +++++++++++++++++++++------- src/french/ExtendFre.gf | 28 ++++++++++++++++++++++++ src/french/ExtraFre.gf | 4 ++-- src/french/MakeStructuralFre.gf | 11 ++++++++-- src/french/StructuralFre.gf | 30 ++++++++++++++++++++------ src/italian/ExtraIta.gf | 1 + src/italian/MakeStructuralIta.gf | 4 ++++ src/italian/StructuralIta.gf | 33 +++++++++++++++++++++++------ src/portuguese/MorphoPor.gf | 4 +++- src/portuguese/StructuralPor.gf | 5 +++-- src/romance/CatRomance.gf | 2 ++ src/romance/ExtendRomanceFunctor.gf | 12 ++++++++++- src/romance/NounRomance.gf | 10 +++++++++ src/spanish/MakeStructuralSpa.gf | 6 +++++- src/spanish/MorphoSpa.gf | 16 ++++++-------- src/spanish/StructuralSpa.gf | 12 +++++++---- 16 files changed, 168 insertions(+), 42 deletions(-) diff --git a/src/catalan/StructuralCat.gf b/src/catalan/StructuralCat.gf index 4833b786..65ae557b 100644 --- a/src/catalan/StructuralCat.gf +++ b/src/catalan/StructuralCat.gf @@ -30,11 +30,16 @@ lin during_Prep = mkPrep "durant" ; ---- either7or_DConj = {s1,s2 = "o" ; n = Sg} ; everybody_NP = makeNP ["tothom"] Masc Sg ; - every_Det = {s,sp = \\_,_ => "cada" ; n = Sg ; s2 = [] ; isNeg = False} ; + every_Det = { + s,sp = \\_,_ => "cada"; + spn =\\c => prepCase c ++ "tot" ; + n = Sg ; s2 = [] ; isNeg = False} ; everything_NP = pn2np (mkPN "tot" Masc) ; everywhere_Adv = ss ["a tot arreu"] ; few_Det = { - s,sp = \\g,c => prepCase c ++ genForms "pocs" "poques" ! g ; n = Pl ; s2 = [] ; isNeg = False} ; + s,sp = \\g,c => prepCase c ++ genForms "pocs" "poques" ! g ; + spn = \\c => prepCase c ++ "pocs" ; + n = Pl ; s2 = [] ; isNeg = False} ; --- first_Ord = {s = \\ag => (regA "primer").s ! Posit ! AF ag.g ag.n} ; for_Prep = mkPrep ["per a"] ; from_Prep = complGen ; --- @@ -64,12 +69,16 @@ lin less_CAdv = X.mkCAdv "menys" conjThan ; ---- many_Det = { - s,sp = \\g,c => prepCase c ++ genForms "molts" "moltes" ! g ; n = Pl ; s2 = [] ; isNeg = False} ; + s,sp = \\g,c => prepCase c ++ genForms "molts" "moltes" ! g ; + spn = \\c => prepCase c ++ "molts" ; + n = Pl ; s2 = [] ; isNeg = False} ; more_CAdv = X.mkCAdv "més" conjThan ; most_Predet = {s = \\_,c => prepCase c ++ ["la majoria"] ; c = CPrep P_de ; a = PNoAg} ; much_Det = { - s,sp = \\g,c => prepCase c ++ genForms "molt" "molta" ! g ; n = Sg ; s2 = [] ; isNeg = False} ; + s,sp = \\g,c => prepCase c ++ genForms "molt" "molta" ! g ; + spn = \\c => prepCase c ++ "molt" ; + n = Sg ; s2 = [] ; isNeg = False} ; must_VV = deVV (verbV (haver_59 "haver" True)) ; no_Utt = ss "no" ; on_Prep = mkPrep "sobre" ; @@ -89,10 +98,14 @@ lin Fem Sg P3 ; so_AdA = ss "tan" ; somebody_NP = pn2np (mkPN ["alg˙"] Masc) ; - somePl_Det = {s,sp = - \\g,c => prepCase c ++ genForms "alguns" "algunes" ! g ; n = Pl ; s2 = [] ; isNeg = False} ; + somePl_Det = { + s,sp = \\g,c => prepCase c ++ genForms "alguns" "algunes" ! g ; + spn = \\c => prepCase c ++ "alguns" ; + n = Pl ; s2 = [] ; isNeg = False} ; someSg_Det = { - s,sp = \\g,c => prepCase c ++ genForms "algun" "alguna" ! g ; n = Sg ; s2 = [] ; isNeg = False} ; + s,sp = \\g,c => prepCase c ++ genForms "algun" "alguna" ! g ; + spn = \\c => prepCase c ++ "quelcom" ; + n = Sg ; s2 = [] ; isNeg = False} ; something_NP = pn2np (mkPN ["quelcom"] Masc) ; somewhere_Adv = ss ["a algun lloc"] ; that_Quant = @@ -103,6 +116,7 @@ lin in { s = \\_ => aquell ; sp = aquell ; + spn= aquell ! Sg ! Masc ; s2 = [] ; isNeg = False } ; there_Adv = mkAdv "allà" ; -- all· @@ -122,6 +136,7 @@ lin in { s = \\_ => aquest ; sp = aquest ; + spn= aquest ! Sg ! Masc ; s2 = [] ; isNeg = False } ; through_Prep = mkPrep "mitjançant" ; @@ -172,7 +187,7 @@ oper lin if_then_Conj = {s1 = "si" ; s2 = "llavors" ; n = Sg ; lock_Conj = <>} ; - + no_Quant = let capS : Str = "cap" ; @@ -183,6 +198,7 @@ lin in { s = \\_ => cap ; sp = cap ; + spn= \\c => prepCase c ++ "res" ; s2 = [] ; isNeg = True } ; nobody_NP = pn2npNeg (mkPN "ningú") ; diff --git a/src/french/ExtendFre.gf b/src/french/ExtendFre.gf index 02b2915e..61ea2f9d 100644 --- a/src/french/ExtendFre.gf +++ b/src/french/ExtendFre.gf @@ -61,4 +61,32 @@ lin ApposNP np1 np2 = np1 ** { -- guessed by KA lin CompoundN a b = lin N {s = \\n => b.s ! n ++ a.s ! Sg ; g = b.g} ; -- connessione internet = internet connection +lin UseDAP = \dap -> + let + g = Masc ; + n = dap.n + in heavyNPpol dap.isNeg { + s = dap.spn ; + a = agrP3 g n ; + hasClit = False + } ; + UseDAPMasc = \dap -> + let + g = Masc ; + n = dap.n + in heavyNPpol dap.isNeg { + s = dap.sp ! g ; + a = agrP3 g n ; + hasClit = False + } ; + UseDAPFem dap = + let + g = Fem ; + n = dap.n + in heavyNPpol dap.isNeg { + s = dap.sp ! g ; + a = agrP3 g n ; + hasClit = False + } ; + } diff --git a/src/french/ExtraFre.gf b/src/french/ExtraFre.gf index 73f76d6d..8be0ae77 100644 --- a/src/french/ExtraFre.gf +++ b/src/french/ExtraFre.gf @@ -74,8 +74,8 @@ concrete ExtraFre of ExtraFreAbs = ExtraRomanceFre ** lin tout_Det = { - s = \\g,c => prepCase c ++ genForms "tout" "toute" ! g ; - sp = \\g,c => prepCase c ++ genForms "tout" "toute" ! g ; + s,sp = \\g,c => prepCase c ++ genForms "tout" "toute" ! g ; + spn= \\c => prepCase c ++ "tout" ; n = Sg ; s2 = [] ; isNeg = False diff --git a/src/french/MakeStructuralFre.gf b/src/french/MakeStructuralFre.gf index 5969d05a..c7285f90 100644 --- a/src/french/MakeStructuralFre.gf +++ b/src/french/MakeStructuralFre.gf @@ -23,6 +23,7 @@ oper in lin Quant { s = \\_ => aucun ; sp = aucun ; + spn= \\c => prepCase c ++ sm ; s2 = [] ; isNeg = False } ; @@ -38,9 +39,15 @@ oper mkInterj : Str -> Interj = \s -> lin Interj (ss s) ; mkDet = overload { - mkDet : Str -> Det = \s -> lin Det {s,sp = \\_,c => prepCase c ++ s ; n = Sg ; s2 = [] ; isNeg = False} ; + mkDet : Str -> Det = \s -> lin Det { + s,sp = \\_,c => prepCase c ++ s ; + spn = \\c => prepCase c ++ s ; + n = Sg ; s2 = [] ; isNeg = False + } ; mkDet : Str -> Str -> Number -> Det = \m,f,n -> lin Det { - s,sp = \\g,c => prepCase c ++ case g of {Masc => m ; Fem => f} ; n = n ; s2 = [] ; isNeg = False + s,sp = \\g,c => prepCase c ++ case g of {Masc => m ; Fem => f} ; + spn = \\c => prepCase c ++ m ; + n = n ; s2 = [] ; isNeg = False } ; } ; diff --git a/src/french/StructuralFre.gf b/src/french/StructuralFre.gf index 9af3fb3e..0a9028e3 100644 --- a/src/french/StructuralFre.gf +++ b/src/french/StructuralFre.gf @@ -36,13 +36,17 @@ lin every_Det = { s = \\_,c => prepCase c ++ "chaque" ; sp = \\g,c => prepCase c ++ genForms "chacun" "chacune" ! g ; - n = Sg ; + spn= \\c => prepCase c ++ "tout" ; + n = Sg ; s2 = [] ; isNeg = False } ; everything_NP = pn2np (mkPN ["tout"] Masc) ; everywhere_Adv = ss "partout" ; - few_Det = {s,sp = \\g,c => prepCase c ++ "peu" ++ elisDe ; n = Pl ; s2 = [] ; isNeg = False} ; + few_Det = { + s,sp = \\g,c => prepCase c ++ "peu" ++ elisDe ; + spn = \\c => prepCase c ++ "peu" ++ elisDe ; + n = Pl ; s2 = [] ; isNeg = False} ; --- DEPREC first_Ord = {s = \\ag => (regA "premier").s ! Posit ! AF ag.g ag.n} ; for_Prep = mkPreposition "pour" ; from_Prep = complGen ; --- @@ -68,10 +72,15 @@ lin "il" (elision "l") "lui" "lui" "son" (elisPoss "s") "ses" Masc Sg P3 ; less_CAdv = X.mkCAdv "moins" conjThan ; - many_Det = {s,sp = \\_,c => prepCase c ++ "plusieurs" ; n = Pl ; s2 = [] ; isNeg = False} ; + many_Det = { + s,sp = \\_,c => prepCase c ++ "plusieurs" ; + spn = \\c => prepCase c ++ "plusieurs" ; + n = Pl ; s2 = [] ; isNeg = False} ; more_CAdv = X.mkCAdv "plus" conjThan ; most_Predet = {s = \\_,c => prepCase c ++ ["la plupart"] ; c = CPrep P_de ; a = PNoAg} ; - much_Det = {s,sp = \\_,c => prepCase c ++ "beaucoup" ++ elisDe ; n = Pl ; s2 = [] ; isNeg = False} ; + much_Det = {s,sp = \\_,c => prepCase c ++ "beaucoup" ++ elisDe ; + spn = \\c => prepCase c ++ "beaucoup" ++ elisDe ; + n = Pl ; s2 = [] ; isNeg = False} ; must_VV = mkVV (devoir_V2 ** {lock_V = <>}) ; ---b no_Phr = ss "non" ; no_Utt = ss "non" ; @@ -91,8 +100,14 @@ lin so_AdA = ss "si" ; somebody_NP = pn2np (mkPN ["quelqu'un"] Masc) ; - somePl_Det = {s,sp = \\_,c => prepCase c ++ "quelques" ; n = Pl ; s2 = [] ; isNeg = False} ; ---- sp - someSg_Det = {s,sp = \\_,c => prepCase c ++ "quelque" ; n = Sg ; s2 = [] ; isNeg = False} ; ----sp + somePl_Det = { + s,sp = \\_,c => prepCase c ++ "quelques" ; + spn = \\c => prepCase c ++ "quelque chose" ; + n = Pl ; s2 = [] ; isNeg = False} ; ---- sp + someSg_Det = { + s,sp = \\_,c => prepCase c ++ "quelque" ; + spn = \\c => prepCase c ++ "quelque chose" ; + n = Sg ; s2 = [] ; isNeg = False} ; ----sp something_NP = pn2np (mkPN ["quelque chose"] Masc) ; somewhere_Adv = ss ["quelque part"] ; --- ne - pas @@ -106,6 +121,7 @@ lin Sg => \\g,c => prepCase c ++ genForms "celui-là" "celle-là" ! g ; Pl => \\g,c => prepCase c ++ genForms "ceux-là" "celles-là" ! g } ; + spn= \\c => prepCase c ++ "celui-là" ; s2 = [] ; ---- "-là" ; isNeg = False } ; @@ -130,6 +146,7 @@ lin Sg => \\g,c => prepCase c ++ genForms "celui-ci" "celle-ci" ! g ; Pl => \\g,c => prepCase c ++ genForms "ceux-ci" "celles-ci" ! g } ; + spn= \\c => prepCase c ++ "cela" ; s2 = [] ; ---- "-ci" isNeg = False } ; @@ -188,6 +205,7 @@ lin in { s = \\_ => aucun ; sp = aucun ; + spn= aucun ! Sg ! Masc ; s2 = [] ; isNeg = True } ; diff --git a/src/italian/ExtraIta.gf b/src/italian/ExtraIta.gf index 40933568..79eeee9c 100644 --- a/src/italian/ExtraIta.gf +++ b/src/italian/ExtraIta.gf @@ -39,6 +39,7 @@ concrete ExtraIta of ExtraItaAbs = ExtraRomanceIta ** PossFamQuant p = { s = \\_,n,g,c => case n of {Sg => prepCase c ; _ => possCase g n c} ++ p.poss ! n ! g ; sp = \\ n,g,c => case n of {Sg => prepCase c ; _ => possCase g n c} ++ p.poss ! n ! g ; + spn= \\ c => prepCase c ++ p.poss ! Sg ! Masc ; s2 = [] ; isNeg = False } ; diff --git a/src/italian/MakeStructuralIta.gf b/src/italian/MakeStructuralIta.gf index 8cd9aa6c..34a4d365 100644 --- a/src/italian/MakeStructuralIta.gf +++ b/src/italian/MakeStructuralIta.gf @@ -34,6 +34,7 @@ oper in lin Quant { s = \\b => questo ; sp = questo ; + spn= \\c => prepCase c ++ s ; s2 = [] ; isNeg = False } ; @@ -53,6 +54,7 @@ oper in lin Quant { s = \\b => questo ; sp = questo ; + spn= \\c => prepCase c ++ tutto ; s2 = [] ; isNeg = False } ; @@ -62,6 +64,7 @@ oper -- Does not inflect for number mkDet : Str -> Number -> Det = \piu,n -> lin Det { s,sp = \\_,_ => piu ; + spn = \\_ => piu ; n = n ; s2 = [] ; isNeg = False @@ -72,6 +75,7 @@ oper Masc => \\_ => alcuni ; Fem => \\_ => alcune } ; + spn = \\_ => alcuni ; n = n ; s2 = [] ; isNeg = False diff --git a/src/italian/StructuralIta.gf b/src/italian/StructuralIta.gf index 257e9ecb..4001dffe 100644 --- a/src/italian/StructuralIta.gf +++ b/src/italian/StructuralIta.gf @@ -31,10 +31,16 @@ lin during_Prep = mkPrep "durante" ; either7or_DConj = {s1,s2 = "o" ; n = Sg} ; everybody_NP = makeNP ["tutti"] Masc Pl ; - every_Det = {s,sp = \\_,_ => "ogni" ; n = Sg ; s2 = [] ; isNeg = False} ; + every_Det = { + s,sp = \\_,_ => "ogni" ; + spn = \\c => prepCase c ++ "tutto" ; + n = Sg ; s2 = [] ; isNeg = False} ; everything_NP = pn2np (mkPN ["tutto"] Masc) ; everywhere_Adv = ss "dappertutto" ; - few_Det = {s,sp = \\g,c => prepCase c ++ genForms "pochi" "poche" ! g ; n = Pl ; s2 = [] ; isNeg = False} ; + few_Det = { + s,sp = \\g,c => prepCase c ++ genForms "pochi" "poche" ! g ; + spn = \\c => prepCase c ++ "pochi" ; + n = Pl ; s2 = [] ; isNeg = False} ; ---- first_Ord = {s = \\ag => (regA "primo").s ! Posit ! AF ag.g ag.n} ; for_Prep = mkPrep "per" ; from_Prep = da_Prep ; @@ -60,11 +66,17 @@ lin "lui" "lo" "gli" "glie" "lui" "suo" "sua" "suoi" "sue" Masc Sg P3 ; less_CAdv = X.mkCAdv "meno" conjThan ; - many_Det = {s,sp = \\g,c => prepCase c ++ genForms "molti" "molte" ! g ; n = Pl ; s2 = [] ; isNeg = False} ; + many_Det = { + s,sp = \\g,c => prepCase c ++ genForms "molti" "molte" ! g ; + spn = \\c => prepCase c ++ "molto" ; + n = Pl ; s2 = [] ; isNeg = False} ; more_CAdv = X.mkCAdv "più" conjThan ; most_Predet = {s = \\_,c => prepCase c ++ ["la maggior parte"] ; c = CPrep P_di ; a = PNoAg} ; - much_Det = {s,sp = \\g,c => prepCase c ++ genForms "molto" "molta" ! g ; n = Sg ; s2 = [] ; isNeg = False} ; + much_Det = { + s,sp = \\g,c => prepCase c ++ genForms "molto" "molta" ! g ; + spn = \\c => prepCase c ++ "molto" ; + n = Sg ; s2 = [] ; isNeg = False} ; must_VV = mkVV (verboV (dovere_47 "dovere")) ; no_Utt = ss "no" ; on_Prep = {s = [] ; c = CPrep P_su ; isDir = False} ; @@ -83,8 +95,14 @@ lin Fem Sg P3 ; so_AdA = ss "così" ; somebody_NP = pn2np (mkPN ["qualcuno"] Masc) ; - somePl_Det = {s,sp = \\_,c => prepCase c ++ "qualche" ; n = Pl ; s2 = [] ; isNeg = False} ; - someSg_Det = {s,sp = \\_,c => prepCase c ++ "qualche" ; n = Sg ; s2 = [] ; isNeg = False} ; + somePl_Det = { + s,sp = \\_,c => prepCase c ++ "qualche" ; + spn = \\c => prepCase c ++ "qualche cosa" ; + n = Pl ; s2 = [] ; isNeg = False} ; + someSg_Det = { + s,sp = \\_,c => prepCase c ++ "qualche" ; + spn = \\c => prepCase c ++ "qualche cosa" ; + n = Sg ; s2 = [] ; isNeg = False} ; something_NP = pn2np (mkPN ["qualche cosa"] Masc) ; somewhere_Adv = ss ["qualche parte"] ; that_Quant = let @@ -98,6 +116,7 @@ lin quello (elision "quel" "quell'" "quello") (elision "quei" "quegli" "quegli") ; sp = quello "quello" "quelli" ; + spn= \\c => prepCase c ++ "quello" ; s2 = [] ; isNeg = False } ; @@ -118,6 +137,7 @@ lin in { s = \\_ => questo ; sp = questo ; + spn= \\c => prepCase c ++ "questo" ; s2 = [] ; isNeg = False } ; @@ -169,6 +189,7 @@ lin in { s = \\_ => aucun ; sp = aucun ; + spn= \\c => prepCase c ++ "nessuno" ; s2 = [] ; isNeg = True } ; diff --git a/src/portuguese/MorphoPor.gf b/src/portuguese/MorphoPor.gf index ac95daef..982f96b0 100644 --- a/src/portuguese/MorphoPor.gf +++ b/src/portuguese/MorphoPor.gf @@ -254,7 +254,7 @@ oper s = \\ag => adj.s ! genNum2Aform ag.g ag.n ; } ; - mkQuantifier : (esse,essa,esses,essas : Str) -> Quant = \esse,essa,esses,essas-> + mkQuantifier : (esse,essa,esses,essas,esso : Str) -> Quant = \esse,essa,esses,essas,esso-> let attrforms : Number => Gender => Case => Str = table { Sg => \\g,c => prepCase c ++ genForms esse essa ! g ; @@ -264,12 +264,14 @@ oper s = \\_ => attrforms ; s2 = [] ; sp = attrforms ; -- in spanish it was different + spn= \\c => prepCase c ++ esso ; isNeg = False } ; mkDeterminer : (muito,muita : Str) -> Number -> Bool -> Det = \muito,muita,number,neg -> lin Det { s,sp = \\g,c => prepCase c ++ genForms muito muita ! g ; + spn = \\c => prepCase c ++ muito ; n = number; s2 = [] ; isNeg = neg diff --git a/src/portuguese/StructuralPor.gf b/src/portuguese/StructuralPor.gf index 953bfe7a..782e1964 100644 --- a/src/portuguese/StructuralPor.gf +++ b/src/portuguese/StructuralPor.gf @@ -102,6 +102,7 @@ concrete StructuralPor of Structural = CatPor ** in { s = \\_ => nenhum ; sp = nenhum ; + spn= \\c => prepCase c ++ "nada" ; s2 = [] ; isNeg = True } ; no_Utt = ss "não" ; @@ -124,13 +125,13 @@ concrete StructuralPor of Structural = CatPor ** someSg_Det = mkDeterminer "algum" "alguma" Sg False ; something_NP = pn2np (mkPN "algo" Masc) ; somewhere_Adv = ss ["em algum lugar"] ; - that_Quant = mkQuantifier "esse" "essa" "esses" "essas" ; + that_Quant = mkQuantifier "esse" "essa" "esses" "essas" "isso" ; there_Adv = mkAdv "ali" ; -- lá there7to_Adv = mkAdv ["para lá"] ; there7from_Adv = mkAdv "dali" ; therefore_PConj = ss ["por isso"] ; - this_Quant = mkQuantifier "este" "esta" "estes" "estas" ; + this_Quant = mkQuantifier "este" "esta" "estes" "estas" "isto" ; through_Prep = mkPrep [] ablative ; -- por too_AdA = ss "demasiado" ; -- o certo seria demais como postfix to_Prep = complDat ; diff --git a/src/romance/CatRomance.gf b/src/romance/CatRomance.gf index 14af013d..4fe38778 100644 --- a/src/romance/CatRomance.gf +++ b/src/romance/CatRomance.gf @@ -67,12 +67,14 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol,MU] n : Number ; s2 : Str ; -- -ci sp : Gender => Case => Str ; -- substantival: mien, mienne + spn: Case => Str ; isNeg : Bool -- negative element, e.g. aucun } ; Quant = { s : Bool => Number => Gender => Case => Str ; s2 : Str ; sp : Number => Gender => Case => Str ; + spn: Case => Str ; -- neutral Spa: esto, eso, Por: isto, isso isNeg : Bool -- negative element, e.g. aucun } ; Predet = { diff --git a/src/romance/ExtendRomanceFunctor.gf b/src/romance/ExtendRomanceFunctor.gf index 03c24e01..8e752710 100644 --- a/src/romance/ExtendRomanceFunctor.gf +++ b/src/romance/ExtendRomanceFunctor.gf @@ -27,6 +27,7 @@ incomplete concrete ExtendRomanceFunctor of Extend = let denp = (np.s ! ResRomance.genitive).ton in { s = \\_,_,_,_ => [] ; sp = \\_,_,_ => denp ; + spn= \\_ => denp ; s2 = denp ; isNeg = False ; } ; @@ -240,7 +241,16 @@ incomplete concrete ExtendRomanceFunctor of Extend = } ; - UseDAP, UseDAPMasc = \dap -> + UseDAP = \dap -> + let + g = Masc ; + n = dap.n + in heavyNPpol dap.isNeg { + s = dap.spn ; + a = agrP3 g n ; + hasClit = False + } ; + UseDAPMasc = \dap -> let g = Masc ; n = dap.n diff --git a/src/romance/NounRomance.gf b/src/romance/NounRomance.gf index d35f04cd..0fe65659 100644 --- a/src/romance/NounRomance.gf +++ b/src/romance/NounRomance.gf @@ -55,6 +55,8 @@ incomplete concrete NounRomance of Noun = DetQuantOrd quant num ord = { s,sp = \\g,c => quant.s ! num.isNum ! num.n ! g ! c ++ num.s ! g ++ ord.s ! aagr g num.n ; + spn = \\c => quant.s ! num.isNum ! num.n ! Masc ! c ++ num.s ! Masc ++ + ord.s ! aagr Masc num.n ; s2 = quant.s2 ; n = num.n ; isNeg = quant.isNeg @@ -66,6 +68,10 @@ incomplete concrete NounRomance of Noun = True => quant.s ! True ! num.n ! g ! c ++ num.s ! g ; False => quant.sp ! num.n ! g ! c ++ num.s ! g } ; + spn= \\c => case num.isNum of { + True => quant.s ! True ! num.n ! Masc ! c ++ num.s ! Masc ; + False => quant.spn ! c ++ num.s ! Masc + } ; s2 = quant.s2 ; n = num.n ; isNeg = quant.isNeg @@ -84,6 +90,7 @@ incomplete concrete NounRomance of Noun = PossPron p = { s = \\_,n,g,c => possCase g n c ++ p.poss ! n ! g ; ---- il mio! sp = \\ n,g,c => possCase g n c ++ p.poss ! n ! g ; ---- not for Fre + spn= \\ c => possCase Masc Sg c ++ p.poss ! Sg ! Masc ; ---- not for Fre s2 = [] ; isNeg = False } ; @@ -117,6 +124,7 @@ incomplete concrete NounRomance of Noun = DefArt = { s = \\_,n,g,c => artDef False g n c ; sp = \\n,g,c => artDef True g n c ; + spn= \\c => artDef True Masc Sg c ; s2 = [] ; isNeg = False } ; @@ -124,6 +132,7 @@ incomplete concrete NounRomance of Noun = IndefArt = { s = \\b,n,g,c => if_then_Str b (prepCase c) (artIndef False g n c) ; sp = \\n,g,c => artIndef True g n c ; + spn= \\c => artIndef True Masc Sg c ; s2 = [] ; isNeg = False } ; @@ -202,6 +211,7 @@ incomplete concrete NounRomance of Noun = n = det.n ; s2 = det.s2 ; -- -ci sp = \\g,c => det.s ! g ! c ++ ap.s ! genNum2Aform g det.n ; + spn= \\c => det.s ! Masc ! c ++ ap.s ! genNum2Aform Masc det.n ; isNeg = det.isNeg } ; diff --git a/src/spanish/MakeStructuralSpa.gf b/src/spanish/MakeStructuralSpa.gf index bda2f96f..42768b33 100644 --- a/src/spanish/MakeStructuralSpa.gf +++ b/src/spanish/MakeStructuralSpa.gf @@ -28,11 +28,12 @@ oper in lin Quant { s = \\b => questo ; sp = questo ; + spn= \\c => prepCase c ++ s ; s2 = [] ; isNeg = False } ; -- Inflects for number and gender - mkQuant : Str -> Str -> Str -> Str -> Quant = \tutto,tutta,tutti,tutte -> + mkQuant : Str -> Str -> Str -> Str -> Str -> Quant = \tutto,tutta,tutti,tutte,esto -> let questo : Number => Gender => Case => Str = table { Sg => table { @@ -47,6 +48,7 @@ oper in lin Quant { s = \\b => questo ; sp = questo ; + spn= \\c => prepCase c ++ "esto" ; s2 = [] ; isNeg = False } ; @@ -56,6 +58,7 @@ oper -- Does not inflect for number mkDet : Str -> Number -> Det = \piu,n -> lin Det { s,sp = \\_,c => prepCase c ++ piu ; + spn = \\c => prepCase c ++ piu ; n = n ; s2 = [] ; isNeg = False @@ -63,6 +66,7 @@ oper -- Inflects for number mkDet : Str -> Str -> Number -> Det = \alcuni,alcune,n -> lin Det { s,sp = \\g,c => prepCase c ++ genForms alcuni alcune ! g ; + spn = \\c => prepCase c ++ alcuni ; n = n ; s2 = [] ; isNeg = False diff --git a/src/spanish/MorphoSpa.gf b/src/spanish/MorphoSpa.gf index fd13665c..28516ddb 100644 --- a/src/spanish/MorphoSpa.gf +++ b/src/spanish/MorphoSpa.gf @@ -239,29 +239,27 @@ oper s = \\ag => adj.s ! genNum2Aform ag.g ag.n ; } ; - mkQuantifier : (ese,esa,esos,esas : Str) -> Quant = \ese,esa,esos,esas-> + mkQuantifier : (ese,esa,esos,esas,eso : Str) -> Quant = \ese,esa,esos,esas,eso-> let - se : Str = Predef.drop 1 ese ; - sa : Str = Predef.drop 1 esa ; - sos : Str = Predef.drop 1 esos ; - sas : Str = Predef.drop 1 esas ; - E : Str = "é" ; attrforms : Number => Gender => Case => Str = table { Sg => \\g,c => prepCase c ++ genForms ese esa ! g ; Pl => \\g,c => prepCase c ++ genForms esos esas ! g ---- } ; npforms : Number => Gender => Case => Str = table { - Sg => \\g,c => prepCase c ++ genForms (E + se) (E + sa) ! g ; - Pl => \\g,c => prepCase c ++ genForms (E + sos) (E + sas) ! g } + Sg => \\g,c => prepCase c ++ genForms ese esa ! g ; + Pl => \\g,c => prepCase c ++ genForms esos esas ! g } in lin Quant { s = \\_ => attrforms ; s2 = [] ; - sp = npforms ; isNeg = False + sp = npforms ; + spn= \\c => prepCase c ++ eso ; + isNeg = False } ; mkDeterminer : (mucho,mucha : Str) -> Number -> Bool -> Det = \mucho,mucha,number,neg -> lin Det { s,sp = \\g,c => prepCase c ++ genForms mucho mucha ! g ; + spn = \\c => prepCase c ++ mucho ; n = number; s2 = [] ; isNeg = neg diff --git a/src/spanish/StructuralSpa.gf b/src/spanish/StructuralSpa.gf index 8efabbab..c617dc8b 100644 --- a/src/spanish/StructuralSpa.gf +++ b/src/spanish/StructuralSpa.gf @@ -35,7 +35,10 @@ lin during_Prep = mkPrep "durante" ; either7or_DConj = {s1,s2 = "o" ; n = Sg} ; everybody_NP = makeNP ["todos"] Masc Pl ; - every_Det = mkDeterminer "cada" "cada" Sg False ; + every_Det = mkDeterminer "cada" "cada" Sg False ** { + sp = \\g,c => prepCase c ++ genForms "todos" "todas" ! g ; + spn = \\c => prepCase c ++ "todo" + }; everything_NP = pn2np (mkPN ["todo"] Masc) ; everywhere_Adv = ss ["en todas partes"] ; except_Prep = mkPrep "excepto" ; @@ -75,7 +78,8 @@ lin } in { s = \\_ => ningun ; - sp = ningun ; + sp = \\_,_,_ => "nadie" ; + spn= \\c => prepCase c ++ "nada" ; s2 = [] ; isNeg = True } ; no_Utt = ss "no" ; @@ -100,13 +104,13 @@ lin someSg_Det = mkDeterminer "algún" "alguna" Sg False ; something_NP = pn2np (mkPN ["algo"] Masc) ; somewhere_Adv = ss ["en alguna parte"] ; - that_Quant = mkQuantifier "ese" "esa" "esos" "esas" ; + that_Quant = mkQuantifier "ese" "esa" "esos" "esas" "eso" ; there_Adv = mkAdv "allí" ; -- allá there7to_Adv = mkAdv ["para allí"] ; there7from_Adv = mkAdv ["de allí"] ; therefore_PConj = ss ["por eso"] ; they_Pron = agr2pron ! {g=Masc ; n=Pl ; p=P3} ; - this_Quant = mkQuantifier "este" "esta" "estos" "estas" ; + this_Quant = mkQuantifier "este" "esta" "estos" "estas" "esto" ; through_Prep = mkPrep "por" ; too_AdA = ss "demasiado" ; to_Prep = complDat ; From 6f73277ac2e39e399a42587f5e39aacbbd37475e Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 12 Oct 2023 11:32:51 +0200 Subject: [PATCH 105/129] (Fin) fix SgPart allomorph for nouns ending #vow+O --- src/finnish/MorphoFin.gf | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/finnish/MorphoFin.gf b/src/finnish/MorphoFin.gf index 3d374218..422a6dbe 100644 --- a/src/finnish/MorphoFin.gf +++ b/src/finnish/MorphoFin.gf @@ -155,9 +155,9 @@ resource MorphoFin = ResFin ** open Prelude in { silakk = init silakka ; silaka = init silakan ; silak = init silaka ; - silakkaa = silakka + case o of { - "o" | "ö" => "t" + a ; -- radiota - _ => a -- sammakkoa + silakkaa = silakka + case silakka of { + _ + #vowel + ("o" | "ö") => "t" + a ; -- radiota + _ => a -- sammakkoa } ; silakoiden = case of { _ + "i" + ("a" | "ä") => -- asemia @@ -859,6 +859,8 @@ resource MorphoFin = ResFin ** open Prelude in { -- Auxiliaries ----------------------------------------- + vowel : pattern Str = #("a"|"e"|"i"|"o"|"u"|"y"|"ä"|"ö") ; + -- The following function defines how grade alternation works if it is active. -- In general, *whether there is* grade alternation must be given in the lexicon -- (cf. "auto - auton" not "audon"; "vihje - vihjeen" not "vihkeen"). From 2f8960e2e845cd87ad77acc85ea2f46c409402ef Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 20 Oct 2023 14:27:11 +0200 Subject: [PATCH 106/129] (Fin) Fixes in Kotus paradigms 25, 26, 33A --- src/finnish/Kotus.gf | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/src/finnish/Kotus.gf b/src/finnish/Kotus.gf index 962c7625..149c8293 100644 --- a/src/finnish/Kotus.gf +++ b/src/finnish/Kotus.gf @@ -1,5 +1,5 @@ -resource Kotus = open MorphoFin, Prelude in { +resource Kotus = open MorphoFin, Prelude, Predef in { flags coding=utf8 ; -- interpretations of paradigms in KOTUS word list, used in DictFin. @@ -100,9 +100,21 @@ oper d24 : Str -> NForms -- 20 uni = \s -> dArpi s (init s + "en") ; d25 : Str -> NForms -- 9 tuomi - = \s -> dArpi s (init s + "en") ; + -- Class 25 is a bit heterogeneous, lumi~lunta,liemi~lientä vs. luomi~luomea (?luonta). + -- To force e.g. toimi~tointa, use the 4-argument smart paradigm. /IL 2023 + -- TODO: how about forcing pl genitive also with nt? + = \s -> + let defaultNForms : NForms = dArpi s (init s + "en") ; + in case s of { + "lumi" => exceptSgPart defaultNForms "lunta" ; + "liemi" => exceptSgPart defaultNForms "lientä" ; + _ => defaultNForms } ; d26 : Str -> NForms -- 113 ääri - = \s -> dArpi s (init s + "en") ; +-- kielten,puolten,vuorten; default mkN gives kielien,puolien,vuorien + = \s -> + let defaultNForms : NForms = dArpi s (init s + "en") ; + puolten : Str = init s + "ten" ; + in exceptPlGen defaultNForms puolten ; d27 : Str -> NForms -- 23 vuosi = \s -> dArpi s (Predef.tk 2 s + "den") ; d28 : Str -> NForms -- 13 virsi @@ -132,7 +144,13 @@ oper d33 : Str -> NForms -- 168 väistin = \s -> dLiitin s (init s + "men") ; d33A : Str -> NForms -- 181 yllytin - = \s -> dLiitin s (strongGrade (init s) + "men") ; + = \s -> let + pyyhkimen : Str = case s of { -- strongGrade doesn't work for all + x + "hin" => x + "hkimen" ; -- pyyhin~pyyhkimen + x + "jin" => x + "kimen" ; -- suljin~sulkimen + _ => strongGrade (init s) + "men" + } ; + in dLiitin s pyyhkimen ; d34 : Str -> NForms -- 1 alaston = \s -> let alastom = init s in nForms10 @@ -323,4 +341,16 @@ oper fcompoundNK : (Str -> NForms) -> Str -> Str -> NForms = \d,x,y -> let ys = d y in \\v => x + ys ! v ; +-- 25, 26 etc. should override the default dArpi on singular partitive and plural genitive +-- lunta, *lumea, puolten, *puolien + exceptSgPart : NForms -> Str -> NForms = \defaultNForms,lunta -> + table { + 2 => lunta ; + m => defaultNForms ! m } ; + + exceptPlGen : NForms -> Str -> NForms = \defaultNForms,puolten -> + table { + 5 => puolten ; + m => defaultNForms ! m } ; + } From cd1a43db58ac62b70616bb96b983d229d83989a6 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 24 Oct 2023 08:27:36 +0200 Subject: [PATCH 107/129] added UseDAP --- src/russian/ExtendRus.gf | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/russian/ExtendRus.gf b/src/russian/ExtendRus.gf index 04060d9b..5c97b8e5 100644 --- a/src/russian/ExtendRus.gf +++ b/src/russian/ExtendRus.gf @@ -23,6 +23,9 @@ concrete ExtendRus of Extend = --ConjRNP, Cons_nr_RNP, Cons_rr_RNP, DetNPMasc, DetNPFem, + UseDAP, + UseDAPMasc, + UseDAPFem, -- EmbedPresPart, EmptyRelSlash, ExistsNP, -- ExistCN, ExistMassCN, ExistPluralCN, @@ -214,6 +217,41 @@ lin a=Ag (gennum g (numSizeNumber det.size)) P3 } ; + UseDAP det = + let g = det.g in { + s=case det.type of { + EmptyIndef => \\cas => a_Det.s ! g ! Inanimate ! cas ++ det.s ! g ! Inanimate ! cas ; + EmptyDef => \\cas => the_Det.s ! g ! Inanimate ! cas ++ det.s ! g ! Inanimate ! cas ; + _ => \\cas => det.s ! g ! Inanimate ! cas + } ; + pron=False ; + a=Ag (gennum g (numSizeNumber det.size)) P3 + } ; + + -- : DAP -> NP ; + UseDAPFem det = + let g = Fem in { + s=case det.type of { + EmptyIndef => \\cas => a_Det.s ! g ! Inanimate ! cas ++ det.s ! g ! Inanimate ! cas ; + EmptyDef => \\cas => the_Det.s ! g ! Inanimate ! cas ++ det.s ! g ! Inanimate ! cas ; + _ => \\cas => det.s ! g ! Inanimate ! cas + } ; + pron=False ; + a=Ag (gennum g (numSizeNumber det.size)) P3 + } ; + + -- : Det -> NP ; + UseDAPMasc det = + let g = Masc in { + s=case det.type of { + EmptyIndef => \\cas => a_Det.s ! g ! Inanimate ! cas ++ det.s ! g ! Inanimate ! cas ; + EmptyDef => \\cas => the_Det.s ! g ! Inanimate ! cas ++ det.s ! g ! Inanimate ! cas ; + _ => \\cas => det.s ! g ! Inanimate ! cas + } ; + pron=False ; + a=Ag (gennum g (numSizeNumber det.size)) P3 + } ; + oper rus_quoted : Str -> Str = \s -> "«" ++ s ++ "»" ; ---- TODO bind ; move to Prelude? From fa8cef4112f547df25b55db1ccd63ea629f50a83 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 25 Oct 2023 09:41:26 +0200 Subject: [PATCH 108/129] added prepositions in the functions for rendering dates --- src/spanish/ConstructionSpa.gf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/spanish/ConstructionSpa.gf b/src/spanish/ConstructionSpa.gf index d6e0f66f..f49755d6 100644 --- a/src/spanish/ConstructionSpa.gf +++ b/src/spanish/ConstructionSpa.gf @@ -66,11 +66,11 @@ lin weekdayLastAdv w = SyntaxSpa.mkAdv noPrep (mkNP the_Det (mkCN (mkA "pasado") w)) ; -- il lunedí scorso weekdayNextAdv w = SyntaxSpa.mkAdv noPrep (mkNP the_Det (mkCN (mkA "próximo") w)) ; -- il lunedí prossimo - monthAdv m = lin Adv {s = "en" ++ m.s ! C.Sg} ; -- in mggio + monthAdv m = lin Adv {s = "en" ++ m.s ! C.Sg} ; -- en mayo yearAdv y = SyntaxSpa.mkAdv (mkPrep "en") y ; ---- - dayMonthAdv d m = ParadigmsSpa.mkAdv ("el" ++ (d.s ! R.Nom).comp ++ m.s ! C.Sg) ; -- le 17 mai - monthYearAdv m y = lin Adv {s = "en" ++ m.s ! C.Sg ++ (y.s ! R.Nom).comp} ; -- in maggio 2012 - dayMonthYearAdv d m y = ParadigmsSpa.mkAdv ("el" ++ (d.s ! R.Nom).comp ++ m.s ! C.Sg ++ (y.s ! R.Nom).comp) ; -- il 17 maggio 2013 + dayMonthAdv d m = ParadigmsSpa.mkAdv ("el" ++ (d.s ! R.Nom).comp ++ "de" ++ m.s ! C.Sg) ; -- el 17 de mayo + monthYearAdv m y = lin Adv {s = "en" ++ m.s ! C.Sg ++ "de" ++ (y.s ! R.Nom).comp} ; -- en mayo de 2012 + dayMonthYearAdv d m y = ParadigmsSpa.mkAdv ("el" ++ (d.s ! R.Nom).comp ++ "de" ++ m.s ! C.Sg ++ "de" ++ (y.s ! R.Nom).comp) ; -- el 17 de mayo de 2013 intYear = symb ; intMonthday = symb ; From 01e51655374040dee8be525276be31e719c553fc Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 25 Oct 2023 11:19:00 +0200 Subject: [PATCH 109/129] make CompoundN more flexible --- src/catalan/LexiconCat.gf | 2 +- src/catalan/ParadigmsCat.gf | 12 ++++++------ src/french/ExtendFre.gf | 11 ++++++++++- src/french/ParadigmsFre.gf | 6 +++--- src/italian/ParadigmsIta.gf | 12 ++++++------ src/portuguese/ExtendPor.gf | 12 ++++++++---- src/portuguese/ParadigmsPor.gf | 4 ++-- src/romance/CatRomance.gf | 6 +++--- src/romance/DiffRomance.gf | 2 ++ src/romance/ExtendRomanceFunctor.gf | 13 +++++++++++-- src/romance/NounRomance.gf | 2 ++ src/spanish/ExtendSpa.gf | 12 ++++++++---- src/spanish/ParadigmsSpa.gf | 12 ++++++------ 13 files changed, 68 insertions(+), 38 deletions(-) diff --git a/src/catalan/LexiconCat.gf b/src/catalan/LexiconCat.gf index bbdc4a3c..d681c231 100644 --- a/src/catalan/LexiconCat.gf +++ b/src/catalan/LexiconCat.gf @@ -10,7 +10,7 @@ flags oper regFN : Str -> N = \s -> femN (regN s) ; regMN : Str -> N = \s -> regN s ; - irregMN : Str -> Str -> N = \pa,pans -> M.mkNounIrreg pa pans masculine ** {lock_N=<>} ; + irregMN : Str -> Str -> N = \pa,pans -> M.mkNounIrreg pa pans masculine ** {relType=D.NRelPrep D.P_de; lock_N=<>} ; saberV : V = verbV (saber_99 "saber") ; lin diff --git a/src/catalan/ParadigmsCat.gf b/src/catalan/ParadigmsCat.gf index c60a4f27..62713fd7 100644 --- a/src/catalan/ParadigmsCat.gf +++ b/src/catalan/ParadigmsCat.gf @@ -348,11 +348,11 @@ oper mkPrep p = {s = p ; c = Acc ; isDir = False ; lock_Prep = <>} ; - mk2N x y g = mkNounIrreg x y g ** {lock_N = <>} ; - regN x = mkNomReg x ** {lock_N = <>} ; - compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ; - femN x = {s = x.s ; g = feminine ; lock_N = <>} ; - mascN x = {s = x.s ; g = masculine ; lock_N = <>} ; + mk2N x y g = mkNounIrreg x y g ** {relType = NRelPrep P_de; lock_N = <>} ; + regN x = mkNomReg x ** {relType = NRelPrep P_de; lock_N = <>} ; + compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; relType = x.relType ; lock_N = <>} ; + femN x = x ** {g = feminine} ; + mascN x = x ** {g = masculine} ; mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ; deN2 n = mkN2 n genitive ; @@ -525,7 +525,7 @@ oper mkN = overload { mkN : (llum : Str) -> N = regN ; - mkN : Str -> Gender -> N = \s,g -> {s = (regN s).s ; g = g ; lock_N = <>}; + mkN : Str -> Gender -> N = \s,g -> (regN s) ** {g = g}; mkN : (disc,discos : Str) -> Gender -> N = mk2N } ; regN : Str -> N ; diff --git a/src/french/ExtendFre.gf b/src/french/ExtendFre.gf index 61ea2f9d..a77fead5 100644 --- a/src/french/ExtendFre.gf +++ b/src/french/ExtendFre.gf @@ -59,7 +59,16 @@ lin ApposNP np1 np2 = np1 ** { -- guessed by KA } ; } ; -lin CompoundN a b = lin N {s = \\n => b.s ! n ++ a.s ! Sg ; g = b.g} ; -- connessione internet = internet connection +lin CompoundN a b = lin N { + s = \\n => b.s ! n ++ + case b.relType of { + NRelPrep p => prepCase (CPrep p) ; -- tasa de suicidio + NRelNoPrep => [] -- connessione internet = internet connection + } ++ + a.s ! Sg ; + g = b.g ; + relType = b.relType + } ; lin UseDAP = \dap -> let diff --git a/src/french/ParadigmsFre.gf b/src/french/ParadigmsFre.gf index 6aceb83d..8310ac1d 100644 --- a/src/french/ParadigmsFre.gf +++ b/src/french/ParadigmsFre.gf @@ -393,16 +393,16 @@ oper regGenN : Str -> Gender -> N ; regN : Str -> N ; mk2N : (oeil,yeux : Str) -> Gender -> N ; - mk2N x y g = mkCNomIrreg x y g ** {lock_N = <>} ; + mk2N x y g = mkCNomIrreg x y g ** {relType = NRelPrep P_de; lock_N = <>} ; regN x = regGenN x g where { g = case of { _ + ("e" | "ion") => Fem ; _ => Masc } } ; - regGenN x g = mkNomReg x g ** {lock_N = <>} ; + regGenN x g = mkNomReg x g ** {relType = NRelPrep P_de; lock_N = <>} ; compN : N -> Str -> N ; - compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ; + compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; relType = NRelPrep P_de ; lock_N = <>} ; mkN = overload { mkN : Str -> N = regN ; diff --git a/src/italian/ParadigmsIta.gf b/src/italian/ParadigmsIta.gf index 22647496..36165db9 100644 --- a/src/italian/ParadigmsIta.gf +++ b/src/italian/ParadigmsIta.gf @@ -378,11 +378,11 @@ oper in_Prep = {s = [] ; c = CPrep P_in ; isDir = False ; lock_Prep = <>} ; su_Prep = {s = [] ; c = CPrep P_su ; isDir = False ; lock_Prep = <>} ; - mk2N x y g = mkNounIrreg x y g ** {lock_N = <>} ; - regN x = mkNomReg x ** {lock_N = <>} ; - compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ; - femN x = {s = x.s ; g = feminine ; lock_N = <>} ; - mascN x = {s = x.s ; g = masculine ; lock_N = <>} ; + mk2N x y g = mkNounIrreg x y g ** {relType=NRelPrep P_da; lock_N = <>} ; + regN x = mkNomReg x ** {relType=NRelPrep P_da; lock_N = <>} ; + compN x y = x ** {s = \\n => x.s ! n ++ y} ; + femN x = {s = x.s ; g = feminine ; relType=NRelPrep P_da; lock_N = <>} ; + mascN x = {s = x.s ; g = masculine ; relType=NRelPrep P_da; lock_N = <>} ; mk2N2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ; @@ -518,7 +518,7 @@ oper mkN = overload { mkN : (cane : Str) -> N = regN ; - mkN : (carne : Str) -> Gender -> N = \n,g -> {s = (regN n).s ; g = g ; lock_N = <>} ; + mkN : (carne : Str) -> Gender -> N = \n,g -> (regN n) ** {g = g} ; mkN : (uomo,uomini : Str) -> Gender -> N = mk2N ; mkN : N -> Str -> N = compN } ; diff --git a/src/portuguese/ExtendPor.gf b/src/portuguese/ExtendPor.gf index c91b169a..50a696e6 100644 --- a/src/portuguese/ExtendPor.gf +++ b/src/portuguese/ExtendPor.gf @@ -67,10 +67,14 @@ concrete ExtendPor of Extend = CatPor ** ExtendRomanceFunctor - lin CompoundN noun noun2 = { -- order is different because that's needed for correct translation from english - s = \\n => noun2.s ! n - ++ variants {"de" ; genForms "do" "da" ! noun.g} - ++ noun.s ! Sg ; - g = noun2.g + s = \\n => noun2.s ! n ++ + case noun2.relType of { + NRelPrep p => artDef True noun.g Sg (CPrep p) ; -- tasa de suicidio + NRelNoPrep => [] -- connessione internet = internet connection + } ++ + noun.s ! Sg ; + g = noun2.g ; + relType = noun2.relType } ; CompoundAP noun adj = { diff --git a/src/portuguese/ParadigmsPor.gf b/src/portuguese/ParadigmsPor.gf index d62697fd..fe1fbd93 100644 --- a/src/portuguese/ParadigmsPor.gf +++ b/src/portuguese/ParadigmsPor.gf @@ -102,7 +102,7 @@ oper --2 Nouns regN : Str -> N ; --% - regN x = lin N (mkNomReg x) ; + regN x = lin N (mkNomReg x ** {relType=NRelPrep P_de}) ; femN : N -> N ; --% femN n = n ** {g = feminine} ; @@ -111,7 +111,7 @@ oper mascN n = n ** {g = masculine} ; mk2N : (bastão, bastões : Str) -> Gender -> N ; --% - mk2N x y g = lin N (mkNounIrreg x y g) ; + mk2N x y g = lin N (mkNounIrreg x y g ** {relType=NRelPrep P_de}) ; -- The regular function takes the singular form and the gender, and -- computes the plural and the gender by a heuristic (see MorphoPor diff --git a/src/romance/CatRomance.gf b/src/romance/CatRomance.gf index 4fe38778..4426fca5 100644 --- a/src/romance/CatRomance.gf +++ b/src/romance/CatRomance.gf @@ -110,9 +110,9 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol,MU] A = {s : AForm => Str ; compar : ComparAgr => Str ; isPre : Bool ; copTyp : CopulaType ; isDeg : Bool} ; A2 = {s : AForm => Str ; compar : ComparAgr => Str ; c2 : Compl ; copTyp : CopulaType ; isDeg : Bool} ; - N = Noun ; - N2 = Noun ** {c2 : Compl} ; - N3 = Noun ** {c2,c3 : Compl} ; + N = Noun ** {relType : NRelType}; + N2 = Noun ** {relType : NRelType; c2 : Compl} ; + N3 = Noun ** {relType : NRelType; c2,c3 : Compl} ; GN, PN = {s : Str ; g : Gender} ; SN = {s : Gender => Str ; pl : Str} ; LN = {s : Str; diff --git a/src/romance/DiffRomance.gf b/src/romance/DiffRomance.gf index acb5237d..105fe90b 100644 --- a/src/romance/DiffRomance.gf +++ b/src/romance/DiffRomance.gf @@ -140,6 +140,8 @@ interface DiffRomance = open CommonRomance, Prelude in { param Case = Nom | Acc | CPrep Prepos ; + NRelType = NRelPrep Prepos | NRelNoPrep ; -- How do build a compound noun + oper Verb = {s : VF => Str ; vtyp : VType ; p : Str} ; diff --git a/src/romance/ExtendRomanceFunctor.gf b/src/romance/ExtendRomanceFunctor.gf index 8e752710..cc68dbbc 100644 --- a/src/romance/ExtendRomanceFunctor.gf +++ b/src/romance/ExtendRomanceFunctor.gf @@ -127,7 +127,7 @@ incomplete concrete ExtendRomanceFunctor of Extend = ExistPluralCN cn = ExistNP (DetCN (DetQuant IndefArt NumPl) cn) ; AdvIsNP adv np = mkClause adv.s False False np.a (UseComp_estar (CompNP np)) ; AdvIsNPAP adv np ap = -- está - let emptyN : N = lin N {s = \\_ => [] ; g = np.a.g} ; -- To match the gender of the N + let emptyN : N = lin N {s = \\_ => [] ; relType = NRelNoPrep ; g = np.a.g} ; -- To match the gender of the N indef : Quant = IndefArt ** {s = \\b,n,g,c => []} ; det : Det = case np.a.n of {Sg => DetQuant indef NumSg ; Pl => DetQuant indef NumPl} ; apAsNP : NP = DetCN det (AdjCN ap (UseN emptyN)) ; -- NP where the string comes only from AP @@ -166,7 +166,16 @@ incomplete concrete ExtendRomanceFunctor of Extend = ComplGenVV = variants {} ; -- VV -> Ant -> Pol -> VP -> VP ; -- want not to have slept ComplSlashPartLast = ComplSlash ; - CompoundN a b = lin N {s = \\n => b.s ! n ++ a.s ! Sg ; g = b.g} ; -- connessione internet = internet connection + CompoundN a b = lin N { + s = \\n => b.s ! n ++ + case b.relType of { + NRelPrep p => prepCase (CPrep p) ; -- tasa de suicidio + NRelNoPrep => [] -- connessione internet = internet connection + } ++ + a.s ! Sg ; + g = b.g ; + relType = b.relType + } ; CompoundAP = variants {} ; -- N -> A -> AP ; -- language independent / language-independent lin diff --git a/src/romance/NounRomance.gf b/src/romance/NounRomance.gf index 0fe65659..c9586cbf 100644 --- a/src/romance/NounRomance.gf +++ b/src/romance/NounRomance.gf @@ -158,11 +158,13 @@ incomplete concrete NounRomance of Noun = ComplN2 f x = { s = \\n => f.s ! n ++ appCompl f.c2 x ; g = f.g ; + relType = f.relType } ; ComplN3 f x = { s = \\n => f.s ! n ++ appCompl f.c2 x ; g = f.g ; + relType = f.relType ; c2 = f.c3 } ; diff --git a/src/spanish/ExtendSpa.gf b/src/spanish/ExtendSpa.gf index c853586b..dd8bdd95 100644 --- a/src/spanish/ExtendSpa.gf +++ b/src/spanish/ExtendSpa.gf @@ -73,10 +73,14 @@ concrete ExtendSpa of Extend = CatSpa ** ExtendRomanceFunctor - (predV (mkV "existir"))) ; CompoundN noun noun2 = { -- order is different because that's needed for correct translation from english - s = \\n => noun2.s ! n - ++ variants {"de" ; genForms "del" "de la" ! noun.g} - ++ noun.s ! Sg ; - g = noun2.g + s = \\n => noun2.s ! n ++ + case noun2.relType of { + NRelPrep p => prepCase (CPrep p) ; -- tasa de suicidio + NRelNoPrep => [] -- connessione internet = internet connection + } ++ + noun.s ! Sg ; + g = noun2.g ; + relType = noun2.relType } ; CompoundAP noun adj = { diff --git a/src/spanish/ParadigmsSpa.gf b/src/spanish/ParadigmsSpa.gf index 89c7f0f6..d2ac452d 100644 --- a/src/spanish/ParadigmsSpa.gf +++ b/src/spanish/ParadigmsSpa.gf @@ -380,11 +380,11 @@ oper } ; - mk2N x y g = mkNounIrreg x y g ** {lock_N = <>} ; - regN x = mkNomReg x ** {lock_N = <>} ; - compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ; - femN x = {s = x.s ; g = feminine ; lock_N = <>} ; - mascN x = {s = x.s ; g = masculine ; lock_N = <>} ; + mk2N x y g = mkNounIrreg x y g ** {relType=NRelPrep P_de; lock_N = <>} ; + regN x = mkNomReg x ** {relType=NRelPrep P_de; lock_N = <>} ; + compN x y = x ** {s = \\n => x.s ! n ++ y} ; + femN x = {s = x.s ; g = feminine ; relType=NRelPrep P_de; lock_N = <>} ; + mascN x = {s = x.s ; g = masculine ; relType=NRelPrep P_de; lock_N = <>} ; mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ; deN2 n = mkN2 n genitive ; @@ -550,7 +550,7 @@ oper mkN = overload { mkN : (luz : Str) -> N = regN ; - mkN : Str -> Gender -> N = \s,g -> {s = (regN s).s ; g = g ; lock_N = <>}; + mkN : Str -> Gender -> N = \s,g -> (regN s) ** {g = g}; mkN : (baston,bastones : Str) -> Gender -> N = mk2N ; mkN : N -> Str -> N = compN ; } ; From e3fd978f42d0d03fe4c5966dc6efe6d4c641e6aa Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Thu, 2 Nov 2023 17:09:09 +0100 Subject: [PATCH 110/129] show comparative forms when existing --- src/spanish/DocumentationSpaFunctor.gf | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/spanish/DocumentationSpaFunctor.gf b/src/spanish/DocumentationSpaFunctor.gf index a23477ea..1c3a3e33 100644 --- a/src/spanish/DocumentationSpaFunctor.gf +++ b/src/spanish/DocumentationSpaFunctor.gf @@ -83,7 +83,15 @@ lin tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++ tr (th (heading masculine_Parameter) ++ td (adj.s ! genNum2Aform Masc Sg) ++ td (adj.s ! genNum2Aform Masc Pl)) ++ tr (th (heading feminine_Parameter) ++ td (adj.s ! genNum2Aform Fem Sg) ++ td (adj.s ! genNum2Aform Fem Pl)) - ) + ) ++ + case adj.isDeg of { + True => heading2 (heading comparative_Parameter) ++ + frameTable ( + tr (th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++ + tr (td (adj.s ! genNum2Aform Masc Sg) ++ td (adj.s ! genNum2Aform Masc Pl)) + ) ; + False=> [] + } } ; InflectionAdv, InflectionAdV, InflectionAdA, InflectionAdN = \adv -> { From 2d03a58d565d9c4a0d7d4c9d80193a2ae16de09c Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Thu, 2 Nov 2023 17:12:55 +0100 Subject: [PATCH 111/129] show the correct forms --- src/spanish/DocumentationSpaFunctor.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spanish/DocumentationSpaFunctor.gf b/src/spanish/DocumentationSpaFunctor.gf index 1c3a3e33..a0b04c0a 100644 --- a/src/spanish/DocumentationSpaFunctor.gf +++ b/src/spanish/DocumentationSpaFunctor.gf @@ -88,7 +88,7 @@ lin True => heading2 (heading comparative_Parameter) ++ frameTable ( tr (th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++ - tr (td (adj.s ! genNum2Aform Masc Sg) ++ td (adj.s ! genNum2Aform Masc Pl)) + tr (td (adj.compar ! Sg) ++ td (adj.compar ! Pl)) ) ; False=> [] } From 2a345b0afc37922634efd91f3b26cf720283e2e1 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Fri, 3 Nov 2023 06:55:37 +0100 Subject: [PATCH 112/129] fix bad_A --- src/portuguese/LexiconPor.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/portuguese/LexiconPor.gf b/src/portuguese/LexiconPor.gf index 63bce8dc..b2de26eb 100644 --- a/src/portuguese/LexiconPor.gf +++ b/src/portuguese/LexiconPor.gf @@ -13,7 +13,7 @@ lin probable_AS = mkAS (prefixA (mkA "provável")) ; fun_AV = mkAV (mkA "divertido") genitive ; -- A - bad_A = prefixA (mkA (mkA "mau") (mkA "pior")) ; + bad_A = prefixA (mkA (mkA "mau" "má" "maus" "más") (mkA "pior")) ; beautiful_A = prefixA (mkA "belo") ; -- bela big_A = prefixA (mkA "grande") ; black_A = mkA "preto" ; -- preta From 14825b5617e3f754724f03c91138c6a0e9582fc3 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sat, 4 Nov 2023 15:03:44 +0100 Subject: [PATCH 113/129] add ReflRNP and ReflPron --- src/romance/ExtendRomanceFunctor.gf | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/romance/ExtendRomanceFunctor.gf b/src/romance/ExtendRomanceFunctor.gf index cc68dbbc..25778070 100644 --- a/src/romance/ExtendRomanceFunctor.gf +++ b/src/romance/ExtendRomanceFunctor.gf @@ -2,8 +2,7 @@ incomplete concrete ExtendRomanceFunctor of Extend = Cat ** open Grammar, ResRomance in { lincat - RNP = Grammar.NP ; - RNPList = Grammar.ListNP ; + RNP = {s : Agr => Case => Str} ; ---- these come from ExtraRomance: how to avoid the repetition? ---- can't seem to be able to use two functors @@ -153,8 +152,17 @@ incomplete concrete ExtendRomanceFunctor of Extend = } ; lin - ReflRNP = variants {} ; -- VPSlash -> RNP -> VP ; -- love my family and myself - ReflPron = variants {} ; -- RNP ; -- myself + ReflRNP v rnp = -- VPSlash -> RNP -> VP ; -- love my family and myself + case v.c2.isDir of { + True => insertRefl v ; + False => insertComplement + (\\a => let agr = verbAgr a in v.c2.s ++ rnp.s ! agr ! v.c2.c) v + } ; + + ReflPron = { -- RNP ; -- myself + s = \\agr,c => reflPron agr.n agr.p c + } ; + ReflPoss = variants {} ; -- Num -> CN -> RNP ; -- my car(s) PredetRNP = variants {} ; -- Predet -> RNP -> RNP ; -- all my brothers ConjRNP = variants {} ; -- Conj -> RNPList -> RNP ; -- my family, John and myself From e97205e04d0ed03a34b67d4f9e2af82cfb694d8d Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sat, 4 Nov 2023 15:04:15 +0100 Subject: [PATCH 114/129] fix the word order for superlatives --- src/catalan/CompatibilityCat.gf | 2 +- src/catalan/DiffCat.gf | 3 ++ src/catalan/StructuralCat.gf | 12 ++++---- src/french/CompatibilityFre.gf | 2 +- src/french/DiffFre.gf | 3 ++ src/french/ExtraFre.gf | 2 +- src/french/MakeStructuralFre.gf | 4 +-- src/french/StructuralFre.gf | 12 ++++---- src/italian/CompatibilityIta.gf | 2 +- src/italian/DiffIta.gf | 3 ++ src/italian/MakeStructuralIta.gf | 4 +-- src/italian/StructuralIta.gf | 12 ++++---- src/portuguese/CompatibilityPor.gf | 2 +- src/portuguese/DiffPor.gf | 3 ++ src/portuguese/MorphoPor.gf | 3 +- src/romance/CatRomance.gf | 7 +++-- src/romance/DiffRomance.gf | 5 +++- src/romance/NounRomance.gf | 47 ++++++++++++++++++++---------- src/romance/SymbolRomance.gf | 2 +- src/spanish/CompatibilitySpa.gf | 2 +- src/spanish/DiffSpa.gf | 3 ++ src/spanish/MakeStructuralSpa.gf | 4 +-- src/spanish/MorphoSpa.gf | 3 +- 23 files changed, 91 insertions(+), 51 deletions(-) diff --git a/src/catalan/CompatibilityCat.gf b/src/catalan/CompatibilityCat.gf index bfadae52..71d41751 100644 --- a/src/catalan/CompatibilityCat.gf +++ b/src/catalan/CompatibilityCat.gf @@ -6,6 +6,6 @@ concrete CompatibilityCat of Compatibility = CatCat ** open Prelude, CommonRoman lin NumInt n = {s = \\_ => n.s ; isNum = True ; n = Pl} ; - OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "."} ; --- + OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "." ; s2 = \\_ => []} ; --- } diff --git a/src/catalan/DiffCat.gf b/src/catalan/DiffCat.gf index f4e7c1e8..a43c5d70 100644 --- a/src/catalan/DiffCat.gf +++ b/src/catalan/DiffCat.gf @@ -228,4 +228,7 @@ oper param HasArt = NoArt | UseArt ; +oper + superlCanBePost = False ; + } diff --git a/src/catalan/StructuralCat.gf b/src/catalan/StructuralCat.gf index 65ae557b..a66a8a41 100644 --- a/src/catalan/StructuralCat.gf +++ b/src/catalan/StructuralCat.gf @@ -33,13 +33,13 @@ lin every_Det = { s,sp = \\_,_ => "cada"; spn =\\c => prepCase c ++ "tot" ; - n = Sg ; s2 = [] ; isNeg = False} ; + n = Sg ; s2 = \\g => [] ; isNeg = False} ; everything_NP = pn2np (mkPN "tot" Masc) ; everywhere_Adv = ss ["a tot arreu"] ; few_Det = { s,sp = \\g,c => prepCase c ++ genForms "pocs" "poques" ! g ; spn = \\c => prepCase c ++ "pocs" ; - n = Pl ; s2 = [] ; isNeg = False} ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; --- first_Ord = {s = \\ag => (regA "primer").s ! Posit ! AF ag.g ag.n} ; for_Prep = mkPrep ["per a"] ; from_Prep = complGen ; --- @@ -71,14 +71,14 @@ lin many_Det = { s,sp = \\g,c => prepCase c ++ genForms "molts" "moltes" ! g ; spn = \\c => prepCase c ++ "molts" ; - n = Pl ; s2 = [] ; isNeg = False} ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; more_CAdv = X.mkCAdv "més" conjThan ; most_Predet = {s = \\_,c => prepCase c ++ ["la majoria"] ; c = CPrep P_de ; a = PNoAg} ; much_Det = { s,sp = \\g,c => prepCase c ++ genForms "molt" "molta" ! g ; spn = \\c => prepCase c ++ "molt" ; - n = Sg ; s2 = [] ; isNeg = False} ; + n = Sg ; s2 = \\g => [] ; isNeg = False} ; must_VV = deVV (verbV (haver_59 "haver" True)) ; no_Utt = ss "no" ; on_Prep = mkPrep "sobre" ; @@ -101,11 +101,11 @@ lin somePl_Det = { s,sp = \\g,c => prepCase c ++ genForms "alguns" "algunes" ! g ; spn = \\c => prepCase c ++ "alguns" ; - n = Pl ; s2 = [] ; isNeg = False} ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; someSg_Det = { s,sp = \\g,c => prepCase c ++ genForms "algun" "alguna" ! g ; spn = \\c => prepCase c ++ "quelcom" ; - n = Sg ; s2 = [] ; isNeg = False} ; + n = Sg ; s2 = \\g => [] ; isNeg = False} ; something_NP = pn2np (mkPN ["quelcom"] Masc) ; somewhere_Adv = ss ["a algun lloc"] ; that_Quant = diff --git a/src/french/CompatibilityFre.gf b/src/french/CompatibilityFre.gf index 9d3dff90..b1b90524 100644 --- a/src/french/CompatibilityFre.gf +++ b/src/french/CompatibilityFre.gf @@ -6,6 +6,6 @@ concrete CompatibilityFre of Compatibility = CatFre ** open Prelude, CommonRoman lin NumInt n = {s = \\_ => n.s ; isNum = True ; n = Pl} ; - OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "."} ; --- + OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "." ; s2 = \\_ => []} ; --- } diff --git a/src/french/DiffFre.gf b/src/french/DiffFre.gf index 303bb731..d65ede46 100644 --- a/src/french/DiffFre.gf +++ b/src/french/DiffFre.gf @@ -341,4 +341,7 @@ instance DiffFre of DiffRomance - [ param HasArt = NoArt | UseArt | AlwaysArt ; +oper + superlCanBePost = False ; + } ; diff --git a/src/french/ExtraFre.gf b/src/french/ExtraFre.gf index 8be0ae77..d249ce8b 100644 --- a/src/french/ExtraFre.gf +++ b/src/french/ExtraFre.gf @@ -77,7 +77,7 @@ concrete ExtraFre of ExtraFreAbs = ExtraRomanceFre ** s,sp = \\g,c => prepCase c ++ genForms "tout" "toute" ! g ; spn= \\c => prepCase c ++ "tout" ; n = Sg ; - s2 = [] ; + s2 = \\c => [] ; isNeg = False } ; diff --git a/src/french/MakeStructuralFre.gf b/src/french/MakeStructuralFre.gf index c7285f90..037d2c20 100644 --- a/src/french/MakeStructuralFre.gf +++ b/src/french/MakeStructuralFre.gf @@ -42,12 +42,12 @@ oper mkDet : Str -> Det = \s -> lin Det { s,sp = \\_,c => prepCase c ++ s ; spn = \\c => prepCase c ++ s ; - n = Sg ; s2 = [] ; isNeg = False + n = Sg ; s2 = \\g => [] ; isNeg = False } ; mkDet : Str -> Str -> Number -> Det = \m,f,n -> lin Det { s,sp = \\g,c => prepCase c ++ case g of {Masc => m ; Fem => f} ; spn = \\c => prepCase c ++ m ; - n = n ; s2 = [] ; isNeg = False + n = n ; s2 = \\g => [] ; isNeg = False } ; } ; diff --git a/src/french/StructuralFre.gf b/src/french/StructuralFre.gf index 0a9028e3..6df71d8f 100644 --- a/src/french/StructuralFre.gf +++ b/src/french/StructuralFre.gf @@ -38,7 +38,7 @@ lin sp = \\g,c => prepCase c ++ genForms "chacun" "chacune" ! g ; spn= \\c => prepCase c ++ "tout" ; n = Sg ; - s2 = [] ; + s2 = \\g => [] ; isNeg = False } ; everything_NP = pn2np (mkPN ["tout"] Masc) ; @@ -46,7 +46,7 @@ lin few_Det = { s,sp = \\g,c => prepCase c ++ "peu" ++ elisDe ; spn = \\c => prepCase c ++ "peu" ++ elisDe ; - n = Pl ; s2 = [] ; isNeg = False} ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; --- DEPREC first_Ord = {s = \\ag => (regA "premier").s ! Posit ! AF ag.g ag.n} ; for_Prep = mkPreposition "pour" ; from_Prep = complGen ; --- @@ -75,12 +75,12 @@ lin many_Det = { s,sp = \\_,c => prepCase c ++ "plusieurs" ; spn = \\c => prepCase c ++ "plusieurs" ; - n = Pl ; s2 = [] ; isNeg = False} ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; more_CAdv = X.mkCAdv "plus" conjThan ; most_Predet = {s = \\_,c => prepCase c ++ ["la plupart"] ; c = CPrep P_de ; a = PNoAg} ; much_Det = {s,sp = \\_,c => prepCase c ++ "beaucoup" ++ elisDe ; spn = \\c => prepCase c ++ "beaucoup" ++ elisDe ; - n = Pl ; s2 = [] ; isNeg = False} ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; must_VV = mkVV (devoir_V2 ** {lock_V = <>}) ; ---b no_Phr = ss "non" ; no_Utt = ss "non" ; @@ -103,11 +103,11 @@ lin somePl_Det = { s,sp = \\_,c => prepCase c ++ "quelques" ; spn = \\c => prepCase c ++ "quelque chose" ; - n = Pl ; s2 = [] ; isNeg = False} ; ---- sp + n = Pl ; s2 = \\g => [] ; isNeg = False} ; ---- sp someSg_Det = { s,sp = \\_,c => prepCase c ++ "quelque" ; spn = \\c => prepCase c ++ "quelque chose" ; - n = Sg ; s2 = [] ; isNeg = False} ; ----sp + n = Sg ; s2 = \\g => [] ; isNeg = False} ; ----sp something_NP = pn2np (mkPN ["quelque chose"] Masc) ; somewhere_Adv = ss ["quelque part"] ; --- ne - pas diff --git a/src/italian/CompatibilityIta.gf b/src/italian/CompatibilityIta.gf index 99714e3e..31d6dc70 100644 --- a/src/italian/CompatibilityIta.gf +++ b/src/italian/CompatibilityIta.gf @@ -6,6 +6,6 @@ concrete CompatibilityIta of Compatibility = CatIta ** open Prelude, CommonRoman lin NumInt n = {s = \\_ => n.s ; isNum = True ; n = Pl} ; - OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "."} ; --- + OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "." ; s2 = \\_ => []} ; --- } diff --git a/src/italian/DiffIta.gf b/src/italian/DiffIta.gf index 215bd6c5..2adb90d0 100644 --- a/src/italian/DiffIta.gf +++ b/src/italian/DiffIta.gf @@ -254,4 +254,7 @@ instance DiffIta of DiffRomance - [contractInf] = open CommonRomance, PhonoIta, param HasArt = NoArt | UseArt ; +oper + superlCanBePost = True ; + } diff --git a/src/italian/MakeStructuralIta.gf b/src/italian/MakeStructuralIta.gf index 34a4d365..67600e67 100644 --- a/src/italian/MakeStructuralIta.gf +++ b/src/italian/MakeStructuralIta.gf @@ -66,7 +66,7 @@ oper s,sp = \\_,_ => piu ; spn = \\_ => piu ; n = n ; - s2 = [] ; + s2 = \\g => [] ; isNeg = False } ; -- Inflects for number @@ -77,7 +77,7 @@ oper } ; spn = \\_ => alcuni ; n = n ; - s2 = [] ; + s2 = \\g => [] ; isNeg = False } ; } ; diff --git a/src/italian/StructuralIta.gf b/src/italian/StructuralIta.gf index 4001dffe..39c2a6bd 100644 --- a/src/italian/StructuralIta.gf +++ b/src/italian/StructuralIta.gf @@ -34,13 +34,13 @@ lin every_Det = { s,sp = \\_,_ => "ogni" ; spn = \\c => prepCase c ++ "tutto" ; - n = Sg ; s2 = [] ; isNeg = False} ; + n = Sg ; s2 = \\g => [] ; isNeg = False} ; everything_NP = pn2np (mkPN ["tutto"] Masc) ; everywhere_Adv = ss "dappertutto" ; few_Det = { s,sp = \\g,c => prepCase c ++ genForms "pochi" "poche" ! g ; spn = \\c => prepCase c ++ "pochi" ; - n = Pl ; s2 = [] ; isNeg = False} ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; ---- first_Ord = {s = \\ag => (regA "primo").s ! Posit ! AF ag.g ag.n} ; for_Prep = mkPrep "per" ; from_Prep = da_Prep ; @@ -69,14 +69,14 @@ lin many_Det = { s,sp = \\g,c => prepCase c ++ genForms "molti" "molte" ! g ; spn = \\c => prepCase c ++ "molto" ; - n = Pl ; s2 = [] ; isNeg = False} ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; more_CAdv = X.mkCAdv "più" conjThan ; most_Predet = {s = \\_,c => prepCase c ++ ["la maggior parte"] ; c = CPrep P_di ; a = PNoAg} ; much_Det = { s,sp = \\g,c => prepCase c ++ genForms "molto" "molta" ! g ; spn = \\c => prepCase c ++ "molto" ; - n = Sg ; s2 = [] ; isNeg = False} ; + n = Sg ; s2 = \\g => [] ; isNeg = False} ; must_VV = mkVV (verboV (dovere_47 "dovere")) ; no_Utt = ss "no" ; on_Prep = {s = [] ; c = CPrep P_su ; isDir = False} ; @@ -98,11 +98,11 @@ lin somePl_Det = { s,sp = \\_,c => prepCase c ++ "qualche" ; spn = \\c => prepCase c ++ "qualche cosa" ; - n = Pl ; s2 = [] ; isNeg = False} ; + n = Pl ; s2 = \\g => [] ; isNeg = False} ; someSg_Det = { s,sp = \\_,c => prepCase c ++ "qualche" ; spn = \\c => prepCase c ++ "qualche cosa" ; - n = Sg ; s2 = [] ; isNeg = False} ; + n = Sg ; s2 = \\g => [] ; isNeg = False} ; something_NP = pn2np (mkPN ["qualche cosa"] Masc) ; somewhere_Adv = ss ["qualche parte"] ; that_Quant = let diff --git a/src/portuguese/CompatibilityPor.gf b/src/portuguese/CompatibilityPor.gf index a300fbef..d9bc7265 100644 --- a/src/portuguese/CompatibilityPor.gf +++ b/src/portuguese/CompatibilityPor.gf @@ -6,6 +6,6 @@ concrete CompatibilityPor of Compatibility = CatPor ** open Prelude, CommonRoman lin NumInt n = {s = \\_ => n.s ; isNum = True ; n = Pl} ; - OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "."} ; --- + OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "." ; s2 = \\_ => []} ; --- } diff --git a/src/portuguese/DiffPor.gf b/src/portuguese/DiffPor.gf index 1a7085eb..8290c7fe 100644 --- a/src/portuguese/DiffPor.gf +++ b/src/portuguese/DiffPor.gf @@ -294,4 +294,7 @@ instance DiffPor of DiffRomance - [iAdvQuestionInv,chooseTA,otherInv,partAgr,sta param HasArt = NoArt | UseArt ; +oper + superlCanBePost = False ; + } ; diff --git a/src/portuguese/MorphoPor.gf b/src/portuguese/MorphoPor.gf index 982f96b0..3ac90256 100644 --- a/src/portuguese/MorphoPor.gf +++ b/src/portuguese/MorphoPor.gf @@ -252,6 +252,7 @@ oper mkOrdinal : A -> Ord = \adj -> lin Ord { s = \\ag => adj.s ! genNum2Aform ag.g ag.n ; + s2 = \\_ => [] } ; mkQuantifier : (esse,essa,esses,essas,esso : Str) -> Quant = \esse,essa,esses,essas,esso-> @@ -273,7 +274,7 @@ oper s,sp = \\g,c => prepCase c ++ genForms muito muita ! g ; spn = \\c => prepCase c ++ muito ; n = number; - s2 = [] ; + s2 = \\g => [] ; isNeg = neg } ; diff --git a/src/romance/CatRomance.gf b/src/romance/CatRomance.gf index 4426fca5..dc56e066 100644 --- a/src/romance/CatRomance.gf +++ b/src/romance/CatRomance.gf @@ -65,7 +65,7 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol,MU] Det,DAP = { s : Gender => Case => Str ; n : Number ; - s2 : Str ; -- -ci + s2 : Gender => Str ; -- -ci sp : Gender => Case => Str ; -- substantival: mien, mienne spn: Case => Str ; isNeg : Bool -- negative element, e.g. aucun @@ -84,7 +84,7 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol,MU] } ; Num = {s : Gender => Str ; isNum : Bool ; n : Number} ; Card = {s : Gender => Str ; n : Number} ; - Ord = {s : AAgr => Str} ; + Ord = {s, s2 : AAgr => Str} ; -- Numeral @@ -146,6 +146,9 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol,MU] A = \a -> a.s ! genNum2Aform Masc Sg ; A2 = \a -> a.s ! genNum2Aform Masc Sg ++ a.c2.s ; + Det = \d -> d.s ! Masc ! Nom ++ d.s2 ! Masc ; + Ord = \o -> o.s ! aagr Masc Sg ++ o.s2 ! aagr Masc Sg ; + N = \n -> n.s ! Sg ; N2 = \n -> n.s ! Sg ++ n.c2.s ; N3 = \n -> n.s ! Sg ++ n.c2.s ++ n.c3.s ; diff --git a/src/romance/DiffRomance.gf b/src/romance/DiffRomance.gf index 105fe90b..d04d280f 100644 --- a/src/romance/DiffRomance.gf +++ b/src/romance/DiffRomance.gf @@ -64,7 +64,7 @@ interface DiffRomance = open CommonRomance, Prelude in { -- e.g. un bon amic (Cat), una gran parte (Spa) vs. predicative bo/bona, grande oper AForm : PType ; oper Adj : Type = {s : AForm => Str} ; - oper mkOrd : Adj -> {s : AAgr => Str} = \x -> {s = \\ag => x.s ! aagr2aform ag} ; + oper mkOrd : Adj -> {s,s2 : AAgr => Str} = \x -> {s = \\ag => x.s ! aagr2aform ag; s2 = \\_ => []} ; oper aform2aagr : AForm -> AAgr ; oper aform2gender : AForm -> Gender = \af -> (aform2aagr af).g ; @@ -221,5 +221,8 @@ oper stare_V = essere_V ; param HasArt ; + + oper + superlCanBePost : Bool ; } ; diff --git a/src/romance/NounRomance.gf b/src/romance/NounRomance.gf index c9586cbf..502753ba 100644 --- a/src/romance/NounRomance.gf +++ b/src/romance/NounRomance.gf @@ -9,7 +9,7 @@ incomplete concrete NounRomance of Noun = g = cn.g ; n = det.n in heavyNPpol det.isNeg { - s = \\c => det.s ! g ! c ++ cn.s ! n ++ det.s2 ; + s = \\c => det.s ! g ! c ++ cn.s ! n ++ det.s2 ! g ; a = agrP3 g n ; hasClit = False } ; @@ -53,11 +53,13 @@ incomplete concrete NounRomance of Noun = } ; DetQuantOrd quant num ord = { - s,sp = \\g,c => quant.s ! num.isNum ! num.n ! g ! c ++ num.s ! g ++ + s = \\g,c => quant.s ! num.isNum ! num.n ! g ! c ++ num.s ! g ++ ord.s ! aagr g num.n ; - spn = \\c => quant.s ! num.isNum ! num.n ! Masc ! c ++ num.s ! Masc ++ - ord.s ! aagr Masc num.n ; - s2 = quant.s2 ; + s2 = \\g => quant.s2 ++ ord.s2 ! aagr g num.n ; + sp = \\g,c => quant.s ! num.isNum ! num.n ! g ! c ++ num.s ! g ++ + ord.s ! aagr g num.n ++ ord.s2 ! aagr g num.n ; + spn = \\c => quant.s ! num.isNum ! num.n ! Masc ! c ++ num.s ! Masc ++ + ord.s ! aagr Masc num.n ++ ord.s2 ! aagr Masc num.n ; n = num.n ; isNeg = quant.isNeg } ; @@ -72,7 +74,7 @@ incomplete concrete NounRomance of Noun = True => quant.s ! True ! num.n ! Masc ! c ++ num.s ! Masc ; False => quant.spn ! c ++ num.s ! Masc } ; - s2 = quant.s2 ; + s2 = \\_ => quant.s2 ; n = num.n ; isNeg = quant.isNeg } ; @@ -101,25 +103,40 @@ incomplete concrete NounRomance of Noun = NumCard n = n ** {isNum = True} ; NumDigits nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; - OrdDigits nu = {s = \\a => nu.s ! NOrd a.g a.n} ; + OrdDigits nu = {s = \\a => nu.s ! NOrd a.g a.n ; s2 = \\_ => []} ; NumDecimal nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; NumNumeral nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; - OrdNumeral nu = {s = \\a => nu.s ! NOrd a.g a.n} ; + OrdNumeral nu = {s = \\a => nu.s ! NOrd a.g a.n ; s2 = \\_ => []} ; AdNum adn num = {s = \\a => adn.s ++ num.s ! a ; isNum = num.isNum ; n = num.n} ; - OrdSuperl adj = { - s = \\a => case adj.isDeg of { - True => adj.compar ! aagr2compar a ; - False => piuComp ++ adj.s ! genNum2Aform a.g a.n } + OrdSuperl adj = + case of { + => { s = \\a => adj.compar ! aagr2compar a ; + s2 = \\_ => [] + } ; + => { s = \\_ => [] ; + s2 = \\a => piuComp ++ adj.s ! genNum2Aform a.g a.n + } ; + => { s = \\a => piuComp ++ adj.s ! genNum2Aform a.g a.n ; + s2 = \\_ => [] + } } ; OrdNumeralSuperl num adj = - let ordSuperl : Ord = OrdSuperl adj - in {s = \\a => num.s ! NOrd a.g a.n ++ ordSuperl.s ! a} ; -- la terza più grande - ---- could be discontinuous: la terza città più grande + case of { + => { s = \\a => num.s ! NOrd a.g a.n ++ adj.compar ! aagr2compar a ; + s2 = \\_ => [] + } ; + => { s = \\a => num.s ! NOrd a.g a.n ; + s2 = \\a => piuComp ++ adj.s ! genNum2Aform a.g a.n + } ; + => { s = \\a => num.s ! NOrd a.g a.n ++ piuComp ++ adj.s ! genNum2Aform a.g a.n ; + s2 = \\_ => [] + } + } ; DefArt = { s = \\_,n,g,c => artDef False g n c ; diff --git a/src/romance/SymbolRomance.gf b/src/romance/SymbolRomance.gf index 8c56c624..ae1157ef 100644 --- a/src/romance/SymbolRomance.gf +++ b/src/romance/SymbolRomance.gf @@ -25,7 +25,7 @@ lin SymbS sy = {s = \\_ => sy.s} ; SymbNum n = {s = \\_ => n.s ; isNum = True ; n = Pl} ; - SymbOrd n = {s = \\_ => n.s ++ BIND ++ "º"} ; -- feminine variant ª, also variants 1.º and 1.ª + SymbOrd n = {s = \\_ => n.s ++ BIND ++ "º"; s2 = \\_ => []} ; -- feminine variant ª, also variants 1.º and 1.ª lincat diff --git a/src/spanish/CompatibilitySpa.gf b/src/spanish/CompatibilitySpa.gf index d736c363..eb2ba47d 100644 --- a/src/spanish/CompatibilitySpa.gf +++ b/src/spanish/CompatibilitySpa.gf @@ -6,6 +6,6 @@ concrete CompatibilitySpa of Compatibility = CatSpa ** open Prelude, CommonRoman lin NumInt n = {s = \\_ => n.s ; isNum = True ; n = Pl} ; - OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "."} ; --- + OrdInt n = {s = \\_ => n.s ++ SOFT_BIND ++ "." ; s2 = \\_ => []} ; --- } diff --git a/src/spanish/DiffSpa.gf b/src/spanish/DiffSpa.gf index d36d8232..b9756eb8 100644 --- a/src/spanish/DiffSpa.gf +++ b/src/spanish/DiffSpa.gf @@ -240,4 +240,7 @@ instance DiffSpa of DiffRomance - [iAdvQuestionInv,otherInv,partAgr,stare_V,vpAg param HasArt = NoArt | UseArt ; +oper + superlCanBePost = True ; + } diff --git a/src/spanish/MakeStructuralSpa.gf b/src/spanish/MakeStructuralSpa.gf index 42768b33..33e16f4d 100644 --- a/src/spanish/MakeStructuralSpa.gf +++ b/src/spanish/MakeStructuralSpa.gf @@ -60,7 +60,7 @@ oper s,sp = \\_,c => prepCase c ++ piu ; spn = \\c => prepCase c ++ piu ; n = n ; - s2 = [] ; + s2 = \\g => [] ; isNeg = False } ; -- Inflects for number @@ -68,7 +68,7 @@ oper s,sp = \\g,c => prepCase c ++ genForms alcuni alcune ! g ; spn = \\c => prepCase c ++ alcuni ; n = n ; - s2 = [] ; + s2 = \\g => [] ; isNeg = False } ; } ; diff --git a/src/spanish/MorphoSpa.gf b/src/spanish/MorphoSpa.gf index 28516ddb..aea78c10 100644 --- a/src/spanish/MorphoSpa.gf +++ b/src/spanish/MorphoSpa.gf @@ -237,6 +237,7 @@ oper mkOrdinal : A -> Ord = \adj-> lin Ord { s = \\ag => adj.s ! genNum2Aform ag.g ag.n ; + s2 = \\_ => [] } ; mkQuantifier : (ese,esa,esos,esas,eso : Str) -> Quant = \ese,esa,esos,esas,eso-> @@ -261,7 +262,7 @@ oper s,sp = \\g,c => prepCase c ++ genForms mucho mucha ! g ; spn = \\c => prepCase c ++ mucho ; n = number; - s2 = [] ; + s2 = \\c => [] ; isNeg = neg } ; From a4237dad7076f254c6dfa6c7dc15af8c26da781e Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sat, 4 Nov 2023 15:25:17 +0100 Subject: [PATCH 115/129] ReflRNP & ReflPron in French --- src/french/ExtendFre.gf | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/french/ExtendFre.gf b/src/french/ExtendFre.gf index a77fead5..bffb25e1 100644 --- a/src/french/ExtendFre.gf +++ b/src/french/ExtendFre.gf @@ -4,7 +4,7 @@ concrete ExtendFre of Extend = CatFre ** ExtendFunctor - [ ---- iFem_Pron, youFem_Pron, weFem_Pron, youPlFem_Pron, theyFem_Pron, youPolFem_Pron, youPolPl_Pron, youPolPlFem_Pron, - ExistCN, ExistMassCN, ExistPluralCN, + ExistCN, ExistMassCN, ExistPluralCN, RNP, ReflRNP, PassVPSlash, PassAgentVPSlash, ApposNP, CompoundN ] -- put the names of your own definitions here with @@ -19,6 +19,9 @@ concrete ExtendFre of Extend = ParadigmsFre in { -- put your own definitions here +lincat + RNP = {s : Agr => Case => Str} ; + lin ExistCN cn = let @@ -43,6 +46,17 @@ lin PassVPSlash vps = passVPSlash vps [] ; PassAgentVPSlash vps np = passVPSlash vps (let by = in by.s ++ (np.s ! by.c).ton) ; + ReflRNP v rnp = -- VPSlash -> RNP -> VP ; -- love my family and myself + case v.c2.isDir of { + True => insertRefl v ; + False => insertComplement + (\\a => let agr = verbAgr a in v.c2.s ++ rnp.s ! agr ! v.c2.c) v + } ; + + ReflPron = { -- RNP ; -- myself + s = \\agr,c => reflPron agr.n agr.p c + } ; + oper passVPSlash : VPSlash -> Str -> VP = \vps, agent -> let auxvp = predV auxPassive From bfad5839b8e49b9972684a51d844ff19987dc1bd Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sat, 4 Nov 2023 16:15:53 +0100 Subject: [PATCH 116/129] improved documentation --- src/russian/DocumentationRusFunctor.gf | 39 ++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/src/russian/DocumentationRusFunctor.gf b/src/russian/DocumentationRusFunctor.gf index 20a4272b..433eec51 100644 --- a/src/russian/DocumentationRusFunctor.gf +++ b/src/russian/DocumentationRusFunctor.gf @@ -27,13 +27,23 @@ oper lin InflectionN, InflectionN2, InflectionN3 = \noun -> { t = "сущ." ; - s1 = heading1 (heading noun_Category) ; + s1 = heading1 (heading noun_Category ++ + case noun.g of { + Masc => "(м.р.)" ; + Fem => "(ж.р.)" ; + Neut => "(ср.р.)" + }) ; s2 = inflNoun noun } ; InflectionPN = \pn -> { t = "сущ.с." ; - s1 = heading1 "Существительное Собственное" ; + s1 = heading1 ("Существительное Собственное" ++ + case pn.g of { + Masc => "(м.р.)" ; + Fem => "(ж.р.)" ; + Neut => "(ср.р.)" + }) ; s2 = frameTable ( tr (th (heading nominative_Parameter) ++ td (pn.snom)) ++ tr (th (heading genitive_Parameter) ++ td (pn.sgen)) ++ @@ -49,7 +59,10 @@ lin InflectionGN = \gn -> { t = "сущ.с." ; - s1 = heading1 "Личное Имя" ; + s1 = heading1 (case gn.g of { + Male => "Мужское Личное Имя" ; + Female => "Женское Личное Имя" + }); s2 = frameTable ( tr (th (heading nominative_Parameter) ++ td (gn.s ! Nom)) ++ tr (th (heading genitive_Parameter) ++ td (gn.s ! Gen)) ++ @@ -81,7 +94,12 @@ lin InflectionLN = \ln -> { t = "сущ.с." ; - s1 = heading1 "Название Местоположения" ; + s1 = heading1 ("Название Местоположения" ++ + case ln.g of { + Masc => "(м.р.)" ; + Fem => "(ж.р.)" ; + Neut => "(ср.р.)" + }) ; s2 = frameTable ( tr (th (heading nominative_Parameter) ++ td (ln.s ! Nom)) ++ tr (th (heading genitive_Parameter) ++ td (ln.s ! Gen)) ++ @@ -119,7 +137,18 @@ lin InflectionPrep p = { t = "пред" ; s1 = heading1 (heading preposition_Category) ; - s2 = paragraph ((S.mkAdv (lin Prep p) S.it_NP).s ++ ";" ++ (S.mkAdv (lin Prep p) S.we_NP).s) + s2 = paragraph (p.s ++ "+" ++ + case p.c of { + Nom => "именительный" ; + Gen => "родительный" ; + Dat => "дательный" ; + Acc => "винительный" ; + Ins => "творительный" ; + Pre => "предложный" ; + Ptv => "разделительный" ; + Loc => "местный" ; + VocRus=>"звательный" + }) } ; InflectionV v = { From 250f7ee82cc96127a552ad5bb9c3c2d310bbd516 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sat, 4 Nov 2023 16:45:22 +0100 Subject: [PATCH 117/129] a new paradigm for mkLN which adds an adjective --- src/russian/ParadigmsRus.gf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/russian/ParadigmsRus.gf b/src/russian/ParadigmsRus.gf index 1c014d2c..7197ac50 100644 --- a/src/russian/ParadigmsRus.gf +++ b/src/russian/ParadigmsRus.gf @@ -507,6 +507,10 @@ oper g = nf.g ; n = n } ; + mkLN : A -> LN -> LN + = \a, ln -> ln ** { + s = \\cas => (adjFormsAdjective a).s ! (gennum ln.g ln.n) ! ln.anim ! cas ++ ln.s ! cas + } ; } ; --------------------- From c22feb7878a08397c4e253be255e3248008a097b Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sat, 4 Nov 2023 16:48:13 +0100 Subject: [PATCH 118/129] remove the adverb from the documentation for LN --- src/russian/DocumentationRusFunctor.gf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/russian/DocumentationRusFunctor.gf b/src/russian/DocumentationRusFunctor.gf index 433eec51..083ad94f 100644 --- a/src/russian/DocumentationRusFunctor.gf +++ b/src/russian/DocumentationRusFunctor.gf @@ -110,9 +110,7 @@ lin tr (th (heading partitive_Parameter) ++ td (ln.s ! Ptv)) ++ tr (th ("местный") ++ td (ln.s ! Loc)) ++ tr (th ("звательный") ++ td (ln.s ! VocRus)) - ) ++ - heading2 (heading adverb_Category) ++ - paragraph "adv.s" + ) } ; InflectionA, InflectionA2 = \adj -> { From a5e6106d5151aadb07bf206c37ed9f8bb3ab88a6 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sat, 4 Nov 2023 17:00:25 +0100 Subject: [PATCH 119/129] make it possible to control the preposition in LN --- src/russian/CatRus.gf | 1 + src/russian/DocumentationRusFunctor.gf | 4 +++- src/russian/NamesRus.gf | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/russian/CatRus.gf b/src/russian/CatRus.gf index 2c770052..9aa05bf6 100644 --- a/src/russian/CatRus.gf +++ b/src/russian/CatRus.gf @@ -12,6 +12,7 @@ lincat } ; LN = { s : Case => Str ; + c : ResRus.ComplementCase ; g : Gender ; n : Number ; anim : Animacy diff --git a/src/russian/DocumentationRusFunctor.gf b/src/russian/DocumentationRusFunctor.gf index 083ad94f..397651cd 100644 --- a/src/russian/DocumentationRusFunctor.gf +++ b/src/russian/DocumentationRusFunctor.gf @@ -110,7 +110,9 @@ lin tr (th (heading partitive_Parameter) ++ td (ln.s ! Ptv)) ++ tr (th ("местный") ++ td (ln.s ! Loc)) ++ tr (th ("звательный") ++ td (ln.s ! VocRus)) - ) + ) ++ + heading2 (heading adverb_Category) ++ + paragraph (ln.c.s ++ ln.s ! ln.c.c) } ; InflectionA, InflectionA2 = \adj -> { diff --git a/src/russian/NamesRus.gf b/src/russian/NamesRus.gf index 3a89fae6..720543be 100644 --- a/src/russian/NamesRus.gf +++ b/src/russian/NamesRus.gf @@ -41,7 +41,7 @@ lin FullName gn sn = a=Ag (gennum ln.g ln.n) P3 } ; -- Does NP need animacy? - InLN ln = ss (applyPrep {s=v_prep_mod; c=Loc; hasPrep=True} { + InLN ln = ss (applyPrep ln.c { s=ln.s ; pron=False; a=Ag (gennum ln.g ln.n) P3 From 93fbfe8d26900b02016fbfe13ba6e12adb3d84d1 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sat, 4 Nov 2023 18:17:59 +0100 Subject: [PATCH 120/129] added invarLN for abbreviations and foreign names --- src/russian/ParadigmsRus.gf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/russian/ParadigmsRus.gf b/src/russian/ParadigmsRus.gf index 7197ac50..8284b133 100644 --- a/src/russian/ParadigmsRus.gf +++ b/src/russian/ParadigmsRus.gf @@ -513,6 +513,16 @@ oper } ; } ; + invarLN : Str -> Gender -> Number -> LN + = \s, g, n -> + lin LN { + s = \\c => s ; + anim = Inanimate ; + c = mkPrep v_prep_mod Loc ; + g = g ; + n = n + } ; + --------------------- -- Adjectives From a9b5848a5f65f78e0f5f4e6f09e9c12ef9d01513 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sat, 4 Nov 2023 19:01:19 +0100 Subject: [PATCH 121/129] Conjunction with and_Conj should always be in plural --- src/russian/ConjunctionRus.gf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/russian/ConjunctionRus.gf b/src/russian/ConjunctionRus.gf index e934b95a..0084d82f 100644 --- a/src/russian/ConjunctionRus.gf +++ b/src/russian/ConjunctionRus.gf @@ -169,8 +169,10 @@ concrete ConjunctionRus of Conjunction = -- : Conj -> ListNP -> NP ; -- she or we ConjNP conj xs = { s = \\c => conj.s1 ++ xs.s1 ! c ++ conj.s2 ++ xs.s2 ! c ; - --prep = \\c => conj.s1 ++ xs.prep1 ! c ++ conj.s2 ++ xs.prep2 ! c ; - a = xs.a ; -- TODO: dep. on conj as well? + a = case conj.n of { + Sg => xs.a ; + Pl => case xs.a of {Ag gn p => Ag GPl p} + } ; pron = xs.pron ; anim = xs.anim } ; From c5e62b16143b782e5998d2e97fb3bc11b9768340 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sat, 4 Nov 2023 19:24:15 +0100 Subject: [PATCH 122/129] add soft spaces between groups of digits --- src/bulgarian/NumeralBul.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bulgarian/NumeralBul.gf b/src/bulgarian/NumeralBul.gf index d447f42a..4a4fb4e2 100644 --- a/src/bulgarian/NumeralBul.gf +++ b/src/bulgarian/NumeralBul.gf @@ -196,7 +196,7 @@ lin pot5decimal d = { oper spaceIf : DTail -> Str = \t -> case t of { - T3 => SOFT_BIND ; + T3 => SOFT_SPACE ; _ => BIND } ; From 1d5b9d49e2ef253f5d99494fe787bdddb09fcdaf Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sat, 4 Nov 2023 21:16:42 +0100 Subject: [PATCH 123/129] use the reflexive clitic when ReflPron is used directly --- src/bulgarian/ExtendBul.gf | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/bulgarian/ExtendBul.gf b/src/bulgarian/ExtendBul.gf index 085284af..808be483 100644 --- a/src/bulgarian/ExtendBul.gf +++ b/src/bulgarian/ExtendBul.gf @@ -183,22 +183,31 @@ lin ComplSlashPartLast = ComplSlash ; lincat - RNP = {s : Role => Str; gn : GenNum} ; + RNP = {s : Role => Str; gn : GenNum; isPron : Bool} ; lin ReflRNP slash rnp = { s = slash.s ; ad = slash.ad ; clitics = slash.clitics ; - compl = \\a => slash.compl1 ! a ++ slash.c2.s ++ rnp.s ! RObj slash.c2.c ++ slash.compl2 ! agrP3 rnp.gn ; - vtype = slash.vtype ; + compl = \\a => slash.compl1 ! a ++ slash.c2.s ++ + case of { + => [] ; + _ => rnp.s ! RObj slash.c2.c + } ++ + slash.compl2 ! agrP3 rnp.gn ; + vtype = case of { + => VMedial slash.c2.c ; + _ => slash.vtype + } ; p = slash.p ; isSimple = False } ; ReflPron = { s = \\role => "себе си"; - gn = GSg Masc + gn = GSg Masc; + isPron = True } ; ReflPoss num cn = @@ -219,15 +228,17 @@ lin RObj c => linCase c Pos ++ s; _ => s } ; - gn = gennum cn.g (numnnum num.nn) + gn = gennum cn.g (numnnum num.nn) ; + isPron = False } ; PredetRNP pred rnp = { s = \\c => pred.s ! rnp.gn ++ rnp.s ! c ; - gn = rnp.gn + gn = rnp.gn ; + isPron = False } ; - AdvRNP np prep rnp = {s = \\role => np.s ! role ++ prep.s ++ rnp.s ! RObj prep.c; gn = np.gn; p = np.p} ; + AdvRNP np prep rnp = {s = \\role => np.s ! role ++ prep.s ++ rnp.s ! RObj prep.c; gn = np.gn; p = np.p; isPron = False} ; AdvRVP vp prep rnp = insertObj (\\a => prep.s ++ rnp.s ! RObj prep.c) Pos vp ; AdvRAP ap prep rnp = { s = \\aform,p => ap.s ! aform ! p ++ prep.s ++ rnp.s ! RObj prep.c ; From 12d7702a7d228fecdaa32dc924dcea6b4c811d75 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 6 Nov 2023 15:32:12 +0100 Subject: [PATCH 124/129] (Fin) add internal table for the pronoun "kukin" --- src/finnish/StructuralFin.gf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/finnish/StructuralFin.gf b/src/finnish/StructuralFin.gf index 39aa1b2d..6b2ad0e7 100644 --- a/src/finnish/StructuralFin.gf +++ b/src/finnish/StructuralFin.gf @@ -216,6 +216,21 @@ oper } } ; + kukinInt : MorphoFin.Number => MorphoFin.Case => Str = + let ku : Noun = nForms2N (dUkko "ku" "kun") + in table { + Sg => table { + Part => "kutakin" ; + Illat => "kuhunkin" ; + c => ku.s ! NCase Sg c + "kin" + } ; + Pl => table { + Gen => "kuidenkin" ; + Part => "kuitakin" ; + c => ku.s ! NCase Pl c + "kin" + } + } ; + kukaInt : MorphoFin.Number => (MorphoFin.Case) => Str = let kuka = snoun2nounBind (mkN "kuka" "kenen" "ketä" "kenä" "keneen" From 02b30024843f22a3f7666d159150f00253e47b86 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 7 Nov 2023 18:12:55 +0100 Subject: [PATCH 125/129] =?UTF-8?q?(Fin)=20move=20#consonant=20to=20Morpho?= =?UTF-8?q?=20+=20add=20o=C3=B6Harmony?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/finnish/MorphoFin.gf | 7 +++++++ src/finnish/ParadigmsFin.gf | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/finnish/MorphoFin.gf b/src/finnish/MorphoFin.gf index 422a6dbe..c2c1b6c9 100644 --- a/src/finnish/MorphoFin.gf +++ b/src/finnish/MorphoFin.gf @@ -726,6 +726,11 @@ resource MorphoFin = ResFin ** open Prelude in { _ => "y" } ; + oöHarmony : Str -> Str = \a -> case a of { + "a" => "o" ; + _ => "ö" + } ; + VForms : Type = Predef.Ints 11 => Str ; vForms12 : (x1,_,_,_,_,_,_,_,_,_,_,x12 : Str) -> VForms = @@ -861,6 +866,8 @@ resource MorphoFin = ResFin ** open Prelude in { vowel : pattern Str = #("a"|"e"|"i"|"o"|"u"|"y"|"ä"|"ö") ; + consonant : pattern Str = #("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"q"|"r"|"s"|"t"|"v"|"w"|"x"|"z") ; + -- The following function defines how grade alternation works if it is active. -- In general, *whether there is* grade alternation must be given in the lexicon -- (cf. "auto - auton" not "audon"; "vihje - vihjeen" not "vihkeen"). diff --git a/src/finnish/ParadigmsFin.gf b/src/finnish/ParadigmsFin.gf index c6eca84e..2d4c9ca9 100644 --- a/src/finnish/ParadigmsFin.gf +++ b/src/finnish/ParadigmsFin.gf @@ -712,8 +712,6 @@ mkVS = overload { } } ; - consonant : pattern Str = #("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"q"|"r"|"s"|"t"|"v"|"w"|"x"|"z") ; - -- like nForms2, but 2nd argument is Pl Genitive nForms2plGen : (sydan,sydanten : Str) -> NForms = \sydan,sydanten -> table { From 7f2bfa11b3c93af6558d3f0895faaa25d25c9d66 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 7 Nov 2023 18:18:13 +0100 Subject: [PATCH 126/129] (Fin) Fix bugs in d08, d34, d44 --- src/finnish/Kotus.gf | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/finnish/Kotus.gf b/src/finnish/Kotus.gf index 149c8293..983bad35 100644 --- a/src/finnish/Kotus.gf +++ b/src/finnish/Kotus.gf @@ -32,11 +32,15 @@ oper = \s -> dArpi s (init s + "en") ; d07A : Str -> NForms -- 70 väki = \s -> dArpi s (init (weakGrade s) + "en") ; - d08 : Str -> NForms -- 99 à la carte - = \s -> dNukke s (s + "n") ; + d08 : Str -> NForms -- 99 nalle + = \s -> let defaultNForms : NForms = dNukke s (s + "n") ; + nallejen : Str = s + "jen" ; + in exceptPlGen defaultNForms nallejen ; d08A : Str -> NForms -- 5 vinaigrette - = \s -> dNukke s (weakGrade s + "n") ; - d09 : Str -> NForms -- 696 ääriraja + = \s -> let defaultNForms : NForms = dNukke s (weakGrade s + "n") ; + nukkejen : Str = s + "jen" ; + in exceptPlGen defaultNForms nukkejen ; + d09 : Str -> NForms -- 696 kala = \s -> let a = last s in dSilakka s (s + "n") (init s + case a of {"a" => "o" ; _ => "ö"} + "j" + a) ; @@ -152,7 +156,7 @@ oper } ; in dLiitin s pyyhkimen ; d34 : Str -> NForms -- 1 alaston - = \s -> let alastom = init s in + = \s -> let alastom = init s + "m" in nForms10 s (alastom + "an") (s + "ta") (alastom + "ana") (alastom + "aan") (alastom + "ien") (alastom + "ia") (alastom + "ina") (alastom + "issa") @@ -197,7 +201,7 @@ oper = \s -> let kevä = init s in nForms10 s (kevä + "än") (s + "tä") (kevä + "änä") (kevä + "äseen") - (s + "iden") (kevä + "itä") (kevä + "inä") (kevä + "issä") + (kevä + "iden") (kevä + "itä") (kevä + "inä") (kevä + "issä") (kevä + "isiin") ; d45 : Str -> NForms -- 23 yhdes = \s -> let yhde = init s ; a = vowelHarmony s in From 96076d6d81eb6f9112354c5c86c199eff68c2fa9 Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Thu, 16 Nov 2023 19:16:58 +0100 Subject: [PATCH 127/129] Reduced Agr to 9 values by removing AgP3SgGen --- src/german/ResGer.gf | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/german/ResGer.gf b/src/german/ResGer.gf index a56dbe43..8273913d 100644 --- a/src/german/ResGer.gf +++ b/src/german/ResGer.gf @@ -37,18 +37,18 @@ resource ResGer = ParamX ** open Prelude in { -- Agreement of $NP$ has three parts: gender, number and person. - -- These 3*2*3 = 18 values can be reduced to 8, since gender is used only + -- These 3*2*3 = 18 values can be reduced to 9, since gender is used only -- in 3rd person singular. To select reflexive and possessive forms for "Sie" - -- in (mkClause str agr vp), add a value AgPlPol, for "man", add AgSgP3Gen. HL 29.9.2023 + -- in (mkClause str agr vp), add a value AgPlPol, for "man", use AgSgP3 Masc. HL 29.9.2023 - Agr = AgSgP1 | AgSgP2 | AgSgP3 Gender | AgSgP3Gen | AgPl Person | AgPlPol ; + Agr = AgSgP1 | AgSgP2 | AgSgP3 Gender | AgPl Person | AgPlPol ; oper genderAgr : Agr -> Gender = \r -> case r of {AgSgP3 g => g ; _ => Masc} ; numberAgr = overload { numberAgr : Agr -> Number = \r -> case r of { - AgSgP1 | AgSgP2 | AgSgP3 _ | AgSgP3Gen => Sg ; + AgSgP1 | AgSgP2 | AgSgP3 _ => Sg ; AgPl _ | AgPlPol => Pl } ; numberAgr : VAgr -> Number = \r -> case r of {VAg n _ => n} ; @@ -57,8 +57,7 @@ resource ResGer = ParamX ** open Prelude in { personAgr : Agr -> Person = \r -> case r of { AgSgP1 | AgPl P1 => P1 ; AgSgP2 | AgPl P2 => P2 ; - AgSgP3 _ | AgSgP3Gen => P3 ; - AgPl P3 | AgPlPol => P3 + AgSgP3 _ | AgPl P3 | AgPlPol => P3 } ; personAgr : VAgr -> Person = \r -> case r of {VAg _ p => p} } ; @@ -215,11 +214,11 @@ resource ResGer = ParamX ** open Prelude in { } ; agr2vagr : Agr -> VAgr = \r -> case r of { - AgSgP1 => VAg Sg P1 ; - AgSgP2 => VAg Sg P2 ; - AgSgP3 _ | AgSgP3Gen => VAg Sg P3 ; - AgPl p => VAg Pl p ; - AgPlPol => VAg Pl P3 + AgSgP1 => VAg Sg P1 ; + AgSgP2 => VAg Sg P2 ; + AgSgP3 g => VAg Sg P3 ; + AgPl p => VAg Pl p ; + AgPlPol => VAg Pl P3 } ; vagrP3 : Number -> VAgr = \n -> VAg n P3 ; @@ -960,8 +959,8 @@ resource ResGer = ParamX ** open Prelude in { -- let vpi = infVP isAux vp in -- vpi.p1 ! agrP3 Sg ++ vpi.p3 ++ vpi.p2 ++ vpi.p4 ; let vpi = infVP isAux Simul Pos vp ; -- HL 3/2022 - agr : Agr = AgSgP3Gen ; -- HL 17.8.2023 - glue : (Agr => Str)*Str -> Str = \i -> i.p1!agr ++ i.p2 + agr = agrP3 Sg ; + glue : (Agr => Str)*Str -> Str = \i -> i.p1 ! agr ++ i.p2 in glue (embedInf vpi.inpl ) ++ vpi.extr!agr ++ vp.ext ; @@ -974,11 +973,11 @@ resource ResGer = ParamX ** open Prelude in { AgSgP3 Masc => caselist "er" "sich" "sich" "seiner" ; AgSgP3 Fem => caselist "sie" "sich" "sich" "ihrer" ; AgSgP3 Neutr => caselist "es" "sich" "sich" "seiner" ; - AgSgP3Gen => caselist "man selbst" "sich" "sich" "seiner" ; -- älter als man selbst sein AgPl P1 => caselist "wir" "uns" "uns" "unser" ; AgPl P2 => caselist "ihr" "euch" "euch" "euer" ; AgPl P3 => caselist "sie" "sich" "sich" "ihrer" ; AgPlPol => caselist "Sie" "sich" "sich" "Ihrer" -- HL 8/2023 + -- AgSgP3Gen => caselist "man selbst" "sich" "sich" "seiner" ; -- älter als man selbst sein -- ; AgPlReci => caselist "man" "einander" "einander" "einander" -- reciPron ? } ; @@ -1002,11 +1001,6 @@ resource ResGer = ParamX ** open Prelude in { => caselist "sein" "sein" "seinem" "seines" ! c ; => caselist "seine" "seine" "seinen" "seiner" ! c ; - => caselist "sein" "seinen" "seinem" "seines" ! c ; - => caselist "seine" "seine" "seiner" "seiner" ! c ; - => caselist "sein" "sein" "seinem" "seines" ! c ; - => caselist "seine" "seine" "seinen" "seiner" ! c ; - => caselist "unser" "unseren" "unserem" "unseres" ! c ; => caselist "unsere" "unsere" "unserer" "unserer" ! c ; => caselist "unser" "unser" "unserem" "unseres" ! c ; From 88be4ca0ae68785f71b4d448c202d840ba306ac9 Mon Sep 17 00:00:00 2001 From: Hans Leiss Date: Wed, 29 Nov 2023 10:48:20 +0100 Subject: [PATCH 128/129] (Ger) ordinal endings of Digits fixed --- src/german/CatGer.gf | 2 +- src/german/NumeralGer.gf | 66 ++++++++++++++++++++++++++-------------- 2 files changed, 45 insertions(+), 23 deletions(-) diff --git a/src/german/CatGer.gf b/src/german/CatGer.gf index 72a55eb3..1f4c64b9 100644 --- a/src/german/CatGer.gf +++ b/src/german/CatGer.gf @@ -84,7 +84,7 @@ concrete CatGer of Cat = -- Numeral Numeral = {s : CardOrd => Str ; n : Number } ; - Digits = {s : CardOrd => Str ; n : Number } ; + Digits = {s : CardOrd => Str ; n : Number ; isDig, tail1to19 : Bool} ; Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/german/NumeralGer.gf b/src/german/NumeralGer.gf index a9b3e267..eab2cc23 100644 --- a/src/german/NumeralGer.gf +++ b/src/german/NumeralGer.gf @@ -12,14 +12,14 @@ lincat lin num x = x ; - n2 = mkDigit "zwei" "zwölf" "zwanzig" "zweite" ; + n2 = mkDigit "zwei" "zwölf" "zwanzig" "zweite" ; n3 = mkDigit "drei" "dreizehn" "dreissig" "dritte" ; - n4 = regDigit "vier" ; - n5 = regDigit "fünf" ; - n6 = regDigit "sechs" ; - n7 = mkDigit "sieben" "siebzehn" "siebzig" "siebte" ; - n8 = mkDigit "acht" "achzehn" "achzig" "achte" ; - n9 = regDigit "neun" ; + n4 = regDigit "vier" ; + n5 = regDigit "fünf" ; + n6 = mkDigit "sechs" "sechzehn" "sechzig" "sechste" ; + n7 = mkDigit "sieben" "siebzehn" "siebzig" "siebte" ; + n8 = mkDigit "acht" "achtzehn" "achtzig" "achte" ; + n9 = regDigit "neun" ; pot01 = { s = \\f => table { @@ -69,17 +69,33 @@ oper Dig = TDigit ; lin - IDig d = d ; + IDig d = {s = table{NCard g c => d.s ! NCard g c ; + NOrd APred => "am" ++ d.s ! invNum ++ BIND ++ "ten"; + NOrd amod => d.s ! NOrd amod} ; + n = d.n ; + isDig = True ; + tail1to19 = notB d.isZero} ; - IIDig d i = { - s = \\o => d.s ! invNum ++ BIND ++ i.s ! o ; - n = Pl - } ; + -- HL 11/2023 added case endings or ordinals to digits + -- NCard Masc Nom (= invNum): 0,1, 19, 20,21,... + -- NOrd (AMid (GSg Masc) Nom): 0ter,1ter,...,19ter, 20ster,21ster,...,99ster, 100ster + -- 101ter,...,119ter,120ster,... , 200ster + IIDig d i = + let isPld : Bool = case d.n of {Sg => False ; _ => True} ; + b : Bool = case i.isDig of {True => isPld ; _ => notB i.tail1to19} ; + i' : Digits = case b of {True => IDig (mkDig (i.s ! invNum ++ BIND ++ "s")) ; + _ => i } + in {s = table {NCard g c => d.s ! invNum ++ BIND ++ i.s ! NCard g c ; + NOrd APred => "am" ++ d.s ! invNum ++ BIND ++ i'.s ! invNum ++ BIND ++ "ten" ; + NOrd af => d.s ! invNum ++ BIND ++ i'.s ! NOrd af} ; + n = Pl ; + isDig = False ; + tail1to19 = case i.isDig of {True => notB isPld ; False => i.tail1to19} + } ; - ---- TODO: case endings of ordinals - D_0 = mkDig "0" ; - D_1 = mk3Dig "1" "1e" Sg ; - D_2 = mk2Dig "2" "2e" ; + D_0 = mk2Dig "0" Sg ** {isZero = True} ; + D_1 = mk2Dig "1" Sg ; + D_2 = mkDig "2" ; D_3 = mkDig "3" ; D_4 = mkDig "4" ; D_5 = mkDig "5" ; @@ -90,7 +106,9 @@ oper PosDecimal d = d ** {hasDot=False} ; NegDecimal d = { - s = \\o => "-" ++ BIND ++ d.s ! o ; + s = \\o => case o of { + NOrd APred => "am" ++ "-" ++ BIND ++ d.s ! NOrd (AMod GPl Dat) ; + _ => "-" ++ BIND ++ d.s ! o} ; n = Pl ; hasDot=False } ; @@ -103,17 +121,21 @@ oper } ; oper - mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; - mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ; + mkDig : Str -> TDigit = \c -> mk2Dig c Pl ; + + mk2Dig : Str -> Number -> TDigit = \c,n -> mk3Dig c (c + "t") n ; -- like Duden 464 (4.Auflage) mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> { - s = table {NCard _ _ => c ; NOrd _ => o} ; - n = n + s = table {NCard _ _ => c ; -- 0,...,9 + NOrd af => (regA o).s ! Posit ! af} ; -- (ein) 0ter .. 9ter | (der) 0te ... 9te + n = n ; -- NOrd APred: "0",... or "am 0ten",... ? + isZero = False } ; TDigit = { n : Number ; - s : CardOrd => Str + s : CardOrd => Str ; + isZero : Bool } ; } From 441c8305dc909ceca4edcb022b5d66797b721ecf Mon Sep 17 00:00:00 2001 From: aarneranta Date: Fri, 8 Dec 2023 14:04:38 +0100 Subject: [PATCH 129/129] added NamesAra to GrammarAra --- src/arabic/GrammarAra.gf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/arabic/GrammarAra.gf b/src/arabic/GrammarAra.gf index 21bf9f57..c97b1bc5 100644 --- a/src/arabic/GrammarAra.gf +++ b/src/arabic/GrammarAra.gf @@ -14,7 +14,8 @@ concrete GrammarAra of Grammar = TextX - [Utt], StructuralAra, IdiomAra, - TenseX - [Utt] + TenseX - [Utt], + NamesAra ** { flags startcat = Phr ; unlexer = text ; lexer = text ;