forked from marfors/paradigmextract
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdata-pipeline.mk
219 lines (171 loc) · 10.7 KB
/
data-pipeline.mk
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
.PHONY: test test-w-coverage
PYTHONPATH=$PYTHONPATH:./src
exp:
cd src; python mexp.py de > ../output/de_morph.txt
cd src; python mexp.py de_noun > ../output/de_noun_morph.txt
cd src; python mexp.py de_verb > ../output/de_verb_morph.txt
cd src; python mexp.py es > ../output/es_morph.txt
cd src; python mexp.py fi > ../output/fi_morph.txt
cd src; python mexp.py fi_noun > ../output/fi_noun_morph.txt
cd src; python mexp.py fi_verb > ../output/fi_verb_morph.txt
slots:
cd src; python paradigm.py -s ../paradigms/german_nouns.p > ../output/german_nouns_slots.txt
cd src; python paradigm.py -s ../paradigms/german_verbs.p > ../output/german_verbs_slots.txt
cd src; python paradigm.py -s ../paradigms/finnish_nounadj.p > ../output/finnish_nounadj_slots.txt
cd src; python paradigm.py -s ../paradigms/finnish_verbs.p > ../output/finnish_verbs_slots.txt
cd src; python paradigm.py -s ../paradigms/spanish_verbs.p > ../output/spanish_verbs_slots.txt
.PRECIOUS: morph/%.foma morph/%.foma.bin
morph: $(patsubst paradigms/%.p,morph/%.foma.bin,$(wildcard paradigms/*.p))
morph/%.foma.bin: morph/%.foma
cd morph; foma -f $(notdir $<)
morph/%.foma: paradigms/%.p
mkdir -p morph ; python src/morphanalyzer.py -o -c -u -s -n $(notdir [email protected]) $< > $@
holes:
cd src; python hole.py
SALDOM=$(wildcard saldom/words/*.txt)
SALDOMPARAS=$(SALDOM:.txt=.p)
saldomp: $(SALDOMPARAS)
saldomaba:
python src/pextract.py < saldom/aba.txt > paradigms/saldom_aba.p
saldom/words/%.p:
python src/pextract.py < saldom/words/$*.txt > saldom/words/$*.p
python src/paradigm.py -t saldom/words/$*.p
testsaldom:
python src/paradigm.py -t paradigms/saldom_*.p
htest:
python src/pextract.py < data/de_noun_h_train_dev.txt > paradigms/de_noun_h_train_dev.p
python src/paradigm.py -p paradigms/de_noun_h_train_dev.p
cparadigm:
python src/cparadigm.py -c paradigms/shared1_de_noun_train.p
cparadigmi:
python src/cparadigm.py -i paradigms/shared1_de_noun_train.p
shared:
python src/convert_shared_data.py data/sigmorphon2016/data/arabic-task1-train V > data/shared1_ar_verb_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/arabic-task1-train N > data/shared1_ar_noun_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/arabic-task1-train ADJ > data/shared1_ar_adj_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/georgian-task1-train V > data/shared1_ka_verb_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/georgian-task1-train N > data/shared1_ka_noun_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/georgian-task1-train ADJ > data/shared1_ka_adj_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/navajo-task1-train V > data/shared1_nv_verb_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/navajo-task1-train N > data/shared1_nv_noun_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/spanish-task1-train V > data/shared1_es_verb_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/spanish-task1-train N > data/shared1_es_noun_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/spanish-task1-train ADJ > data/shared1_es_adj_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/finnish-task1-train V > data/shared1_fi_verb_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/finnish-task1-train N > data/shared1_fi_noun_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/finnish-task1-train ADJ > data/shared1_fi_adj_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/german-task1-train V > data/shared1_de_verb_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/german-task1-train N > data/shared1_de_noun_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/german-task1-train ADJ > data/shared1_de_adj_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/russian-task1-train V > data/shared1_ru_verb_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/russian-task1-train N > data/shared1_ru_noun_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/russian-task1-train ADJ > data/shared1_ru_adj_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/turkish-task1-train V > data/shared1_tr_verb_train.txt
python src/convert_shared_data.py data/sigmorphon2016/data/turkish-task1-train N > data/shared1_tr_noun_train.txt
pshared:
python src/pextract.py < data/shared1_ar_verb_train.txt > paradigms/shared1_ar_verb_train.p
python src/pextract.py < data/shared1_ar_noun_train.txt > paradigms/shared1_ar_noun_train.p
python src/pextract.py < data/shared1_ar_adj_train.txt > paradigms/shared1_ar_adj_train.p
python src/pextract.py < data/shared1_ka_verb_train.txt > paradigms/shared1_ka_verb_train.p
python src/pextract.py < data/shared1_ka_noun_train.txt > paradigms/shared1_ka_noun_train.p
python src/pextract.py < data/shared1_ka_adj_train.txt > paradigms/shared1_ka_adj_train.p
python src/pextract.py < data/shared1_nv_verb_train.txt > paradigms/shared1_nv_verb_train.p
python src/pextract.py < data/shared1_nv_noun_train.txt > paradigms/shared1_nv_noun_train.p
python src/pextract.py < data/shared1_es_verb_train.txt > paradigms/shared1_es_verb_train.p
python src/pextract.py < data/shared1_es_noun_train.txt > paradigms/shared1_es_noun_train.p
python src/pextract.py < data/shared1_es_adj_train.txt > paradigms/shared1_es_adj_train.p
python src/pextract.py < data/shared1_fi_verb_train.txt > paradigms/shared1_fi_verb_train.p
python src/pextract.py < data/shared1_fi_noun_train.txt > paradigms/shared1_fi_noun_train.p
python src/pextract.py < data/shared1_fi_adj_train.txt > paradigms/shared1_fi_adj_train.p
python src/pextract.py < data/shared1_de_verb_train.txt > paradigms/shared1_de_verb_train.p
python src/pextract.py < data/shared1_de_noun_train.txt > paradigms/shared1_de_noun_train.p
python src/pextract.py < data/shared1_de_adj_train.txt > paradigms/shared1_de_adj_train.p
python src/pextract.py < data/shared1_ru_verb_train.txt > paradigms/shared1_ru_verb_train.p
python src/pextract.py < data/shared1_ru_noun_train.txt > paradigms/shared1_ru_noun_train.p
python src/pextract.py < data/shared1_ru_adj_train.txt > paradigms/shared1_ru_adj_train.p
python src/pextract.py < data/shared1_tr_verb_train.txt > paradigms/shared1_tr_verb_train.p
python src/pextract.py < data/shared1_tr_noun_train.txt > paradigms/shared1_tr_noun_train.p
cpshared:
python src/cparadigm.py -c paradigms/shared1_ar_verb_train.p > paradigms/shared1_ar_verb_train.cp
python src/cparadigm.py -c paradigms/shared1_ar_noun_train.p > paradigms/shared1_ar_noun_train.cp
python src/cparadigm.py -c paradigms/shared1_ar_adj_train.p > paradigms/shared1_ar_adj_train.cp
python src/cparadigm.py -c paradigms/shared1_ka_verb_train.p > paradigms/shared1_ka_verb_train.cp
python src/cparadigm.py -c paradigms/shared1_ka_noun_train.p > paradigms/shared1_ka_noun_train.cp
python src/cparadigm.py -c paradigms/shared1_ka_adj_train.p > paradigms/shared1_ka_adj_train.cp
python src/cparadigm.py -c paradigms/shared1_nv_verb_train.p > paradigms/shared1_nv_verb_train.cp
python src/cparadigm.py -c paradigms/shared1_nv_noun_train.p > paradigms/shared1_nv_noun_train.cp
python src/cparadigm.py -c paradigms/shared1_es_verb_train.p > paradigms/shared1_es_verb_train.cp
python src/cparadigm.py -c paradigms/shared1_es_noun_train.p > paradigms/shared1_es_noun_train.cp
python src/cparadigm.py -c paradigms/shared1_es_adj_train.p > paradigms/shared1_es_adj_train.cp
python src/cparadigm.py -c paradigms/shared1_fi_verb_train.p > paradigms/shared1_fi_verb_train.cp
python src/cparadigm.py -c paradigms/shared1_fi_noun_train.p > paradigms/shared1_fi_noun_train.cp
python src/cparadigm.py -c paradigms/shared1_fi_adj_train.p > paradigms/shared1_fi_adj_train.cp
python src/cparadigm.py -c paradigms/shared1_de_verb_train.p > paradigms/shared1_de_verb_train.cp
python src/cparadigm.py -c paradigms/shared1_de_noun_train.p > paradigms/shared1_de_noun_train.cp
python src/cparadigm.py -c paradigms/shared1_de_adj_train.p > paradigms/shared1_de_adj_train.cp
python src/cparadigm.py -c paradigms/shared1_ru_verb_train.p > paradigms/shared1_ru_verb_train.cp
python src/cparadigm.py -c paradigms/shared1_ru_noun_train.p > paradigms/shared1_ru_noun_train.cp
python src/cparadigm.py -c paradigms/shared1_ru_adj_train.p > paradigms/shared1_ru_adj_train.cp
python src/cparadigm.py -c paradigms/shared1_tr_verb_train.p > paradigms/shared1_tr_verb_train.cp
python src/cparadigm.py -c paradigms/shared1_tr_noun_train.p > paradigms/shared1_tr_noun_train.cp
clean:
rm -f morph/*.foma morph/*.bin
#dev:
# mkdir -p output
# cd src;python cexp.py ../paradigms/es_verb_train.p ../data/es_verb_dev.txt > ../output/es_verb.txt
# cd src;python cexp.py ../paradigms/de_verb_train.p ../data/de_verb_dev.txt > ../output/de_verb.txt
# cd src;python cexp.py ../paradigms/fi_verb_train.p ../data/fi_verb_dev.txt > ../output/fi_verb.txt
# cd src;python cexp.py ../paradigms/de_noun_train.p ../data/de_noun_dev.txt > ../output/de_noun.txt
# cd src;python cexp.py ../paradigms/fi_nounadj_train.p ../data/fi_nounadj_dev.txt > ../output/fi_nounadj.txt
# tail -n 3 output/*
#test:
# mkdir -p output
# cd src;python cexp.py ../paradigms/es_verb_train_dev.p ../data/es_verb_test.txt > ../output/es_verb.txt
# cd src;python cexp.py ../paradigms/de_verb_train_dev.p ../data/de_verb_test.txt > ../output/de_verb.txt
# cd src;python cexp.py ../paradigms/fi_verb_train_dev.p ../data/fi_verb_test.txt > ../output/fi_verb.txt
# cd src;python cexp.py ../paradigms/de_noun_train_dev.p ../data/de_noun_test.txt > ../output/de_noun.txt
# cd src;python cexp.py ../paradigms/fi_nounadj_train_dev.p ../data/fi_nounadj_test.txt > ../output/fi_nounadj.txt
# tail -n 3 output/*
ifeq (${VIRTUAL_ENV},)
VENV_NAME = .venv
INVENV = rye run
else
VENV_NAME = ${VIRTUAL_ENV}
INVENV =
endif
install-dev:
rye sync
PROJECT := paradigmextract
PROJECT_SRC := paradigmextract
PLATFORM := ${shell uname -o}
default_cov := "--cov=paradigmextract"
cov_report := "term-missing"
cov := ${default_cov}
all_tests := tests
tests := tests
${info Platform: ${PLATFORM}}
${info Using ${VENV_NAME}}
.PHONY: test
test:
${INVENV} pytest -vv ${tests}
.PHONY: doc-tests
doc-tests:
${INVENV} pytest --doctest-modules ${PROJECT_SRC}
.PHONY: test-w-coverage
test-w-coverage: install-dev
${INVENV} pytest -vv ${cov} --cov-report=${cov_report} ${all_tests}
.PHONY: type-check
type-check:
${INVENV} mypy --config-file mypy.ini ${PROJECT} ${tests}
.PHONY: lint
lint:
${INVENV} ruff ${PROJECT} ${tests}
part := "patch"
bumpversion: install-dev
${INVENV} bump2version ${part}
.PHONY: fmt
fmt:
${INVENV} ruff format ${PROJECT} ${tests}
.PHONY: fmt-check
fmt-check:
${INVENV} ruff format --check ${PROJECT} ${tests}