-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrules.tdl
351 lines (230 loc) · 10.2 KB
/
rules.tdl
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
;;; -*- Mode: TDL; Coding: utf-8 -*-
head-comp := head-comp-phrase.
;; SSH 2015-04-21: The subject cannot be indefinite.
subj-head := subj-head-phrase & [ STYLE robust ].
spr-head := spr-head-phrase & [ STYLE robust ].
;; SSH 2015-04-20: head-spec-hs is now divided into two rules.
;; head-spec-deg: [[有 多] 高兴]
;; ZZF 2015-9-30: taking out "STYLE robust," to allow "很 甜"
spr-head-noncl := spr-head-h-sem-phrase &
"""
head specifier rule used for adjectives and adverbs.
"""
[ NON-HEAD-DTR.SYNSEM.LOCAL.CAT.HEAD +jr ].
; HEAD-DTR.SYNSEM.LOCAL.CAT.HEAD +jrp,
;spr-head-d := spr-head-h-sem-phrase &
;"""
; [LMC] It seems it wasn't being used.
;;; head-spec-d: [[我 的] 猫]
;head specifier rule used for determiners.
;"""
; [ STYLE robust,
; HEAD-DTR.SYNSEM [ LOCAL [ CAT.HEAD det,
; CONT.HOOK.INDEX.COG-ST uniq-or-more ] ] ].
;; head-spec-cl: [[一 只] 猫]
;; ZZF 20161123 changed COG-ST "type-id" to "cog-st" (underspecified), to allow combining with determiners, which is "uniq+fam+act". Example: [[这 [两 只]] 猫]. To be refined with Sanghoun when reviewing definiteness.
spr-head-cl := spr-head-h-sem-phrase &
"""
This a version of the specifier head to join numerals with classifiers.
It inherits from 'spr-head-h-sem-phrase' and 'basic-head-spr-phrase' that is also used to join degree specifiers to adjectives and certain verbs.
In order to be more useful to capture 两 vs 二 distinction, we can further restrict the NON-HEAD-DTR to only allow
This will all have to be revised during the Marie Curie.
Added [NON-HEAD-DTR.SYNSEM.LOCAL.CAT.HEAD [CARDINAL +]] to require that the numeral in this construction be compatible with CARDINAL +. Currently only 二 is marked as [CARDINAL -].
"""
[ STYLE robust,
NON-HEAD-DTR.SYNSEM.LOCAL.CAT.HEAD [CARDINAL +],
HEAD-DTR.SYNSEM [ LOCAL [ CAT.HEAD classifier,
CONT.HOOK.INDEX.COG-ST cog-st ] ] ].
;spr-headn-hs := spr-head-nom-h-sem-phrase & [ STYLE robust ]
;"""
; [LMC] This didn't seem to ever be used.
;""".
;==============================================
; LMC&FCB trying to solve some ambiguity:
; it is not clear why bare-s existed... might
; be breaking some things.
;
; bare-s := bare-s-phrase.
;===============================================
; bare-adv := bare-adv-phrase.
;==============================================
; LMC&FCB trying to solve some ambiguity:
; we might not need bare-adv
bare-np := bare-np-phrase
"""
Noun-phrases without a determiner phrase (with or without classifiers).
<ex> 她 喜欢 猫 。
<ex> 她 买 了 两 只 猫 。
Both (猫) and (两 只 猫) are bare NPs.
""".
;;assuming nominalization is done using adj+DE
;;0-nom-j := bare-nominal-adj-phrase.
0-nom-p := bare-nominal-postp-phrase.
0-nom-d := bare-nominal-det-cl-phrase.
0-nom-d-nocl := bare-nominal-det-nocl-phrase.
0-nom-cls := bare-nominal-cls-phrase.
rbst-meas-np := meas-np-phrase
"""
This rule is currently marked as robust because it allows both common and measure nouns to be modified by a numeral without a classifier. While this is needed to some classes of nouns/cl (measure words) like 'cup' 'kilo' etc, it should definitely not be acceptable with common nouns.
There is currently no implementation of measure words, and they are sprinkled both as classifiers and common nouns. For this reason, it is not true that everything this mal-rule picks up is, in fact, ungrammatical.
This needs to be solved in the near future (during Marie Curie).
""".
;;FB & ZZF 4/11/2015 comment out this rule as there's bare-np rule to handle this
;generic-np := generic-np-phrase.
;; SSH 2014-09-04: STYLE
comp-head := comp-head-phrase &
[ STYLE #style,
HEAD-DTR.STYLE #style ].
;rel-cl := relative-clause.
; Rule instances for head-modifier structures. Corresponding types
; are defined in matrix.tdl. The matrix customization script did
; not need to add any further constraints, so no corresponding tyes
; appear in mandarin chinese.tdl
;;FB & ZZF 4-11-2015change rule name from "head-adj-int" to "head-mod-int", from "adj-head-int" to "mod-head"
head-mod-int := head-adj-int-phrase &
[ STYLE #style,
NON-HEAD-DTR.STYLE #style ].
; mod-head-int := adj-head-int-mc & [ STYLE #style, ;;; this is the old (unsplit) version
; NON-HEAD-DTR.STYLE #style ].
mod-head-int := adj-head-int-noncls &
"""
mod-head only for non classifiers.
"""
[ STYLE #style,
NON-HEAD-DTR.STYLE #style ].
mod-head-int-cls := adj-head-int-cls &
"""
mod-head only for classifiers.
"""
[ STYLE #style,
NON-HEAD-DTR.STYLE #style ].
head-mod-scop := head-adj-scop-phrase & [ STYLE robust ].
mod-head-scop := adj-head-scop-phrase & [ STYLE robust ].
n1-top-coord := n1-top-coord-rule & [ STYLE robust ].
n1-mid-coord := n1-mid-coord-rule & [ STYLE robust ].
conj-coord := bottom-coord-rule & [ STYLE robust ].
vp1-top-coord := vp1-top-coord-rule & [ STYLE robust ].
s1-top-coord := s1-top-coord-rule & [ STYLE robust ].
; #|
; n3-top-coord := n3-top-coord-rule.
; n3-bottom-coord := n3-bottom-coord-rule.
; np3-top-coord := np3-top-coord-rule.
; np3-bottom-coord := np3-bottom-coord-rule.
; vp3-top-coord := vp3-top-coord-rule.
; vp3-bottom-coord := vp3-bottom-coord-rule.
; s3-bottom-coord := s3-bottom-coord-rule.
; n4-top-coord := n4-top-coord-rule.
; n4-mid-coord := n4-mid-coord-rule.
; n4-bottom-coord := n4-bottom-coord-rule.
; n5-top-coord := n5-top-coord-rule.
; n5-mid-coord := n5-mid-coord-rule.
; n5-bottom-coord := n5-bottom-coord-rule.
; np5-top-coord := np5-top-coord-rule.
; np5-mid-coord := np5-mid-coord-rule.
; np5-bottom-coord := np5-bottom-coord-rule.
; vp5-top-coord := vp5-top-coord-rule.
; vp5-mid-coord := vp5-mid-coord-rule.
; vp5-bottom-coord := vp5-bottom-coord-rule.
; s5-top-coord := s5-top-coord-rule.
; s5-mid-coord := s5-mid-coord-rule.
; s5-bottom-coord := s5-bottom-coord-rule.
; s6-top-coord := s6-top-coord-rule.
; s6-mid-coord := s6-mid-coord-rule.
; s6-bottom-coord := s6-bottom-coord-rule.
; s7-top-coord := s7-top-coord-rule.
; s7-mid-coord := s7-mid-coord-rule.
; s7-bottom-coord := s7-bottom-coord-rule.
; |#
opt-comp := head-opt-comp-phrase & [ STYLE robust ].
;;ZZF/FB/LMC 2016-3-16 allow subj to be optional
opt-subj-decl := opt-subj-declarative-phrase & [ STYLE robust ].
opt-subj-imp := opt-subj-imperative-phrase & [ STYLE robust ].
;; SSH/ZZF 2015-04-08: 张三 李四 追 了 (i.e. SOV)
comp-head-final := comp-head-final-phrase & [ STYLE robust ].
filler-head := filler-head-phrase & [ STYLE robust ].
extracted-comp := extracted-comp-phrase.
extracted-subj := extracted-subj-phrase.
;; Overenthusiastic
;; sent-subj := sent-subj-phrase.
n-n-compound := noun-noun-compound-phrase.
prn-n-compound := pronoun-noun-compound-phrase.
prp-n-compound := propernoun-noun-compound-phrase.
n-prp-compound := noun-proper-compound-phrase.
;de-n-compound := nom-de-noun-compound-phrase.
;============================================================================
; RESULTATIVE CONSTRUCTIONS
;============================================================================
rslt-1_12 := rslt-1_12-phrase &
[ NON-HEAD-DTR.SYNSEM.LOCAL.CAT.VAL.COMPS < [ OPT - ] > ].
rslt-12_12 := rslt-12_12-phrase.
rslt-1_1-sbj := rslt-1_1-sbj-phrase.
rslt-1_1-obj := rslt-1_1-obj-phrase &
[ SYNSEM.LOCAL.CAT.VAL.COMPS < [ OPT - ] > ].
rslt-1_1-ns := rslt-1_1-noshare-phrase &
[ HEAD-DTR.SYNSEM.LOCAL.CAT.VAL.SUBJ < unexpressed & [ OPT + ] > ].
rslt-12_1-sbj := rslt-12_1-sbj-phrase.
rslt-12_1-obj := rslt-12_1-obj-phrase.
rslt-12_1-inv := rslt-12_1-inv-phrase &
[ HEAD-DTR.SYNSEM.LOCAL.CAT.VAL.COMPS < [ OPT - ] > ].
;; li:90 (p. 200)
;;张三 带 给 李四 苹果
rslt-12_123 := rslt-compound-phrase &
[ SYNSEM.LOCAL.CAT.VAL [ SUBJ.FIRST #subj,
COMPS < #comp1, #comp2 > ],
HEAD-DTR.SYNSEM.LOCAL.CAT.VAL [ SUBJ.FIRST #subj,
COMPS < #comp1 > ],
NON-HEAD-DTR.SYNSEM.LOCAL.CAT [ HEAD.CHAR.WCHAR "给",
VAL [ SUBJ.FIRST #subj,
COMPS < #comp1, #comp2 > ] ] ].
;; li:90 (p. 200)
;;张三 送 给 李四 苹果
rslt-123_123 := rslt-compound-phrase &
[ SYNSEM.LOCAL.CAT.VAL [ SUBJ.FIRST #subj,
COMPS < #comp1, #comp2 > ],
HEAD-DTR.SYNSEM.LOCAL.CAT.VAL [ SUBJ.FIRST #subj,
COMPS < #comp1, #comp2 > ],
NON-HEAD-DTR.SYNSEM.LOCAL.CAT [ HEAD.CHAR.WCHAR "给",
VAL [ SUBJ.FIRST #subj,
COMPS < #comp1, #comp2 > ] ] ].
;============================================================================
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Newly introduced phrase structure rules
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
np-num := np-num-phrase
"""
Rule to pump numbers nouns.
""".
np-time-adp := np-time-adp-phrase.
rbst-np-place-adp := np-place-adp-phrase
"""
This is a rule that allows certain NP (i.e. mostly headed by locative relational nouns) to assume the role of an adjunct.
This is currently marked as robust because it is understood that in the majority of cases these locative adjuncts need to be included in a 在 phrase. However, in casual speech (not writting) and certain syntactic contexts (e.g. imperatives/suggestions) this is not necessary.
""".
comp-marker := comp-marker-phrase.
marker-comp := marker-comp-phrase &
[ NON-HEAD-DTR.SYNSEM [ L-PERIPH na-or--,
R-PERIPH na-or--,
LOCAL.CAT [ HEAD marker ] ] ].
punct-comp := marker-comp-phrase &
[ NON-HEAD-DTR.SYNSEM.LOCAL.CAT [ HEAD punct ] ].
head-2nd-comp := head-2nd-comp-phrase
"""
;ZZF/SSH 2015-04-01 to handle variations of ditransitive verbs
This is a rule has been restricted to refer to prepositional complements.
It seems like for sentences such as:
她 发 (给 你) (一 本 书) 。
We do need this head-2nd-comp rule. It performs the should be the same as head-comp, but it assumes the order of complements have shifted in the process.
她 发 (一 本 书) (给 你) 。
Can use the normal head-comp twice so it the grammar currently sees 发 as taking an NP + PP .
If we give it a PP+ NP then we are taking the second complement first, hence the need to use this head-2nd-comp.
""".
q-phrase := question-phrase.
;;;;discoursal structures
np-voc-adp := np-voc-adp-phrase.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Fragments
;;;
frg-np := frag-np-rule.
frag-vmod-int := frag-vmod-int-rule.
frag-vmod-scop := frag-vmod-scop-rule.