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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
---
language:
- multilingual
- aa
- ab
- abs
- ace
- ady
- aeb
- af
- agq
- ak
- aln
- als
- alt
- am
- ami
- an
- ang
- anp
- ar
- arc
- arn
- arq
- ary
- arz
- as
- ase
- ast
- atj
- av
- avk
- awa
- ay
- az
- ba
- bag
- ban
- bar
- bas
- bbc
- bcc
- bcl
- be
- bg
- bgn
- bh
- bho
- bi
- bjn
- bkm
- bm
- bn
- bo
- bpy
- bqi
- br
- brh
- bs
- btm
- bto
- bug
- bxr
- ca
- cbk
- cdo
- ce
- ceb
- ch
- cho
- chr
- chy
- ckb
- co
- cps
- cr
- crh
- cs
- csb
- cu
- cv
- cy
- da
- dag
- de
- din
- diq
- dsb
- dtp
- dty
- dv
- dz
- ee
- egl
- el
- eml
- en
- eo
- es
- et
- eu
- ext
- fa
- ff
- fi
- fit
- fj
- fkv
- fo
- fr
- frc
- frp
- frr
- fur
- fy
- ga
- gag
- gan
- gcr
- gd
- gl
- glk
- gn
- gom
- gor
- got
- grc
- gsw
- gu
- guc
- gur
- gv
- ha
- hak
- haw
- he
- hi
- hif
- hil
- ho
- hr
- hrx
- hsb
- ht
- hu
- hy
- hyw
- hz
- ia
- id
- ie
- ig
- ii
- ik
- ike
- ilo
- inh
- io
- is
- it
- iu
- ja
- jam
- jbo
- jut
- jv
- ka
- kaa
- kab
- kbd
- kbp
- kcg
- kea
- kg
- khw
- ki
- kiu
- kj
- kjp
- kk
- kl
- km
- kn
- ko
- koi
- kr
- krc
- kri
- krj
- krl
- ks
- ksh
- ku
- kum
- kv
- kw
- ky
- la
- lad
- lb
- lbe
- lez
- lfn
- lg
- li
- lij
- liv
- lki
- lld
- lmo
- ln
- lo
- loz
- lrc
- lt
- ltg
- lus
- luz
- lv
- lzh
- lzz
- mad
- mai
- map
- mcn
- mdf
- mg
- mh
- mhr
- mi
- min
- mk
- ml
- mn
- mni
- mnw
- mo
- mr
- mrj
- ms
- mt
- mus
- mwl
- my
- myv
- mzn
- na
- nah
- nan
- nap
- nb
- nds
- ne
- new
- ng
- nia
- niu
- nl
- nn
- no
- nod
- nov
- nqo
- nrm
- nso
- nv
- ny
- nys
- oc
- om
- or
- os
- ota
- pa
- pag
- pam
- pap
- pcd
- pdc
- pdt
- pfl
- pi
- pih
- pl
- pms
- pnb
- pnt
- prg
- ps
- pt
- pwn
- qu
- qug
- rgn
- rif
- rm
- rmc
- rmf
- rmy
- rn
- ro
- roa
- ru
- rue
- rup
- ruq
- rw
- rwr
- ryu
- sa
- sah
- sat
- sc
- scn
- sco
- sd
- sdc
- se
- sei
- ses
- sg
- sgs
- sh
- shi
- shn
- shy
- si
- sjd
- sje
- sju
- sk
- skr
- sl
- sli
- sm
- sma
- smj
- smn
- sms
- sn
- so
- sq
- sr
- srn
- srq
- ss
- st
- stq
- sty
- su
- sv
- sw
- szl
- szy
- ta
- tay
- tcy
- te
- tet
- tg
- th
- ti
- tk
- tl
- tly
- tn
- to
- tpi
- tr
- tru
- trv
- ts
- tt
- tum
- tw
- ty
- tyv
- tzm
- udm
- ug
- uk
- ur
- uz
- ve
- vec
- vep
- vi
- vls
- vmf
- vo
- vot
- vro
- wa
- war
- wls
- wo
- wuu
- xal
- xh
- xmf
- xsy
- yi
- yo
- yue
- zea
- zgh
- zh
- zu
---

