Datasets:
Add --blocked-treebanks flag to parquet generator
Browse files- Added support for --blocked-treebanks argument
- Defaults to tools/blocked_treebanks.yaml
- Automatically filters out treebanks with license restrictions
- Updated usage documentation
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- tools/04_generate_parquet.py +14 -4
tools/04_generate_parquet.py
CHANGED
|
@@ -16,11 +16,15 @@ For the actual implementation, see: https://github.com/bot-zen/ud-hf-parquet-too
|
|
| 16 |
Repository: commul/universal_dependencies
|
| 17 |
|
| 18 |
Usage:
|
| 19 |
-
python 04_generate_parquet.py [
|
| 20 |
|
| 21 |
-
|
| 22 |
-
--
|
| 23 |
-
--
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
Note for developers:
|
| 26 |
If you're modifying the ud-hf-parquet-tools library locally, run this script
|
|
@@ -48,6 +52,7 @@ REPO_ROOT = Path(__file__).parent.parent.resolve()
|
|
| 48 |
METADATA_FILE = REPO_ROOT / f"metadata.json"
|
| 49 |
UD_REPOS_DIR = REPO_ROOT / "tools" / "UD_repos"
|
| 50 |
OUTPUT_DIR = REPO_ROOT / "parquet"
|
|
|
|
| 51 |
|
| 52 |
|
| 53 |
def main():
|
|
@@ -57,12 +62,16 @@ def main():
|
|
| 57 |
)
|
| 58 |
parser.add_argument("--test", action="store_true", help="Test mode: process 3 treebanks only")
|
| 59 |
parser.add_argument("--treebanks", help="Comma-separated list of treebank names")
|
|
|
|
| 60 |
parser.add_argument("--overwrite", action="store_true", help="Overwrite existing parquet files")
|
| 61 |
parser.add_argument("-v", "--verbose", action="store_true", default=True, help="Verbose output")
|
| 62 |
parser.add_argument("-q", "--quiet", action="store_true", help="Quiet mode")
|
| 63 |
|
| 64 |
args = parser.parse_args()
|
| 65 |
|
|
|
|
|
|
|
|
|
|
| 66 |
# Build arguments for ud-hf-parquet-tools
|
| 67 |
tool_args = [
|
| 68 |
"ud-hfp-tools",
|
|
@@ -70,6 +79,7 @@ def main():
|
|
| 70 |
"--metadata", str(METADATA_FILE),
|
| 71 |
"--ud-repos-dir", str(UD_REPOS_DIR),
|
| 72 |
"--output-dir", str(OUTPUT_DIR),
|
|
|
|
| 73 |
]
|
| 74 |
|
| 75 |
if args.test:
|
|
|
|
| 16 |
Repository: commul/universal_dependencies
|
| 17 |
|
| 18 |
Usage:
|
| 19 |
+
python 04_generate_parquet.py [OPTIONS]
|
| 20 |
|
| 21 |
+
Options:
|
| 22 |
+
--test Only process 3 test treebanks (fr_gsd, en_ewt, it_isdt)
|
| 23 |
+
--treebanks NAMES Comma-separated list of treebank names to process
|
| 24 |
+
--blocked-treebanks FILE Path to blocked treebanks YAML file (default: tools/blocked_treebanks.yaml)
|
| 25 |
+
--overwrite Overwrite existing parquet files (default: skip existing)
|
| 26 |
+
-v, --verbose Print progress messages (default: True)
|
| 27 |
+
-q, --quiet Suppress progress messages
|
| 28 |
|
| 29 |
Note for developers:
|
| 30 |
If you're modifying the ud-hf-parquet-tools library locally, run this script
|
|
|
|
| 52 |
METADATA_FILE = REPO_ROOT / f"metadata.json"
|
| 53 |
UD_REPOS_DIR = REPO_ROOT / "tools" / "UD_repos"
|
| 54 |
OUTPUT_DIR = REPO_ROOT / "parquet"
|
| 55 |
+
BLOCKED_TREEBANKS_FILE = REPO_ROOT / "tools" / "blocked_treebanks.yaml"
|
| 56 |
|
| 57 |
|
| 58 |
def main():
|
|
|
|
| 62 |
)
|
| 63 |
parser.add_argument("--test", action="store_true", help="Test mode: process 3 treebanks only")
|
| 64 |
parser.add_argument("--treebanks", help="Comma-separated list of treebank names")
|
| 65 |
+
parser.add_argument("--blocked-treebanks", help="Path to blocked treebanks YAML file")
|
| 66 |
parser.add_argument("--overwrite", action="store_true", help="Overwrite existing parquet files")
|
| 67 |
parser.add_argument("-v", "--verbose", action="store_true", default=True, help="Verbose output")
|
| 68 |
parser.add_argument("-q", "--quiet", action="store_true", help="Quiet mode")
|
| 69 |
|
| 70 |
args = parser.parse_args()
|
| 71 |
|
| 72 |
+
# Use default blocked treebanks file if not specified
|
| 73 |
+
blocked_treebanks_path = args.blocked_treebanks or str(BLOCKED_TREEBANKS_FILE)
|
| 74 |
+
|
| 75 |
# Build arguments for ud-hf-parquet-tools
|
| 76 |
tool_args = [
|
| 77 |
"ud-hfp-tools",
|
|
|
|
| 79 |
"--metadata", str(METADATA_FILE),
|
| 80 |
"--ud-repos-dir", str(UD_REPOS_DIR),
|
| 81 |
"--output-dir", str(OUTPUT_DIR),
|
| 82 |
+
"--blocked-treebanks", blocked_treebanks_path,
|
| 83 |
]
|
| 84 |
|
| 85 |
if args.test:
|