Skip to content

Instantly share code, notes, and snippets.

@inariksit
Last active March 4, 2022 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inariksit/83cec5f55ced6bece35a249b9ad73c9e to your computer and use it in GitHub Desktop.
Save inariksit/83cec5f55ced6bece35a249b9ad73c9e to your computer and use it in GitHub Desktop.
GF linrefs and the significance of the s field
abstract Fields = {
flags startcat = S ;
cat
S ; CN ; Adv ;
fun
ThereIs : CN -> S ; -- there is a house
ThereAre : CN -> S ; -- there are houses
ModCN : CN -> Adv -> CN ; -- house on a hill
house_CN : CN ;
on_a_hill_Adv : Adv ;
}
concrete FieldsEng of Fields = {
lincat
S, Adv = {s : Str} ;
-- This lincat is discontinuous just for the sake of example
CN = {
s : Number => Str ; -- house / houses
postmod : Str ; -- on a hill
} ;
-- Uncomment the linref to see how it affects parsing and linearisation of CN
{-
linref
CN = \cn -> cn.s ! Sg ++ cn.postmod ;
-}
param
Number = Sg | Pl ;
lin
-- : CN -> S ; -- there is a house / there are houses
ThereIs cn = {s = "there is" ++ cn.s ! Sg ++ cn.postmod} ;
ThereAre cn = {s = "there are" ++ cn.s ! Pl ++ cn.postmod} ;
-- : CN -> Adv -> CN ;
ModCN cn adv = cn ** { -- keep the CN's s field intact
postmod = cn.postmod ++ adv.s -- add the Adv to its postmod field
} ;
house_CN = {
s = table {
Sg => "house" ;
Pl => "houses"} ;
postmod = []} ;
on_a_hill_Adv = {s = "on a hill"} ;
}
{-
(1) When you run these files in a GF shell, try to parse and linearise in the category of CN.
Run these commands:
Fields> gt -depth=1 -cat=CN | l -treebank
Fields> p -cat=CN "house on a hill"
(2) Now, uncomment the linref for CN in this file, lines 11-14. Then try the commands again.
(3) Change the linref to just `CN = \cn -> cn.postmod ;`. What happens then?
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment