File size: 8,895 Bytes
48056e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22c9e6d
 
 
 
 
 
3ae464f
 
 
 
 
 
a93d1d7
 
 
 
 
 
28c203a
 
 
 
 
 
 
22c9e6d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48056e2
3ae464f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a93d1d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28c203a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a93d1d7
48056e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
.PHONY: FORCE


## Check hub identity
hub/whoami : .make/requirements
	poetry run huggingface-cli whoami

## Login to hub
hub/login : .make/requirements
	poetry run huggingface-cli login

## Create the hub dataset repository
# had to create this through the web interface
hub/create : .make/requirements
	poetry run huggingface-cli repo create aste-v2 --type dataset

data : \
	data/2014/laptop/aste/test.gz.parquet \
	data/2014/laptop/aste/valid.gz.parquet \
	data/2014/laptop/sem-eval/train.gz.parquet \
	data/2014/laptop/aste/train.gz.parquet \
	data/2014/laptop/sem-eval/test.gz.parquet \
	data/2014/laptop/sem-eval/valid.gz.parquet \
	data/2014/restaurant/aste/train.gz.parquet \
	data/2014/restaurant/aste/valid.gz.parquet \
	data/2014/restaurant/aste/test.gz.parquet \
	data/2014/restaurant/sem-eval/train.gz.parquet \
	data/2014/restaurant/sem-eval/valid.gz.parquet \
	data/2014/restaurant/sem-eval/test.gz.parquet \
	data/2015/restaurant/aste/test.gz.parquet \
	data/2015/restaurant/aste/train.gz.parquet \
	data/2015/restaurant/aste/valid.gz.parquet \
	data/2015/restaurant/sem-eval/test.gz.parquet \
	data/2015/restaurant/sem-eval/train.gz.parquet \
	data/2015/restaurant/sem-eval/valid.gz.parquet \
	data/2016/restaurant/aste/train.gz.parquet \
	data/2016/restaurant/aste/valid.gz.parquet \
	data/2016/restaurant/aste/test.gz.parquet \
	data/2016/restaurant/sem-eval/train.gz.parquet \
	data/2016/restaurant/sem-eval/valid.gz.parquet \
	data/2016/restaurant/sem-eval/test.gz.parquet


data/2014/laptop/aste/train.gz.parquet : .make/requirements
	poetry run python -m src.main aste \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/laptop-2014/train_triplets.txt \
		--output-file $@

data/2014/laptop/aste/valid.gz.parquet : .make/requirements
	poetry run python -m src.main aste \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/laptop-2014/dev_triplets.txt \
		--output-file $@

data/2014/laptop/aste/test.gz.parquet : .make/requirements
	poetry run python -m src.main aste \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/laptop-2014/test_triplets.txt \
		--output-file $@

data/2014/laptop/sem-eval/train.gz.parquet : .make/requirements
	poetry run python -m src.main sem-eval \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/laptop-2014/train_triplets.txt \
		--sem-eval-file data/raw/sem-eval/2014/Laptop_Train_v2.xml \
		--output-file $@

data/2014/laptop/sem-eval/valid.gz.parquet : .make/requirements
	poetry run python -m src.main sem-eval \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/laptop-2014/dev_triplets.txt \
		--sem-eval-file data/raw/sem-eval/2014/Laptop_Train_v2.xml \
		--output-file $@

data/2014/laptop/sem-eval/test.gz.parquet : .make/requirements
	poetry run python -m src.main sem-eval \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/laptop-2014/test_triplets.txt \
		--sem-eval-file data/raw/sem-eval/2014/Laptops_Test_Data_PhaseA.xml \
		--output-file $@


data/2014/restaurant/aste/train.gz.parquet : .make/requirements
	poetry run python -m src.main aste \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2014/train_triplets.txt \
		--output-file $@

data/2014/restaurant/aste/valid.gz.parquet : .make/requirements
	poetry run python -m src.main aste \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2014/dev_triplets.txt \
		--output-file $@

data/2014/restaurant/aste/test.gz.parquet : .make/requirements
	poetry run python -m src.main aste \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2014/test_triplets.txt \
		--output-file $@

data/2014/restaurant/sem-eval/train.gz.parquet : .make/requirements
	poetry run python -m src.main sem-eval \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2014/train_triplets.txt \
		--sem-eval-file data/raw/sem-eval/2014/Restaurants_Train_v2.xml \
		--output-file $@

