File size: 9,907 Bytes
a098bd7
 
c30bf20
 
 
 
 
 
 
42d887e
 
 
109539c
 
 
37918f3
 
 
 
 
57b7640
 
 
 
 
 
 
8c1b44b
 
 
0d19be1
 
 
efed354
 
 
 
232fce9
f8f322b
 
 
 
 
 
 
76af9fe
 
 
e38ce93
 
 
0734936
 
 
 
d33524c
f48a8a6
a098bd7
 
 
 
 
 
9d09419
 
 
54e758d
 
 
dc8c68c
 
 
 
d13341b
f056a87
 
 
 
 
 
 
b4a2102
 
 
be4e40e
 
 
317e52d
 
 
 
 
f48a8a6
 
 
 
 
 
 
ebea844
 
 
12b5a92
 
 
09c2825
 
 
 
 
a098bd7
c30bf20
 
 
 
42d887e
 
 
 
57b7640
 
 
 
8c1b44b
 
 
 
f8f322b
 
 
 
76af9fe
 
 
 
a098bd7
 
 
 
9d09419
 
 
 
f056a87
 
 
 
b4a2102
 
 
 
f48a8a6
 
 
 
ebea844
 
 
 
a098bd7
7d5545c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
dataset_info:
- config_name: journalistic
  features:
  - name: text
    dtype: string
  - name: label
    dtype: int64
  splits:
  - name: test
    num_bytes: 28294
    num_examples: 36
  - name: train
    num_bytes: 1192735900.4926126
    num_examples: 1776291
  - name: valid
    num_bytes: 671475.5073873665
    num_examples: 1000
  download_size: 6231236879
  dataset_size: 1193435670.0
- config_name: legal
  features:
  - name: text
    dtype: string
  - name: label
    dtype: int64
  splits:
  - name: test
    num_bytes: 10385
    num_examples: 37
  - name: train
    num_bytes: 1124338737.8820171
    num_examples: 4068980
  - name: valid
    num_bytes: 276319.55376581283
    num_examples: 1000
  download_size: 2029336818
  dataset_size: 1124625442.435783
- config_name: literature
  features:
  - name: text
    dtype: string
  - name: label
    dtype: int64
  splits:
  - name: test
    num_bytes: 12767
    num_examples: 36
  - name: train
    num_bytes: 30455231.959382813
    num_examples: 78315
  - name: valid
    num_bytes: 388881.2099774349
    num_examples: 1000
  download_size: 136991326
  dataset_size: 30856880.169360247
- config_name: politics
  features:
  - name: text
    dtype: string
  - name: label
    dtype: int64
  splits:
  - name: test
    num_bytes: 64499
    num_examples: 48
  - name: train
    num_bytes: 56779240.84597156
    num_examples: 31406
  - name: valid
    num_bytes: 1807910.61726968
    num_examples: 1000
  download_size: 100396628
  dataset_size: 58651650.46324124
- config_name: social_media
  features:
  - name: text
    dtype: string
  - name: label
    dtype: int64
  splits:
  - name: test
    num_bytes: 6146
    num_examples: 28
  - name: train
    num_bytes: 301649578.2733254
    num_examples: 2538360
  - name: valid
    num_bytes: 118836.40550328771
    num_examples: 1000
  download_size: 1112482919
  dataset_size: 301774560.67882866
- config_name: web
  features:
  - name: text
    dtype: string
  - name: label
    dtype: int64
  splits:
  - name: test
    num_bytes: 64024
    num_examples: 34
  - name: train
    num_bytes: 478895826.0863611
    num_examples: 87508
  - name: valid
    num_bytes: 5472594.803747784
    num_examples: 1000
  download_size: 1073024003
  dataset_size: 484432444.8901089
configs:
- config_name: journalistic
  data_files:
  - split: train
    path: journalistic/train-*
  - split: valid
    path: journalistic/valid-*
  - split: test
    path: journalistic/test-*
- config_name: legal
  data_files:
  - split: train
    path: legal/train-*
  - split: valid
    path: legal/valid-*
  - split: test
    path: legal/test-*
