TestiMole / README.md
mrinaldi's picture
Update README.md
aa45433 verified
|
raw
history blame
No virus
31.6 kB
metadata
dataset_info:
  - config_name: usenet
    features:
      - name: title
        dtype: string
      - name: author
        dtype: string
      - name: id
        dtype: int64
      - name: progressive_number
        dtype: int64
      - name: timestamp
        dtype: timestamp[s]
      - name: newsgroup
        dtype: string
      - name: original_url
        dtype: string
      - name: text
        dtype: string
    splits:
      - name: train
        num_bytes: 75784729153
        num_examples: 89499446
    download_size: 34215328650
    dataset_size: 75784729153
  - config_name: forums
    features:
      - name: title
        dtype: string
      - name: author
        dtype: string
      - name: post_id
        dtype: int32
      - name: progressive_number
        dtype: int32
      - name: timestamp
        dtype: string
      - name: forum
        dtype: string
      - name: text
        dtype: string
      - name: image_list
        sequence: int32
      - name: image_file
        dtype: int32
    splits:
      - name: train
        num_bytes: 263411751276
        num_examples: 468698334
    download_size: 103952670799
    dataset_size: 263411751276
  - config_name: OJS
    features:
      - name: journal
        dtype: string
      - name: url
        dtype: string
      - name: metadata
        list:
          - name: Alternative
            dtype: string
          - name: Coverage
            dtype: string
          - name: DOI
            dtype: string
          - name: Description
            dtype: string
          - name: Format
            dtype: string
          - name: ISSN
            dtype: string
          - name: Identifier
            dtype: string
          - name: Issue
            dtype: string
          - name: Language
            dtype: string
          - name: NBN
            dtype: string
          - name: PersonalName
            dtype: string
          - name: Rights
            dtype: string
          - name: Source
            dtype: string
          - name: Sponsor
            dtype: string
          - name: Subject
            dtype: string
          - name: Title
            dtype: string
          - name: Type
            dtype: string
          - name: URI
            dtype: string
          - name: Volume
            dtype: string
          - name: abbrev
            dtype: string
          - name: abstract
            dtype: string
          - name: articleType
            dtype: string
          - name: author
            dtype: string
          - name: authors
            dtype: string
          - name: available
            dtype: string
          - name: created
            dtype: string
          - name: date
            dtype: string
          - name: dateSubmitted
            dtype: string
          - name: doi
            dtype: string
          - name: firstpage
            dtype: string
          - name: institution
            dtype: string
          - name: issn
            dtype: string
          - name: issue
            dtype: string
          - name: issued
            dtype: string
          - name: keywords
            dtype: string
          - name: language
            dtype: string
          - name: lastpage
            dtype: string
          - name: modified
            dtype: string
          - name: nbn
            dtype: string
          - name: pageNumber
            dtype: string
          - name: readable
            dtype: string
          - name: reference
            dtype: string
          - name: spatial
            dtype: string
          - name: temporal
            dtype: string
          - name: title
            dtype: string
          - name: url
            dtype: string
          - name: volume
            dtype: string
      - name: text
        dtype: string
      - name: platform
        dtype: string
    splits:
      - name: train
        num_bytes: 12343533858
        num_examples: 232223
    download_size: 2948236259
    dataset_size: 12343533858
  - config_name: blogs
    features:
      - name: title
        dtype: string
      - name: name
        dtype: string
      - name: author
        dtype: string
      - name: date
        dtype: string
      - name: url
        dtype: string
      - name: text
        dtype: string
      - name: category
        dtype: string
      - name: license_guess
        dtype: string
      - name: fasttext_langid
        sequence: string
      - name: fasttext_langprob
        dtype: float64
    splits:
      - name: train
        num_bytes: 7100477248
        num_examples: 1724658
    download_size: 3765734285
    dataset_size: 7100477248
  - config_name: books
    features:
      - name: title
        dtype: string
      - name: author
        dtype: string
      - name: url
        dtype: string
      - name: text
        dtype: string
    splits:
      - name: train
        num_bytes: 1567112840
        num_examples: 6167
    download_size: 970007483
    dataset_size: 1567112840
  - config_name: reddit
    features:
      - name: subreddit
        dtype: string
      - name: author
        dtype: string
      - name: id
        dtype: string
      - name: parent_id
        dtype: string
      - name: created_utc
        dtype: string
      - name: score
        dtype: string
      - name: ups
        dtype: string
      - name: downs
        dtype: string
      - name: text
        dtype: string
    splits:
      - name: train
        num_bytes: 368299927
        num_examples: 4192526
    download_size: 137818471
    dataset_size: 368299927
  - config_name: websites
    features:
      - name: url
        dtype: string
      - name: text
        dtype: string
    splits:
      - name: train
        num_bytes: 2046525253
        num_examples: 163554
    download_size: 966736330
    dataset_size: 2046525253
  - config_name: wikimedia_it
    features:
      - name: title
        dtype: string
      - name: text
        dtype: string
      - name: wiki
        dtype: string
    splits:
      - name: train
        num_bytes: 16019187125
        num_examples: 5408451
    download_size: 7883736990
    dataset_size: 16019187125
  - config_name: wikimedia_others
    features:
      - name: title
        dtype: string
      - name: text
        dtype: string
      - name: wiki
        dtype: string
    splits:
      - name: train
        num_bytes: 1837994874
        num_examples: 1043329
    download_size: 814755723
    dataset_size: 1837994874