<img src="data/paranames_banner.png"></img>

# ParaNames: A multilingual resource for parallel names

This repository contains releases for the ParaNames corpus, consisting of parallel names of over 12 million named entities in over 400 languages.

ParaNames was introduced in [Sälevä, J. and Lignos, C., 2022. ParaNames: A Massively Multilingual Entity Name Corpus. arXiv preprint arXiv:2202.14035](https://arxiv.org/abs/2202.14035).

Please cite as:
```
@article{saleva2022paranames,
  title={ParaNames: A Massively Multilingual Entity Name Corpus},
  author={S{\"a}lev{\"a}, Jonne and Lignos, Constantine},
  journal={arXiv preprint arXiv:2202.14035},
  year={2022}
}
```

See the [Releases page](https://github.com/bltlab/paranames/releases) for the downloadable release.

# Using the data release

## Release format

The corpus is released as a gzipped TSV file which is produced by the pipeline included in this repository.

## Release notes

### Repeated entities

In current releases, any entity that is associated with multiple named entity types (PER, LOC, ORG) in the Wikidata type hierarchy will appear multiple times in the output, once with each type. This affects less than 3% of the entities in the data.

If you want a unique set of entities, you should deduplicate the data using the `wikidata_id` field.

If you only want to use entities that are associated with a single named entity type, you should remove any `wikidata_id` that appears in multiple rows.


# Using the code

First, install the following non-Python dependencies:

- MongoDB
- [xsv](https://github.com/BurntSushi/xsv)
- ICU support for your computer (e.g. `libicu-dev`)

Next, install ParaNames and its Python dependencies by running `pip install -e .`.

It is recommended that you use a Conda environment for package management.

## Creating the ParaNames corpus

To create a corpus following our approach, follow the steps below:

1. Download the latest Wikidata dump from the [Wikimedia page](https://dumps.wikimedia.org/wikidatawiki/entities/) and extract it. Note that this may take up several TB of disk space.
2. Use `recipes/paranames_pipeline.sh` which ingests the Wikidata JSON to MongoDB and then dumps and postprocesses it to our final TSV resource.

The call to `recipes/paranames_pipeline.sh` works as follows:

```
recipes/paranames_pipeline.sh <path_to_extracted_json_dump> <output_folder> <n_workers>
```

Set the number of workers based on the number of CPUs your machine has.
By default, only 1 CPU is used.

The output folder will contain one subfolder per language, inside of which `paranames_<language_code>.tsv` can be found.
The entire resource is located in `<output_folder>/combined/paranames.tsv`.

### Notes


ParaNames offers several options for customization:

- If your MongoDB instance uses a non-standard port, you should change the value of [`mongodb_port`](https://github.com/bltlab/paranames/blob/main/recipes/paranames_pipeline.sh#L13) accordingly inside `paranames_pipeline.sh`.

- Setting [`should_collapse_languages=yes`](https://github.com/bltlab/paranames/blob/main/recipes/dump.sh#L17) will cause Wikimedia language codes to be "collapsed" to the top-level Wikimedia language code, i.e. `kk-cyrl` will be converted to `kk`, `en-ca` to `en` etc.

- Setting [`should_keep_intermediate_files=yes`](https://github.com/bltlab/paranames/blob/main/recipes/dump.sh#L18) will cause intermediate files to be deleted. This includes the raw per-type TSV dumps (`{PER,LOC,ORG}.tsv`) from MongoDB, as well as outputs of `postprocess.py`.

- Within [`recipes/dump.sh`](https://github.com/bltlab/paranames/blob/main/recipes/dump.sh), it is also possible to define languages to be excluded and whether entity types should be disambiguated. By default, no languages are excluded and no disambiguation is done.

- After the pipeline completes, `<output_folder>` will contain one folder per language, inside of which is a TSV file containing the subset of names in that language. Combined TSVs with names in all languages are available in the `combined` folder.