diff --git a/grammars/resource/english/DatabaseEng.gf b/grammars/resource/english/DatabaseEng.gf index 9d94e69ed..927434d9a 100644 --- a/grammars/resource/english/DatabaseEng.gf +++ b/grammars/resource/english/DatabaseEng.gf @@ -1,4 +1,4 @@ -concrete DatabaseEng of Database = open Prelude,Syntax,English,Predication,Paradigms,DatabaseRes in { +concrete DatabaseEng of Database = open Prelude,Syntax,English,Predication,Paradigms,DatabaseEngRes in { flags lexer=text ; unlexer=text ; @@ -11,7 +11,7 @@ lincat Relation = Adj2 ; Feature = Fun ; Value = NP ; - Name = ProperName ; + Name = PN ; lin LongForm sent = ss (sent.s ! True ++ "?") ; @@ -41,7 +41,7 @@ lin -- only these are language-dependent - Any = detNounPhrase anyPlDet ; --- + Any n = detNounPhrase anyPlDet n ** {lock_NP = <>} ; --- IsThere A = mkSentPrel ["is there"] (defaultNounPhrase (IndefOneNP A)) ; AreThere A = mkSentPrel ["are there"] (defaultNounPhrase (IndefManyNP A)) ; diff --git a/grammars/resource/english/Paradigms.gf b/grammars/resource/english/Paradigms.gf index 478377598..d13179338 100644 --- a/grammars/resource/english/Paradigms.gf +++ b/grammars/resource/english/Paradigms.gf @@ -159,9 +159,10 @@ oper nominative = Nom ; - mkN = \man,men,man's,men's,g -> mkNoun man men man's men's ** {g = g} ; - nReg = addGenN nounReg ; - nKiss = addGenN nounS ; + mkN = \man,men,man's,men's,g -> + mkNoun man men man's men's ** {g = g ; lock_N = <>} ; + nReg a g = addGenN nounReg a g ; + nKiss n g = addGenN nounS n g ; nFly = \fly -> addGenN nounY (Predef.tk 1 fly) ; nMan = \man,men -> mkN man men (man + "'s") (men + "'s") ; nHero = nKiss ; @@ -180,33 +181,34 @@ oper eqy "z" nKiss ( nReg))) fly g ; - mkFun = \n,p -> n ** {s2 = p} ; + mkFun = \n,p -> n ** {lock_Fun = <> ; s2 = p} ; funNonhuman = \s -> mkFun (nNonhuman s) "of" ; funHuman = \s -> mkFun (nHuman s) "of" ; - pnReg = nameReg ; + pnReg n = nameReg n ** {lock_PN = <>} ; cnNonhuman = \s -> UseN (nGen s nonhuman) ; cnHuman = \s -> UseN (nGen s human) ; npReg = \s -> UsePN (pnReg s) ; - mkFunCN = \n,p -> n ** {s2 = p} ; + mkFunCN = \n,p -> n ** {lock_Fun = <> ; s2 = p} ; funOfCN = \n -> mkFunCN n "of" ; addGenN : (Str -> CommonNoun) -> Str -> Gender -> N = \f -> - \s,g -> f s ** {g = g} ; + \s,g -> f s ** {g = g ; lock_N = <>} ; - mkAdj1 = simpleAdj ; - mkAdj2 = \s,p -> simpleAdj s ** {s2 = p} ; - mkAdjDeg = mkAdjDegr ; - aReg = adjDegrReg ; - aHappy = \happy -> adjDegrY (Predef.tk 1 happy) ; + mkAdj1 a = simpleAdj a ** {lock_Adj1 = <>} ; + mkAdj2 = \s,p -> simpleAdj s ** {s2 = p} ** {lock_Adj2 = <>} ; + mkAdjDeg a b c = mkAdjDegr a b c ** {lock_AdjDeg = <>} ; + aReg a = adjDegrReg a ** {lock_AdjDeg = <>} ; + aHappy = \happy -> adjDegrY (Predef.tk 1 happy) ** {lock_AdjDeg = <>} ; aFat = \fat -> let {fatt = fat + Predef.dp 1 fat} in mkAdjDeg fat (fatt + "er") (fatt + "est") ; - aRidiculous = adjDegrLong ; + aRidiculous a = adjDegrLong a ** {lock_AdjDeg = <>} ; apReg = \s -> AdjP1 (mkAdj1 s) ; - mkV = \go,goes,went,gone -> verbNoPart (mkVerbP3 go goes went gone) ; + mkV = \go,goes,went,gone -> verbNoPart (mkVerbP3 go goes went gone) ** + {lock_V = <>} ; vReg = \walk -> mkV walk (walk + "s") (walk + "ed") (walk + "ed") ; vKiss = \kiss -> mkV kiss (kiss + "es") (kiss + "ed") (kiss + "ed") ; vFly = \cry -> let {cr = Predef.tk 1 cry} in @@ -223,14 +225,16 @@ oper eqy "z" vKiss ( vReg))) fly ; - vPart = \go, goes, went, gone, up -> verbPart (mkVerbP3 go goes went gone) up ; - vPartReg = \get, up -> verbPart (regVerbP3 get) up ; + vPart = \go, goes, went, gone, up -> + verbPart (mkVerbP3 go goes went gone) up ** {lock_V = <>} ; + vPartReg = \get, up -> + verbPart (regVerbP3 get) up ** {lock_V = <>} ; - mkTV = \v,p -> v ** {s3 = p} ; + mkTV = \v,p -> v ** {lock_TV = <> ; s3 = p} ; tvPartReg = \get, along, to -> mkTV (vPartReg get along) to ; - vBe = verbBe ; - vHave = verbP3Have ; + vBe = verbBe ** {s1 = [] ; lock_V = <>} ; + vHave = verbP3Have ** {s1 = [] ; lock_V = <>} ; tvGen = \s,p -> mkTV (vGen s) p ; tvDir = \v -> mkTV v [] ; diff --git a/grammars/resource/english/Predication.gf b/grammars/resource/english/Predication.gf index cc92c465f..4285a8e24 100644 --- a/grammars/resource/english/Predication.gf +++ b/grammars/resource/english/Predication.gf @@ -58,10 +58,10 @@ oper predV1 = \F, x -> PredVP x (PosV F) ; predV2 = \F, x, y -> PredVP x (PosTV F y) ; predVColl = \F, x, y -> PredVP (conjNP x y) (PosV F) ; - predA1 = \F, x -> PredVP x (PosA F) ; + predA1 = \F, x -> PredVP x (PosA (AdjP1 F)) ; predA2 = \F, x, y -> PredVP x (PosA (ComplAdj F y)) ; predAComp = \F, x, y -> PredVP x (PosA (ComparAdjP F y)) ; - predAColl = \F, x, y -> PredVP (conjNP x y) (PosA F) ; + predAColl = \F, x, y -> PredVP (conjNP x y) (PosA (AdjP1 F)) ; predN1 = \F, x -> PredVP x (PosCN (UseN F)) ; predN2 = \F, x, y -> PredVP x (PosCN (AppFun F y)) ; predNColl = \F, x, y -> PredVP (conjNP x y) (PosCN (UseN F)) ; diff --git a/grammars/resource/english/ResEng.gf b/grammars/resource/english/ResEng.gf index 1be1f7d57..6ae9c7fb3 100644 --- a/grammars/resource/english/ResEng.gf +++ b/grammars/resource/english/ResEng.gf @@ -52,7 +52,7 @@ lincat V3 = TransVerb ** {s4 : Preposition} ; VS = Verb ; - AdV = {s : Str ; isPost : Bool} ; + AdV = {s : Str ; p : Bool} ; S = {s : Str} ; Slash = {s : Bool => Str ; s2 : Preposition} ; diff --git a/grammars/resource/english/RestaurantEng.gf b/grammars/resource/english/RestaurantEng.gf index 00a9392f0..69905ee32 100644 --- a/grammars/resource/english/RestaurantEng.gf +++ b/grammars/resource/english/RestaurantEng.gf @@ -1,5 +1,7 @@ +--# -path=.:../abstract:../../prelude + concrete RestaurantEng of Restaurant = - DatabaseEng ** open Prelude,Paradigms,DatabaseRes in { + DatabaseEng ** open Prelude,Paradigms,DatabaseEngRes in { lin Restaurant = cnNonhuman "restaurant" ; diff --git a/grammars/resource/english/Syntax.gf b/grammars/resource/english/Syntax.gf index 18944fa2d..07f4c7358 100644 --- a/grammars/resource/english/Syntax.gf +++ b/grammars/resource/english/Syntax.gf @@ -417,23 +417,23 @@ oper -- compared adverbials as separate expressions; this could be done another way). -- We distinguish between post- and pre-verbal adverbs. - Adverb : Type = SS ** {isPost : Bool} ; + Adverb : Type = SS ** {p : Bool} ; - advPre : Str -> Adverb = \seldom -> ss seldom ** {isPost = False} ; - advPost : Str -> Adverb = \well -> ss well ** {isPost = True} ; + advPre : Str -> Adverb = \seldom -> ss seldom ** {p = False} ; + advPost : Str -> Adverb = \well -> ss well ** {p = True} ; -- N.B. this rule generates the cyclic parsing rule $VP#2 ::= VP#2$ -- and cannot thus be parsed. adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \sings, well -> - let {postp = orB well.isPost sings.isAux} in + let {postp = orB well.p sings.isAux} in { s = \\v => (if_then_else Str postp [] well.s) ++ sings.s ! v ; s2 = \\n => sings.s2 ! n ++ (if_then_else Str postp well.s []) ; isAux = sings.isAux } ; - advAdjPhrase : Adverb -> AdjPhrase -> AdjPhrase = \very, good -> + advAdjPhrase : SS -> AdjPhrase -> AdjPhrase = \very, good -> {s = very.s ++ good.s ; p = good.p } ; @@ -750,7 +750,7 @@ oper -- This class covers adverbials such as "otherwise", "therefore", which are prefixed -- to a sentence to form a phrase. - advSentence : Adverb -> Sentence -> Utterance = \hence,itiseven -> + advSentence : SS -> Sentence -> Utterance = \hence,itiseven -> ss (hence.s ++ itiseven.s ++ ".") ; diff --git a/grammars/resource/german/DatabaseDeu.gf b/grammars/resource/german/DatabaseDeu.gf index a7a8f278e..b5f41969d 100644 --- a/grammars/resource/german/DatabaseDeu.gf +++ b/grammars/resource/german/DatabaseDeu.gf @@ -1,3 +1,5 @@ +--# -path=.:../abstract:../../prelude + concrete DatabaseDeu of Database = open Prelude,Syntax,Deutsch,Predication,Paradigms,DatabaseRes in { @@ -12,7 +14,7 @@ lincat Relation = Adj2 ; Feature = Fun ; Value = NP ; - Name = ProperName ; + Name = PN ; lin LongForm sent = ss (sent.s ! True ++ "?") ; @@ -34,7 +36,7 @@ lin WithProperty A B = ModAdj B A ; - Individual = nameNounPhrase ; + Individual n = nameNounPhrase n ** {lock_NP = <>} ; AllN = DetNP AllDet ; MostN = DetNP MostDet ; @@ -42,7 +44,7 @@ lin -- only these are language-dependent - Any = detNounPhrase einDet ; + Any n = detNounPhrase einDet n ** {lock_NP = <>} ; IsThere A = mkSentPrel ["gibt es"] (defaultNounPhrase (IndefOneNP A)) ; AreThere A = mkSentPrel ["gibt es"] (defaultNounPhrase (IndefManyNP A)) ; diff --git a/grammars/resource/german/Logical.gf b/grammars/resource/german/Logical.gf index 3347ae129..b6d3b524b 100644 --- a/grammars/resource/german/Logical.gf +++ b/grammars/resource/german/Logical.gf @@ -1,3 +1,5 @@ +--# -path=.:../abstract:../../prelude + -- Slightly ad hoc and formal negation and connectives. resource Logical = Predication ** open Deutsch, Paradigms in { @@ -12,7 +14,8 @@ resource Logical = Predication ** open Deutsch, Paradigms in { negS = \A -> PredVP ItNP (NegNP (DefOneNP (CNthatS (UseN (nRaum "Fall" "Fälle")) A))) ; univS = \A,B -> - PredVP ItNP (AdvVP (PosVS (mkV "gelten" "gilt" "gelte" "gegolten") B) + PredVP ItNP + (AdvVP (PosVS (mkV "gelten" "gilt" "gelte" "gegolten" ** {lock_VS = <>}) B) (mkPP accusative "für" (DetNP AllDet A))) ; existS = \A,B -> PredVP ItNP (PosTV (tvDir (mkV "geben" "gibt" "gib" "gegeben")) diff --git a/grammars/resource/german/Paradigms.gf b/grammars/resource/german/Paradigms.gf index d180dc281..1bfeb3fe6 100644 --- a/grammars/resource/german/Paradigms.gf +++ b/grammars/resource/german/Paradigms.gf @@ -1,3 +1,5 @@ +--# -path=.:../abstract:../../prelude + --1 German Lexical Paradigms -- -- Aarne Ranta 2003 @@ -192,7 +194,7 @@ oper -- Three-place verbs require two prepositions and cases. - mkV3 : V -> Str -> Case -> Str -> Case -> TV ; -- geben,[],dative,[],accusative + mkV3 : V -> Str -> Case -> Str -> Case -> V3 ; -- geben,[],dative,[],accusative --2 Adverbials @@ -223,20 +225,21 @@ oper -- singular defined in Types -- plural defined in Types - mkN = mkNoun ; + mkN a b c d e f g = mkNoun a b c d e f g ** {lock_N = <>} ; nGen = \punkt, punktes, punkte, g -> let { e = Predef.dp 1 punkte ; - eqy = ifTok (Gender -> N) e ; - noN = mkNoun4 punkt punktes punkte punkte + eqy = ifTok N e ; + noN = mkNoun4 punkt punktes punkte punkte g ** {lock_N = <>} } in eqy "n" noN ( eqy "s" noN ( - mkNoun4 punkt punktes punkte (punkte+"n"))) g ; + mkNoun4 punkt punktes punkte (punkte+"n") g ** {lock_N = <>})) ; nRaum = \raum, räume -> nGen raum (raum + "es") räume masculine ; nTisch = \tisch -> - mkNoun4 tisch (tisch + "es") (tisch + "e") (tisch +"en") masculine ; + mkNoun4 tisch (tisch + "es") (tisch + "e") (tisch +"en") masculine ** + {lock_N = <>}; nVater = \vater, väter -> nGen vater (vater + "s") väter masculine ; nFehler = \fehler -> nVater fehler fehler ; @@ -249,7 +252,7 @@ oper nBuch = \buch, bücher -> nGen buch (buch + "es") bücher neuter ; nMesser = \messer -> nGen messer (messer + "s") messer neuter ; nAuto = \auto -> let {autos = auto + "s"} in - mkNoun4 auto autos autos autos neuter ; + mkNoun4 auto autos autos autos neuter ** {lock_N = <>} ; nHand = \hand, hände -> nGen hand hand hände feminine ; @@ -259,10 +262,11 @@ oper } in mkN frau frau frau frau frauen frauen feminine ; - mkFun = \n -> mkFunCN (n2n n) ; - funVon = \n -> funVonCN (n2n n) ; + mkFun n = mkFunCN (UseN n) ; + funVon n = funVonCN (UseN n) ; - mkPN = \karolus, karoli -> {s = table {Gen => karoli ; _ => karolus}} ; + mkPN = \karolus, karoli -> + {s = table {Gen => karoli ; _ => karolus} ; lock_PN = <>} ; pnReg = \horst -> mkPN horst (ifTok Tok (Predef.dp 1 horst) "s" horst (horst + "s")) ; @@ -270,37 +274,37 @@ oper mkNP = \x,y -> UsePN (mkPN x y) ; npReg = \s -> UsePN (pnReg s) ; - mkFunCN = mkFunC ; - funVonCN = funVonC ; + mkFunCN n p c = mkFunC n p c ** {lock_Fun = <>} ; + funVonCN n = funVonC n ** {lock_Fun = <>} ; - mkAdj1 = mkAdjective ; - adjInvar = Morpho.adjInvar ; - adjGen = Morpho.adjGen ; - mkAdj2 = \a,p,c -> a ** {s2 = p ; c = c} ; + mkAdj1 x y = mkAdjective x y ** {lock_Adj1 = <>} ; + adjInvar a = Morpho.adjInvar a ** {lock_Adj1 = <>} ; + adjGen a = Morpho.adjGen a ** {lock_Adj1 = <>} ; + mkAdj2 = \a,p,c -> a ** {s2 = p ; c = c ; lock_Adj2 = <>} ; - mkAdjDeg = mkAdjComp ; - aDeg3 = adjCompReg3 ; - aReg = adjCompReg ; - aPastPart = \v -> {s = table AForm {a => v.s ! VPart a}} ; + mkAdjDeg a b c = mkAdjComp a b c ** {lock_AdjDeg = <>} ; + aDeg3 a b c = adjCompReg3 a b c ** {lock_AdjDeg = <>} ; + aReg a = adjCompReg a ** {lock_AdjDeg = <>} ; + aPastPart = \v -> {s = table AForm {a => v.s ! VPart a} ; lock_Adj1 = <>} ; apReg = \s -> AdjP1 (adjGen s) ; mkV = \sehen, sieht, sieh, gesehen -> - mkVerbSimple (mkVerbum sehen (Predef.tk 1 sieht) sieh gesehen) ; - vReg = \s -> mkVerbSimple (regVerb s) ; - vSein = verbSein ; - vHaben = verbHaben ; + mkVerbSimple (mkVerbum sehen (Predef.tk 1 sieht) sieh gesehen) ** {lock_V = <>} ; + vReg = \s -> mkVerbSimple (regVerb s) ** {lock_V = <>} ; + vSein = verbSein ** {lock_V = <>} ; + vHaben = verbHaben ** {lock_V = <>} ; vPart = \sehen, sieht, sieh, gesehen, aus -> - mkVerb (mkVerbum sehen sieht sieh gesehen) aus ; - vPartReg = \sehen, aus -> mkVerb (regVerb sehen) aus ; + mkVerb (mkVerbum sehen sieht sieh gesehen) aus ** {lock_V = <>} ; + vPartReg = \sehen, aus -> mkVerb (regVerb sehen) aus ** {lock_V = <>} ; - mkTV = mkTransVerb ; + mkTV v p c = mkTransVerb v p c ** {lock_TV = <>} ; tvReg = \hören, zu, dat -> mkTV (vReg hören) zu dat ; tvDir = \v -> mkTV v [] accusative ; tvDirReg = \v -> tvReg v [] accusative ; - mkV3 = mkDitransVerb ; + mkV3 v s c t d = mkDitransVerb v s c t d ** {lock_V3 = <>} ; - mkAdV = ss ; - mkPP = prepPhrase ; - mkAdA = ss ; - mkAdS = ss ; + mkAdV a = ss a ** {lock_AdV = <>} ; + mkPP x y z = prepPhrase x y z ** {lock_AdV = <>}; + mkAdA a = ss a ** {lock_AdA = <>} ; + mkAdS a = ss a ** {lock_AdS = <>} ; } ; diff --git a/grammars/resource/german/Predication.gf b/grammars/resource/german/Predication.gf index 283718498..37572b4c1 100644 --- a/grammars/resource/german/Predication.gf +++ b/grammars/resource/german/Predication.gf @@ -1,3 +1,4 @@ +--# -path=.:../abstract:../../prelude --1 A Small Predication Library -- @@ -28,13 +29,13 @@ oper -- Individual-valued function applications. appFun1 : Fun -> NP -> NP ; -- one-place function: "the successor of x" - appFun2 : Fun -> NP -> NP -> NP ; -- two-place function: "the line from x to y" + appFun2 : Fun2 -> NP -> NP -> NP ; -- two-place function: "the line from x to y" appFunColl : Fun -> NP -> NP -> NP ; -- collective function: "the sum of x and y" -- Families of types, expressed by common nouns depending on arguments. appFam1 : Fun -> NP -> CN ; -- one-place family: "divisor of x" - appFam2 : Fun -> NP -> NP -> CN ; -- two-place family: "line from x to y" + appFam2 : Fun2 -> NP -> NP -> CN ; -- two-place family: "line from x to y" appFamColl : Fun -> NP -> NP -> CN ; -- collective family: "path between x and y" -- Type constructor, similar to a family except that the argument is a type. @@ -65,10 +66,10 @@ oper predV1 = \F, x -> PredVP x (PosV F) ; predV2 = \F, x, y -> PredVP x (PosTV F y) ; predVColl = \F, x, y -> PredVP (conjNP x y) (PosV F) ; - predA1 = \F, x -> PredVP x (PosA F) ; + predA1 = \F, x -> PredVP x (PosA (AdjP1 F)) ; predA2 = \F, x, y -> PredVP x (PosA (ComplAdj F y)) ; predAComp = \F, x, y -> PredVP x (PosA (ComparAdjP F y)) ; - predAColl = \F, x, y -> PredVP (conjNP x y) (PosA F) ; + predAColl = \F, x, y -> PredVP (conjNP x y) (PosA (AdjP1 F)) ; predN1 = \F, x -> PredVP x (PosCN (UseN F)) ; predN2 = \F, x, y -> PredVP x (PosCN (AppFun F y)) ; predNColl = \F, x, y -> PredVP (conjNP x y) (PosCN (UseN F)) ; @@ -85,7 +86,8 @@ oper disjS = \A, B -> ConjS OrConj (TwoS A B) ; implS = \A, B -> SubjS IfSubj A B ; - ifThenS = \A,B -> SubjS IfSubj A {s = \\o => "then" ++ B.s ! o} ; --- not in Res + ifThenS = \A,B -> + SubjS IfSubj A {s = \\o => "then" ++ B.s ! o ; lock_S = <>} ; --- not in Res constrTyp1 = \F, A -> AppFun F (IndefManyNP A) ; diff --git a/grammars/resource/german/RestaurantDeu.gf b/grammars/resource/german/RestaurantDeu.gf index 3a6d6f8d6..8517533b1 100644 --- a/grammars/resource/german/RestaurantDeu.gf +++ b/grammars/resource/german/RestaurantDeu.gf @@ -1,3 +1,5 @@ +--# -path=.:../abstract:../../prelude + concrete RestaurantDeu of Restaurant = DatabaseDeu ** open Prelude,Paradigms,Deutsch,DatabaseRes in { @@ -10,7 +12,7 @@ lin Japanese = apReg "Japanisch" ; address = funVon (nFrau "Adresse") ; - phone = funVon (nFrau "Rufnummer") ; ---- + phone = funVon (nFrau "Rufnummer") ; --- priceLevel = funVon (nFrau "Preisstufe") ; Cheap = aReg "billig" ;