-
Notifications
You must be signed in to change notification settings - Fork 0
/
produce.ini
312 lines (263 loc) · 12.1 KB
/
produce.ini
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
[]
ActionsToTrees = java -classpath dist/epar.jar epar.ActionsToTrees
Train = java -classpath dist/epar.jar epar.Train
Decode = java -classpath dist/epar.jar epar.Decode
TreesToActionSequences = java -classpath dist/epar.jar epar.TreesToActionSequences
InitModel = java -classpath dist/epar.jar epar.InitModel
InitModelFromOracles = java -classpath dist/epar.jar epar.InitModelFromOracles
shell = bash
prelude =
def count_lines(filename):
result = 0
with open(filename) as f:
for line in f:
result += 1
return result
## PARSEVAL EVALUATION ########################################################
[output/%{exp}/dev.eval%{i}]
dep.output = output/%{exp}/dev.trees%{i}
dep.reference = output/%{exp}/reference.txt
dep.eval = scripts/eval.py
recipe = ./%{eval} %{reference} %{output} > %{target}
## DEPENDENCY EVALUATION ######################################################
# This only works for the original wsj experiment because the other experiments
# are not compatible with generate. We do this to verify we are in the same
# accuracy ballpark as Zhang and Clark (2011).
# TODO should exclude rules like Zhang and Clark (2011) to make sure we
# evaluate on the full set.
[output/wsj/dev.depeval%{i}]
dep.filtered_ccgbank_deps = output/wsj/output.%{i}.filtered.ccgbank_deps
dep.reference_filtered_stagged = output/wsj/reference.%{i}.filtered.stagged
dep.reference_filtered_ccgbank_deps = output/wsj/reference.%{i}.filtered.ccgbank_deps
dep.evaluate = ext/candc/src/scripts/ccg/evaluate
recipe = %{evaluate} %{reference_filtered_stagged} %{reference_filtered_ccgbank_deps} %{filtered_ccgbank_deps} > %{target}
# The following rules use more or less the same file name scheme as the ZPar
# evaluation script.
[output/wsj/reference.%{i}.filtered.%{x}]
cond = %{x in ('stagged', 'ccgbank_deps')}
deps = output/wsj/output.%{i}.filtered.ccgbank_deps
[output/wsj/output.%{i}.filtered.ccgbank_deps]
dep.ccgbank_deps = output/wsj/output.%{i}.ccgbank_deps
dep.reference_stagged = output/wsj/reference.stagged
dep.reference_ccgbank_deps = output/wsj/reference.ccgbank_deps
reference_filtered_stagged = output/wsj/reference.%{i}.filtered.stagged
reference_filtered_ccgbank_deps = output/wsj/reference.%{i}.filtered.ccgbank_deps
outputs = %{reference_filtered_stagged} %{reference_filtered_ccgbank_deps}
recipe = ./scripts/filter_ccgbank_deps %{reference_stagged} %{reference_ccgbank_deps} %{ccgbank_deps} %{reference_filtered_stagged} %{reference_filtered_ccgbank_deps} %{target}
[output/wsj/output.%{i}.ccgbank_deps]
depfile = output/wsj/output.%{i}.ccgbank_deps.d
dep.output = output/wsj/dev.trees%{i}
recipe =
rm -f %{target}
echo '#' >> %{target}
echo '#' >> %{target}
echo '' >> %{target}
for j in $(zsh -c 'echo {1..$(cat %{output} | wc -l)}')
do
cat tmp/wsj/output.%{i}.ccgbank_deps.part.$j >> %{target}
done
[output/wsj/output.%{i}.ccgbank_deps.d]
dep.output = output/wsj/dev.trees%{i}
recipe =
rm -f %{target}
for j in $(zsh -c 'echo {1..$(cat %{output} | wc -l)}')
do
echo tmp/wsj/output.%{i}.ccgbank_deps.part.$j >> %{target}
done
[tmp/wsj/output.%{i}.ccgbank_deps.part.%{j}]
dep.text = tmp/wsj/output.%{i}.text.part.%{j}
dep.ccgbank_deps_formatted = tmp/wsj/output.%{i}.ccgbank_deps.formatted.part.%{j}
dep.cat = tmp/wsj/output.%{i}.cat.part.%{j}
recipe =
if [ `cat %{text} | grep '__PARSE_FAILED__' | wc -l | cut -d\ -f 1` == 0 ]
then
grep ^[^\#] %{ccgbank_deps_formatted} | cat > %{target}
./scripts/merge_fragmented_cats %{cat} >> %{target}
else
echo bin/generator failed
echo '' > %{target}
fi
[tmp/wsj/output.%{i}.text.part.%{j}]
dep.pipe_fragmented = tmp/wsj/output.%{i}.pipe.fragmented.part.%{j}
recipe =
./ext/candc/bin/generate -T ext/candc/src/data/ccg/cats ext/candc/src/data/ccg/cats/markedup %{pipe_fragmented} > %{target} 2> %{target}.log
[tmp/wsj/output.%{i}.ccgbank_deps.formatted.part.%{j}]
dep.ccgbank_deps_without_cats = tmp/wsj/output.%{i}.ccgbank_deps.without_cats.part.%{j}
dep.pipe_fragmented = tmp/wsj/output.%{i}.pipe.fragmented.part.%{j}
dep.cat = tmp/wsj/output.%{i}.cat.part.%{j}
recipe = ./scripts/merge_fragmented_deps %{ccgbank_deps_without_cats} %{pipe_fragmented} %{cat} > %{target}
[tmp/wsj/output.%{i}.ccgbank_deps.without_cats.part.%{j}]
dep.pipe_fragmented = tmp/wsj/output.%{i}.pipe.fragmented.part.%{j}
recipe = ./ext/candc/bin/generate -j ext/candc/src/data/ccg/cats ext/candc/src/data/ccg/cats/markedup %{pipe_fragmented} > %{target} 2> %{target}.log
[tmp/wsj/output.%{i}.cat.part.%{j}]
deps = tmp/wsj/output.%{i}.pipe.fragmented.part.%{j}
[tmp/wsj/output.%{i}.pipe.fragmented.part.%{j}]
dep.pipe = tmp/wsj/output.%{i}.pipe.part.%{j}
cat = tmp/wsj/output.%{i}.cat.part.%{j}
outputs = %{cat}
recipe =
set -e
set -o pipefail
python ext/zpar/scripts/ccg/pipe.py split %{pipe} %{cat} %{target}
[tmp/wsj/output.%{i}.pipe.part.%{j}]
dep.output = tmp/wsj/output.%{i}.txt.part.%{j}
recipe = python scripts/zpar2pipe.py -op %{output} > %{target}
[tmp/wsj/output.%{i}.txt.part.%{j}]
dep.output = output/wsj/dev.trees%{i}
recipe =
set -e
mkdir -p tmp
(cd tmp; mkdir -p wsj)
cat %{output} | head -%{j} | tail -1 > %{target}
## DECODING ###################################################################
[output/%{exp}/dev.trees%{i}]
dep.input = output/%{exp}/input.txt
dep.grammar = output/%{exp}/grammar
dep.actions = output/%{exp}/dev.actions%{i}
deps = dist/epar.jar
recipe =
%{ActionsToTrees} %{input} %{grammar} %{actions} %{target}
[output/%{exp}/dev.actions%{i}]
dep.model = output/%{exp}/train.model%{i}
dep.input = output/%{exp}/input.txt
dep.grammar = output/%{exp}/grammar
deps = dist/epar.jar
recipe =
mkdir -p output/%{exp}
# HACK training data for translating between strings and numbers
%{Decode} output/%{exp}/train.input output/%{exp}/train.oracles %{grammar} %{grammar} %{model} %{input} 16 %{target} 2> %{target}.log
## TRAINING ###################################################################
[output/%{exp}/train.model0]
deps = dist/epar.jar
recipe = %{InitModel} %{target}
[output/%{exp}/train.oracles]
cond = %{'wsj' in exp}
dep.txt = output/%{exp}/train.txt
dep.grammar = output/%{exp}/grammar
deps = dist/epar.jar
recipe =
mkdir -p output/%{exp}
%{TreesToActionSequences} %{txt} %{grammar} > %{target}
[output/%{exp}/train.model%{i}]
dep.oracles = output/%{exp}/train.oracles
dep.input = output/%{exp}/train.input
dep.grammar = output/%{exp}/grammar
dep.model_in = output/%{exp}/train.model%{int(i) - 1}
deps = dist/epar.jar
recipe = %{Train} %{input} %{oracles} %{grammar} %{model_in} %{target} 2> %{target}.log
## OTHER ######################################################################
# TODO use the same file naming scheme as in DECODING section
[output/wsj/grammar]
dep.grammar = grammar/wsj02-21.grammar
recipe =
set -e
mkdir -p output/wsj
cp %{grammar} %{target}
[output/wsj-straight/grammar]
dep.grammar = grammar/wsj02-21.grammar
dep.grammar_straighten = scripts/grammar_straighten.py
recipe =
set -e
set -o pipefail
mkdir -p output/wsj-straight
cat %{grammar} | ./%{grammar_straighten} > %{target}
[output/wsj/reference.stagged]
dep.pipe = output/wsj/reference.pipe
recipe = ./ext/candc/src/scripts/ccg/extract_sequences -s %{pipe} > %{target}
[output/wsj/reference.pipe]
recipe =
mkdir -p output/wsj
./ext/candc/src/scripts/ccg/convert_auto ext/CCGbank1.2/data/AUTO/00/*.auto | sed 's|((S\[b\]\\NP)/NP)/ |(S[b]\\NP)/NP |g' | sed -f ext/candc/src/scripts/ccg/convert_brackets > %{target}
[output/wsj/reference.ccgbank_deps]
dep.parg = output/wsj/reference.parg
recipe = ./ext/candc/src/scripts/ccg/parg2ccgbank_deps %{parg} > %{target}
[output/wsj-straight-markedup/reference.ccgbank_deps]
dep.ccgbank_deps = output/wsj/reference.ccgbank_deps
recipe = cat %{ccgbank_deps} | ./scripts/straighten_ccgbank_deps.py > %{target}
[output/wsj/reference.parg]
recipe = cat ext/CCGbank1.2/data/PARG/00/*.parg | sed -f ext/candc/src/scripts/ccg/convert_brackets > %{target}
[output/wsj/train.txt]
recipe =
set -o pipefail
mkdir -p output/wsj
# convert to pipe format, fix that one broken category, convert brackets, convert to ZPar format
python ./ext/zpar/scripts/ccg/ccg2zpar.py <(cat ext/CCGbank1.2/data/AUTO/{02..21}/*.auto | ./ext/candc/src/scripts/ccg/convert_auto | sed 's|((S\[b\]\\NP)/NP)/ |(S[b]\\NP)/NP |g' | sed -f ./ext/candc/src/scripts/ccg/convert_brackets) > %{target}
[output/wsj/reference.txt]
recipe =
set -o pipefail
mkdir -p output/wsj
python ./ext/zpar/scripts/ccg/ccg2zpar.py <(cat ext/CCGbank1.2/data/AUTO/00/*.auto | ./ext/candc/src/scripts/ccg/convert_auto | sed -f ./ext/candc/src/scripts/ccg/convert_brackets) > %{target}
[output/wsj-straight/train.txt]
recipe =
set -o pipefail
mkdir -p output/wsj-straight
# convert to pipe format, fix that one broken category, convert brackets, convert to ZPar format
python ./ext/zpar/scripts/ccg/ccg2zpar.py <(cat ext/CCGbank1.2/data/AUTO/{02..21}/*.auto | ./ext/candc/src/scripts/ccg/convert_auto | sed 's|((S\[b\]\\NP)/NP)/ |(S[b]\\NP)/NP |g' | sed -f ./ext/candc/src/scripts/ccg/convert_brackets | ./ext/supertagging/pipe_straighten.py) > %{target}
[output/wsj-straight/reference.txt]
recipe =
set -e
set -o pipefail
mkdir -p output/wsj-straight
python ./ext/zpar/scripts/ccg/ccg2zpar.py <(cat ext/CCGbank1.2/data/AUTO/00/*.auto | ./ext/candc/src/scripts/ccg/convert_auto | sed -f ./ext/candc/src/scripts/ccg/convert_brackets | ./ext/supertagging/pipe_straighten.py) > %{target}
[output/wsj-straight-markedup/train.txt]
recipe =
set -o pipefail
mkdir -p output/wsj-straight-markedup
# convert to pipe format, fix that one broken category, convert brackets, convert to ZPar format
python ./ext/zpar/scripts/ccg/ccg2zpar.py <(cat ext/CCGbank1.2/data/AUTO/{02..21}/*.auto | ./ext/candc/src/scripts/ccg/convert_auto | sed 's|((S\[b\]\\NP)/NP)/ |(S[b]\\NP)/NP |g' | sed -f ./ext/candc/src/scripts/ccg/convert_brackets | ./ext/supertagging/pipe_markup.py | ./ext/supertagging/pipe_straighten.py) > %{target}
[output/wsj-straight-markedup/reference.txt]
recipe =
set -o pipefail
mkdir -p output/wsj-straight-markedup
python ./ext/zpar/scripts/ccg/ccg2zpar.py <(cat ext/CCGbank1.2/data/AUTO/00/*.auto | ./ext/candc/src/scripts/ccg/convert_auto | sed -f ./ext/candc/src/scripts/ccg/convert_brackets | ./ext/supertagging/pipe_markup.py | ./ext/supertagging/pipe_straighten.py) > %{target}
[output/wsj/train.input]
# automultistagged file already contains the gold categories where the supertagger did not find them
deps = scripts/msuper2epar
recipe =
set -o pipefail
cat ext/supertagging/out/wsj02-21.automultistagged | ./scripts/msuper2epar > %{target}
[output/wsj-straight/train.input]
# automultistagged file already contains the gold categories where the supertagger did not find them
deps = scripts/msuper2epar
recipe =
set -o pipefail
cat ext/supertagging/out/straightbank02-21.automultistagged | ./scripts/msuper2epar > %{target}
# TODO should we be using straight categories with the supertagger?
# Don't think we have to, we're talking about the parsing model. Also in our application, supertagging is done based on English derivations.
[output/wsj-straight-markedup/train.input]
dep.input = output/wsj/train.input
dep.input_markup = scripts/input_markup.py
dep.input_straighten = scripts/input_straighten.py
dep.markup = scripts/markup.py
recipe =
set -o pipefail
cat %{input} | ./%{input_markup} | ./%{input_straighten} > %{target}
[output/wsj/grammar]
dep.grammar = grammar/wsj02-21.grammar
recipe = cp %{grammar} %{target}
[output/wsj-straight-markedup/grammar]
dep.grammar = output/wsj/grammar
grammar_out = %{target}
dep.grammar_markup = scripts/grammar_markup.py
dep.markup = scripts/markup.py
dep.grammar_straighten = scripts/grammar_straighten.py
recipe =
cat %{grammar} | ./%{grammar_markup} | ./%{grammar_straighten} > %{target}
[output/wsj/input.txt]
deps = scripts/msuper2epar
recipe =
set -e
set -o pipefail
cat ext/supertagging/out/wsj00.automultistagged | ./scripts/msuper2epar > %{target}
[output/wsj-straight/input.txt]
deps = scripts/msuper2epar
recipe =
set -e
set -o pipefail
cat ext/supertagging/out/straightbank00.automultistagged | ./scripts/msuper2epar > %{target}
[output/wsj-straight-markedup/input.txt]
deps = scripts/msuper2epar
recipe =
set -e
set -o pipefail
cat ext/supertagging/out/markedupstraightbank00.automultistagged | ./scripts/msuper2epar > %{target}