configs:
  - config_name: OJS
    data_files:
      - split: train
        path: OJS/train-*
  - config_name: blogs
    data_files:
      - split: train
        path: blogs/train-*
  - config_name: books
    data_files:
      - split: train
        path: books/train-*
  - config_name: forums
    data_files:
      - split: train
        path: forums/train-*
  - config_name: reddit
    data_files:
      - split: train
        path: reddit/train-*
  - config_name: usenet
    data_files:
      - split: train
        path: usenet/train-*
  - config_name: websites
    data_files:
      - split: train
        path: websites/train-*
  - config_name: wikimedia_it
    data_files:
      - split: train
        path: wikimedia_it/train-*
  - config_name: wikimedia_others
    data_files:
      - split: train
        path: wikimedia_others/train-*
task_categories:
  - text-classification
  - text-generation
annotations_creators:
  - no-annotation
multilinguality:
  - monolingual
task_ids:
  - language-modeling
language:
  - it
size_categories:
  - 100B<n<1T

Dataset Card for Testimole -- A multi-billion tokens Italian text corpus

image/jpeg

Testimole is a large linguistic resource for Italian obtained through a massive web scraping effort. As of June 2024, it is one of the largest datasets for the Italian language, if not the largest, publicly available, consisting of almost 100B tokens counted with the Tiktoken cl100k BPE tokenizer. It consists mainly of conversational data (Italian Usenet hierarchies, Italian message boards, Italian subreddits) but also contains other textual data derived from blogs, wikis, websites, and academic journals. Each data source is separated into a different dataset split.

Testimole is a wordplay combining "Testi" (texts) and "Mole." "Mole" refers to one of the most famous monuments of Torino, the Mole Antonelliana, where this dataset was conceived and built. Moreover, "mole" means "mass" or "bulk" in Italian, highlighting the large size of this dataset. Testimole is also similar to the word "Testimone" (witness), emphasizing the diachronic quality of the data, thus being a witness of the passage of time in the Italian webosphere.

Dataset Details

Dataset Description

The goal of this work is to create a huge linguistic resource for the Italian language that can be used for several NLP applications, including but not limited to language modelling. The dataset is the result of a massive web scraping effort going on from February 2024 to May 2024, so the resources have a cut-off date comprised within this time span. There is a project to further expand the dataset, as explained in the "Future Plans" section.

To create the dataset, I developed several scripts using Python3 and libraries such as BeautifulSoup and Selenium; the scripts were mostly written and executed manually, making it an extremely time-consuming project. The texts span different topics and periods, containing several divergent opinions and beliefs, in accordance with the main ideas of the "Perspective Data Manifesto" [1]. It is important to note that these data alone are not enough to train an Italian large language model from scratch, mainly not due to the size of the data but because, even if they span different topics, they are far from covering the broad range of subjects, information, culture, and techniques required to train a state-of-the-art model. Also, as will be better pointed out later, while it is safe to use these data under Fair Use for research purposes, users must investigate potential copyright infringement for other possible purposes. The Tiktoken BPE tokenizer with the cl100k_base model [2] was used for tokenization. This dataset is composed of several sub-datasets, each with different types of data and goals.

