news_fr / README.md
eckendoerffer's picture
Update README.md
468fffe
|
raw
history blame
3.97 kB
metadata
license: cc-by-3.0
task_categories:
  - text-generation
language:
  - fr
tags:
  - news
  - media
  - Press
size_categories:
  - 100K<n<1M

NEWS FR

There is an open-access dataset on BnF / Gallica comprising nearly a hundred newspapers from the print media spanning almost 100 years. Unfortunately, for this dataset, only 85% of the text is transcribed accurately.

DATASET

This dataset compiles 400,000 online articles from nearly 100 Francophone media outlets. This dataset is intended for research purposes and non-commercial use. It includes 548,000 lines for model training, and 30,445 lines for the test and validation files.

Included with this dataset are scripts to extract and process the article text from the same sources. The script is somewhat rough around the edges, but it is functional and commented.

Format

  • Type: Text
  • File Extension: .txt

The text has been standardized for consistent formatting and line length. Additionally, the dataset has been filtered using the langid library to include only text in French.

Structure

The dataset is divided into the following splits:

  • train.txt: 1.04 GB - 548,000 rows - 90%
  • test.txt : 56 MB - 30,445 rows - 5%
  • valid.txt: 56 MB - 30,445 rows - 5%

Exploring the Dataset

You can use the explore_dataset.py script to explore the dataset by randomly displaying a certain number of lines from it. The script creates and saves an index based on the line breaks, enabling faster data retrieval and display.

Additional Information

This dataset is a subset of a larger 10GB French dataset, which also contains several thousand books and theses in French, Wikipedia, as well as several hundred thousand Francophone news articles.

EXTRACT NEWS FR

The "NEWS FR" module allows for the extraction of online press articles from over a hundred different sources.

Installation

To set up the module, follow the steps below:

  1. Database Setup:

    • Create a database and incorporate the two tables present in database.sql.
  2. Database Configuration:

    • Update your MySQL connection information in the functions_mysqli.php file.
  3. Dependencies Installation:

    • The script requires the installation of electrolinux/phpquery. Install it using composer:
      composer require electrolinux/phpquery
      

Note: RSS feed links for media sources, as well as the HTML structure of media pages, tend to change and evolve regularly. It's crucial to regularly check the output per media source and adjust the parsing process to ensure high-quality text extraction and to address potential changes in RSS feed URLs.

Usage

1. 1_extract_rss.php:

This script fetches RSS feeds from various media outlets and adds URLs for further extraction.

php 1_extract_rss.php

2. 2_extract_news.php:

This script retrieves the sources of articles for subsequent local processing.

php 2_extract_news.php

3. 3_extract_news_txt.php:

This script extracts the text content of press articles and saves it (title + description + text) to a .txt file.

php 3_extract_news_txt.php

After completing this step, you can use the Python script located at /dataset/2_cleaning_txt.py to standardize the text for your dataset.

4. 4_extract_news_url.php:

This script allows for the extraction of links to other articles from local article sources. This ensures swift retrieval of numerous past articles, as opposed to fetching only the most recent ones.

php 4_extract_news_url.php

After using this script, you'll need to run 2_extract_news.php again to retrieve the sources of the new articles, as well as 3_extract_news_txt.php to extract the text from these articles.


PHP + MySQL was chosen for this section to facilitate debugging, and to allow display by source or by media.