-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
124 lines (101 loc) · 3.15 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
## 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
PY_DOC_BUILD_HTML_DEPS += cpgraphs
## Project
#
ENTRY = ./calamr
ALIGN_DIR = results/align
## 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
$(ENTRY) aligncorp liu-example -o example -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
$(ENTRY) aligncorp ALL -o example -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 -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
# 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 ~/.cache/calamr ~/.calamrrc