-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
154 lines (118 loc) · 4.79 KB
/
Makefile
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
#!/usr/bin/make
# @file Makefile
# @brief Makefile for the YiSi unit test suite
#
# @author Darlene Stewart
#
# Multilingual Text Processing / Traitement multilingue de textes
# Digital Technologies Research Centre / Centre de recherche en technologies numériques
# National Research Council Canada / Conseil national de recherches Canada
# Copyright 2018, Her Majesty in Right of Canada /
# Copyright 2018, Sa Majeste la Reine du Chef du Canada
SHELL:=/bin/bash
.NOTPARALLEL:
.SECONDARY:
# Override the value of MATEPLUS_HOME with a command line definition, or
# consider defining MATEPLUS_HOME in your .profile, for example:
# export MATEPLUS_HOME=~/u/sandboxes/mateplus
MATEPLUS_HOME ?= ~/u/tools/MATE/mateplus-master/src
MATEPLUS_PATH ?= $(MATEPLUS_HOME)/mateplus.jar
ifneq ("$(wildcard $(MATEPLUS_PATH))","")
WITH_SRLMATE ?= True
else
$(info *** mateplus.jar not found)
endif
.PHONY: all
# "make all" should create the .gitignore file
all: gitignore
@echo All tests PASSED.
test: all
CMDLP_TEST_PROGS := cmdlp_test.1 cmdlp_test.2
SIMPLE_TEST_PROGS := util_test
SIMPLE_TEST_PROGS += phrasesim_test
SIMPLE_TEST_PROGS += lexweight_test
SIMPLE_TEST_PROGS += lexsim_test
SIMPLE_TEST_PROGS += biw2v_test
SIMPLE_TEST_PROGS += w2v_test
SIMPLE_TEST_PROGS += maxmatching_test
SIMPLE_TEST_PROGS += srlutil_test
SIMPLE_TEST_PROGS += srlgraph_test
SIMPLE_TEST_PROGS += yisiscorer_test
ifdef WITH_SRLMATE
SIMPLE_SRL_TEST_PROGS += srl_test
SIMPLE_SRL_TEST_PROGS += srlmate_test
endif
ALL_SIMPLE_TEST_PROGS := $(CMDLP_TEST_PROGS) $(SIMPLE_TEST_PROGS) $(SIMPLE_SRL_TEST_PROGS)
all: $(ALL_SIMPLE_TEST_PROGS)
all: test_yisi
TMP_FILES += $(addsuffix .out, $(ALL_SIMPLE_TEST_PROGS))
TMP_FILES += test_yisi_[0-2]*.out test_hyp.docyisi[0-2]* test_hyp.sntyisi[0-2]*
TMP_FILES += test_ref.en.srl
compare.%: %
diff $< ref/$< -q
SUB:="s/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]* */00.00.000 /"
compare_w_java_log.%: %
diff <(cat $< | sed -e $(SUB)) <(cat ref/$< | sed -e $(SUB)) -q
compare_w_alt.%: %
diff $< ref/$< -q || diff -s $< ref/$<.alt -q
# Simple tests
.PHONY: $(ALL_SIMPLE_TEST_PROGS)
$(CMDLP_TEST_PROGS): %: compare.%.out
$(SIMPLE_TEST_PROGS): %: compare.%.out
$(SIMPLE_SRL_TEST_PROGS): %: compare_w_java_log.%.out
cmdlp_test.1.out: ARGS = --beta 0 --settings <(echo hello) --refs test_ref.en --help
cmdlp_test.2.out: ARGS = --beta 0 --settings <(echo hello) --refs /etc/timezone
util_test.out: ARGS =
phrasesim_test.out: ARGS = --lexsim-type w2v --outlexsim-path mini.d300.en \
--reflexweight-type learn --reflexweight-path test_ref.en --phrasesim-type nwpr --ngram-size 3
lexweight_test.out: ARGS =
lexsim_test.out: ARGS = w2v mini.d300.en EU UK
biw2v_test.out: ARGS = mini.d300.de mini.d300.en . .
w2v_test.out: ARGS = mini.d300.en EU UK
maxmatching_test.out: ARGS =
srlutil_test.out: ARGS = test_ref.en.conll09
srlgraph_test.out: ARGS = test_ref.en test_ref.en.assert
yisiscorer_test.out: ARGS = --lexsim-type w2v --outlexsim-path mini.d300.en \
--reflexweight-type learn --reflexweight-path test_ref.en --phrasesim-type nwpr --ngram-size 3
srl_test.out: ARGS = mate ../src/en.mplsconfig test_ref.en test_ref.en.srl
srlmate_test.out: ARGS = ../src/en.mplsconfig <<<'Hello there'
$(CMDLP_TEST_PROGS): BIN = ../src/cmdlp/build/bin
$(SIMPLE_TEST_PROGS) $(SIMPLE_SRL_TEST_PROGS): BIN = ../bin
compare_w_java_log.srl_test.out: compare_w_alt.test_ref.en.srl
test_ref.en.srl: srl_test.out ;
$(addsuffix .out, $(ALL_SIMPLE_TEST_PROGS)): %.out:
$(BIN)/$(firstword $(subst ., ,$*)) $(ARGS) &> $@
# YiSi tests
YSFX_NOSRL := 0 1 2
YSFX_SRL := 1_srl 2_srl
.PHONY: test_yisi
.PHONY: $(foreach n,$(YSFX_NOSRL),test_yisi_$n)
test_yisi: $(foreach n,$(YSFX_NOSRL),test_yisi_$n)
$(foreach n,$(YSFX_NOSRL),test_yisi_$n): test_yisi_%: compare.test_yisi_%.out
$(foreach n,$(YSFX_NOSRL),compare.test_yisi_$n.out): compare.test_yisi_%.out: compare.test_hyp.docyisi% compare.test_hyp.sntyisi%
.PHONY: $(foreach n,$(YSFX_SRL),test_yisi_$n)
ifdef WITH_SRLMATE
test_yisi: $(foreach n,$(YSFX_SRL),test_yisi_$n)
endif
# YiSi SRL tests have alternate reference files too because mateplus may return
# an alternate parse.
$(foreach n,$(YSFX_SRL),test_yisi_$n): test_yisi_%: compare_w_java_log.test_yisi_%.out
$(foreach n,$(YSFX_SRL),compare_w_java_log.test_yisi_$n.out): compare_w_java_log.test_yisi_%.out: compare_w_alt.test_hyp.docyisi% compare_w_alt.test_hyp.sntyisi%
test_yisi_%.out: yisi-%.config
../bin/yisi --config $< &> $@
test_hyp.docyisi% test_hyp.sntyisi%: test_yisi_%.out
:
########################################
.PHONY: gitignore
gitignore:
echo "$(TMP_FILES) $(TMP_DIRS) core core.* .gitignore !src/* !ref/* !in/* !data/*" | tr ' ' '\n' > .gitignore
.PHONY: clean clean.tmp_files
clean: clean.tmp_files
clean.tmp_files:
$(RM) $(TMP_FILES) core core.* .gitignore
ifdef TMP_DIRS
.PHONY: clean.tmp_dirs
clean: clean.tmp_dirs
clean.tmp_dirs:
$(RM) -r $(TMP_DIRS)
endif