File size: 6,486 Bytes
de68f2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# -*- Makefile -*-

# This make module sets up the actual experiments

L1 = fr
L2 = en
tune-ref-ready = /fs/sif0/bhaddow/experiments/accept/symantec-baseline/tuning/reference.tc.18
eval-ref-ready = /fs/saxnot5/germann/accept/homophones/exp.new/evaluation/201201_devtest_b.reference.tok.1 
crp_train      = /fs/sif0/bhaddow/experiments/accept/symantec-baseline/training/corpus.19
ttable         = /fs/sif0/bhaddow/experiments/accept/symantec-baseline/model/phrase-table.10

untuned_moses_ini = model/moses.ini.0
fixed-iweight = --activate-feature d_0,d_1,d_2,d_3,d_4,d_5,d_6,lm_0,w_0,tm_0,tm_1,tm_2,tm_3,tm_4

# list the evaluation metrics to be used for evaluation
# TO DO: list available metrics
eval-metrics  = multi-bleu
moses-threads = 20
tuning-runs   = $(shell seq 25)

# experiments.make: WSCHEMES = uniform unigram bigram bigram2
# experiments.make: DATASETS = tune eval
# experiments.make: PREPROC  = baseline uniq multi
# experiments.make: CSETS    = unfiltered filtered edited
experiments.make: WSCHEMES = bigram2 
experiments.make: DATASETS = tune eval
experiments.make: PREPROC  = baseline
experiments.make: CSETS    = filtered 
# remake experiments.make if this file changes
experiments.make: $(word $(words ${MAKEFILE_LIST}), ${MAKEFILE_LIST})
experiments.make:
	mkdir $@.lock
	echo $(call lockline) > $@.lock/owner
	echo '# -*- Makefile -*-' > $@_
	echo '# This file was automatically generated by setup-experiments.make.' >> $@_
	echo 'experiments := '                   >> $@_; 
	$(foreach p, ${PREPROC}, \
	echo '# NEW EXPERIMENT #####################################' >> $@_; \
	echo 'experiments += $p'                   >> $@_; \
	echo 'ctr = $$(words $${experiments})'     >> $@_; \
	echo '$p: input-type = 0'                  >> $@_; \
	echo '$p: eval-sets = $p.eval'             >> $@_; \
	echo '$p: tune-src = input/$p.tune.tc'     >> $@_; \
	echo '$p: tune-ref = ${tune-ref-ready}'    >> $@_; \
	echo '$p: $p.eval-src = input/$p.eval.tc'  >> $@_; \
	echo '$p: $p.eval-ref = ${eval-ref-ready}' >> $@_; \
	echo '$p: evaluation/$${ctr}/report'       >> $@_; \
	echo                                       >> $@_; \
	echo 'evaluation/$p/%/$p.eval.output: input = input/$p.eval.tc' >> $@_; \
	echo 'evaluation/$p/%/$p.eval.output: input/$p.eval.tc' >> $@_; \
	echo $(if $(findstring ini,${tuned_moses_ini}), \
	  'evaluation/$${ctr}/$p.eval.output: ${tuned_moses_ini}', \
	  'evaluation/$${ctr}/$p.eval.output: tuning/$${ctr}/moses.tuned.ini') >> $@_; \
	echo $(if $(findstring ini,${tuned_moses_ini}), \
	  'evaluation/$${ctr}/$p.eval.output: moses_ini := ${tuned_moses_ini}', \
	  'evaluation/$${ctr}/$p.eval.output: moses_ini := tuning/$${ctr}/moses.tuned.ini') >> $@_; \
	echo 'evaluation/$${ctr}/$p.eval.multi-bleu: $${$p.eval-ref}' >> $@_; \
	echo                                       >> $@_;)
	$(foreach c, ${CSETS}, \
	$(foreach p, ${PREPROC}, \
	$(foreach w, ${WSCHEMES}, \
	echo '# NEW EXPERIMENT #####################################' >> $@_; \
	echo 'experiments += $w-$c-$p'                                >> $@_; \
	echo 'ctr = $$(words $${experiments})'     >> $@_; \
	echo '$w-$c-$p: input-type = 1'                  >> $@_; \
	echo '$w-$c-$p: eval-sets = $w-$c-$p.eval'             >> $@_; \
	echo '$w-$c-$p: tune-src = input/$w-$c-$p.tune.cfn'     >> $@_; \
	echo '$w-$c-$p: tune-ref = ${tune-ref-ready}'    >> $@_; \
	echo '$w-$c-$p: $w-$c-$p.eval-src = input/$w-$c-$p.eval.cfn'  >> $@_; \
	echo '$w-$c-$p: $w-$c-$p.eval-ref = ${eval-ref-ready}' >> $@_; \
	echo '$w-$c-$p: evaluation/$${ctr}/report'       >> $@_; \
	echo                                       >> $@_; \
	echo 'evaluation/$${ctr}/$w-$c-$p.eval.output: input = input/$w-$c-$p.eval.cfn' >> $@_; \
	echo 'evaluation/$${ctr}/$w-$c-$p.eval.output: input/$w-$c-$p.eval.cfn' >> $@_; \
	echo $(if $(findstring ini,${tuned_moses_ini}), \
	  'evaluation/$${ctr}/$w-$c-$p.eval.output: ${tuned_moses_ini}', \
	  'evaluation/$${ctr}/$w-$c-$p.eval.output: tuning/$${ctr}/moses.tuned.ini') >> $@_; \
	echo $(if $(findstring ini,${tuned_moses_ini}), \
	  'evaluation/$${ctr}/$w-$c-$p.eval.output: moses_ini := ${tuned_moses_ini}', \
	  'evaluation/$${ctr}/$w-$c-$p.eval.output: moses_ini := tuning/$${ctr}/moses.tuned.ini') >> $@_; \
	echo 'evaluation/$${ctr}/$w-$c-$p.eval.multi-bleu: $${$w-$c-$p.eval-ref}' >> $@_; \
	echo                                       >> $@_;\
	$(foreach d, tune eval, \
	echo 'cfn-targets += input/$w-$c-$p.$d.cfn' >> $@_; \
	echo 'input/$w-$c-$p.$d.cfn: input/$p.$d.tc' >> $@_; \
	printf '\t@mkdir $$@.lock\n\t@echo $$(call lockline) > $$@.lock/owner\n' >> $@_; \
	printf '\tcreate-confusion-network.01.exe -q -w $w -s csets/csets.$c.txt -c ../mm/fr < $$< > $$@_ && mv $$@_ $$@\n' >> $@_;\
	printf '\t@rm $$@.lock/owner\n\t@rmdir $$@.lock\n' >> $@_;))))
	echo '.PHONY += $$(experiments) cfn' >> $@_
	echo 'cfns: $${cfn-targets}' >> $@_
	@mv $@_ $@
	@rm $@.lock/owner
	@rmdir $@.lock



