-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile.testg
275 lines (223 loc) · 9.91 KB
/
Makefile.testg
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
### -*-Mode: makefile;-*-
job := job${shell echo $$$$}
default:
@echo "make test suite=SUITE"
@echo "will run Alpino on the specified suite"
@echo
@echo
@echo "Each target typically creates its own working directory"
@echo "for temporary stuff; in addition it appends summarizing"
@echo "statistics to some of the files in a directory dedicated"
@echo "to that suite."
ll:
@for dir in $(suites); do $(MAKE) --no-print-directory compare suite=$$dir; $(MAKE) --no-print-directory comparescore suite=$$dir; done
l:
@echo all jobs:
@$(MAKE) --no-print-directory ll | grep sentences
@echo finished jobs:
@$(MAKE) --no-print-directory cf
@$(MAKE) --no-print-directory diffs
include $(ALPINO_HOME)/Makefile.errormining
cat=cat
LOGS=*/job*/log
suitepath=../Suites
suite=g_suite
dir=./
part=
debug=1
## defaults for test1 target
default_test_options=debug=$(debug) use_fluency_model=on user_max=300000 generate_robustness=on
cdb_test_options= -flag fluency_feature_weights ../Generation/fluency/maxent_feature_weights_c
extra_test_options= -flag fluency_feature_weights ../Generation/fluency/maxent_feature_weights_x
qa_test_options= -flag fluency_feature_weights ../Generation/fluency/maxent_feature_weights_q
test:
@mkdir -p $(suite)$(part)/$(job)
@echo "extra=$(extra)" >> $(suite)$(part)/times
@-$(MAKE) trees dir=$(suite)$(part)/$(job)
@$(MAKE) test1rest job=$(job) suite=$(suite) part="$(part)"
@cat $(suite)$(part)/$(job)/times >> $(suite)$(part)/times
testgss: g1 g2 g3 g4 g5
g1:
$(MAKE) test suite=gen_g_suite
g2:
$(MAKE) test suite=g_suite
g3:
$(MAKE) test suite=h_suite
g4:
$(MAKE) test suite=i_suite
g5:
$(MAKE) test suite=lassy-doc
testgsl: g6 g7 g8 g12
g6:
$(MAKE) test suite=extra
g7:
$(MAKE) test suite=qa
g8:
$(MAKE) test suite=cdb
g12:
$(MAKE) test suite=wpspel
tests:
$(MAKE) testgsl testgss
test1rest:
-grep '^T#' $(suite)$(part)/$(job)/log\
> $(suite)$(part)/$(job)/time
-grep '^G#' $(suite)$(part)/$(job)/log\
| awk -F\| '{ print $$1, $$2, $$3 }'\
> $(suite)$(part)/$(job)/sents
-grep '^K#' $(suite)$(part)/$(job)/log\
> $(suite)$(part)/$(job)/scores
$(MAKE) --no-print-directory score file=$(suite)$(part)/$(job)/scores\
>> $(suite)$(part)/$(job)/times
-grep '^##' $(suite)$(part)/$(job)/log\
| awk '{ print $$2, $$3 }' | sort | uniq -c\
>> $(suite)$(part)/$(job)/times
$(MAKE) --no-print-directory report
trees:
@echo > $(dir)/times
hostname -f >>$(dir)/times
@echo `date` >> $(dir)/times
@echo `hostname` >> $(dir)/times
@echo "extra=$(extra) $(PUNCT)" >> $(dir)/times
$(ALPINO_HOME)/src/Alpino\
-flag suite $(suitepath)/$(suite)\
penalties=undefined\
$(default_test_options)\
$($(suite)_test_options)\
$(extra) -notk cmdint=off\
batch_command=roundtrip\
2>$(dir)/log >> $(dir)/times
n=10
report:
@if [ -f $(suite)$(part)/times ]; then\
grep XX $(suite)$(part)/times | tail -n $(n); \
grep 'mean GTM' $(suite)$(part)/times | tail -n $(n); fi
upd_all:
@for file in `echo $(shell ls $(ORDERED) */*/time 2>/dev/null)`; do \
suite=`echo $$file | awk -F/ '{ print $$1 }'`;\
echo "cp $$file $(prefix)$$suite/time";\
done
@for file in `echo $(shell ls $(ORDERED) */*/sents 2>/dev/null)`; do \
suite=`echo $$file | awk -F/ '{ print $$1 }'`;\
echo "cp $$file $(prefix)$$suite/sents";\
done
@for file in `echo $(shell ls $(ORDERED) */*/scores 2>/dev/null)`; do \
suite=`echo $$file | awk -F/ '{ print $$1 }'`;\
echo "cp $$file $(prefix)$$suite/scores";\
done
rm_all:
@for dir in */job*;\
do\
if cmp -s $$dir/time $$dir/../time ;\
then echo "rm -rf $$dir";\
fi;\
done
ORDERED=-rt
pat=T
compare:
@$(MAKE) --no-print-directory compare_field field=4 diff=1.25 txt="cputime" min=200 less="!!!" more="???" pat=T
@$(MAKE) --no-print-directory compare_field field=6 diff=1 txt="edges" min=-1 less="!!!" more="???" pat=T
@$(MAKE) --no-print-directory compare_field field=3 diff=1 txt="results" min=-1 less="<<<" more=">>>" pat=T
@if [ "$(score1)" != "" ]; then awk -F\| '/^T#/{ if ($$3 == 0) N++;}\
END { printf "%d items without result (%s)\n",N,"$(score1)" }' $(score1); fi
score2=$(prefix)$(suite)$(part)/scores
compare_score: comparescore
comparescore:
@$(MAKE) compare_field field=3 diff=1 txt="GTM" min=-1 less="???" more="!!!"\
pat=K score2=$(score2) prefix=score
filter=cat
## only first reading (1) or if no reading (0):
scorefilter=awk -F\| '{ if ($$2<2) print $$0}'
compare_field:
@if [ "$(score1)" != "" ] && [ "$(score2)" != "" ]; then\
grep '^$(pat)#' $(score1)\
| sed -e 's/^$(pat)#//'\
| $($(prefix)filter)\
| awk -F\| '{ print $$ $(field), $$1 }' >$(L1) ;\
grep '^$(pat)#' $(score2)\
| sed -e 's/^$(pat)#//'\
| $($(prefix)filter)\
| awk -F\| '{ print $$ $(field), $$1 }' >$(L2) ;\
echo " NEW PREV (GTM %) ITEM DELTA SUITE";\
paste $(L1) $(L2) |\
awk 'BEGIN {I=1} \
{ if (NF==4 && $$2 == $$4) { \
if ($$1!=$$3) { \
if ($$1>$(diff)*$$3 && $$1>$(min)) \
{ F="$(more)" }; \
if ($$3>$(diff)*$$1 && $$3>$(min)) \
{ F="$(less)" }; \
if(F) { printf "%5.1f %5.1f %40s %s %23s\n", $$1*100,$$3*100,$$2,F,"$(suite)"}\
}; \
F=""; \
I=I+1; \
N=N+$$1; \
M=M+$$3 } \
} \
END {print "------------------------------------ total --------------------------------------"; \
if (I>1) {printf "%6.2f %6.2f %8d sentences %40s %s (%%)\n", 100*N/(I-1), 100*M/(I-1), I-1, "$(score1)", "$(txt)" }; \
}' ; fi
@rm -f $(L1) $(L2)
suites=$(dir $(wildcard */scores))
jobsuites=$(sort $(dir $(wildcard */job*)))
cs:
for j in $(jobsuites); do for l in $$j/job*/log; do echo $$j $$l; $(MAKE) -s comparescore score2=$$j/scores suite=$$j score1=$$l; done; done
echo:
echo $(jobsuites)
score1=${shell ls -t $(suite)$(part)/job*/log 2>/dev/null |head -n 1}
sss:
echo $(suites)
cf00:
@if [ -r $(file) ]; then make --no-print-directory score; make --no-print-directory score file=$(suite)scores ; fi
cf:
@for suite in $(suites) ; do $(MAKE) --no-print-directory cf0 suite=$$suite; done
cf0:
@for file in $(suite)job*/scores; do $(MAKE) --no-print-directory cf00 file=$$file suite=$(suite); done
scores:
@for file in */job*/log; do $(MAKE) -s score file=$$file; done
score:
@if [ -r $(file) ]; then awk -F\| '/^K#/ { if ($$2<2) { N=N+1; R=R+$$3} } END {printf "%s mean GTM: %.3f after %d items\n","$(file)",R/N,N}' $(file) ; fi
sents1=${shell ls -t $(suite)$(part)/job*/sents 2>/dev/null|head -n 1}
sents2=$(prefix)$(suite)$(part)/sents
diffs:
@for suite in $(suites); do $(MAKE) --no-print-directory diff suite=$$suite; done
diff:
@-if [ "$(sents1)" != "" ]; then echo compare new sentences with old for $(suite); diff $(sents1) $(sents2); fi
difft:
@grep '^G#' ${shell ls -t $(suite)$(part)/job*/log 2>/dev/null|head -n 1} |\
awk -F\| '{ print $$1,$$2,$$3 }' > \
${dir ${shell ls -t $(suite)$(part)/job*/log 2>/dev/null|head -n 1}}/sents
$(MAKE) diff
cpu1=${shell ls -t $(suite)/*/log|head -n 1}
cpu2=$(prefix)$(suite)/time
L1 := $(shell mktemp)
L2 := $(shell mktemp)
compare_cpu:
@echo "NEW PREV ITEM"
@grep '^T#' $(cpu1) | sed -e 's/^T#//' | tr '\|' '\t' > $(L1)
@grep '^T#' $(cpu2) | sed -e 's/^T#//' | tr '\|' '\t' > $(L2)
@paste $(L1) $(L2) |\
awk 'BEGIN {I=1} \
{ if (NF==12) { \
if ($$4>1.2*$$10 && $$4>500) \
{ F="???" }; \
if ($$10>1.2*$$4 && $$10>500) \
{ F="!!!" }; \
if(F) { printf "%10d %10d %30s %s\n", $$4, $$10, $$1, F } \
F=""; \
I=I+1; \
N=N+$$4; \
M=M+$$10 } \
} \
END {print "------------"; \
print "AVERAGES after " I-1 " sentences"; \
printf "AV %10.1f %10.1f %8.5f %30s\n", N/(I-1), M/(I-1), (N/(I-1))/(M/(I-1)),"$(cpu1)"; \
print "================================================"; \
}'
@rm -f $(L1) $(L2)
cg:
@for file in `ls -tr */job*/log*`;\
do echo $$file;\
$(MAKE) -s compare_cpu cpu1=$$file cpu2=`dirname $$file`/../time;\
done | grep '^AV '
overview:
@for file in */scores; do $(MAKE) -s score file=$$file; done