mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-22 17:42:51 -06:00
Changed some function names, added derived libraries.
This commit is contained in:
@@ -172,11 +172,11 @@ fun
|
||||
DetNP : Det -> CN -> NP ; -- "every car"
|
||||
MassNP : CN -> NP ; -- "wine"
|
||||
IndefOneNP : CN -> NP ; -- "a car", "cars"
|
||||
IndefManyNP : Num -> CN -> NP ; -- "houses", "86 houses"
|
||||
IndefNumNP : Num -> CN -> NP ; -- "houses", "86 houses"
|
||||
DefOneNP : CN -> NP ; -- "the car"
|
||||
DefManyNP : Num -> CN -> NP ; -- "the cars", "the 86 cars"
|
||||
DefNumNP : Num -> CN -> NP ; -- "the cars", "the 86 cars"
|
||||
ModGenOne : NP -> CN -> NP ; -- "John's car"
|
||||
ModGenMany : Num -> NP -> CN -> NP ; -- "John's cars", "John's 86 cars"
|
||||
ModGenNum : Num -> NP -> CN -> NP ; -- "John's cars", "John's 86 cars"
|
||||
AppFun : Fun -> NP -> CN ; -- "successor of zero"
|
||||
AppFun2 : Fun2 -> NP -> Fun ; -- "flight from Paris"
|
||||
CNthatS : CN -> S -> CN ; -- "idea that the Earth is flat"
|
||||
|
||||
82
lib/resource-0.6/abstract/Predication.gf
Normal file
82
lib/resource-0.6/abstract/Predication.gf
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
--1 A Small Predication Library
|
||||
--
|
||||
-- (c) Aarne Ranta 2003 under Gnu GPL.
|
||||
--
|
||||
-- This library is built on a language-independent API of
|
||||
-- resource grammars. It has a common part, the type signatures
|
||||
-- (defined here), and language-dependent parts. The user of
|
||||
-- the library should only have to look at the type signatures.
|
||||
|
||||
incomplete resource Predication = open Resource, ResourceExt in {
|
||||
|
||||
-- We first define a set of predication patterns.
|
||||
|
||||
oper
|
||||
predV1 : V -> NP -> S ; -- one-place verb: "John walks"
|
||||
predV2 : TV -> NP -> NP -> S ; -- two-place verb: "John loves Mary"
|
||||
predVColl : V -> NP -> NP -> S ; -- collective verb: "John and Mary fight"
|
||||
predA1 : Adj1 -> NP -> S ; -- one-place adjective: "John is old"
|
||||
predA2 : Adj2 -> NP -> NP -> S ; -- two-place adj: "John is married to Mary"
|
||||
predAComp : AdjDeg -> NP -> NP -> S ; -- compar adj: "John is older than Mary"
|
||||
predAColl : Adj1 -> NP -> NP -> S ; -- collective adj: "John and Mary are married"
|
||||
predN1 : N -> NP -> S ; -- one-place noun: "John is a man"
|
||||
predN2 : Fun -> NP -> NP -> S ; -- two-place noun: "John is a lover of Mary"
|
||||
predNColl : N -> NP -> NP -> S ; -- collective noun: "John and Mary are lovers"
|
||||
|
||||
-- Individual-valued function applications.
|
||||
|
||||
appFun1 : Fun -> NP -> NP ; -- one-place function: "the successor of x"
|
||||
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"
|
||||
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.
|
||||
|
||||
constrTyp1 : Fun -> CN -> CN ;
|
||||
|
||||
-- Logical connectives on two sentences.
|
||||
|
||||
conjS : S -> S -> S ;
|
||||
disjS : S -> S -> S ;
|
||||
implS : S -> S -> S ;
|
||||
|
||||
-- As an auxiliary, we need two-place conjunction of names ("John and Mary"),
|
||||
-- used in collective predication.
|
||||
|
||||
conjNP : NP -> NP -> NP ;
|
||||
|
||||
-----------------------------
|
||||
|
||||
---- what follows should be an implementation of the preceding
|
||||
|
||||
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 (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 (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)) ;
|
||||
|
||||
appFun1 = \f, x -> DefOneNP (AppFun f x) ;
|
||||
appFunColl = \f, x, y -> DefOneNP (AppFun f (conjNP x y)) ;
|
||||
|
||||
appFam1 = \F, x -> AppFun F x ;
|
||||
appFamColl = \F, x, y -> AppFun F (conjNP x y) ;
|
||||
|
||||
conjS = \A, B -> ConjS AndConj (TwoS A B) ;
|
||||
disjS = \A, B -> ConjS OrConj (TwoS A B) ;
|
||||
implS = \A, B -> SubjS IfSubj A B ;
|
||||
|
||||
constrTyp1 = \F, A -> AppFun F (IndefManyNP A) ;
|
||||
|
||||
conjNP = \x, y -> ConjNP AndConj (TwoNP x y) ;
|
||||
|
||||
} ;
|
||||
36
lib/resource-0.6/abstract/ResourceExt.gf
Normal file
36
lib/resource-0.6/abstract/ResourceExt.gf
Normal file
@@ -0,0 +1,36 @@
|
||||
incomplete resource ResourceExt = open Resource in {
|
||||
|
||||
-- Mostly for compatibility with old API (v 0.4). Also for
|
||||
-- special cases of plural determiners without numerals.
|
||||
-- AR 12/1/2004
|
||||
|
||||
oper
|
||||
|
||||
PosV : V -> VP = \x -> PosVG (PredV x) ;
|
||||
NegV : V -> VP = \x -> NegVG (PredV x) ;
|
||||
PosTV : TV -> NP -> VP = \x,y -> PosVG (PredTV x y) ;
|
||||
NegTV : TV -> NP -> VP = \x,y -> NegVG (PredTV x y) ;
|
||||
PosA : AP -> VP = \x -> PosVG (PredAP x) ;
|
||||
NegA : AP -> VP = \x -> NegVG (PredAP x) ;
|
||||
PosCN : CN -> VP = \x -> PosVG (PredCN x) ;
|
||||
NegCN : CN -> VP = \x -> NegVG (PredCN x) ;
|
||||
|
||||
IndefManyNP : CN -> NP = IndefNumNP NoNum ;
|
||||
DefManyNP : CN -> NP = DefNumNP NoNum ;
|
||||
ModGenMany : NP -> CN -> NP = ModGenNum NoNum ;
|
||||
|
||||
WeNP : NP = WeNumNP NoNum ;
|
||||
YeNP : NP = YeNumNP NoNum ;
|
||||
|
||||
TheseNP : NP = TheseNumNP NoNum ;
|
||||
ThoseNP : NP = ThoseNumNP NoNum ;
|
||||
|
||||
AllDet : Det = AllNumDet NoNum ;
|
||||
WhichsDet : Det = WhichNumDet NoNum ;
|
||||
SomesDet : Det = SomeNumDet NoNum ;
|
||||
AnysDet : Det = AnyNumDet NoNum ;
|
||||
NosDet : Det = NoNumDet NoNum ;
|
||||
TheseDet : Det = TheseNumDet NoNum ;
|
||||
ThoseDet : Det = ThoseNumDet NoNum ;
|
||||
|
||||
} ;
|
||||
@@ -17,19 +17,19 @@ fun
|
||||
-- Many plural determiners can take a numeral modifier. So can the plural
|
||||
-- pronouns "we" and "you".
|
||||
|
||||
EveryDet, WhichDet, AllDet, -- every, sg which, sg all
|
||||
EveryDet, WhichDet, AllMassDet, -- every, sg which, sg all
|
||||
SomeDet, AnyDet, NoDet, -- sg some, any, no
|
||||
MostDet, MostsDet, ManyDet, MuchDet : Det ; -- sg most, pl most, many, much
|
||||
ThisDet, ThatDet : Det ; -- this, that
|
||||
|
||||
AllsDet, WhichsDet, -- pl all, which (86)
|
||||
SomesDet, AnysDet, NosDet, -- pl some, any, no
|
||||
TheseDet, ThoseDet : Num -> Det ; -- these, those (86)
|
||||
AllNumDet, WhichNumDet, -- pl all, which (86)
|
||||
SomeNumDet, AnyNumDet, NoNumDet, -- pl some, any, no
|
||||
TheseNumDet, ThoseNumDet : Num -> Det ; -- these, those (86)
|
||||
|
||||
ThisNP, ThatNP : NP ; -- this, that
|
||||
TheseNP, ThoseNP : Num -> NP ; -- these, those (86)
|
||||
TheseNumNP, ThoseNumNP : Num -> NP ; -- these, those (86)
|
||||
INP, ThouNP, HeNP, SheNP, ItNP : NP ; -- personal pronouns in singular
|
||||
WeNP, YeNP : Num -> NP ; -- these pronouns can take numeral
|
||||
WeNumNP, YeNumNP : Num -> NP ; -- these pronouns can take numeral
|
||||
TheyNP : NP ; YouNP : NP ; -- they, the polite you
|
||||
|
||||
EverybodyNP, SomebodyNP, NobodyNP, -- everybody, somebody, nobody
|
||||
|
||||
Reference in New Issue
Block a user