data/2014/restaurant/sem-eval/valid.gz.parquet : .make/requirements
	poetry run python -m src.main sem-eval \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2014/dev_triplets.txt \
		--sem-eval-file data/raw/sem-eval/2014/Restaurants_Train_v2.xml \
		--output-file $@

data/2014/restaurant/sem-eval/test.gz.parquet : .make/requirements
	poetry run python -m src.main sem-eval \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2014/test_triplets.txt \
		--sem-eval-file data/raw/sem-eval/2014/Restaurants_Test_Data_PhaseA.xml \
		--output-file $@


data/2015/restaurant/aste/train.gz.parquet : .make/requirements
	poetry run python -m src.main aste \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2015/train_triplets.txt \
		--output-file $@

data/2015/restaurant/aste/valid.gz.parquet : .make/requirements
	poetry run python -m src.main aste \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2015/dev_triplets.txt \
		--output-file $@

data/2015/restaurant/aste/test.gz.parquet : .make/requirements
	poetry run python -m src.main aste \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2015/test_triplets.txt \
		--output-file $@

data/2015/restaurant/sem-eval/train.gz.parquet : .make/requirements
	poetry run python -m src.main sem-eval \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2015/train_triplets.txt \
		--sem-eval-file data/raw/sem-eval/2015/ABSA-15_Restaurants_Train_Final.xml \
		--output-file $@

data/2015/restaurant/sem-eval/valid.gz.parquet : .make/requirements
	poetry run python -m src.main sem-eval \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2015/dev_triplets.txt \
		--sem-eval-file data/raw/sem-eval/2015/ABSA-15_Restaurants_Train_Final.xml \
		--output-file $@

data/2015/restaurant/sem-eval/test.gz.parquet : .make/requirements
	poetry run python -m src.main sem-eval \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2015/test_triplets.txt \
		--sem-eval-file data/raw/sem-eval/2015/ABSA15_Restaurants_Test.xml \
		--output-file $@


data/2016/restaurant/aste/train.gz.parquet : .make/requirements
	poetry run python -m src.main aste \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2016/train_triplets.txt \
		--output-file $@

data/2016/restaurant/aste/valid.gz.parquet : .make/requirements
	poetry run python -m src.main aste \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2016/dev_triplets.txt \
		--output-file $@

data/2016/restaurant/aste/test.gz.parquet : .make/requirements
	poetry run python -m src.main aste \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2016/test_triplets.txt \
		--output-file $@

data/2016/restaurant/sem-eval/train.gz.parquet : .make/requirements
	poetry run python -m src.main sem-eval \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2016/train_triplets.txt \
		--sem-eval-file data/raw/sem-eval/2016/ABSA16_Restaurants_Train_SB1_v2.xml \
		--output-file $@

data/2016/restaurant/sem-eval/valid.gz.parquet : .make/requirements
	poetry run python -m src.main sem-eval \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2016/dev_triplets.txt \
		--sem-eval-file data/raw/sem-eval/2016/ABSA16_Restaurants_Train_SB1_v2.xml \
		--output-file $@

data/2016/restaurant/sem-eval/test.gz.parquet : .make/requirements
	poetry run python -m src.main sem-eval \
		--aste-file data/raw/aspect-sentiment-triplet-extraction/restaurant-2016/test_triplets.txt \
		--sem-eval-file data/raw/sem-eval/2016/EN_REST_SB1_TEST.xml.gold \
		--output-file $@


## Install Python Dependencies
requirements : .make/requirements

.make/requirements : PYTHON_VERSION = $(shell cat .python-version)
.make/requirements : pyproject.toml poetry.lock
	poetry env use $(PYTHON_VERSION)
	PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry install
	touch $@

poetry.lock : PYTHON_VERSION = $(shell cat .python-version)
poetry.lock : pyproject.toml
	poetry env use $(PYTHON_VERSION)
	PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry install
	touch $@

#################################################################################
# Self Documenting Commands                                                     #
#################################################################################

.DEFAULT_GOAL := show-help
# See <https://gist.github.com/klmr/575726c7e05d8780505a> for explanation.
.PHONY: show-help
show-help:
	@echo "$$(tput setaf 2)Available rules:$$(tput sgr0)";sed -ne"/^## /{h;s/.*//;:d" -e"H;n;s/^## /---/;td" -e"s/:.*//;G;s/\\n## /===/; s/\\n//g;p;}" ${MAKEFILE_LIST}|awk -F === -v n=$$(tput cols) -v i=4 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"- %s%s%s\n",a, $$1,z;m=split($$2,w,"---");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;}printf"%*s%s\n",-i," ",w[j];}}'