# Blocked Treebanks This document explains the treebank blocking system used to handle licensing restrictions. ## Overview Some Universal Dependencies treebanks have restrictive licenses that prohibit redistribution in derived formats (like Parquet files). The blocking system allows these treebanks to be excluded from Parquet generation while still remaining accessible through the dataset loader when loading directly from CoNLL-U files. ## How It Works ### Configuration File The `blocked_treebanks.yaml` file contains a list of treebanks that should be excluded from Parquet generation: ```yaml treebank_name: reason: "Brief explanation of why this treebank is blocked" license: "License type (e.g., CC BY-NC-ND 4.0)" alternative: "How users can access the data" ``` ### Parquet Generation When running `04_generate_parquet.py`, the script: 1. Loads the blocked treebanks list from `blocked_treebanks.yaml` 2. Filters them out from the processing queue 3. Reports which treebanks were skipped and why ### Dataset Loader Behavior The dataset loader (`universal_dependencies.py`) handles blocked treebanks gracefully: **For non-blocked treebanks:** - Loads from pre-generated Parquet files (fast, efficient) **For blocked treebanks:** - Falls back to loading from original CoNLL-U files - Requires `trust_remote_code=True` parameter - Slightly slower but provides full access to the data - Respects the treebank's original license terms ## Usage Examples ### Loading a Non-Blocked Treebank ```python from datasets import load_dataset # Fast loading from Parquet ds = load_dataset("commul/universal_dependencies", "en_ewt", split="train") ``` ### Loading a Blocked Treebank ```python from datasets import load_dataset # Falls back to CoNLL-U loading (requires trust_remote_code) ds = load_dataset( "commul/universal_dependencies", "pt_cintil", # Example blocked treebank split="train", trust_remote_code=True ) ``` ## Adding a Blocked Treebank To block a treebank from Parquet distribution: 1. **Check the license** in the treebank's README.md 2. **Add entry to `blocked_treebanks.yaml`**: ```yaml pt_cintil: reason: "Restrictive license prohibits redistribution in derived formats" license: "CC BY-NC-ND 4.0" alternative: "Load directly from UD release using trust_remote_code=True" ``` 3. **Remove existing Parquet files** (if any): ```bash rm -rf ../parquet/pt_cintil/ ``` 4. **Update documentation** if needed 5. **Commit the change** with a clear message explaining the restriction ## License Considerations ### Permissive Licenses (Allow Parquet Distribution) - ✅ CC BY 3.0 / 4.0 - ✅ CC BY-SA 3.0 / 4.0 - ✅ MIT - ✅ Apache 2.0 ### Restrictive Licenses (Block Parquet Distribution) - ❌ CC BY-NC (No Commercial use) - ❌ CC BY-ND (No Derivatives) - ❌ CC BY-NC-ND (No Commercial use, No Derivatives) - ❌ Custom restrictive licenses **Note:** Even with permissive licenses, always verify the specific terms in each treebank's README.md, as some may have additional restrictions. ## Current Status As of UD v2.17, **0 treebanks** are currently blocked. The blocklist infrastructure is in place and ready to use if needed in future releases. ## Technical Details ### File Locations - **Blocklist:** `tools/blocked_treebanks.yaml` - **Generation script:** `tools/04_generate_parquet.py` - **Loader template:** `tools/templates/universal_dependencies.tmpl` - **Documentation:** `tools/BLOCKED_TREEBANKS.md` (this file) ### Validation To test the blocking system: ```bash # Add a test entry to blocked_treebanks.yaml echo "test_treebank: reason: Test license: Test" >> tools/blocked_treebanks.yaml # Run parquet generation uv run tools/04_generate_parquet.py # Should see: "Skipping 1 blocked treebank(s) due to license restrictions" ``` ## See Also - [CONLLU_PARSING.md](https://github.com/bot-zen/ud-hf-parquet-tools/blob/main/CONLLU_PARSING.md) - CoNLL-U parsing edge cases (in ud-hf-parquet-tools) - [Universal Dependencies Licensing](https://lindat.mff.cuni.cz/repository/xmlui/page/license-ud-2.17)