This repository has been archived by the owner on Jul 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoneb.pl
92 lines (80 loc) · 1.93 KB
/
oneb.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
% David Ly, lydavid1, 1001435501
bot sub [case, number, type, cat].
% declare features
case sub [nom,acc].
nom sub [].
acc sub [].
number sub [sing,plural].
sing sub [].
plural sub [].
type sub [noun, pronoun].
noun sub [].
pronoun sub [].
% declare the categories
cat sub [s,n,np,v,vp,p,pp,det].
s sub [].
n sub [] intro [case:case, number:number, type:type].
np sub [] intro [head:n]. % noun phrase with head as noun (top-level)
v sub [].
vp sub [] intro [obj_vp:np]. % verb phrase with object as np
p sub [].
pp sub [] intro [obj_pp:np]. % preposition phrase with object as np
det sub [].
% specify their grammar features
she ---> (n, case:nom, type:pronoun).
fed ---> v.
the ---> det.
dog ---> (n, number:sing).
puppies ---> (n, number:plural).
him ---> (n, case:acc, type:pronoun).
with ---> p.
% augment Grammar 2 with features so as to restrict it to the language of Grammar 1
% Grammar 1: S -> NP VP | PROnom VP
% Grammar 2: S -> NP VP
srule rule
s
===>
cat> (np, head:(case:nom)),
cat> (vp, obj_vp:(head:(case:acc))).
% Grammar 1: VP -> V NP | V PROacc
% Grammar 2: VP -> V NP
vp_rule rule
(vp, obj_vp:(head:(case:acc)))
===>
cat> v,
cat> (np, head:(case:acc)).
% Grammar 1: PP -> P NP | P PROacc
% Grammar 2: PP -> P NP
pp_rule rule
(pp, obj_pp:(head:(case:acc)))
===>
cat> p,
cat> (np, head:(case:acc)).
% Grammar 1: NP -> Npl PP
% Grammar 2: NP -> N PP
np_rule rule
(np, head:(number:plural, type:noun))
===>
cat> (n, number:plural, type:noun),
cat> pp.
% Grammar 1: NP -> Det Nsg | Det Npl
% Grammar 2: NP -> Det N
np_rule rule
(np, head:(type:noun))
===>
cat> det,
cat> (n, type:noun).
% Grammar 1: NP -> Det Nsg PP | Det Npl PP
% Grammar 2: NP -> Det N PP
np_rule rule
(np, head:(type:noun))
===>
cat> det,
cat> (n, type:noun),
cat> pp.
% Grammar 1: NP -> Npl | PROnom | PROacc
% Grammar 2: NP -> N
np_rule rule
(np, head:(number:plural, case:Case))
===>
cat> (n, number:plural, case:Case).