24.9 MB
3 files
Updated about 1 month ago
Name
Size
data
.gitattributes2.46 kB
xet
README.md3.17 kB
xet
README.md

Egyptian Legal Corpus

A comprehensive collection of Egyptian legal texts, meticulously extracted and tokenized for Natural Language Processing (NLP) applications, legal research, and AI model training. This corpus provides high-quality Arabic legal content with structured metadata for efficient processing.

Dataset Statistics

This release provides a foundational legal corpus with strict quality controls:

  • Token Count: 25M+ tokens (25,054,372 tokens) using cl100k_base (GPT-4 standard)
  • Hierarchical Categorization: Multi-level legal taxonomy for precise document classification
  • Quality Assurance: Standardized metadata schema and validated token counts

Dataset Structure

Each record in the dataset contains the following fields:

  • text (string): The extracted Arabic legal text from the source document.
  • categories (list): A hierarchical list of legal categories derived from the document's classification path (e.g., ["Constitutional Law", "Civil Rights"]).
  • law_name (string): The official name or identifier of the law/document (derived from the source filename).
  • tokens (int): Precise token count calculated using cl100k_base encoding for accurate LLM context estimation.

Dataset Example

{
  "text": "قانون رقم 12 لسنة 2003 بإصدار قانون الطفل...",
  "categories": [
    "القوانين الاجتماعية",
    "قانون الطفل"
  ],
  "law_name": "قانون_الطفل_12_لسنة_2003",
  "tokens": 15847
}

Usage

Loading the Dataset

from datasets import load_dataset

# Load the full dataset
dataset = load_dataset("dataflare/egypt-legal-corpus")

# Access a sample record
sample = dataset['train'][0]
print(f"Law: {sample['law_name']}")
print(f"Categories: {' > '.join(sample['categories'])}")
print(f"Tokens: {sample['tokens']}")
print(f"Text preview: {sample['text'][:200]}...")

Filtering by Category

# Filter documents by specific legal category
constitutional_docs = dataset['train'].filter(
    lambda x: "Constitutional" in x['categories']
)

Changelog

Version 1.0 (January 2026)

Initial release establishing the baseline Egyptian legal corpus:

  • Extracted and processed legal texts from official Egyptian legal documents
  • Implemented hierarchical categorization system for legal taxonomy
  • Validated token counts using cl100k_base encoding
  • Standardized metadata schema across all records

Citation and License

This dataset is released under the MIT License, allowing for both academic and commercial use.

If you use this dataset in your research or applications, please cite:

@dataset{egyptian_legal_corpus,
  title={Egyptian Legal Corpus: A Comprehensive Collection of Egyptian Legal Texts},
  author={Dataflare},
  year={2026},
  publisher={Hugging Face},
  url={https://huggingface.co/datasets/dataflare/egypt-legal-corpus}
}
Total size
24.9 MB
Files
3
Last updated
Aug 16
Pre-warmed CDN
US EU US EU

Contributors