#	# echo 'ctr = $$(words $${experiments})'                        >> $@_; \
	# echo 'eval-sets = $w-$c-$p.eval'                 >> $@_; \
	# echo 'rx  := $$(call report-prereqs,$${ctr},$${eval-sets})' >> $@_; \
	# echo '$w-$c-$p: run-id    := $${ctr}'                         >> $@_; \
	# echo '$w-$c-$p: tune-input = input/$w-$c-$p.tune.cfn'         >> $@_; \
	# echo '$w-$c-$p: tune-src = input/$w-$c-$p.tune.cfn'           >> $@_; \
	# echo '$w-$c-$p: tune-ref = ${tune-ref-ready}'                 >> $@_; \
	# echo '$w-$c-$p: $w-$c-$p.eval-src = input/$w-$c-$p.eval.cfn'  >> $@_; \
	# echo '$w-$c-$p: $w-$c-$p.eval-ref = ${eval-ref-ready}'        >> $@_; \
	# echo '$w-$c-$p: input-type = 1'                               >> $@_; \
	# echo '$w-$c-$p: mert.options += $$(if $$(findstring uniform,$w),${fixed-iweight})' >> $@_; \
	# echo '$w-$c-$p: evaluation/report.$${ctr}'                    >> $@_; \
	# echo                                                          >> $@_; \
	# echo 'evaluation/$w-$c-$p.eval.output.$${ctr}: input = input/$w-$c-$p.eval.cfn' >> $@_; \
	# echo                                                          >> $@_; \
	# $(foreach d, tune eval, \
	# ofile=input/$w-$c-$p.$d.cfn; \
	# ifile=input/$p.$d.tc; \
	# echo "$$ofile: $$ifile" >> $@_ ; \
	# printf '\t create-confusion-network.01.exe -w $w -s csets/cset.$c.txt -c ../mm/fr < $$< > $$@_ && mv $$@_ $$@\n' >> $@_ ; \
	# echo                                                          >> $@_; ))))
	# echo '.PHONY += $$(experiments)' >> $@_
	# @mv $@_ $@
	# @rm $@.lock/owner
	# @rmdir $@.lock