-
Notifications
You must be signed in to change notification settings - Fork 786
/
Copy pathCascadilla Proceedings Project.js
390 lines (369 loc) · 13.8 KB
/
Cascadilla Proceedings Project.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
{
"translatorID": "cbed2134-f963-43a0-a8ad-9813e94de9a7",
"label": "Cascadilla Proceedings Project",
"creator": "Abe Jellinek",
"target": "^https?://(www\\.)?lingref\\.com/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-10-29 00:35:04"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
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 *****
*/
function detectWeb(doc, _url) {
if (doc.querySelector('.bookinfo')) {
return "conferencePaper";
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('.pagecontent > .contentpadding > a[href*="abstract"][href$=".html"]');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(nearestPreviousSibling(row, 'b'));
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function nearestPreviousSibling(el, selector) {
while ((el = el.previousElementSibling)) {
if (el.matches(selector)) {
return el.textContent.trim();
}
}
return '';
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
var translator = Zotero.loadTranslator('web');
// Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) {
fillBookInfo(doc, url, item);
item.complete();
});
translator.getTranslatorObject(function (trans) {
trans.itemType = 'conferencePaper';
trans.doWeb(doc, url);
});
}
function fillBookInfo(doc, url, item) {
let bookInfo = doc.querySelector('.bookinfo > .contentpadding')
|| doc.querySelector('.pagecontent > .contentpadding');
item.proceedingsTitle = text(bookInfo, '.largerfont');
item.abstractNote = text(doc, '.abstract div');
if (item.publisher && item.publisher.startsWith('Cascadilla')) {
item.place = 'Somerville, MA';
}
item.url = url;
for (let child of bookInfo.childNodes) {
if (child.textContent.trim().startsWith('edited by')) {
for (let name of child.textContent.trim()
.replace(/^edited by\s*/, '').split(/, (?:and )?| and /)) {
item.creators.push(ZU.cleanAuthor(name, 'editor'));
}
break;
}
}
for (let attachment of item.attachments) {
if (attachment.url && attachment.url.startsWith('www.')) {
attachment.url = 'https://' + attachment.url;
}
}
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://www.lingref.com/cpp/wccfl/25/abstract1429.html",
"items": [
{
"itemType": "conferencePaper",
"title": "Subject Preference in Korean",
"creators": [
{
"firstName": "Nayoung",
"lastName": "Kwon",
"creatorType": "author"
},
{
"firstName": "Maria",
"lastName": "Polinsky",
"creatorType": "author"
},
{
"firstName": "Robert",
"lastName": "Kluender",
"creatorType": "author"
},
{
"firstName": "Donald",
"lastName": "Baumer",
"creatorType": "editor"
},
{
"firstName": "David",
"lastName": "Montero",
"creatorType": "editor"
},
{
"firstName": "Michael",
"lastName": "Scanlon",
"creatorType": "editor"
}
],
"date": "2006",
"ISBN": "9781574734157",
"abstractNote": "This paper presents experimental data on the processing of relative and adjunct clauses in Korean. Both types of clause contain null elements (gaps), although these gaps may possibly represent different types of empty categories (deletion under movement in relative clauses, null pronominals in adjunct clauses). The experimental evidence shows that even in head-final languages like Korean, subject gaps of all types enjoy a processing advantage over object gaps, thus adding support to the idea that the subject advantage is a universal principle of grammar. Different explanatory mechanisms have been proposed to account for this subject advantage. The Korean data support structurally-based accounts rather than accounts that rely on the linear distance between the filler and the gap in a long-distance dependency. Theoretically, these new data shed additional light on—but do not entirely resolve—long-standing controversies over whether Korean relative clauses represent English-like operator-movement structures or structures with an unselectively bound null pronominal.",
"conferenceName": "25th West Coast Conference on Formal Linguistics",
"libraryCatalog": "www.lingref.com",
"pages": "1-14",
"place": "Somerville, MA",
"proceedingsTitle": "Proceedings of the 25th West Coast Conference on Formal Linguistics",
"publisher": "Cascadilla Proceedings Project",
"url": "http://www.lingref.com/cpp/wccfl/25/abstract1429.html",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://www.lingref.com/cpp/wccfl/25/index.html",
"items": "multiple"
},
{
"type": "web",
"url": "http://www.lingref.com/cpp/acal/42/abstract2769.html",
"items": [
{
"itemType": "conferencePaper",
"title": "A Comparative Study of Topological Relation Markers in Two Gur Languages: Gurenɛ and Chakali",
"creators": [
{
"firstName": "Jonathan Allen",
"lastName": "Brindle",
"creatorType": "author"
},
{
"firstName": "Samuel Awinkene",
"lastName": "Atintono",
"creatorType": "author"
},
{
"firstName": "Michael R.",
"lastName": "Marlo",
"creatorType": "editor"
},
{
"firstName": "Nikki B.",
"lastName": "Adams",
"creatorType": "editor"
},
{
"firstName": "Christopher R.",
"lastName": "Green",
"creatorType": "editor"
},
{
"firstName": "Michelle",
"lastName": "Morrison",
"creatorType": "editor"
},
{
"firstName": "Tristan M.",
"lastName": "Purvis",
"creatorType": "editor"
}
],
"date": "2012",
"ISBN": "9781574734539",
"abstractNote": "This paper explores from a comparative perspective the strategies employed for the coding of topological relations in two Gur languages, Gurenε and Chakali. It identifies the similarities and differences in the coding of semantic concepts that describe topological relations and examines the lexical semantics of locative predicate relations. The results of the study show that both languages use existential, postural or positional verbs to express topological relations, and that these verbs often combine with nominal postpositions. The paper is a contribution to the typological classification of locative predication proposed by Ameka and Levinson (2007), and to areal typology, as it concludes by comparing some of the findings with an analysis of Likpe (Ghana-Togo Mountain, Kwa (Ameka, 2007a)).",
"conferenceName": "42nd Annual Conference on African Linguistics",
"libraryCatalog": "www.lingref.com",
"pages": "195-207",
"place": "Somerville, MA",
"proceedingsTitle": "Selected Proceedings of the 42nd Annual Conference on African Linguistics: African Languages in Context",
"publisher": "Cascadilla Proceedings Project",
"shortTitle": "A Comparative Study of Topological Relation Markers in Two Gur Languages",
"url": "http://www.lingref.com/cpp/acal/42/abstract2769.html",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://www.lingref.com/cpp/slrf/2011/abstract2914.html",
"items": [
{
"itemType": "conferencePaper",
"title": "Does Partial Radical Information Help in the Learning of Chinese Characters?",
"creators": [
{
"firstName": "Jing",
"lastName": "Wang",
"creatorType": "author"
},
{
"firstName": "Keiko",
"lastName": "Koda",
"creatorType": "author"
},
{
"firstName": "Erik",
"lastName": "Voss",
"creatorType": "editor"
},
{
"firstName": "Shu-Ju Diana",
"lastName": "Tai",
"creatorType": "editor"
},
{
"firstName": "Zhi",
"lastName": "Li",
"creatorType": "editor"
}
],
"date": "2013",
"ISBN": "9781574734584",
"abstractNote": "Whether and how partial radical information in different transparency levels helps in the acquisition of Chinese characters, as well as how contextual information interacts with semantic transparency in character meaning inference, are open questions and are explored in the present study. A character meaning inference task in isolation and a character meaning inference task in context were completed by 37 first-year students\nin the University of Pittsburgh Chinese program. Three kinds of characters (transparent, semitransparent, and single-unit characters without radicals) were chosen based on Shu et al.'s (2003) study, and two conditions (isolation and context) were designed. The results showed that in both conditions, learners achieved higher scores on transparent characters than on semi-transparent characters, and their performance was significantly better on compound characters (both transparent and semitransparent) than single-unit characters without radicals. Also, context impeded with learning semitransparent characters, but did not affect transparent and single-unit characters. The results suggest that partial radical information helps Chinese character learning, and that teaching compound characters componentially may be more effective than teaching them holistically.",
"conferenceName": "2011 Second Language Research Forum",
"libraryCatalog": "www.lingref.com",
"pages": "162-172",
"place": "Somerville, MA",
"proceedingsTitle": "Selected Proceedings of the 2011 Second Language Research Forum: Converging Theory and Practice",
"publisher": "Cascadilla Proceedings Project",
"url": "http://www.lingref.com/cpp/slrf/2011/abstract2914.html",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://www.lingref.com/cpp/slrf/2011/abstract2913.html",
"items": [
{
"itemType": "conferencePaper",
"title": "A Reexamination of Ultimate Attainment in L2 Phonology: Length of Immersion, Motivation, and Phonological Short-Term Memory",
"creators": [
{
"firstName": "Charles",
"lastName": "Nagle",
"creatorType": "author"
},
{
"firstName": "Erik",
"lastName": "Voss",
"creatorType": "editor"
},
{
"firstName": "Shu-Ju Diana",
"lastName": "Tai",
"creatorType": "editor"
},
{
"firstName": "Zhi",
"lastName": "Li",
"creatorType": "editor"
}
],
"date": "2013",
"ISBN": "9781574734584",
"abstractNote": "The current study investigated phonological attainment among a sample of 34 English-speaking late-learners of L2 Spanish. Participants completed a language background questionnaire, motivation assessment, operation span task, and phonological short-term memory task, and recorded three speaking tasks. As a point of comparison, three native Spanish-speaking participants also recorded the speaking tasks. Four naïve L1 Spanish raters subsequently evaluated the speech clips. Regression analyses on the raters' scores revealed that length of immersion, motivation, and phonological short-term memory accounted for 70% of the variance in the sample. Furthermore, three learners received ratings that fell within the native range. Taken together, these findings suggest that immersion, motivation, and PSTM are critical factors that determine end-state phonological attainment for the learners in this study, as well as that late-learners appear to be capable of achieving near-native pronunciation in a foreign language.",
"conferenceName": "2011 Second Language Research Forum",
"libraryCatalog": "www.lingref.com",
"pages": "148-161",
"place": "Somerville, MA",
"proceedingsTitle": "Selected Proceedings of the 2011 Second Language Research Forum: Converging Theory and Practice",
"publisher": "Cascadilla Proceedings Project",
"shortTitle": "A Reexamination of Ultimate Attainment in L2 Phonology",
"url": "http://www.lingref.com/cpp/slrf/2011/abstract2913.html",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/