mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 19:22:50 -06:00
Extending resource.
This commit is contained in:
33
grammars/database/Database.gf
Normal file
33
grammars/database/Database.gf
Normal file
@@ -0,0 +1,33 @@
|
||||
abstract Database = {
|
||||
|
||||
flags startcat=Query ;
|
||||
|
||||
cat
|
||||
Query ;
|
||||
Category ; Subject ; Value ; Property ; Relation ; Comparison ; Name ;
|
||||
Feature ;
|
||||
|
||||
fun
|
||||
WhichAre : Category -> Property -> Query ;
|
||||
IsThere : Category -> Query ;
|
||||
AreThere : Category -> Query ;
|
||||
IsIt : Subject -> Property -> Query ;
|
||||
WhatIs : Value -> Query ;
|
||||
|
||||
MoreThan : Comparison -> Subject -> Property ;
|
||||
TheMost : Comparison -> Category -> Value ;
|
||||
Relatively : Comparison -> Category -> Property ;
|
||||
|
||||
RelatedTo : Relation -> Subject -> Property ;
|
||||
|
||||
Individual : Name -> Subject ;
|
||||
AllN : Category -> Subject ;
|
||||
Any : Category -> Subject ;
|
||||
MostN : Category -> Subject ;
|
||||
EveryN : Category -> Subject ;
|
||||
|
||||
FeatureOf : Feature -> Subject -> Subject ;
|
||||
ValueOf : Feature -> Name -> Value ;
|
||||
|
||||
WithProperty : Category -> Property -> Category ;
|
||||
} ;
|
||||
43
grammars/database/DatabaseEng.gf
Normal file
43
grammars/database/DatabaseEng.gf
Normal file
@@ -0,0 +1,43 @@
|
||||
--# -path=.:../resource/nabstract:../resource/nenglish:../prelude
|
||||
|
||||
concrete DatabaseEng of Database = open Prelude, ResEng in {
|
||||
|
||||
flags lexer=text ; unlexer=text ;
|
||||
|
||||
lincat
|
||||
Query = Phr ;
|
||||
Subject = NP ;
|
||||
Category = CN ;
|
||||
Property = AP ;
|
||||
Comparison = AdjDeg ;
|
||||
Relation = Adj2 ;
|
||||
Feature = Fun ;
|
||||
Value = NP ;
|
||||
Name = PN ;
|
||||
|
||||
lin
|
||||
WhichAre A B = QuestPhrase (IntVP (NounIPMany A) (PosA B)) ;
|
||||
IsThere A = QuestPhrase (IsThereCN A) ;
|
||||
AreThere A = QuestPhrase (AreThereCN A) ;
|
||||
WhatIs val = QuestPhrase (IntVP WhatOne (PosNP val)) ;
|
||||
IsIt Q A = QuestPhrase (QuestVP Q (PosA A)) ;
|
||||
|
||||
MoreThan = ComparAdjP ;
|
||||
TheMost = SuperlNP ;
|
||||
Relatively C _ = PositAdjP C ;
|
||||
|
||||
RelatedTo = ComplAdj ;
|
||||
|
||||
FeatureOf f x = DefOneNP (AppFun f x) ;
|
||||
ValueOf f x = DefOneNP (AppFun f (UsePN x)) ;
|
||||
|
||||
WithProperty A B = ModAdj B A ;
|
||||
|
||||
Individual = UsePN ;
|
||||
|
||||
AllN = DetNP AllDet ;
|
||||
MostN = DetNP MostDet ;
|
||||
EveryN = DetNP EveryDet ;
|
||||
Any = DetNP AnysDet ;
|
||||
|
||||
} ;
|
||||
11
grammars/database/DatabaseEngRes.gf
Normal file
11
grammars/database/DatabaseEngRes.gf
Normal file
@@ -0,0 +1,11 @@
|
||||
resource DatabaseEngRes = open Prelude in {
|
||||
oper
|
||||
mkSent : SS -> SS -> SS1 Bool = \long, short ->
|
||||
{s = table {b => if_then_else Str b long.s short.s}} ;
|
||||
|
||||
mkSentPrel : Str -> SS -> SS1 Bool = \prel, matter ->
|
||||
mkSent (ss (prel ++ matter.s)) matter ;
|
||||
|
||||
mkSentSame : SS -> SS1 Bool = \s ->
|
||||
mkSent s s ;
|
||||
} ;
|
||||
16
grammars/database/Restaurant.gf
Normal file
16
grammars/database/Restaurant.gf
Normal file
@@ -0,0 +1,16 @@
|
||||
abstract Restaurant = Database ** {
|
||||
|
||||
fun
|
||||
Restaurant, Bar : Category ;
|
||||
French, Italian, Indian, Japanese : Property ;
|
||||
address, phone, priceLevel : Feature ;
|
||||
Cheap, Expensive : Comparison ;
|
||||
|
||||
WhoRecommend : Name -> Query ;
|
||||
WhoHellRecommend : Name -> Query ;
|
||||
|
||||
-- examples of restaurant names
|
||||
LucasCarton : Name ;
|
||||
LaCoupole : Name ;
|
||||
BurgerKing : Name ;
|
||||
} ;
|
||||
30
grammars/database/RestaurantEng.gf
Normal file
30
grammars/database/RestaurantEng.gf
Normal file
@@ -0,0 +1,30 @@
|
||||
--# -path=.:../resource/nabstract:../resource/nenglish:../prelude
|
||||
|
||||
concrete RestaurantEng of Restaurant =
|
||||
DatabaseEng ** open Prelude,ParadigmsEng in {
|
||||
|
||||
lin
|
||||
Restaurant = cnNonhuman "restaurant" ;
|
||||
Bar = cnNonhuman "bar" ;
|
||||
French = apReg "French" ;
|
||||
Italian = apReg "Italian" ;
|
||||
Indian = apReg "Indian" ;
|
||||
Japanese = apReg "Japanese" ;
|
||||
|
||||
address = funNonhuman "address" ;
|
||||
phone = funNonhuman ["number"] ; --- phone
|
||||
priceLevel = funNonhuman ["level"] ; --- price
|
||||
|
||||
Cheap = aReg "cheap" ;
|
||||
Expensive = aRidiculous "expensive" ;
|
||||
|
||||
WhoRecommend rest =
|
||||
ss (["who recommended"] ++ rest.s ! nominative) ** {lock_Phr = <>} ;
|
||||
WhoHellRecommend rest =
|
||||
ss (["who the hell recommended"] ++ rest.s ! nominative) ** {lock_Phr = <>} ;
|
||||
|
||||
LucasCarton = pnReg ["Lucas Carton"] ;
|
||||
LaCoupole = pnReg ["La Coupole"] ;
|
||||
BurgerKing = pnReg ["Burger King"] ;
|
||||
|
||||
} ;
|
||||
Reference in New Issue
Block a user