Uses

Because this dataset consists of a large amount of texts in the Italian language, it can be used for all Natural Language applications that seek to improve support for Italian in a multilingual context and require data for training. This includes, but is not limited to, training large language models. Other possible uses are sentiment analysis, diachronic data classification (as the majority of the data is date-tagged), and text classification. Researchers are invited to annotate even small parts of this dataset. In such cases, the data could be used for other tasks as well, such as Named Entity Recognition (NER), Part-of-Speech (POS) tagging, information retrieval, summarization, and more. This versatility makes the dataset a valuable resource for various NLP projects and research endeavors.

Out-of-Scope Use

By downloading this dataset, users agree not to attempt to identify specific users. This includes refraining from cross-referencing the dataset with other information to ascertain personal identities.

Dataset Structure

Conversational (~ 85 Billions tokens):

UsenetArchiveIT

This is the project that started the entire work: the goal was to collect the largest possible amount of Usenet posts published in the hierachies it.* and italia.* [3], as they were listed on "www.eternal-september.org" and gathered mainly from Google Groups archive.

This split contains 19.395.579.455 tokens. Texts were not checked for language, but it is a safe assumption that most of the text contained is in Italian as the selected Usenet hierarchies target only Italian users.

General stats:

"chars": 59389804791,

"tokens": 19395579455,

"sentences": 519535427,

"posts": 89499446,

"threads": 14521548

Columns of the dataset

  • Title: The original title of the thread
  • Author: Author of the post
  • ID: a unique identifier of the post for the specific newsgroup
  • Progressive_id: the progressive id of the single message in the thread
  • Timestamp: the time and data of creation of the post, in ISO-8601 format
  • Newsgroup: the name of the newsgroup in which the post belong
  • Original_url: the URL of the thread
  • Text: the text of the message

83GB of JSONL file before the conversion to HuggingFace dataset

Forum

The second part of the project is the one that produced the largest amount of data (62.415.825.978 tokens) A list of Italian message boards based on different platforms (phpBB, vBulletin, Simple Machines, Invision, Snitz, XenForo...) was created using both manual and semi-automatic web searches. Then, for each forum, a generic script (forum_scraper.py) using Python3 and BeautifulSoup was adapted to fit the characteristics of the forum (such as correct div classes for the different fields and multiple page mechanisms). Then, the script ran over the entire range of available pages and output a JSONL file with one post per line.

General stats: {

"chars": 199436329709,

"tokens": 62415825978,

"sentences": 1673025712,

"posts": 468391746,

"threads": 25280745,

"hasImage": 46071

}

Columns of the dataset

  • Title: The original title of the thread
  • Author: Author of the post
  • post_id: a unique identifier of the post for the specific forum
  • Progressive_id: the progressive id of the single message in the thread
  • Timestamp: the time and data of creation of the post. In the majority of cases, it is in ISO-8601 format but sometime it could be not converted to ISO-8601 and so being in other formats (a good future work is to convert everything to ISO-8601). In rare cases, it is set to None.
  • Forum: the name of the forum. If the forum belongs to the Forumfree or Forumcommunity circuit, the name of the circuit is appended to the name of the forum. There are cases of forums belonging to the Forumfree circuit where Forumfree is not appended. This should be fixed in a future release.
  • Text: the text of the message
  • image_list: experimental multimodal support
  • image_file: experimental multimodal support

303GB of JSONL files before the conversion to HuggingFace dataset.

Regarding multimodality, in short: this feature is not very well implemented. More details will follow, but do not expect too much regarding this point.

General notes on conversational datasets:

The data contained in the "usenet" and "forums" splits were generated by Italian users of the Internet between 1995 and 2024. For this reason, they may contain biases, problematic stances with respect to ethics, grammatically wrong sentences and non-factually true information. On the other hand, the kind of data can be considered safer than a random crawl of the Internet, in particular regarding the "forum" subset because in many forums there is a strict system of moderation that prohibit posts to go beyond a certain treshold of acceptance (different from forum to forum) with regards to language and thematics. Because the name of the forum/newsgroup is always present in the dataset, it is possible for the users of this dataset to filter the sources of data according to their needs.

