-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
142 lines (117 loc) · 3.8 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
## makefile automates the build and deployment for python projects
## Build system
#
PROJ_TYPE = python
PROJ_MODULES = git python-resources python-cli python-doc python-doc-deploy markdown
PY_DEP_POST_DEPS += scoredeps modeldeps
CLEAN_DEPS += pycleancache
ADD_CLEAN_ALL += data corpus/micro/amr.txt ~/.cache/calamr ~/.calamrrc
PY_DOC_BUILD_HTML_DEPS += cpgraphs
## Project
#
ENTRY = ./calamr
ALIGN_DIR = results/align
PY_CMR_ENV = ./env
EXAMPLE_DIR = example
## Includes
#
include ./zenbuild/main.mk
## Configure
#
# download [spacy models](https://spacy.io/models/en)
.PHONY: modeldeps
modeldeps:
$(PIP_BIN) install $(PIP_ARGS) -r $(PY_SRC)/requirements-model.txt
# install dependencies needed for scoring AMRs (i.e. WLK)
.PHONY: scoredeps
scoredeps:
$(PIP_BIN) install $(PIP_ARGS) -r $(PY_SRC)/requirements-score.txt
# configure the application
.PHONY: configapp
configapp:
[ ! -f ~/.calamrrc ] && cp src/config/dot-calamrrc ~/.calamrrc
if [ ! -d ~/.cache/calamr ] ; then \
mkdir -p ~/.cache/calamr ; \
cp -r corpus ~/.cache/calamr ; \
fi
# recreate the micro corpus using adhoc source/summary sentences in a JSON file
.PHONY: micro
micro: clean
$(ENTRY) mkadhoc --override calamr_corpus.name=adhoc
mkdir -p download
( cat corpus/micro/amr.txt | bzip2 > download/micro.txt.bz2 )
## Alignment
#
# create adhoc corpus graphs for one example
.PHONY: aligncorp
aligncorp:
rm -rf ${EXAMPLE_DIR}
$(ENTRY) aligncorp liu-example -o ${EXAMPLE_DIR} -f txt \
--override='calamr_corpus.name=adhoc,calamr_default.renderer=graphviz'
# do not invoke directly--used by the align<corpus> targets
.PHONY: aligncorpall
aligncorpall:
@echo "aligning $(CORP_CONF)"
$(ENTRY) aligncorp ALL \
--override \
"calamr_corpus.name=$(CORP_CONF),calamr_default.renderer=graphviz,calamr_default.flow_graph_result_caching=preemptive" \
--rendlevel $(REND_LEVEL) --cached \
-o $(ALIGN_DIR)/$(CORP_CONF)
# align and generate graphs for the adhoc corpus
.PHONY: alignadhoc
alignadhoc:
make CORP_CONF=adhoc REND_LEVEL=5 aligncorpall
# align and generate graphs for the proxyreport corpus
.PHONY: alignproxy
alignproxy:
make CORP_CONF=proxy-report REND_LEVEL=5 \
aligncorpall > align-proxy.log 2>&1 &
## Example graphs
#
# create examples of html graphs
.PHONY: graphexampleshtml
graphexampleshtml:
rm -rf ${EXAMPLE_DIR}
$(ENTRY) aligncorp ALL -o ${EXAMPLE_DIR} -r 2 -f txt \
--override='calamr_corpus.name=adhoc,calamr_default.renderer=graphviz'
# create examples of graphs in latex friendly EPS
.PHONY: graphexampleseps
graphexampleseps:
rm -rf example
$(ENTRY) aligncorp ALL -o ${EXAMPLE_DIR} -r 2 -f txt \
--override='calamr_corpus.name=adhoc,calamr_graph_render_graphviz.extension=eps,calamr_default.renderer=graphviz'
# copy the graphs and guide to GitHub pages
.PHONY: cpgraphs
cpgraphs:
@echo "copy graphs"
mkdir -p $(PY_DOC_BUILD_HTML)
cp -r doc $(PY_DOC_BUILD_HTML)
## Test
#
# test: unit and integration
.PHONY: testall
testall: test
./test/inttest
# create a virtual environment for the tests
$(PY_CMR_ENV):
@if [ ! -d "$(PY_CMR_ENV)" ] ; then \
echo "creating environment in $(PY_CMR_ENV)" ; \
conda env create -f src/python/environment.yml \
--prefix=$(PY_CMR_ENV) ; \
$(PY_CMR_ENV)/bin/pip install plac zensols.pybuild ; \
fi
# creates a test environment and then tests
.PHONY: testworld
testworld: hellfire $(PY_CMR_ENV)
@echo "unit and integration testing..."
@PATH="$(PY_CMR_ENV)/bin:$(PATH)" make test
@PATH="$(PY_CMR_ENV)/bin:$(PATH)" ./test/inttest
# remove everything (careful)
.PHONY: vaporize
vaporize: cleanall
rm -fr corpus download
git checkout corpus
# remove everything and more (careful!)
.PHONY: hellfire
hellfire: vaporize
rm -fr $(PY_CMR_ENV) ${EXAMPLE_DIR} scored.csv