-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathud-lang-model-enhancement.proto.txt
215 lines (215 loc) · 6.73 KB
/
ud-lang-model-enhancement.proto.txt
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
rulegroup {
name: "Conjunctions"
priority: 1
rule {
name: "np conjunction"
# "Bill" and "Dave"
priority: 1
tregex: "/^l-conj$/=relation $ /^t-(?:NOUN|PROPN|PRON|ADJ)$/ < /^t-(?:NOUN|PROPN|PRON)$/"
transformation {
target: "relation"
action: CHANGE_LABEL
label: "l-conj-np"
}
}
rule {
name: "adj conjunction"
# "red" and "blue"
priority: 1
tregex: "/^l-conj$/=relation $ /^t-(?:ADJ)$/ < /^t-(?:ADJ)$/"
transformation {
target: "relation"
action: CHANGE_LABEL
label: "l-conj-adj"
}
}
rule {
name: "sentence conjunction"
# Cameron "directed" Titanic and Spielber "produced" Transformers.
priority: 1
tregex: "/^l-conj$/=relation $ /^t-(?:VERB)$/ < /^l-dobj$/ < /^l-nsubj$/ < /^t-(?:VERB)$/"
transformation {
target: "relation"
action: CHANGE_LABEL
label: "l-conj-sent"
}
}
rule {
name: "vp conjunction"
# "directed" Titanic and "produced" Titanic.
priority: 5
tregex: "/^l-conj$/=relation $ /^t-(?:VERB)$/ < /^l-dobj$/ < /^t-(?:VERB)$/"
transformation {
target: "relation"
action: CHANGE_LABEL
label: "l-conj-vp"
}
}
rule {
name: "verb conjunction"
# "directed" and "produced"
priority: 10
tregex: "/^l-conj$/=relation $ /^t-(?:VERB)$/ < /^t-(?:VERB)$/"
transformation {
target: "relation"
action: CHANGE_LABEL
label: "l-conj-verb"
}
}
}
rulegroup {
name: "reduced relative and relative clause extractions"
priority: 1
rule {
name: "pobj extraction"
priority: 1
# The "country" which Darwin "belongs" to, is UK.
# "country" Darwin was "born" in
# country "which" Darwin was born in
# TODO: Ideally this should produce the same parse as "Darwin was born in country", however, we produce "Darwin was born[in] country" where [in] is invisible.
# (l-root w-1-country t-NOUN (l-acl:relcl w-5-bear t-VERB (l-dobj w-2-which t-DET) (l-nsubjpass w-3-darwin t-PROPN) (l-auxpass w-4-was t-AUX) (l-nmod w-6-at t-ADP)))
tregex: "/^l-acl.*$/=relation < (/^l-nmod$/ < /^t-ADP$/)"
transformation {
target: "relation"
action: ADD_CHILD
label: "l-nmod"
child: "v-f"
}
transformation {
target: "relation"
action: ADD_CHILD
label: "l-BIND"
child: "v-f"
}
}
rule {
name: "nsubj extraction"
priority: 5
tregex: "/^l-acl.*$/=relation !< /^l-(?:nsubj|nsubjpas)$/"
# The company "bought" Youtube, owns Gmail. -- construction exists in Telugu
transformation {
target: "relation"
action: ADD_CHILD
label: "l-nsubj"
child: "v-f"
}
transformation {
target: "relation"
action: ADD_CHILD
label: "l-BIND"
child: "v-f"
}
}
rule {
name: "nsubj extraction"
priority: 5
tregex: "/^l-acl.*$/=relation < (/^l-nsubj$/ < /^t-(?:DET|ADV)$/)"
# The "company" which "bought" Youtube owns Gmail.
transformation {
target: "relation"
action: ADD_CHILD
label: "l-nsubj"
child: "v-f"
}
transformation {
target: "relation"
action: ADD_CHILD
label: "l-BIND"
child: "v-f"
}
}
rule {
name: "nsubjpass extraction"
priority: 5
tregex: "/^l-acl.*$/=relation < (/^l-nsubjpass$/ < /^t-(?:DET|ADV)$/)"
# The "company" which is "based" in
transformation {
target: "relation"
action: ADD_CHILD
label: "l-nsubjpass"
child: "v-f"
}
transformation {
target: "relation"
action: ADD_CHILD
label: "l-BIND"
child: "v-f"
}
}
rule {
name: "dobj extraction"
priority: 10
tregex: "/^l-acl.*$/=relation !< /^l-dobj$/"
# The "movie" Cameron "directed"
transformation {
target: "relation"
action: ADD_CHILD
label: "l-dobj"
child: "v-f"
}
transformation {
target: "relation"
action: ADD_CHILD
label: "l-BIND"
child: "v-f"
}
}
rule {
name: "dobj extraction"
priority: 10
tregex: "/^l-acl.*$/=relation < (/^l-dobj$/ < /^t-(?:DET|ADV)$/)"
# The "movie" which Cameron "directed"
transformation {
target: "relation"
action: ADD_CHILD
label: "l-dobj"
child: "v-f"
}
transformation {
target: "relation"
action: ADD_CHILD
label: "l-BIND"
child: "v-f"
}
}
rule {
name: "no extraction"
priority: 15
tregex: "/^l-acl.*$/=relation"
# the "issues" as he "sees" them
transformation {
target: "relation"
action: CHANGE_LABEL
label: "l-acl-other"
}
}
}
rulegroup {
name: "question special cases"
priority: 1
rule {
name: "pobj"
priority: 1
# what city did Obama come from?
# TODO: Ideally this should produce same parse as "Obama comes from what city", whereas the current rule procduces "Obama comes [from] what city" where [from] is invisible.
# (l-root w-5-come t-VERB (l-dobj w-2-city t-NOUN (l-det w-1-what t-DET)) (l-aux w-3-did t-AUX) (l-nsubj w-4-obama t-PROPN) (l-nmod w-6-from t-ADP) (l-punct w-7-? t-PUNCT))
tregex: "/^l-.*$/=root < (/^l-.*$/=pobj << (/w-.*-(?:what|when|who|where|which|how|whom|whose|why|quién|qué|dónde|cuándo|cuánto|cuánta|cuántos|cuántas|cuál|quiénes|cuáles|cómo|adónde|porqué|quien|que|donde|cuando|cuanto|cuanta|cuantos|cuantas|cual|quienes|cuales|como|adonde|porque|wer|welche|welcher|wen|wem|welchen|welchem|wessen|was|welches|warum|weshalb|weswegen|wieso|wie|wofür|wofuer|wozu|womit|wodurch|worum|worüber|worueber|wobei|wovon|wo|wohin|woher|woran|worin|worauf|worunter|wovor|wohinter|wann|wan|wieviele|wieviel|wievele|wievievel)$/=qword $ /t-(?:PRON|DET|ADV|ADJ)/)) < (/^l-nmod$/ < /^t-ADP$/ !> /^l-acl.*$/)"
transformation {
target: "pobj"
action: CHANGE_LABEL
label: "l-nmod"
}
}
rule {
name: "pobj"
priority: 1
# where did Obama come from?
# TODO: Ideally this should produce same parse as "Obama comes from where", whereas the current rule procduces "Obama comes [from] where". Here [from] is invisible.
tregex: "/^l-.*$/=root < (/^l-.*$/=pobj < (/w-.*-(?:what|when|who|where|which|how|whom|whose|why|quién|qué|dónde|cuándo|cuánto|cuánta|cuántos|cuántas|cuál|quiénes|cuáles|cómo|adónde|porqué|quien|que|donde|cuando|cuanto|cuanta|cuantos|cuantas|cual|quienes|cuales|como|adonde|porque|wer|welche|welcher|wen|wem|welchen|welchem|wessen|was|welches|warum|weshalb|weswegen|wieso|wie|wofür|wofuer|wozu|womit|wodurch|worum|worüber|worueber|wobei|wovon|wo|wohin|woher|woran|worin|worauf|worunter|wovor|wohinter|wann|wan|wieviele|wieviel|wievele|wievievel)$/=qword $ /t-(?:PRON|DET|ADV|ADJ)/)) < (/^l-nmod$/ < /^t-ADP$/ !> /^l-acl.*$/)"
transformation {
target: "pobj"
action: CHANGE_LABEL
label: "l-nmod"
}
}
}