It is also important to note, for people less accustomed to internet conversations, that data coming from forums are not just generic conversations but are often a real goldmine of detailed and extremely specific information about several topics written by people who are often passionate and very knowledgeable about what they are discussing. This is especially true for forums that discuss technical and scientific topics.

This collection of conversational data is useful not only for general language modelling but also for many NLP tasks that could take advantages from a very large amount of conversational data, such as sentiment analysis, hate/misoginy speech detection, parsing and so on; on the other hand, the diacronic nature of data permits interesting analysis on diachronic phenomena such as anaylysis of how the Italian language used in the Internet changed over the year and the most discussed topics for each historical period, just to mention a couple of examples.

The post should not contain personal information as in all the forums internal rules was asked to the user not to share personal information as they would have been publicly available on the web.

General

OJS

This split of the dataset contains articles published as Open Access using the platform OJS. It comprised mainly academic journals from Italian universities, so it can be considered as a very high-quality dataset and not problematic regarding biases, apart from very generic biases that may be present in the Italian language in itself or in Academia environments. All the articles are published with Creative Commons licenses, and the license used for the single article can be retrieved from the metadata. Columns of the dataset

  • Journal:
  • url:
  • metadata:
  • text:
  • platform:

Blogs

This resource was gathered by scraping data from blogs and on-line newspapers written in Italian.

This sub-project started with the goal of collecting only blogs released under Public Domain or Creative Commons license. However, due do the automatic nature of the list creation process, I noticed that some blog having an "All right reserved" license were scraped too. Some of these license permits the reuse of the information with the only obligation of mentioning the URL, and the URL is always present in the rows of the dataset. I created a simple script that tried to guess from the home page of the blog, but the results are not optimal and a better pipeline should be implemented. This means that the direct use of this resource is fine under Fair-Use for research purposes but the possibility of usage should be checked by whom wants to use this dataset for other purposes, especially for commercial purposes.

The project started with a collection of blogs regarding left-wing activism, in order to help another person for his research project, that it is still work in progress. The list of these blog was obtained on a blog aggregator. The blogs that fall under this category are labelled with the category "pol/ant" (Poltics/Antagonism). Because from a quick analysis it seems that data coming from the "forum" category are mainly biased toward right political stances (data about this statement will follow in the next weeks), it could be useful to integrate these data in a general language-modelling task in the optic of the "Perspectivist Data Manifesto" [1]. The other two categories are "let/litblog", containing blogs about literature (the list was obtained from another aggregator) and "inf/linux", a very small category containing blog posts from Italian Linux User Groups. The rest of the data, which account for the majority of tokens, is not categorized.

This resource can be considered as a "medium-high" quality dataset, because it mostly contain blogs post, often from good sources with very informative content. It is not possible to guarantee a total absence of undesired content inside the resource, but this, depending from the use case, probably constitutes a minority.

As for the Conversational data split, also this split is diachronically annotated so it could be used for diachronic analysis of language and topics too.

Finally, the blog split contains also an annotation for the language used, as identified by the FastText library.

Columns of the dataset

  • title: The title of the article/post
  • name: The name of the blog
  • author: The author of the article/post, if available
  • date: The date of the article/post in ISO-8601, if available if not None
  • url: The original URL
  • text: The text of the article/post
  • category: The category of the blog. Only a few blogs are annotated for category up to now.
  • license_guess: A guess of the original license of the blog made by an automated and non-perfect script
  • fasttext_langid: The most probable language as identified by fasttext
  • fasttext_langprob: The probability of the most probable language as identified by fasttext

Wikimedia

This split doesn't need many explanation as it is simply a dump of wikimedia resources in Italian (Wikipedia, Wikibooks, Wikinews, Wikiquote, Wikisource, Wikiversity, Wikivoyage and Wiktionary) as of May 2024. It can be very important to include this resource in the training data of a language model because it contains information, presented in a mostly neutral language, about many possible subjects and topics that are not covered by the rest of the dataset.

I decided to create also a category called "wikimedia_others" containing data from Wikimedia projects of other regional languages related with Italian and spoken in Italy, as well as Latin for its historical importance for Italian language and culture. Languages code included in this split are: eml (emilian e rumagno) ,fur (furlan) ,la (latin) ,lij (ligure) ,lld (ladin) ,lmo (lombarda) ,nap (napolitan) ,scn (sicilianu) ,sc (sardu) and vec (veneto). Using this data, depending from the goal of the project, could produce very interesting results.

