mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
added Facebook grammar from SummerSchool tutorial on best practices for grammar writing
This commit is contained in:
35
contrib/summerschool/2013/bestPractices/Facebook.gf
Normal file
35
contrib/summerschool/2013/bestPractices/Facebook.gf
Normal file
@@ -0,0 +1,35 @@
|
||||
abstract Facebook = {
|
||||
|
||||
flags startcat = Action ;
|
||||
|
||||
cat
|
||||
SPerson;
|
||||
Person;
|
||||
Place;
|
||||
Page;
|
||||
Action;
|
||||
Item ;
|
||||
|
||||
fun
|
||||
CheckIn : SPerson -> Place -> Action ;
|
||||
BeFriends : SPerson -> Person -> Action ;
|
||||
Like : SPerson -> Item -> Action ;
|
||||
|
||||
SPersonToPerson : SPerson -> Person ;
|
||||
MorePersons : SPerson -> Person -> Person ;
|
||||
|
||||
PlaceToItem : Place -> Item ;
|
||||
PageToItem : Page -> Item ;
|
||||
ActionToItem : Action -> Item ;
|
||||
|
||||
|
||||
---------
|
||||
|
||||
You : SPerson ;
|
||||
John : SPerson;
|
||||
Mary : SPerson;
|
||||
|
||||
Frauinsel : Place;
|
||||
GF : Page;
|
||||
|
||||
}
|
||||
14
contrib/summerschool/2013/bestPractices/FacebookEng.gf
Normal file
14
contrib/summerschool/2013/bestPractices/FacebookEng.gf
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
concrete FacebookEng of Facebook = FacebookI with
|
||||
(Syntax = SyntaxEng),
|
||||
(LexFacebook = LexFacebookEng) **
|
||||
open ParadigmsEng in {
|
||||
|
||||
lin
|
||||
You = you_NP ;
|
||||
John = mkNP (mkPN "John") ;
|
||||
Mary = mkNP (mkPN "Mary") ;
|
||||
Frauinsel = mkNP (mkPN "Frauinsel") ;
|
||||
GF = mkNP (mkPN "GF") ;
|
||||
|
||||
}
|
||||
29
contrib/summerschool/2013/bestPractices/FacebookI.gf
Normal file
29
contrib/summerschool/2013/bestPractices/FacebookI.gf
Normal file
@@ -0,0 +1,29 @@
|
||||
incomplete concrete FacebookI of Facebook =
|
||||
open
|
||||
Syntax,
|
||||
Prelude,
|
||||
LexFacebook
|
||||
in
|
||||
{
|
||||
lincat
|
||||
SPerson = NP ;
|
||||
Person = NP ;
|
||||
Place = NP ;
|
||||
Page = NP ;
|
||||
Action = S ;
|
||||
Item = NP ;
|
||||
|
||||
|
||||
lin
|
||||
SPersonToPerson sperson = sperson ;
|
||||
MorePersons sperson person = mkNP and_Conj sperson person ;
|
||||
|
||||
PlaceToItem place = place ;
|
||||
PageToItem page = page ;
|
||||
ActionToItem action = nounFromS action ;
|
||||
|
||||
CheckIn sperson place = mkS pastTense (mkCl sperson (checkIn place)) ;
|
||||
BeFriends sperson person = mkS pastTense (mkCl sperson (beFriends person)) ;
|
||||
Like sperson item = like sperson item ;
|
||||
|
||||
}
|
||||
8
contrib/summerschool/2013/bestPractices/LexFacebook.gf
Normal file
8
contrib/summerschool/2013/bestPractices/LexFacebook.gf
Normal file
@@ -0,0 +1,8 @@
|
||||
interface LexFacebook = open Syntax in
|
||||
{
|
||||
oper
|
||||
nounFromS : S -> NP ;
|
||||
checkIn : NP -> VP ;
|
||||
beFriends : NP -> VP ;
|
||||
like : NP -> NP -> S ;
|
||||
}
|
||||
16
contrib/summerschool/2013/bestPractices/LexFacebookEng.gf
Normal file
16
contrib/summerschool/2013/bestPractices/LexFacebookEng.gf
Normal file
@@ -0,0 +1,16 @@
|
||||
instance LexFacebookEng of LexFacebook =
|
||||
open SyntaxEng,
|
||||
ParadigmsEng,
|
||||
--ExtraEng,
|
||||
IrregEng in
|
||||
{
|
||||
oper
|
||||
nounFromS s = mkNP (mkNP the_Det (mkCN (mkN "fact"))) (SyntaxEng.mkAdv that_Subj s) ;
|
||||
|
||||
checkIn np = mkVP (mkV2 (partV (mkV "check") "in") (mkPrep "to")) np ;
|
||||
|
||||
beFriends np = mkVP (mkVP (dirV2 become_V) (mkNP a_Art plNum (mkCN (mkN "friend")))) (SyntaxEng.mkAdv (mkPrep "with") np) ;
|
||||
|
||||
like np1 np2 = mkS (mkCl np1 (mkVP (dirV2 (mkV "like")) np2)) ;
|
||||
|
||||
}
|
||||
7
contrib/summerschool/2013/bestPractices/corpus.txt
Normal file
7
contrib/summerschool/2013/bestPractices/corpus.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
You and John are now friends. You became friends with John.
|
||||
You became friends with John and Mary.
|
||||
You checked in to Frauinsel.
|
||||
You like GF.
|
||||
You like Frauinsel.
|
||||
You like that John checked in to Frauinsel.
|
||||
You like that you became friends with John and Mary.
|
||||
Reference in New Issue
Block a user