forked from zotero/translators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ACLWeb.js
600 lines (578 loc) · 18.6 KB
/
ACLWeb.js
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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
{
"translatorID": "f4a5876a-3e53-40e2-9032-d99a30d7a6fc",
"label": "ACLWeb",
"creator": "Guy Aglionby",
"target": "^https?://(www\\.)?(aclanthology\\.org|aclweb\\.org/anthology)/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2022-11-10 10:36:48"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2018 Guy Aglionby
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
var ext2mime = {
gz: 'application/gzip',
tgz: 'application/gzip',
pdf: 'application/pdf',
zip: 'application/zip',
tar: 'application/x-tar',
txt: 'text/plain',
rar: 'application/x-rar-compressed',
rtf: 'application/rtf',
bz2: 'application/x-bzip2',
bz: 'application/x-bzip',
doc: 'application/msword',
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
ppt: 'application/vnd.ms-powerpoint',
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
xls: 'application/vnd.ms-excel',
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
html: 'text/html',
png: 'image/png',
gif: 'image/gif',
jpg: 'image/jpeg',
jpeg: 'image/jpeg',
mp4: 'video/mp4',
tsv: 'text/tab-separated-values',
csv: 'text/csv',
py: 'text/x-python',
tex: 'text/x-tex',
bbl: 'text/x-tex'
};
function detectWeb(doc, url) {
let paperIdRegex = /([A-Z])\d{2}-\d{4}|\d{4}\.([\w\d]+)-[\w\d]+\.\d+/;
let paperMatch = url.match(paperIdRegex);
if (paperMatch) {
let venue = paperMatch[1] ? paperMatch[1] : paperMatch[2];
venue = venue.toLowerCase();
if (venue == 'j' || venue == 'q' || venue == 'tacl' || venue == 'cl') {
return 'journalArticle';
}
else {
return 'conferencePaper';
}
}
else if ((url.includes('/events/') || url.includes('/people/')
|| url.includes('/volumes/') || url.includes('/search/'))
&& getSearchResults(doc, url)) {
return 'multiple';
}
return false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) === 'multiple') {
Zotero.selectItems(getSearchResults(doc, url), function (selected) {
if (selected) {
ZU.processDocuments(Object.keys(selected), scrape);
}
});
}
else if (url.endsWith('.bib')) {
let paperURL = url.slice(0, -'.bib'.length);
ZU.processDocuments(paperURL, scrape);
}
else if (url.endsWith('.pdf')) {
// e.g. http://aclweb.org/anthology/P18-1001.pdf
let paperURL = url.slice(0, -'.pdf'.length);
ZU.processDocuments(paperURL, scrape);
}
else {
scrape(doc);
}
}
function scrape(doc) {
let bibtex = ZU.xpath(doc, '//pre[@id = "citeBibtexContent"]')[0].textContent;
let pdfURL = ZU.xpath(doc, '//a[span[contains(text(), "PDF")]]/@href')[0].value;
let translator = Zotero.loadTranslator("import");
translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4");
translator.setString(bibtex);
translator.setHandler("itemDone", function (obj, item) {
item.attachments.push({
url: pdfURL,
title: 'Full Text PDF',
mimeType: 'application/pdf'
});
delete item.itemID;
if (item.date) {
item.date = ZU.strToISO(item.date);
}
if (item.abstractNote) {
item.abstractNote = ZU.cleanTags(item.abstractNote);
}
if (item.itemType == 'conferencePaper') {
item.conferenceName = getVenue(doc, item.publicationTitle);
}
if (Z.getHiddenPref('attachSupplementary')) {
let supplementaries = ZU.xpath(doc, '//div[contains(@class, "acl-paper-link-block")]//a[contains(@class, "btn-attachment")]');
supplementaries.forEach(function (supplementary) {
let ext = supplementary.href.split('.').pop();
let supplementaryMime = Z.getHiddenPref('supplementaryAsLink') ? 'text/html' : ext2mime[ext];
item.attachments.push({
url: supplementary.href,
title: supplementary.text,
mimeType: supplementaryMime || 'text/html',
snapshot: !Z.getHiddenPref('supplementaryAsLink')
});
});
}
item.complete();
});
translator.translate();
}
function getVenue(doc, pubTitle) {
let venueElements = ZU.xpath(doc, '//dt[contains(text(), "Venue")]//following::dd[1]/a');
let venues = venueElements.map(function (v) {
return v.innerText.trim();
});
if (!venues.length) {
return '';
}
let year = ZU.xpath(doc, '//dt[contains(text(), "Year")]/following::dd[1]')[0].textContent;
let venueString = venues.join('-') + ' ' + year;
if (pubTitle.includes('Student') || pubTitle.includes('Demonstration') || pubTitle.includes('Tutorial')) {
// better to use full proceedingsTitle to cite these publications
return '';
}
if (venueString.includes('SemEval')) {
if (pubTitle.includes('SENSEVAL')) {
return 'SENSEVAL ' + year;
}
else if (pubTitle.includes('Evaluation') && !pubTitle.includes('Joint')) {
return 'SemEval ' + year;
}
else if (!pubTitle.includes('Evaluation') && pubTitle.includes('Joint')) {
return '*SEM ' + year;
}
else if (pubTitle.includes('Volume 1') && pubTitle.includes('Volume 2')) {
return '*SEM/SemEval ' + year;
}
else if (pubTitle.includes('SemEval')) {
return 'SemEval ' + year;
}
else {
return '*SEM ' + year;
}
}
else if (venueString.includes('WS')) {
// better to use full proceedingsTitle to cite these publications
return '';
}
else if (!venueString.includes("HLT") && pubTitle.match('HLT|Human Language Technolog(y|ies)')) {
return venues.join('-') + '-HLT ' + year;
}
return venueString;
}
function getSearchResults(doc, url) {
let items = {};
if (url.includes('/search/')) {
// e.g. https://www.aclweb.org/anthology/search/?q=foo+bar
let results = ZU.xpath(doc, '//div[contains(@class, "gsc-webResult")]//div[contains(@class, "gs-title")]/a');
let paperRegex = /[A-Z]\d{2}-\d{4}|\d{4}\.[\w\d]+-[\w\d]+\.\d+/;
for (let result of results) {
let url = result.href;
if (url.match(paperRegex)) {
if (url.endsWith('.pdf')) {
url = url.slice(0, -'.pdf'.length);
}
items[url] = result.text;
}
}
}
else {
let papers = ZU.xpath(doc, '//section[@id="main"]//strong/a');
for (let paper of papers) {
items[paper.href] = paper.text;
}
}
return Object.keys(items).length ? items : false;
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://www.aclanthology.org/events/acl-2018/",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.aclanthology.org/volumes/P18-1/",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.aclanthology.org/people/i/iryna-gurevych/",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.aclanthology.org/Q18-1001/",
"items": [
{
"itemType": "journalArticle",
"title": "Whodunnit? Crime Drama as a Case for Natural Language Understanding",
"creators": [
{
"firstName": "Lea",
"lastName": "Frermann",
"creatorType": "author"
},
{
"firstName": "Shay B.",
"lastName": "Cohen",
"creatorType": "author"
},
{
"firstName": "Mirella",
"lastName": "Lapata",
"creatorType": "author"
}
],
"date": "2018",
"DOI": "10.1162/tacl_a_00001",
"abstractNote": "In this paper we argue that crime drama exemplified in television programs such as CSI: Crime Scene Investigation is an ideal testbed for approximating real-world natural language understanding and the complex inferences associated with it. We propose to treat crime drama as a new inference task, capitalizing on the fact that each episode poses the same basic question (i.e., who committed the crime) and naturally provides the answer when the perpetrator is revealed. We develop a new dataset based on CSI episodes, formalize perpetrator identification as a sequence labeling problem, and develop an LSTM-based model which learns from multi-modal data. Experimental results show that an incremental inference strategy is key to making accurate guesses as well as learning from representations fusing textual, visual, and acoustic input.",
"libraryCatalog": "ACLWeb",
"pages": "1–15",
"publicationTitle": "Transactions of the Association for Computational Linguistics",
"shortTitle": "Whodunnit?",
"url": "https://www.aclweb.org/anthology/Q18-1001",
"volume": "6",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.aclanthology.org/W04-0801/",
"items": [
{
"itemType": "conferencePaper",
"title": "The Basque lexical-sample task",
"creators": [
{
"firstName": "Eneko",
"lastName": "Agirre",
"creatorType": "author"
},
{
"firstName": "Itziar",
"lastName": "Aldabe",
"creatorType": "author"
},
{
"firstName": "Mikel",
"lastName": "Lersundi",
"creatorType": "author"
},
{
"firstName": "David",
"lastName": "Martínez",
"creatorType": "author"
},
{
"firstName": "Eli",
"lastName": "Pociello",
"creatorType": "author"
},
{
"firstName": "Larraitz",
"lastName": "Uria",
"creatorType": "author"
}
],
"date": "2004-07",
"conferenceName": "SENSEVAL 2004",
"libraryCatalog": "ACLWeb",
"pages": "1–4",
"place": "Barcelona, Spain",
"proceedingsTitle": "Proceedings of SENSEVAL-3, the Third International Workshop on the Evaluation of Systems for the Semantic Analysis of Text",
"publisher": "Association for Computational Linguistics",
"url": "https://www.aclweb.org/anthology/W04-0801",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.aclanthology.org/W19-0101/",
"items": [
{
"itemType": "conferencePaper",
"title": "Can Entropy Explain Successor Surprisal Effects in Reading?",
"creators": [
{
"firstName": "Marten",
"lastName": "van Schijndel",
"creatorType": "author"
},
{
"firstName": "Tal",
"lastName": "Linzen",
"creatorType": "author"
}
],
"date": "2019",
"DOI": "10.7275/qtbb-9d05",
"libraryCatalog": "ACLWeb",
"pages": "1–7",
"proceedingsTitle": "Proceedings of the Society for Computation in Linguistics (SCiL) 2019",
"url": "https://www.aclweb.org/anthology/W19-0101",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.aclanthology.org/N12-2001/",
"items": [
{
"itemType": "conferencePaper",
"title": "Finding the Right Supervisor: Expert-Finding in a University Domain",
"creators": [
{
"firstName": "Fawaz",
"lastName": "Alarfaj",
"creatorType": "author"
},
{
"firstName": "Udo",
"lastName": "Kruschwitz",
"creatorType": "author"
},
{
"firstName": "David",
"lastName": "Hunter",
"creatorType": "author"
},
{
"firstName": "Chris",
"lastName": "Fox",
"creatorType": "author"
}
],
"date": "2012-06",
"libraryCatalog": "ACLWeb",
"pages": "1–6",
"place": "Montréal, Canada",
"proceedingsTitle": "Proceedings of the NAACL HLT 2012 Student Research Workshop",
"publisher": "Association for Computational Linguistics",
"shortTitle": "Finding the Right Supervisor",
"url": "https://www.aclweb.org/anthology/N12-2001",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.aclanthology.org/N18-1001/",
"items": [
{
"itemType": "conferencePaper",
"title": "Label-Aware Double Transfer Learning for Cross-Specialty Medical Named Entity Recognition",
"creators": [
{
"firstName": "Zhenghui",
"lastName": "Wang",
"creatorType": "author"
},
{
"firstName": "Yanru",
"lastName": "Qu",
"creatorType": "author"
},
{
"firstName": "Liheng",
"lastName": "Chen",
"creatorType": "author"
},
{
"firstName": "Jian",
"lastName": "Shen",
"creatorType": "author"
},
{
"firstName": "Weinan",
"lastName": "Zhang",
"creatorType": "author"
},
{
"firstName": "Shaodian",
"lastName": "Zhang",
"creatorType": "author"
},
{
"firstName": "Yimei",
"lastName": "Gao",
"creatorType": "author"
},
{
"firstName": "Gen",
"lastName": "Gu",
"creatorType": "author"
},
{
"firstName": "Ken",
"lastName": "Chen",
"creatorType": "author"
},
{
"firstName": "Yong",
"lastName": "Yu",
"creatorType": "author"
}
],
"date": "2018-06",
"DOI": "10.18653/v1/N18-1001",
"abstractNote": "We study the problem of named entity recognition (NER) from electronic medical records, which is one of the most fundamental and critical problems for medical text mining. Medical records which are written by clinicians from different specialties usually contain quite different terminologies and writing styles. The difference of specialties and the cost of human annotation makes it particularly difficult to train a universal medical NER system. In this paper, we propose a label-aware double transfer learning framework (La-DTL) for cross-specialty NER, so that a medical NER system designed for one specialty could be conveniently applied to another one with minimal annotation efforts. The transferability is guaranteed by two components: (i) we propose label-aware MMD for feature representation transfer, and (ii) we perform parameter transfer with a theoretical upper bound which is also label aware. We conduct extensive experiments on 12 cross-specialty NER tasks. The experimental results demonstrate that La-DTL provides consistent accuracy improvement over strong baselines. Besides, the promising experimental results on non-medical NER scenarios indicate that La-DTL is potential to be seamlessly adapted to a wide range of NER tasks.",
"conferenceName": "NAACL-HLT 2018",
"libraryCatalog": "ACLWeb",
"pages": "1–15",
"place": "New Orleans, Louisiana",
"proceedingsTitle": "Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers)",
"publisher": "Association for Computational Linguistics",
"url": "https://www.aclweb.org/anthology/N18-1001",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.aclanthology.org/2020.lrec-1.2/",
"items": [
{
"itemType": "conferencePaper",
"title": "A Cluster Ranking Model for Full Anaphora Resolution",
"creators": [
{
"firstName": "Juntao",
"lastName": "Yu",
"creatorType": "author"
},
{
"firstName": "Alexandra",
"lastName": "Uma",
"creatorType": "author"
},
{
"firstName": "Massimo",
"lastName": "Poesio",
"creatorType": "author"
}
],
"date": "2020-05",
"ISBN": "9791095546344",
"abstractNote": "Anaphora resolution (coreference) systems designed for the CONLL 2012 dataset typically cannot handle key aspects of the full anaphora resolution task such as the identification of singletons and of certain types of non-referring expressions (e.g., expletives), as these aspects are not annotated in that corpus. However, the recently released dataset for the CRAC 2018 Shared Task can now be used for that purpose. In this paper, we introduce an architecture to simultaneously identify non-referring expressions (including expletives, predicative s, and other types) and build coreference chains, including singletons. Our cluster-ranking system uses an attention mechanism to determine the relative importance of the mentions in the same cluster. Additional classifiers are used to identify singletons and non-referring markables. Our contributions are as follows. First all, we report the first result on the CRAC data using system mentions; our result is 5.8% better than the shared task baseline system, which used gold mentions. Second, we demonstrate that the availability of singleton clusters and non-referring expressions can lead to substantially improved performance on non-singleton clusters as well. Third, we show that despite our model not being designed specifically for the CONLL data, it achieves a score equivalent to that of the state-of-the-art system by Kantor and Globerson (2019) on that dataset.",
"conferenceName": "LREC 2020",
"language": "English",
"libraryCatalog": "ACLWeb",
"pages": "11–20",
"place": "Marseille, France",
"proceedingsTitle": "Proceedings of the 12th Language Resources and Evaluation Conference",
"publisher": "European Language Resources Association",
"url": "https://www.aclweb.org/anthology/2020.lrec-1.2",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.aclanthology.org/volumes/2020.lrec-1/",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.aclanthology.org/T87-1010.bib",
"items": [
{
"itemType": "conferencePaper",
"title": "Unification and the new grammatism",
"creators": [
{
"firstName": "Steve",
"lastName": "Pulman",
"creatorType": "author"
}
],
"date": "1987",
"conferenceName": "TINLAP 1987",
"libraryCatalog": "ACLWeb",
"proceedingsTitle": "Theoretical Issues in Natural Language Processing 3",
"url": "https://www.aclweb.org/anthology/T87-1010",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/