Columns of the dataset

  • title
  • text
  • wiki

Books

This collection contains mainly the books coming from LiberLiber's project "Manuzio" [2]. The books were downloaded from the website in many formats and converted to text. Liber Liber is a project akin to Project Gutenberg as it contains many books with expired copyright and thus in Public Domain. Many of these books are considered cornerstones of Italian culture.

The collection contains also a smaller amount of data coming from other sources, such as the Creative Commons licensed school books of "Matematicamente" [3] and Oilproject-Weschool [4] as well as some other CC and PD licenses book found online.

Columns of the dataset

  • title
  • author
  • url
  • text

Websites

I created a very generic script that is able to extract all the text of a website as well as the text contained in Office, PDF and TeX documents. Now, the websites section is mainly composed of three very high-quality and freely licensed websites: ArchivioAntimafia [5], that contains many official documents about Mafia persecution in Italy, Peacelink [6], an historical Italian website about peace activism and HomoLaicus [7] a big collection of texts about various topics (mainly history and politics) released under a CC license. Also other smaller and randomly selected (but filtered for quality) websites are included in this collection. This section has to be considered experimental for two reasons: (1) It containly only a very small subset of the entire high-quality Italian web landscape and it could be increased and improved "ad libitum" (2) It is the only section that can have some bigger issue with deduplication, that we will discuss in the appropriate section.

Despite these two point, users are encouraged to use this section as it is composed of medium-high and high quality contents.

Columns of the dataset

  • url
  • text

Reddit

It contains a small subsets (4192672 messages) of conversations in some Italian subreddits.

Italatex Still work in progress. A collection of materials written in LaTeX.

Dataset Creation

Curation Rationale

Multilinguality is one of the main challenges for the new AI and NLP revolution that is taking place in the 2020s. Until now, the most advanced models are mostly trained on English or a few other languages, creating a dangerous gap for people speaking other languages (that is, 81.2% of the world population, according to the CIA Factbook of 2022) in accessing these new advanced instruments. Translations from English are not enough to capture the cultural differences of peoples that do not belong to the Anglo-American culture. Thus, it is important for a general model to be truly inclusive by including data that can capture different views of the world and uses of language. These data are not only useful for modeling the Italian language itself but also for gaining insights into Italian culture and the way in which Italian-speaking people engage with various topics.

Source Data

  • Usenet
  • Message boards
  • Blogs
  • Websites
  • Open Journal System platforms hosted by Italian universities or included in DOAJ
  • LiberLiber
  • Wikimedia

Data Collection and Processing

The dataset is the result of a massive web scraping effort that was carried out using manually created Python3 scripts using libraries such as BeautifulSoup for HTML parsing and Selenium in the few cases in which Javascript support or browser automatization was required. I have created blueprints of the script, such a generic "forum scraper" or "blog scraper" script but then I had to adapt them almost manually for each resource included in the dataset. Some resources were sharing the same technical platform, so it was trivial to adapt the script, in other case a significant reverse-engineering effort was required. The scraping took place on very simple resources: a very old unused 2006 Sony Vaio laptop with an Intel Core2Duo processor connected to a domestic FTTC connection was enough for the majority of websites, while in other cases other resources were rented or borrowed in order to have a speed-up or to aggregate and analyse the entire collection of data. Using such a simple setup was also a way to have a "natural" anti-overload system. Because many web scraping instances were running in parallel, websites were not loaded so much and often timeouts were implemented in order to protect smaller servers. It never happened that a website was slowed down due to this scraping process, that was crafted to be as gentle and slow as possible. Considering an average power consumption of the laptop of 40W and 100 days of running, circa 96Kwh were used to power the laptop. The laptop was plugged in the Italian-Centre electricity zone, with an average electricity/co2 ratio of 250g per KW with more than 60% of power coming from renewable sources. This means that the laptop Co2 emissions were circa 24KG of Co2, equivalent to a short 150km trip on a small car with emissions of 160g/km. All the data were collected in a JSONL format and then merged, cleaned, analyzed and converted to an Hugging Face dataset using an HPC resource that was gently provided to the author. The vast majority of data coming from forums undergone a process of deduplication in order to avoid the case of having two instances of the same message.

