-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplates.py
325 lines (317 loc) · 13.2 KB
/
templates.py
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
prompt_templates = {
'gpt-jt': {
'prefix': 'Please answer the following question:',
'example': 'Question: {question}\nAnswer: {answer}',
'joiner': '\n\n',
},
'gpt-jt_no_prefix': {
'prefix': '',
'example': 'Question: {question} Answer: {answer}',
'joiner': '\n\n',
},
'question_only': {
'prefix': '',
'example': '{question} {answer}',
'joiner': '\n',
},
'mention_only': {
'prefix': '',
'example': '{question}',
'joiner': '\n',
},
}
_pred2paraphrase_idx2question_tpl = {
'P1082': [
'What is the population of {subj}?',
'What is the size of the population of {subj}?',
'How many people live in {subj}?',
'How many inhabitants does {subj} have?',
'What is the number of people living in {subj}?',
],
'P1128': [
'How many employees does {subj} have?',
'How many people work for {subj}?',
'What is the number of employees of {subj}?',
'What is the total number of employees at {subj}?',
'How big is the workforce of {subj}?',
],
'P1538': [
'What is the number of households in {subj}?',
'How many households does {subj} have?',
'What is the total count of households in {subj}?',
'How many households are there in {subj}?',
'How big is the number of households in {subj}?',
],
'P2031': [
'In what year did {subj} start working?',
'In what year did the career of {subj} begin?',
'In what year did {subj} become active?',
'In which year did {subj} begin their career?',
'What year did the career of {subj} start?',
],
'P2044': [
'How high is {subj}?',
'What is the elevation of {subj}?',
'What is the height of {subj}?',
'What is the elevation above mean sea level of {subj}?',
'How high is {subj} above mean sea level?',
],
'P2046': [
'What is the area of {subj}?',
'What is the surface area of {subj}?',
'How large is {subj} in terms of area?',
'How large is {subj} in terms of surface area?',
'What is the total area of {subj}?',
],
'P2047': [
'What is the duration of {subj}?',
'How long does {subj} last?',
'How long does {subj} take?',
'How long is {subj} in terms of time?',
'How long is the duration of {subj}?',
],
'P2927': [
'What percent of {subj} is water?',
'What percent of the area of {subj} is water?',
'In terms of surface area, what percent of {subj} is water?',
'In {subj}, how much of the surface area is water?',
'What percent of {subj} is water?',
],
'P569': [
'In what year was {subj} born?',
'In which year was {subj} born?',
'What is the birthyear of {subj}?',
'{subj} was born in what year?',
'What is the year in which {subj} was born?',
],
'P570': [
'In what year did {subj} die?',
'In which year did {subj} die?',
'{subj} died in what year?',
'What is the year in which {subj} died?',
'In which year did {subj} pass away?',
],
'P571': [
'In what year was {subj} established?',
'In what year was {subj} created?',
'In which year did {subj} come into existence?',
'In what year was {subj} founded?',
'What is the creation year of {subj}?',
],
'P576': [
'In what year did {subj} cease to exist?',
'In what year was {subj} dissolved, abolished or demolished?',
'What is the final year of {subj}?',
'What year marks the end of {subj}?',
'What is the year in which {subj} ceased to exist?',
],
'P577': [
'In what year was {subj} published?',
'In what year was {subj} first published?',
'{subj} was initially released in which year?',
'In which year was {subj} first released?',
'In what year was the initial release of {subj}?',
],
'P585': [
'In what year did {subj} take place?',
'In which year year was {subj}?',
'{subj} was in what year?',
'{subj} took place in what year?',
'What is the year in which {subj} happened?',
],
'P625.lat': [
'What is the latitude of {subj}?',
'What degree of latitude is {subj}?',
'What is the geographic latitude of {subj}?',
'Where is {subj} located in terms of geographic latitude?',
'{subj} is located at which geographic latitude?',
],
'P625.long': [
'What is the longitude of {subj}?',
'What degree of longitude is {subj}?',
'What is the geographic longitude of {subj}?',
'Where is {subj} located in terms of geographic longitude?',
'{subj} is located at which geographic longitude?',
],
}
_pred2paraphrase_idx2statement_tpl = {
'P1082': [
'{subj} has a population of {value} people.',
'The size of the population of {subj} is {value} people.',
'{value} people live in {subj}.',
'{subj} has {value} inhabitants.',
'The number of people living in {subj} is {value}.',
],
'P1128': [
'{subj} has {value} employees.',
'{value} people work for {subj}.',
'The number of employees of {subj} is {value}',
'The total number of employees at {subj} is {value}.',
'The workforce of {subj} has a size of {value} people.',
],
'P1538': [
'The number of households in {subj} is {value}.',
'{subj} has {value} households.',
'The total count of households in {subj} is {value}.',
'There are {value} households in {subj}.',
'The number of households in {subj} is {value} households.',
],
'P2031': [
'{subj} started working in the year {value}.',
'The career of {subj} began in the year {value}.',
'{subj} become active in the year {value}.',
'{subj} began their career in the year {value}',
'The career of {subj} started in the year {value}.',
],
'P2044': [
'{subj} is {value} high.',
'The elevation of {subj} is {value}.',
'The height of {subj} is {value}.',
'The elevation above mean sea level of {subj} is {value}',
'{subj} is {value} above mean sea level.',
],
'P2046': [
'The area of {subj} is {value}.',
'The surface area of {subj} is {value}.',
'{subj} has a size of {value} in terms of area.',
'{subj} has a size of {value} in terms of surface area.',
'The total area of {subj} is {value}',
],
'P2047': [
'The duration of {subj} is {value}.',
'{subj} lasts {value}.',
'{subj} takes {value}.',
'{subj} is {value} long.',
'The duration of {subj} is {value} long.',
],
'P2927': [
'{value} percent of {subj} is water.',
'{value} percent of the area of {subj} is water.',
'In terms of surface area, {value} percent of {subj} is water.',
'In {subj}, {value} percent of the surface area is water.',
'{value} percent of {subj} are water.',
],
'P569': [
'{subj} was born in {value}.',
'{subj} was born in the year {value}.',
'The birthyear of {subj} is {value}',
'The year {subj} was born in is {value}.',
'The year in which {subj} was born is {value}.',
],
'P570': [
'{subj} died in {value}.',
'{subj} died in the year {value}.',
'{subj} passed away in {value}.',
'The year in which {subj} died is {value}.',
'The year in which {subj} passed away is {value}.',
],
'P571': [
'{subj} was established in the year {value}.',
'{subj} was created in the year {value}.',
'{subj} came into existence in {value}',
'{subj} was founded in the year {value}',
'The creation year of {subj} is {value}.',
],
'P576': [
'{subj} ceased to exist in the year {value}.',
'{subj} was dissolved, abolished or demolished in the year {value}.',
'The final year of {subj} is {value}.',
'The year {value} marks the end of {subj}.',
'{subj} ceased to exist in {value}.',
],
'P577': [
'{subj} was published in the year {value}.',
'{subj} was first published in {value}',
'{subj} was initially released in the year {value}.',
'{subj} was first released in the year {value}.',
'The initial release of {subj} was in {value}.',
],
'P585': [
'{subj} took place in the year {value}.',
'{subj} was in the year {value}.',
'{subj} was in {value}.',
'The year in which {subj} took place is {value}.',
'The year in which {subj} happened is {value}.',
],
'P625.lat': [
'The latitude of {subj} is {value}.',
'The degree of latitude of {subj} is {value}.',
'The geographic latitude of {subj} is {value}.',
'In terms of geographic latitude, {subj} is located at {value}.',
'{subj} is located at a geographic latitude of {value}',
],
'P625.long': [
'The longitude of {subj} is {value}.',
'The degree of longitude of {subj} is {value}.',
'The geographic longitude of {subj} is {value}.',
'In terms of geographic longitude, {subj} is located at {value}.',
'{subj} is located at a geographic longitude of {value}',
],
}
deprecated_pred2question_tpl = {
# 'P1539': 'How big is the female population of {subj}?',
# 'P1540': 'How big is the male population of {subj}?',
'P1082': 'What is the population of {subj}?',
'P1128': 'How many employees does {subj} have?',
'P1538': 'What is the number of households in {subj}?',
'P2031': 'In what year did {subj} start working?',
'P2044': 'How high is {subj}?',
'P2046': 'What is the area of {subj}?',
'P2047': 'What is the duration of {subj}?',
'P2927': 'What percent of {subj} is water?',
'P569': 'In what year was {subj} born?',
'P570': 'In what year did {subj} die?',
'P571': 'In what year was {subj} established?',
'P576': 'In what year did {subj} cease to exist?',
'P577': 'In what year was {subj} published?',
# 'P580': 'In what year did {subj} start?',
# 'P582': 'In what year did {subj} end?',
'P585': 'In what year did {subj} take place?',
'P625.lat': 'What is the latitude of {subj}?',
'P625.long': 'What is the longitude of {subj}?',
# 'P8687': 'How many social media followers does {subj} have?',
}
_pred2tpl_binary = {
'P1082': '{subj} has a population of {value}.',
'P1128': '{subj} has {value} employees.',
'P1538': '{subj} has {value} households.',
'P1539': '{subj} has a female population of {value}.',
'P1540': '{subj} has a male population of {value}.',
'P2031': '{subj} start working in the year {value}.',
'P2044': '{subj} has a height of {value} {unit}.',
'P2046': '{subj} has an area of {value} {unit}.',
'P2927': '{value} percent of {subj} is water.',
'P569': '{subj} was born in the year {value}.',
'P570': '{subj} died in the year {value}.',
'P571': '{subj} was established in the year {value}.',
'P576': '{subj} ceased to exist in the year {value}.',
'P577': '{subj} was first published in the year {value}.',
'P580': '{subj} started in the year {value}.',
'P582': '{subj} ended in the year {value}.',
'P585': '{subj} took place in the year {value}.',
'P625.lat': '{subj} has a latitude of {value}.',
'P625.long': '{subj} has a longitude of {value}.',
'P8687': '{subj} has {value} followers on social media.',
}
_pred2question_tpl_binary = {
'P1082': 'Does {subj} have a population of {value}?',
'P1128': 'Does {subj} have {value} employees?',
'P1538': 'Does {subj} have {value} households?',
'P1539': 'Does {subj} have a female population of {value}?',
'P1540': 'Does {subj} have a male population of {value}?',
'P2031': 'Did {subj} start working in the year {value}?',
'P2044': 'Does {subj} have a height of {value} {unit}?',
'P2046': 'Does {subj} have an area of {value} {unit}?',
'P2927': 'Are {value} percent of {subj} water?',
'P569': 'Was {subj} born in the year {value}?',
'P570': 'Did {subj} die in the year {value}?',
'P571': 'Was {subj} established in the year {value}?',
'P576': 'Did {subj} cease to exist in the year {value}?',
'P577': 'Was {subj} first published in the year {value}?',
'P580': 'Did {subj} start in the year {value}?',
'P582': 'Did {subj} end in the year {value}?',
'P585': 'Did {subj} take place in the year {value}?',
'P625.lat': '{subj} have a latitude of {value}?',
'P625.long': '{subj} have a longitude of {value}?',
'P8687': '{subj} have {value} followers on social media?',
}