-
Notifications
You must be signed in to change notification settings - Fork 1
/
production.mk
137 lines (107 loc) · 3.58 KB
/
production.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
# Make file for production data for the gendertropes vis.
# These tasks output data in the format we are going to pipe
# down to the client.
#
# Shared Variables
#
output_dir = data/production
create_out:
mkdir -p data/production
#
# Trope info map
#
trope_dict: $(output_dir)/trope_dict.json
$(output_dir)/trope_dict.json:
mkdir -p data/production
python -m src.trope.trope_dictionary --dest $@
#
# Trope lists (just the trope ids)
#
trope_lists: $(output_dir)/trope_list_all.json $(output_dir)/trope_list_top_100_ll.json $(output_dir)/trope_list_top_100_count.json $(output_dir)/film_list.json
$(output_dir)/trope_list_all.json:
python -m src.trope.trope_lists --dest $@
$(output_dir)/trope_list_top_100_ll.json:
python -m src.trope.trope_lists --by_ll --dest $@
$(output_dir)/trope_list_top_100_count.json:
python -m src.trope.trope_lists --by_film_occurence --dest $@
#
# Film lists
#
film_list: create_out $(output_dir)/film_list.json $(output_dir)/genres/all_top_100.json $(output_dir)/genres/genres.json $(output_dir)/genres/decades.json
$(output_dir)/film_list.json: data/results/films/full_with_similarity.json
python -m src.film.list --src $< --dest $@
$(output_dir)/genres/all_top_100.json: data/results/films/full_with_similarity.json
mkdir -p $(output_dir)/genres
python -m src.film.list --src $< --dest $@ --top 100
$(output_dir)/genres/genres.json: data/results/films/full_with_similarity.json
mkdir -p $(output_dir)/genres
python -m src.film.list --src $< --dest $@ --genres true
touch -c $(output_dir)/genres/genres.json
$(output_dir)/genres/decades.json: data/results/films/full_with_similarity.json
mkdir -p $(output_dir)/genres
python -m src.film.list --src $< --dest $@ --decades true
touch -c $(output_dir)/genres/decades.json
#
# Adjective page data
#
adjectives: $(output_dir)/adjectives_network.json
$(output_dir)/adjectives_network.json:
python -m src.adjectives.adjectives --dest $@
#
# Gender splits page data
#
gender_split: $(output_dir)/gender_splits.json
$(output_dir)/gender_splits.json:
python -m src.adjectives.gender_splits --dest $@
#
# Film details data
#
film_details:
echo "Building detail film files"
mkdir -p $(output_dir)/films/details
python -m src.film.detail --src=data/results/films/full_with_similarity.json \
--dest=data/production/films/details \
--roles data/results/films/roles-female.json \
--roles data/results/films/roles-male.json \
--extended=True
#
# Trope details data
#
trope_details:
echo "Building trope detail files"
mkdir -p $(output_dir)/tropes/details
python -m src.trope.detail --dest=$(output_dir)/tropes/details
#
# Clean tasks
#
clean:
rm -rf data/production/*.json
rm -rf data/production/genres/*.json
rm -rf data/production/films/details/*.json
rm -rf data/production/tropes/details/*.json
mkdir -p data/production
#
# Copy tasks
#
# This will sync the production files to their corresponding path in
# a target data directory. The target directory is expected to have
# the following structure of subdirs. It will use rsync to avoid
# unnecessary copies. The target folder should be passed in as
# a var to the makefile e.g. target=foo
#
# adjectives
# films
# details
# posters
# gender
# tropes
# detail
# images
copy:
echo $(target)
rsync -a data/production/trope_* $(target)/tropes
rsync -a data/production/adjectives_network.json $(target)/adjectives
rsync -a data/production/gender_splits.json $(target)/gender
rsync -a data/production/films/details/ $(target)/films/detail/
rsync -a data/production/tropes/details/ $(target)/tropes/detail/
rsync -a data/production/genres/ $(target)/films/genres/