Who are the source data producers?

Data is produced by users of the Italian Internet mostly between 1995 and 2024. This resource also contains texts produced before 1995, such as the content of public domain books written by authors from any historical period.

Recommendations

This dataset could be used along with other Italian natural language resources. A very good list of them is available at the address [https://huggingface.co/collections/gsarti/italian-nlp-resources-64fc606927fb3a92e9ea72f2]. For example, gsarti/clean_mc4_it [https://huggingface.co/datasets/gsarti/clean_mc4_it], being the biggest as-to-date cleaned version of Common Crawl for Italian, could be used to increase the variety of the data for the training of a Large Language Model.

Deduplication

The presence of duplicate text can be, depending from the use cases, a big problem for several machine learning tasks. I tried to avoid as much as possible the presence of duplicate text in the dataset but still there are some potential issues to be took into consideration. We will distinguish two kind of duplications: (A): Full document duplication, for example, if the same forum post is present more than one time (B): Strings duplication: if some strings (often garbage) recurr several times in the data.

Usenet: Safe regarding A-types of duplications; Could contain B-types duplications, for example: - Users signatures; - Headers such as "reply to message posted by X at Y";

Forums: Safe regarding A-types of duplications. The most problematic forums under this respect were deduplicated using an ad-hoc created script. It shares the same potential problems of Usenet with regard to B-type duplications;

OJS: it should be safe regarding both A-type and B-type duplications;

Blogs: Safe regarding A-types of duplications and mostly safe regarding B-type duplications. However, I noticed that some blogs were scraped along with some html garbage at the beginning or end of the text blob, that should be identified and removed

Wikimedia: it should be mostly safe, with the exception of the recurrence of some Wikipedia-specific lexicon such as "this page is a stub", "this page needs references" and so on;

Books: it should be safe regarding A-types of duplication, but there is a very simple to identify B-type duplication, that is, the header of Liber Liber books with a short presentation of the community-driven project;

Websites: In this case A-type duplication could be in theory present if some pages share the same content, but it should be rare (with the exception of Archivio Antimafia, where files to download are often available in PDF and Word Processing format, so they were downloaded twice). B-type duplication here could be an issue as it is very present in the form of 1) header of the website 2) list of links 3) footer of the website. All the HTML was converted using HTML2TEXT so it should not contain html code.

Citation

Citation Information

@software{testimole,
  author = {Rinaldi},
  title = {TestiMole},
  month = May,
  year = 2024,
  url = {https://huggingface.co/datasets/mrinaldi/TestiMole}
}

Future work

The dataset could be enhanced in several ways:

  • Increasing the amount of data (scraping): this could be done both by recycling the same scripts for other forums, blogs and websites or by writing new scraping scripts. It is important to understand that, even if the dataset is big, it only capture a small amount of the entire Italian webosphere;
  • Increasing the amount of data (not by scraping): we have projects in mind to increase the dataset with high quality contents coming from different sources, expecially from Italian Universities;
  • Cleaning the data: deduplication, as explained in the appropriate section, is probably the top-priority work that should be done on this dataset;
  • Much more :) You are warmly invited to collaborate with me in this effort.

Statistics

More statistics will be added in the near future. In the "asset" directory, JSONL files contain precomputed token counts for each subcategory (e.g., single forum, newsgroup, or blog), allowing anyone interested to easily craft more detailed statistics.

Conversational aggregated tokens per year:

image/png

Forum tokens per year:

image/png

Usenet tokens per year:

image/png

Usenet hierarchies breakdown:

image/png

Usenet and Forum in diachronic perspective:

image/png

Blogs tokens per year:

image/png

Contributions

Special thanks to Viviana Patti and Valerio Basile, professors at the Computer Science Department, NLP group, at the University of Turin, Italy who are significantly supporting me and my projects. Grazie mille :) Thanks also to ruggsea, who helped in the first stage of the creation of the Usenet dataset by converting the first JSONL files to parquet and giving some resources to download part of the dataset. Thanks to the entire mii-community who supported and expressed interest in the project. Thanks to Luisa for plugging the old laptop, giving me SSH access and reboot it in cases such as power surges or crashes.

References (partial)

* [1] https://pdai.info/

* [2] https://github.com/openai/tiktoken

* [3] https://xmau.com/usenet/