- config_name: literature
  data_files:
  - split: train
    path: literature/train-*
  - split: valid
    path: literature/valid-*
  - split: test
    path: literature/test-*
- config_name: politics
  data_files:
  - split: train
    path: politics/train-*
  - split: valid
    path: politics/valid-*
  - split: test
    path: politics/test-*
- config_name: social_media
  data_files:
  - split: train
    path: social_media/train-*
  - split: valid
    path: social_media/valid-*
  - split: test
    path: social_media/test-*
- config_name: web
  data_files:
  - split: train
    path: web/train-*
  - split: valid
    path: web/valid-*
  - split: test
    path: web/test-*
---


# PtBrVId

The developed corpus is a composition of pre-existing datasets initially created for other NLP tasks that provide permissive licenses. The first release of the corpus is available on [Huggingface](https://huggingface.co/datasets/Random-Mary-Smith/port_data_random).

#### Data Sources

The corpus consists of the following datasets:

<p align="center">
  <table>
    <tr>
      <th>Domain</th>
      <th>Variety</th>
      <th>Dataset</th>
      <th>Original Task</th>
      <th># Docs</th>
      <th>License</th>
      <th>Silver Labeled</th>
    </tr>
    <tr>
      <td rowspan="5">Literature</td>
      <td rowspan="3">PT-PT</td>
      <td><a href="http://arquivopessoa.net/">Arquivo Pessoa</a></td>
      <td>-</td>
      <td>~4k</td>
      <td>CC</td>
      <td>✔</td>
    </tr>
    <tr>
      <td><a href="https://www.gutenberg.org/ebooks/bookshelf/99">Gutenberg Project</a></td>
      <td>-</td>
      <td>6</td>
      <td>CC</td>
      <td>✔</td>
    </tr>
    <tr>
      <td><a href="https://www.clul.ulisboa.pt/recurso/corpus-de-textos-literarios">LT-Corpus</a></td>
      <td>-</td>
      <td>56</td>
      <td>ELRA END USER</td>
      <td>✘</td>
    </tr>
    <tr>
      <td rowspan="2">PT-BR</td>
      <td><a href="https://www.kaggle.com/datasets/rtatman/brazilian-portuguese-literature-corpus">Brazilian Literature</a></td>
      <td>Author Identification</td>
      <td>81</td>
      <td>CC</td>
      <td>✘</td>
    </tr>
    <tr>
      <td>LT-Corpus</td>
      <td>-</td>
      <td>8</td>
      <td>ELRA END USER</td>
      <td>✘</td>
    </tr>
    <tr>
      <td rowspan="2">Politics</td>
      <td>PT-PT</td>
      <td><a href="http://www.statmt.org/europarl/">Koehn (2005) Europarl</a></td>
      <td>Machine Translation</td>
      <td>~10k</td>
      <td>CC</td>
      <td>✘</td>
    </tr>
    <tr>
      <td>PT-BR</td>
      <td>Brazilian Senate Speeches</td>
      <td>-</td>
      <td>~5k</td>
      <td>CC</td>
      <td>✔</td>
    </tr>
    <tr>
      <td rowspan="2">Journalistic</td>
      <td>PT-PT</td>
      <td><a href="https://www.linguateca.pt/CETEMPublico/">CETEM Público</a></td>
      <td>-</td>
      <td>1M</td>
      <td>CC</td>
      <td>✘</td>
    </tr>
    <tr>
      <td>PT-BR</td>
      <td><a href="https://www.linguateca.pt/CETEMFolha/">CETEM Folha</a></td>
      <td>-</td>
      <td>272k</td>
      <td>CC</td>
      <td>✘</td>
    </tr>
    <tr>
      <td rowspan="3">Social Media</td>
      <td>PT-PT</td>
      <td><a href="https://www.aclweb.org/anthology/2021.ranlp-1.37/">Ramalho (2021)</a></td>
      <td>Fake News Detection</td>
      <td>2M</td>
      <td>MIT</td>
      <td>✔</td>
    </tr>
    <tr>
      <td rowspan="2">PT-BR</td>
      <td><a href="https://www.aclweb.org/anthology/2022.lrec-1.322/">Vargas (2022)</a></td>
      <td>Hate Speech Detection</td>
      <td>5k</td>
      <td>CC-BY-NC-4.0</td>
      <td>✘</td>
    </tr>
    <tr>
      <td><a href="https://www.aclweb.org/anthology/2021.wlp-1.72/">Cunha (2021)</a></td>
      <td>Fake News Detection</td>
      <td>2k</td>
      <td>GPL-3.0 license</td>
      <td>✔</td>
    </tr>
    <tr>
      <td>Web</td>
      <td>BOTH</td>
      <td><a href="https://www.aclweb.org/anthology/2020.lrec-1.451/">Ortiz-Suarez (2020)</a></td>
      <td>-</td>
      <td>10k</td>
      <td>CC</td>
      <td>✔</td>
    </tr>
  </table>
</p>

<p align="center">
    <em>Table 1: Data Sources</em>
</p>

#####

 Note: The dataset "Brazilian Senate Speeches" was created by the authors of this paper, using web crawling of the Brazilian Senate website and is available in the Huggingface repository.

#### Annotation Schema & Data Preprocessing Pipeline

We leveraged our knowledge of the Portuguese language to identify data sources that guaranteed mono-variety documents. However, this first release lacks any kind of supervision, so we cannot guarantee that all documents are mono-variety. In the future, we plan to release a second version of the corpus with a more robust annotation schema, combining automatic and manual annotation.

To improve the quality of the corpus, we applied a preprocessing pipeline to all documents. The pipeline consists of the following steps:

1. Remove all NaN values.
2. Remove all empty documents.
3. Remove all duplicated documents.
4. Apply the [clean_text](https://github.com/jfilter/clean-text) library to remove non-relevant information for language identification from the documents.
5. Remove all documents with a length significantly more than two standard deviations from the mean length of the documents in the corpus.

The pipeline is illustrated in Figure 1.

<p align="center">
  <img src="assets/pipeline_lid.jpg" alt="Image Description">
</p>
<p align="center">
  <em>Figure 1: Data Pre-Processing Pipeline</em>
</p>

#### Class Distribution

The class distribution of the corpus is presented in Table 2. The corpus is highly imbalanced, with the majority of the documents being from the journalistic domain. In the future, we plan to release a second version of the corpus with a more balanced distribution across the six domains. Depending on the imbalance of the textual domain, we used different strategies to perform train-validation-test splits. For the heavily imbalanced domains, we ensured a minimum of 100 documents for validation and 400 for testing. In the other domains, we applied a stratified split.

<p align="center">
  <table>
    <tr>
      <th>Domain</th>
      <th># PT-PT</th>
      <th># PT-BR</th>
      <th>Stratified</th>
    </tr>
    <tr>
      <td>Politics</td>
      <td>6500</td>
      <td>4894</td>
      <td>&#10003;</td>
    </tr>
    <tr>
      <td>Web</td>
      <td>7960</td>
      <td>21592</td>
      <td>&#10003;</td>
    </tr>
    <tr>
      <td>Literature</td>
      <td>18282</td>
      <td>2772</td>
      <td>&#10003;</td>
    </tr>
    <tr>
      <td>Law</td>
      <td>392839</td>
      <td>5766</td>
      <td>&#10005;</td>
    </tr>
    <tr>
      <td>Journalistic</td>
      <td>1494494</td>
      <td>354180</td>
      <td>&#10003;</td>
    </tr>
    <tr>
      <td>Social Media</td>
      <td>2013951</td>
      <td>6222</td>
      <td>&#10005;</td>
    </tr>
  </table>
</p>

<p align="center">
  <em>Table 2: Class Balance across the six textual domains in both varieties of Portuguese.</em>
</p>

#### Future Releases & How to Contribute

We plan to release a second version of this corpus considering more textual domains and extending the scope to other Portuguese varieties. If you want to contribute to this corpus, please [contact us]().