Created
March 24, 2023 14:13
-
-
Save inariksit/e4968f5566164b2578351ea8a8760f23 to your computer and use it in GitHub Desktop.
How to use GF lists in Foods grammar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract FoodsList = { | |
flags coding = utf8 ; | |
flags startcat = Comment ; | |
cat | |
Comment ; Item ; Kind ; Quality ; | |
[Comment]{2} ; -- List of Comments | |
fun | |
-- BaseComment and ConsComment are added automatically | |
-- We only have to define a function from list to a single comment | |
Repeat : [Comment] -> Comment ; | |
Pred : Item -> Quality -> Comment ; | |
This, That : Kind -> Item ; | |
Mod : Quality -> Kind -> Kind ; | |
Wine, Cheese, Fish : Kind ; | |
Very : Quality -> Quality ; | |
Fresh, Warm, Italian,Expensive, Delicious, Boring : Quality ; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
concrete FoodsListEng of FoodsList = open Prelude, Coordination in { | |
lincat | |
Comment, Item, Kind, Quality = SS ; -- from Prelude | |
[Comment] = Coordination.ListX ; -- from Coordination | |
lin | |
-- We still have to define linearisations for the list funs | |
BaseComment = Coordination.twoSS ; | |
ConsComment = Coordination.consrSS "," ; | |
Repeat = Coordination.conjunctSS (ss "and") ; | |
Pred i q = cc3 i (ss "is") q ; | |
This = cc2 (ss "this") ; | |
That = cc2 (ss "that") ; | |
Mod = cc2 ; | |
Wine = ss "wine" ; | |
Cheese = ss "cheese" ; | |
Fish = ss "fish" ; | |
Fresh = ss "fresh" ; | |
Warm = ss "warm" ; | |
Italian = ss "Italian" ; | |
} | |
{- | |
FoodsList> gr Repeat ? | l -treebank | |
FoodsList: Repeat (ConsComment (Pred (This Wine) Fresh) (BaseComment (Pred (This Wine) Warm) (Pred (That Wine) Warm))) | |
FoodsListEng: this wine is fresh , this wine is warm and that wine is warm | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment