File size: 8,197 Bytes
3d22d5c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: cc
task_categories:
- text-generation
task_ids:
- language-modeling
pretty_name: ©️ Common Crawl Creative Commons
language:
- afr
- deu
- eng
- fra
- fry
- ita
- nld
- spa
configs:
- config_name: CC-MAIN-2024-51
  data_files: data/CC-MAIN-2024-51/**/*.parquet
- config_name: CC-MAIN-2024-51-af
  data_files:
  - split: train
    path: data/CC-MAIN-2024-51/af/train-*
- config_name: CC-MAIN-2024-51-de
  data_files: data/CC-MAIN-2024-51/de/*.parquet
- config_name: CC-MAIN-2024-51-en
  data_files: data/CC-MAIN-2024-51/en/*.parquet
- config_name: CC-MAIN-2024-51-es
  data_files: data/CC-MAIN-2024-51/es/*.parquet
- config_name: CC-MAIN-2024-51-fr
  data_files: data/CC-MAIN-2024-51/fr/*.parquet
- config_name: CC-MAIN-2024-51-fy
  data_files: data/CC-MAIN-2024-51/fy/*.parquet
- config_name: CC-MAIN-2024-51-it
  data_files: data/CC-MAIN-2024-51/it/*.parquet
- config_name: CC-MAIN-2024-51-nl
  data_files: data/CC-MAIN-2024-51/nl/*.parquet
- config_name: af
  data_files: data/**/af/*.parquet
- config_name: de
  data_files: data/**/de/*.parquet
- config_name: default
  data_files: data/**/*.parquet
- config_name: en
  data_files: data/**/en/*.parquet
- config_name: es
  data_files: data/**/es/*.parquet
- config_name: fr
  data_files: data/**/fr/*.parquet
- config_name: fy
  data_files: data/**/fy/*.parquet
- config_name: it
  data_files: data/**/it/*.parquet
- config_name: nl
  data_files: data/**/nl/*.parquet
dataset_info:
  config_name: CC-MAIN-2024-51-af
  features:
  - name: text
    dtype: string
  - name: id
    dtype: string
  - name: dump
    dtype: string
  - name: url
    dtype: string
  - name: date
    dtype: string
  - name: file_path
    dtype: string
  - name: license_abbr
    dtype: string
  - name: license_version
    dtype: string
  - name: license_location
    dtype: string
  - name: license_in_head
    dtype: bool
  - name: license_in_footer
    dtype: bool
  - name: potential_licenses
    struct:
    - name: abbr
      sequence: string
    - name: in_footer
      sequence: bool
    - name: in_head
      sequence: bool
    - name: location
      sequence: string
    - name: version
      sequence: string
  - name: license_parse_error
    dtype: bool
  - name: license_disagreement
    dtype: bool
  - name: language
    dtype: string
  - name: language_score
    dtype: float64
  - name: in_fw2
    dtype: bool
  splits:
  - name: train
    num_bytes: 75356511
    num_examples: 17733
  download_size: 41860751
  dataset_size: 75356511
---

> **Raw CommonCrawl crawls, annotated with potential Creative Commons license information**

**The licensing information is extracted from the web pages based on whether they link to Creative Commons licenses but false positives may occur!** While further filtering based on the location type of the license should improve the precision (e.g. by removing hyperlink (a_tag) references), false positives may still occur.

## Usage

```python
from datasets import load_dataset

# Everything
ds = load_dataset("BramVanroy/CommonCrawl-CreativeCommons")

# Single dump, all languages
ds = load_dataset("BramVanroy/CommonCrawl-CreativeCommons", "CC-MAIN-2024-51")

# Single language, all dumps
ds = load_dataset("BramVanroy/CommonCrawl-CreativeCommons", "nl")

# Single language, single dump
ds = load_dataset("BramVanroy/CommonCrawl-CreativeCommons", "CC-MAIN-2024-51-nl")
```

## Fields

In some cases, multiple licenses are found on a single page. All licenses are collected in `potential_licenses`. From these, the "best guess" is selected
based on three criteria:

1. location_preference_order: meta_tag, json-ld, link_tag, a_tag
2. head_preference_order: True, False
3. footer_preference_order: True, False

Based on these criteria, the "best guessed" license is picked as the one in the `license_*` columns. Potential disagreement between multiple licenses is given in `license_disagreement`.

- text: the extracted text (unmodified)
- id: WARC-Record-ID
- dump: Common Crawl crawl
- url: original url for document
- date: crawl date
- file_path: file path on the S3 bucket
- license_abbr: the license type. Possible values: "cc-unknown" (recommended to filter this one out), "by", "by-sa", "by-nd", "by-nc", "by-nc-sa", "by-nc-nd", "zero", "certification", "mark". If multiple licenses were found (`potential_licenses`) 
- license_version: the license version, e.g. "4.0"
- license_location: the location where the license was found. Possible values: "meta_tag", "json-ld", "link_tag", "a_tag"
- license_in_head: whether the license was found inside a `head` HTML element
- license_in_footer: whether the license was found inside a `footer` HTML element, or an HTML element that had `footer` in the ID or class name
- potential_licenses:
  - abbr: list of all found license abbreviations
  - version: list of all found license versions
  - location: list of all found license locations
  - in_head: list of whether licenses were found in the head
  - in_footer: list of whether licenses were found in a footer
- license_parse_error: whether there was a problem when trying to extract the license, e.g. an unparseable HTML document
- license_disagreement: whether the `potential_licenses["abbr"]` disagree, i.e., different types of licenses were found. License *versions* are not included in the comparison!
- language: the language, as detected by fastText `ft176`
- language_score: the language identification confidence score
- found_in_fw2: whether this sample was found in FineWeb-2. Crawls that are more recent than FW2 (everything after 2024-18) is marked as None


## Progress

The attempt is to at least process all five RedPyjama crawls + `CC-MAIN-2024-51`. 

Done:

- CC-MAIN-2024-51

Running:

- CC-MAIN-2019-30

To do:

- CC-MAIN-2019-30
- CC-MAIN-2020-05
- CC-MAIN-2021-04
- CC-MAIN-2022-05
- CC-MAIN-2023-06
- CC-MAIN-2024-51


## Languages

The following languages are included.

- afr_Latn
- deu_Latn
- eng_Latn
- fra_Latn
- fry_Latn
- ita_Latn
- nld_Latn
- spa_Latn


## Recommendations

- Raw CommonCrawl data is processed in an attempt to extract licensing information. No quality filtering is done!! It is **highly** recommended to filter this data further on quality, fluency, toxicity, etc.
- Similarly, the data has **not been deduplicated**. 
- The licenses include all possible Creative Commons licenses, including non-commercial ones. Take care about what kind of data you wish to use, and filter out non-commercial licenses when needed.
- The column `license_disagreement` indicates whether multiple licenses were found that have not the same abbreviation, e.g. `cc-by` and `cc-by-nc`. It is recommended to filter these out.
- The column `license_parse_error` indicates whether an error occurred when parsing the license. You probably want to filter out documents where this was the case, though this should be extremely rare.
- Unsurpisingly, the data contains a lot of Wikipedia/Wikimedia content. Depending on what you need, you may wish to filter those out. For Wikipedia specifically, you may opt to use the more thoroughly parsed (but potentially more outdated) [wikimedia/wikipedia](https://huggingface.co/datasets/wikimedia/wikipedia) set.
- In exceptional cases, a link to creativecommons.org is found but the exact license could not be found. These are under `license_abbr="cc-unknown"` which you may wish to filter out.

## Acknowledgments

- [TNO](https://www.tno.nl/nl/), who funded the work hours to accomplish this collection. They intend to use parts of this material for the [GPT-NL project](https://gpt-nl.nl/).
- [Flemish Supercomputer Center](https://www.vscentrum.be/) for part of the compute under grant 2024-107
- Guilherme Penedo ([@guipenedo](https://huggingface.co/guipenedo)) and the rest of the [FineWeb](https://huggingface.co/datasets/HuggingFaceFW/fineweb) and [datatrove](https://github.com/huggingface/datatrove) team for the help and insights
- ML6 and specifically Robin Van Craenenbroek for their [Fondant Creative Commons](https://github.com/ml6team/fondant-usecase-filter-creative-commons/tree/add-fondant-usecase-cc-image-extraction) filter for image datasets. While my approach is different, their code did serve as inspiration.