Datasets:
dataset_info:
features:
- name: text
dtype: string
- name: file_name
dtype: string
splits:
- name: train
num_bytes: 1534739938
num_examples: 13110
download_size: 497931218
dataset_size: 1534739938
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
license: gpl
task_categories:
- text-generation
language:
- fa
tags:
- chemistry
- biology
- finance
- legal
- music
- art
- medical
size_categories:
- 10K<n<100K
Persian Document Corpus
Dataset Summary
The Persian Document Corpus (PDC) is a large collection of Persian documents, comprising over 13,000 files, gathered from publicly accessible PDFs across a wide array of knowledge domains. This corpus includes research articles, theses, dissertations, scientific reports, and book chapters, offering a rich and diverse resource for the Persian Natural Language Processing (NLP) community. It is designed to facilitate the training and evaluation of NLP models for a broad spectrum of tasks and applications in various fields.
The documents span a diverse range of subjects, reflecting the breadth of Persian scholarly and professional output. The corpus is expected to include documents from the following fields:
- Science and Technology: This category encompasses Mathematics, Physics (including Quantum Physics), Chemistry, Computer Science, Engineering, Information Technology (including Blockchain, Cryptocurrencies, Metaverse, NFTs, Smart Contracts), Automotive Engineering, and other technical domains.
- Social Sciences and Humanities: This area includes Sociology, Political Science, Economics, Law (particularly Women's Rights), Philosophy, History (especially Iranian History), Education, Linguistics (including Persian and English Language Learning), Library Science, Media Studies (including Podcasts and Film), Literature, and potentially Psychology and Gender Studies (Feminism, Women's Studies).
- Applied Sciences and Practical Domains: This section covers Medicine and Health (including topics like Pregnancy, Menstruation, Dermatology - Acne, Ophthalmology - Eye Diseases, Cosmetics - Perfume, Nail Care, Masks), Agriculture (including Poultry - Chicken, Floriculture - Flowers), Business and Finance (Stock Market, Real Estate, E-commerce - Online Classifieds), Culinary Arts (Recipes), Home Improvement, and potentially Career Development (Employment, Migration), as well as general interest topics like Games, Music, and Lifestyle.
This dataset is particularly valuable for tasks that require the analysis of formal Persian language, specialized terminology, and structured writing styles across these diverse domains.
Supported Tasks
- Language Modeling: Train Persian language models on a wide variety of formal texts.
- Information Retrieval: Develop and evaluate Persian information retrieval systems.
- Keyword Extraction: Extract key terms and build domain-specific vocabularies for various fields.
- Text Summarization: Summarize Persian documents from diverse subject areas.
Dataset Creation
Curation Rationale
This dataset was created to address the need for a large, publicly available Persian text corpus covering a diverse range of subjects. Existing Persian datasets often lack sufficient content representing the breadth of knowledge domains, which is essential for training robust models for various NLP tasks. The PDC aims to bridge this gap and support advancements in Persian NLP research and applications across diverse fields of study.
Source Data
Data Collection and Processing
- Data Acquisition: Documents were discovered and collected through web searches using a curated list of Persian search queries designed to target publicly available Persian PDF documents across a wide range of topics. These topics span Science, Technology, Social Sciences, Humanities, and applied fields. Examples of subjects include "Mathematics," "Chemistry," "Feminism," "Migration Studies," and "Persian Podcasts," among many others. The search queries combined subject keywords (e.g., 'Mathematics', 'Feminism') with terms indicating document types (e.g., 'article', 'thesis', 'dissertation', 'book', 'guide') to refine searches and ensure relevance to informative content.
- PDF Download and Conversion: Relevant PDFs identified through search queries were downloaded and then converted to plain text format. This conversion process utilized a combination of tools optimized for Persian text, which can be challenging due to its right-to-left script and complex layouts.
- Text Cleaning and Normalization: The extracted text underwent several cleaning and normalization steps to improve data quality and consistency:
- PDF Artifact Removal: Headers, footers, page numbers, watermarks, and other extraneous elements introduced during PDF conversion were removed using regular expressions and rule-based methods.
- Character Normalization: Character encodings were standardized to UTF-8, and inconsistencies in Persian characters were addressed. This also included normalizing diacritics and vowel markings for uniformity.
- Whitespace Normalization: Multiple whitespace characters (spaces, tabs, newlines) were consolidated into single spaces, and leading/trailing whitespace was removed from lines and documents.
Considerations for Using the Data
Social Impact
This dataset is intended to have a positive social impact by:
- Democratizing Access to Persian Knowledge: Providing a large, freely available collection of Persian texts from various fields to researchers, students, and developers globally.
- Advancing Persian Language Technology: Serving as a valuable resource for developing and enhancing Persian language processing tools and models, benefiting Persian speakers in education, research, and various professional domains.
- Enabling Interdisciplinary Research on Persian Content: Facilitating the computational analysis of Persian content across disciplines, leading to insights into research trends, knowledge dissemination, and the evolution of information within Persian-speaking communities in diverse fields of study.
Dataset Bias
Users should be aware of potential biases in this dataset:
- Formal Language Bias: The corpus primarily consists of formal and structured writing, which may differ significantly from informal Persian or other genres. Models trained on this data might perform optimally on formal text but less effectively on other types of Persian text.
- Topical Bias: While aiming for broad topical coverage, the distribution of subjects may not perfectly represent the entire spectrum of Persian knowledge production or interests. The subject list in Persian Search Queries Dataset indicates the intended scope, but topic representation may vary based on the online availability of PDFs and the search queries used. For example, topics like "Games," "Songs," or "Fortune Telling" might be less represented in structured documents compared to core science or social science subjects, despite being included in the subject queries. Further analysis of the corpus's topic distribution is recommended to understand the actual topical balance.
- Source Bias: The dataset is limited to publicly accessible documents found through web searches, potentially excluding documents behind paywalls, in private repositories, or not indexed by search engines. This may bias the corpus towards institutions and individuals more likely to publish their work online in PDF format.
- Geographic and Institutional Bias: The origin of documents might be skewed towards specific geographic regions or institutions more active in online publishing of information and research.
Known Limitations
- PDF Conversion Artifacts: Despite cleaning efforts, some documents may still contain residual artifacts from PDF conversion, such as layout inconsistencies, broken characters, or misidentified text elements. Users should expect to handle some noise in the data.
- Document Length Variability: The dataset includes documents of varying lengths, from short articles to lengthy dissertations and books. This variation may need consideration depending on the specific NLP task.
- Language Mixing: While primarily in Persian, some documents may contain technical terms, citations, or abstracts in English or other languages, which is common in academic and technical writing.
Additional Information
Dataset Curator
This dataset was curated by Mohammad Shojaei.
Dataset Statistics
- Number of Documents: 13k
- Total Token Count: Approximately 1 billion tokens
- Number of Subjects: 1313
Usage Example
Here's a basic example of loading and using the dataset with the datasets
library from Hugging Face:
from datasets import load_dataset
# Load the dataset
dataset = load_dataset("mshojaei77/persian-document-corpus")
# Access the first few examples
for example in dataset['train'].select(range(3)):
print(f"File: {example['file_name']}")
print(f"Text preview (first 200 characters):\n{example['text'][:200]}...")
print("-" * 50)
# Example: Iterate through all documents and count words (basic example)
def count_words(example):
words = example['text'].split() # Simple word splitting; more sophisticated tokenization may be needed
return {'word_count': len(words)}
dataset = dataset.map(count_words)
total_word_count = sum(dataset['train']['word_count'])
print(f"\nTotal word count in the dataset (approximate): {total_word_count}")
Licensing Information
This dataset is released under the GNU General Public License v3.0 (GPL-3.0). This license permits free use, distribution, and modification, even for commercial purposes, provided that derivative works are also licensed under GPL-3.0.
Citation Information
If you utilize this dataset in your research or applications, please cite it as follows:
@misc{persian-document-corpus2024,
title={Persian Document Corpus},
author={Mohammad Shojaei},
year={2024},
publisher={Hugging Face},
howpublished={\url{https://huggingface.co/datasets/mshojaei77/persian-document-corpus}}
}
Contributions
For questions, issues, or to contribute to the dataset, please open issues or submit pull requests. Contributions to improve the dataset and its documentation are welcomed.