forked from GitHub/gf-core
experiment with dep resource
This commit is contained in:
18
grammars/dep/App.gf
Normal file
18
grammars/dep/App.gf
Normal file
@@ -0,0 +1,18 @@
|
||||
abstract App = {
|
||||
cat
|
||||
S ; Q ;
|
||||
NP ; QP ;
|
||||
V ; V2 ;
|
||||
|
||||
fun
|
||||
SPredV : NP -> V -> S ;
|
||||
SPredV2 : NP -> V -> NP -> S ;
|
||||
QPredV : QP -> V -> Q ;
|
||||
QPredV2 : QP -> V -> NP -> Q ;
|
||||
|
||||
aJohn : NP ;
|
||||
aWho : QP ;
|
||||
|
||||
aWalk : V ;
|
||||
aLove : V2 ;
|
||||
}
|
||||
21
grammars/dep/AppEng.gf
Normal file
21
grammars/dep/AppEng.gf
Normal file
@@ -0,0 +1,21 @@
|
||||
concrete AppEng of App = open DepEng in {
|
||||
lincat
|
||||
S = SG ;
|
||||
Q = SG ;
|
||||
NP = NG ;
|
||||
QP = NG ;
|
||||
V = VG ;
|
||||
V2 = VG ;
|
||||
|
||||
lin
|
||||
SPredV np v = MkSG NtS Vt1 np v CG1 ;
|
||||
SPredV2 np v y = MkSG NtS Vt2 np v (CG2 y) ;
|
||||
QPredV np v = MkSG NtQ Vt1 np v CG1 ;
|
||||
QPredV2 np v y = MkSG NtQ Vt2 np v (CG2 y) ;
|
||||
|
||||
aJohn = John ;
|
||||
aWho = Who ;
|
||||
|
||||
aWalk = Walk ;
|
||||
aLove = Love ;
|
||||
}
|
||||
25
grammars/dep/Dep.gf
Normal file
25
grammars/dep/Dep.gf
Normal file
@@ -0,0 +1,25 @@
|
||||
abstract Dep = {
|
||||
cat
|
||||
NType ;
|
||||
VType ;
|
||||
SG NType ;
|
||||
NG NType ;
|
||||
VG VType ;
|
||||
CG VType ;
|
||||
|
||||
|
||||
fun
|
||||
NtS, NtQ : NType ;
|
||||
Vt1, Vt2, VtS : VType ;
|
||||
|
||||
MkSG : (n : NType) -> (v : VType) -> NG n -> VG v -> CG v -> SG n ;
|
||||
|
||||
CG1 : CG Vt1 ;
|
||||
CG2 : NG NtS -> CG Vt2 ;
|
||||
|
||||
John : NG NtS ;
|
||||
Who : NG NtQ ;
|
||||
|
||||
Walk : VG Vt1 ;
|
||||
Love : VG Vt2 ;
|
||||
}
|
||||
26
grammars/dep/DepEng.gf
Normal file
26
grammars/dep/DepEng.gf
Normal file
@@ -0,0 +1,26 @@
|
||||
-- to test:
|
||||
-- p -cat=SG -tr "who walks" | pt -transform=typecheck -tr | l
|
||||
|
||||
concrete DepEng of Dep = {
|
||||
lincat
|
||||
NType, VType = {s : Str} ;
|
||||
SG = {s : Str} ;
|
||||
NG = {s : Str} ;
|
||||
VG = {s : Str} ;
|
||||
CG = {s : Str} ;
|
||||
|
||||
lin
|
||||
NtS, NtQ = {s = []} ;
|
||||
Vt1, Vt2, VtS = {s = []} ;
|
||||
|
||||
MkSG n v ng vg cg = {s = n.s ++ v.s ++ ng.s ++ vg.s ++ cg.s} ;
|
||||
|
||||
CG1 = {s = []} ;
|
||||
CG2 ng = ng ;
|
||||
|
||||
John = {s = "John"} ;
|
||||
Who = {s = "who"} ;
|
||||
|
||||
Walk = {s = "walks"} ;
|
||||
Love = {s = "loves"} ;
|
||||
}
|
||||
Reference in New Issue
Block a user