Download scripts/README.md from RaiyanKhaan/Beyond-Chunking: direct link, hf CLI and curl.
- Browser
- Download file 4.22 kB
-
https://huggingface.co/datasets/RaiyanKhaan/Beyond-Chunking/resolve/main/scripts/README.md
- Command line
-
hf download hf://datasets/RaiyanKhaan/Beyond-Chunking/scripts/README.md
-
curl -L -o README.md https://huggingface.co/datasets/RaiyanKhaan/Beyond-Chunking/resolve/main/scripts/README.md
Dataset Preparation and Representation Scripts
This folder contains the official, verified dataset preparation, validation, and representation-building scripts for:
"Beyond Chunking: Node Integrity and Field Structure in Bengali Retrieval-Augmented Agent Memory"
1. Directory Structure
reproducibility/scripts/
├── README.md # This guide
├── data_ingestion/
│ ├── 00_fetch_external_data.py # Validates external provenance and local file presence
│ ├── 01_prepare_corpora.py # Standardizes knowledge corpora across Agri, Legal, and Edu
│ └── 02_prepare_queries.py # Standardizes benchmark queries and evaluation subsets
├── validation/
│ └── 03_validate_data.py # Independent reproducibility audit gate
├── representations/
│ ├── 04_build_l1_chunks.py # L1 Chunked Unstructured builder (500-char window)
│ ├── 05_build_l2_full_nodes.py # L2 Full-Node Unstructured builder (intact concatenated text)
│ └── 06_build_l3_fields.py # L3 Structured BM25F schema builder (dedicated search slots)
├── 00_fetch_external_data.py # Top-level entry point runner
├── 01_prepare_corpora.py # Top-level entry point runner
├── 02_prepare_queries.py # Top-level entry point runner
├── 03_validate_data.py # Top-level entry point runner
├── 04_build_l1_chunks.py # Top-level entry point runner
├── 05_build_l2_full_nodes.py # Top-level entry point runner
└── 06_build_l3_fields.py # Top-level entry point runner
2. Script Execution Guide
Script 00: Check External Data Sources and Provenance
Validates external data repositories (HuggingFace datasets, NCTB curriculum textbooks, AIS/DAE handbooks):
python reproducibility/scripts/00_fetch_external_data.py
Script 01: Ingest and Standardize Corpora
Standardizes raw nodes into canonical JSON schema (structured_nodes.json) and exports selected_act_ids.json (735 legal acts) and nctb_provenance.json (190 secondary experiments):
python reproducibility/scripts/01_prepare_corpora.py
Script 02: Prepare Benchmark Queries and Evaluation Subsets
Standardizes 3,670 queries (queries.jsonl) and generates the 900-query agent sample, the 872-query common evaluated subset, the 28 timeout exclusions, and the 300-query perturbation sample:
python reproducibility/scripts/02_prepare_queries.py
Script 03: Execute Independent Data Validation Audit Gate
Executes the cryptographic and census audit verifying 100% hash integrity against manifest.json, node counts, query counts, chunk counts, and referential integrity:
python reproducibility/scripts/03_validate_data.py
Expected Output: DATA VALIDATION AUDIT: PASS
3. Representation Builders ($L_1$, $L_2$, $L_3$)
Script 04: Build / Verify $L_1$ (Chunked Unstructured)
Splits knowledge records into 500-character recursive windows with overlap (4,526 agri, 4,202 legal, 892 edu chunks):
python reproducibility/scripts/04_build_l1_chunks.py
Script 05: Build / Verify $L_2$ (Full-Node Unstructured)
Concatenates all active schema fields with newline delimiters into an intact document per record (1,028 agri, 735 legal, 190 edu intact documents):
python reproducibility/scripts/05_build_l2_full_nodes.py
Script 06: Build / Verify $L_3$ (Structured BM25F)
Extracts records into dedicated indexed field slots according to the official schema (Appendix Table 7), tagging designated query-aligned anchor fields:
python reproducibility/scripts/06_build_l3_fields.py
4. Design Principles
- Standard Library Only: All scripts run in standard Python 3.8+ without external dependencies.
- Console Encoding Safe: Automatic UTF-8 console reconfiguring prevents Windows cp1252 character errors.
- Relocatable Execution: Scripts automatically detect project root from
__file__or accept explicit--data_dirand--output_dirarguments.