1
0
forked from GitHub/gf-rgl

Modifications of Prep\', Predet\', Quant\', Det\', NP\' to remove PCase and use NP.s : Agr => Str * Str instead

This commit is contained in:
Hans Leiss
2022-07-19 18:27:56 +02:00
parent d3de861e86
commit 8eee3df739
34 changed files with 1331 additions and 187 deletions

View File

@@ -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").
}

35
src/abstract/Adverb'.gf Normal file
View File

@@ -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)
}

1
src/abstract/Cat'.gf Normal file
View File

@@ -0,0 +1 @@
abstract Cat' = Cat ** {cat NP'; Det'; Quant'; Predet'; Prep'; }

View File

@@ -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
-}
}

24
src/abstract/Grammar'.gf Normal file
View File

@@ -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'
;

35
src/abstract/Idiom'.gf Normal file
View File

@@ -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)
}

16
src/abstract/Lang'.gf Normal file
View File

@@ -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 ;
} ;

161
src/abstract/Noun'.gf Normal file
View File

@@ -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)
}

View File

@@ -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 ;
}

48
src/abstract/Phrase'.gf Normal file
View File

@@ -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
}

55
src/abstract/Question'.gf Normal file
View File

@@ -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
}

26
src/abstract/Relative'.gf Normal file
View File

@@ -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
}

107
src/abstract/Sentence'.gf Normal file
View File

@@ -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
-}

130
src/abstract/Structural'.gf Normal file
View File

@@ -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 ;
}

29
src/abstract/Transfer'.gf Normal file
View File

@@ -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 ;
}

85
src/abstract/Verb'.gf Normal file
View File

@@ -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
}

View File

@@ -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 => <appPrepNP a.c2 np, []> ;
True => <[], appPrepNP a.c2 np> }
isCase => <appPrepNP' a.c2 np, []> ;
_ => <[], 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 => <compl, []> ;
True => <[], compl> }
{isCase => <compl, []> ;
_ => <[], compl> } -- HL Check isPrepDefArt
in {
s = a.s ! Posit ;
isPre = True ;

View File

@@ -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 ;

View File

@@ -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 ;

View File

@@ -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 = {

View File

@@ -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,

View File

@@ -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 ;
} ;

View File

@@ -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]
** {

View File

@@ -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 ;

View File

@@ -17,8 +17,8 @@ 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 ;
-- isLight, isPron : Bool ;
@@ -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} ;

View File

@@ -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 => <det'.s ! 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
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 <quant.a, quant.aPl> of {<Strong,Strong> => 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 <quant.a, quant.aPl> of {<Strong,Strong> => 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 <n,c> of {
<Pl,Dat> => "denen" ; -- HL 6/2019
<Pl,Gen> => "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,18 +223,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 ;

View File

@@ -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
@@ -316,15 +310,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 ;
} ;
@@ -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}) ;
} ;
@@ -608,39 +605,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 -> 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
= \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}) ;
} ;
}

View File

@@ -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} ;
}

View File

@@ -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 {

View File

@@ -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)
} ;

View File

@@ -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 ->
{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 <n,w> of {
<Sg,WDefArt> => -- 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 {
<vpnn.p1, vpnn.p2, vpnn.p3 ++ obj, vpnn.p4> }
} ; -- 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 <isPrep, np.w, c> of { -- 2 * 3 * 4 = 24 cases
<True, _,_> => -- <prons, light, heavy++pp, compl>
<vpnn.p1, vpnn.p2, vpnn.p3 ++ obj, vpnn.p4> ;
<False,WPron', Acc> => -- <ihn ++ sich, light, heavy, comp>
<obj ++ vpnn.p1, vpnn.p2, vpnn.p3, vpnn.p4> ;
<False,WPron', _ > => -- <sich ++ ihm|seiner, light, heavy, comp>
<vpnn.p1 ++ obj, vpnn.p2, vpnn.p3, vpnn.p4> ;
<False,WLight',Dat> => -- (assuming v.c2=acc) nonPron: dat < acc|gen
-- <prons, dat ++ np, heavy, comp>
<vpnn.p1, obj ++ vpnn.p2, vpnn.p3, vpnn.p4> ;
<False,WHeavy'|WDefArt,Dat> => -- <prons, light, dat ++ np, comp>
<vpnn.p1, vpnn.p2, obj ++ vpnn.p3, vpnn.p4> ;
<False,WLight',_ > => -- <prons, np ++ gen|acc, heavy, comp>
<vpnn.p1, vpnn.p2 ++ obj, vpnn.p3, vpnn.p4> ;
<False,WHeavy'|WDefArt,_ > => -- <prons, light, dat ++ np, comp>
<vpnn.p1, vpnn.p2, vpnn.p3 ++ obj, vpnn.p4> }
} ; -- 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 => <obj ! a ++ vpnn.p1, vpnn.p2, vpnn.p3, vpnn.p4> ;
True => <vpnn.p1, obj ! a ++ vpnn.p2, vpnn.p3, vpnn.p4> }
isCase => <obj ! a ++ vpnn.p1, vpnn.p2, vpnn.p3, vpnn.p4> ;
_ => <vpnn.p1, obj ! a ++ vpnn.p2, vpnn.p3, vpnn.p4> }
} ;
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 <subj , agr> ;
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 <subj , agr> ;
}

View File

@@ -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} ;

View File

@@ -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

View File

@@ -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 <v.c2.c, v.c2.isPrep> of {
<NPC Acc, False> => NPC Nom ; _ => v.c2.c}
<Acc, isCase> => 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