Datasets:
tools: make version selection flag-driven and optional-env
Browse files- ADDING_NEW_UD_VERSION.md +19 -20
- tools/00_fetch_ud_clarin-dspace_metadata.py +8 -0
- tools/01_fetch_ud_snapshot.sh +90 -12
- tools/02_generate_metadata.py +4 -1
- tools/03_generate_README.py +4 -1
- tools/04_generate_parquet.py +5 -1
- tools/05_validate_parquet.py +9 -4
- tools/README.md +23 -18
- tools/metadata-2.17.json +0 -0
ADDING_NEW_UD_VERSION.md
CHANGED
|
@@ -54,27 +54,25 @@ git checkout -b 2.18
|
|
| 54 |
|
| 55 |
**Why branching?** Each UD version is maintained independently, allowing users to load specific versions via `revision="2.18"`.
|
| 56 |
|
| 57 |
-
### 3.
|
| 58 |
|
| 59 |
```bash
|
| 60 |
cd tools
|
| 61 |
|
| 62 |
# Set the version number
|
| 63 |
export NEW_VER=2.18
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
# Verify
|
| 67 |
-
cat .env
|
| 68 |
-
# Output: UD_VER=2.18
|
| 69 |
```
|
| 70 |
|
| 71 |
-
**
|
|
|
|
| 72 |
|
| 73 |
### 4. Fetch Metadata from LINDAT/CLARIN
|
| 74 |
|
| 75 |
```bash
|
| 76 |
# Fetch citation and description
|
| 77 |
-
./00_fetch_ud_clarin-dspace_metadata.py -o
|
| 78 |
|
| 79 |
# This creates:
|
| 80 |
# - etc/citation-2.18
|
|
@@ -95,7 +93,7 @@ cat .env
|
|
| 95 |
|
| 96 |
```bash
|
| 97 |
# Fetch language metadata
|
| 98 |
-
./00_fetch_ud_codes_and_flags.sh -o
|
| 99 |
|
| 100 |
# This creates:
|
| 101 |
# - etc/codes_and_flags-2.18.yaml
|
|
@@ -120,18 +118,18 @@ Use `--all` only when you want to refresh all mapped versions.
|
|
| 120 |
|
| 121 |
```bash
|
| 122 |
# Download and extract official UD release snapshot
|
| 123 |
-
./01_fetch_ud_snapshot.sh
|
| 124 |
|
| 125 |
# This creates/updates:
|
| 126 |
# - ud-treebanks-v2.18/ (extracted snapshot directory)
|
| 127 |
# - UD_repos -> ud-treebanks-v2.18 (symlink used by generation scripts)
|
| 128 |
```
|
| 129 |
|
| 130 |
-
**What does this do?**
|
| 131 |
|
| 132 |
**Useful options:**
|
| 133 |
- `--online`: Force re-download and re-extraction
|
| 134 |
-
- `--keep-archive`: Keep the downloaded
|
| 135 |
- `--keep-backup`: Keep previous snapshot as `ud-treebanks-v{VER}.bak.<timestamp>`
|
| 136 |
|
| 137 |
### 7. Verify Snapshot Layout
|
|
@@ -154,7 +152,7 @@ ls UD_repos | head
|
|
| 154 |
|
| 155 |
```bash
|
| 156 |
# Generate metadata from all treebank directories
|
| 157 |
-
./02_generate_metadata.py -o
|
| 158 |
|
| 159 |
# This creates:
|
| 160 |
# - metadata-2.18.json (contains info for all treebanks)
|
|
@@ -182,7 +180,7 @@ python -c "import json; print(len(json.load(open('metadata-${NEW_VER}.json'))))"
|
|
| 182 |
|
| 183 |
```bash
|
| 184 |
# Generate HuggingFace dataset card
|
| 185 |
-
./03_generate_README.py -o
|
| 186 |
|
| 187 |
# This creates:
|
| 188 |
# - README-2.18 (dataset card for HuggingFace)
|
|
@@ -215,10 +213,10 @@ cat blocked_treebanks.yaml
|
|
| 215 |
|
| 216 |
```bash
|
| 217 |
# Test with 3 treebanks first
|
| 218 |
-
uv run ./04_generate_parquet.py --test
|
| 219 |
|
| 220 |
# If successful, generate all treebanks (takes 2-4 hours)
|
| 221 |
-
uv run ./04_generate_parquet.py
|
| 222 |
|
| 223 |
# This creates:
|
| 224 |
# - ../parquet/{treebank_name}/{split}.parquet for all treebanks
|
|
@@ -241,10 +239,10 @@ du -sh ../parquet/
|
|
| 241 |
|
| 242 |
```bash
|
| 243 |
# Test validation on 3 treebanks
|
| 244 |
-
uv run ./05_validate_parquet.py --local --test
|
| 245 |
|
| 246 |
# Full validation (optional, takes ~30-60 minutes)
|
| 247 |
-
uv run ./05_validate_parquet.py --local -vv > /tmp/parquet-check.log
|
| 248 |
|
| 249 |
# Check for errors (excluding metadata comments)
|
| 250 |
grep -E " [+-]" /tmp/parquet-check.log | grep -vE " [+-]#"
|
|
@@ -303,7 +301,8 @@ git add tools/README-${NEW_VER}
|
|
| 303 |
git add tools/etc/citation-${NEW_VER}
|
| 304 |
git add tools/etc/description-${NEW_VER}
|
| 305 |
git add tools/etc/codes_and_flags-${NEW_VER}.yaml
|
| 306 |
-
|
|
|
|
| 307 |
|
| 308 |
# Commit with descriptive message
|
| 309 |
git commit -m "Add UD ${NEW_VER} data with Parquet format
|
|
@@ -488,7 +487,7 @@ uv run --script ./script.py
|
|
| 488 |
|
| 489 |
Before marking the release as complete:
|
| 490 |
|
| 491 |
-
- [ ] `
|
| 492 |
- [ ] Metadata files generated (`citation-{VER}`, `description-{VER}`, `codes_and_flags-{VER}.yaml`)
|
| 493 |
- [ ] UD snapshot downloaded and `UD_repos` symlink points to `ud-treebanks-v{VER}`
|
| 494 |
- [ ] `metadata-{VER}.json` generated with blocked treebank info
|
|
|
|
| 54 |
|
| 55 |
**Why branching?** Each UD version is maintained independently, allowing users to load specific versions via `revision="2.18"`.
|
| 56 |
|
| 57 |
+
### 3. Choose Version Input (Flags or .env)
|
| 58 |
|
| 59 |
```bash
|
| 60 |
cd tools
|
| 61 |
|
| 62 |
# Set the version number
|
| 63 |
export NEW_VER=2.18
|
| 64 |
+
# Optional convenience for scripts that read defaults from env:
|
| 65 |
+
# echo "UD_VER=${NEW_VER}" > .env
|
|
|
|
|
|
|
|
|
|
| 66 |
```
|
| 67 |
|
| 68 |
+
**Recommended:** pass explicit flags (`--ud-ver` / `--rev`) in commands below.
|
| 69 |
+
**Optional:** keep `.env` for a persistent default.
|
| 70 |
|
| 71 |
### 4. Fetch Metadata from LINDAT/CLARIN
|
| 72 |
|
| 73 |
```bash
|
| 74 |
# Fetch citation and description
|
| 75 |
+
./00_fetch_ud_clarin-dspace_metadata.py -o -r ${NEW_VER}
|
| 76 |
|
| 77 |
# This creates:
|
| 78 |
# - etc/citation-2.18
|
|
|
|
| 93 |
|
| 94 |
```bash
|
| 95 |
# Fetch language metadata
|
| 96 |
+
./00_fetch_ud_codes_and_flags.sh -o -r ${NEW_VER}
|
| 97 |
|
| 98 |
# This creates:
|
| 99 |
# - etc/codes_and_flags-2.18.yaml
|
|
|
|
| 118 |
|
| 119 |
```bash
|
| 120 |
# Download and extract official UD release snapshot
|
| 121 |
+
./01_fetch_ud_snapshot.sh -r ${NEW_VER}
|
| 122 |
|
| 123 |
# This creates/updates:
|
| 124 |
# - ud-treebanks-v2.18/ (extracted snapshot directory)
|
| 125 |
# - UD_repos -> ud-treebanks-v2.18 (symlink used by generation scripts)
|
| 126 |
```
|
| 127 |
|
| 128 |
+
**What does this do?** Resolves the official release treebanks archive from LINDAT/CLARIN API for the handle, downloads it, extracts it, and points `UD_repos` to the extracted snapshot.
|
| 129 |
|
| 130 |
**Useful options:**
|
| 131 |
- `--online`: Force re-download and re-extraction
|
| 132 |
+
- `--keep-archive`: Keep the downloaded archive after extraction
|
| 133 |
- `--keep-backup`: Keep previous snapshot as `ud-treebanks-v{VER}.bak.<timestamp>`
|
| 134 |
|
| 135 |
### 7. Verify Snapshot Layout
|
|
|
|
| 152 |
|
| 153 |
```bash
|
| 154 |
# Generate metadata from all treebank directories
|
| 155 |
+
./02_generate_metadata.py --ud-ver ${NEW_VER} -o
|
| 156 |
|
| 157 |
# This creates:
|
| 158 |
# - metadata-2.18.json (contains info for all treebanks)
|
|
|
|
| 180 |
|
| 181 |
```bash
|
| 182 |
# Generate HuggingFace dataset card
|
| 183 |
+
./03_generate_README.py --ud-ver ${NEW_VER} -o
|
| 184 |
|
| 185 |
# This creates:
|
| 186 |
# - README-2.18 (dataset card for HuggingFace)
|
|
|
|
| 213 |
|
| 214 |
```bash
|
| 215 |
# Test with 3 treebanks first
|
| 216 |
+
uv run ./04_generate_parquet.py --ud-ver ${NEW_VER} --test
|
| 217 |
|
| 218 |
# If successful, generate all treebanks (takes 2-4 hours)
|
| 219 |
+
uv run ./04_generate_parquet.py --ud-ver ${NEW_VER}
|
| 220 |
|
| 221 |
# This creates:
|
| 222 |
# - ../parquet/{treebank_name}/{split}.parquet for all treebanks
|
|
|
|
| 239 |
|
| 240 |
```bash
|
| 241 |
# Test validation on 3 treebanks
|
| 242 |
+
uv run ./05_validate_parquet.py --ud-ver ${NEW_VER} --local --test
|
| 243 |
|
| 244 |
# Full validation (optional, takes ~30-60 minutes)
|
| 245 |
+
uv run ./05_validate_parquet.py --ud-ver ${NEW_VER} --local -vv > /tmp/parquet-check.log
|
| 246 |
|
| 247 |
# Check for errors (excluding metadata comments)
|
| 248 |
grep -E " [+-]" /tmp/parquet-check.log | grep -vE " [+-]#"
|
|
|
|
| 301 |
git add tools/etc/citation-${NEW_VER}
|
| 302 |
git add tools/etc/description-${NEW_VER}
|
| 303 |
git add tools/etc/codes_and_flags-${NEW_VER}.yaml
|
| 304 |
+
# Optional (only if you intentionally version-control .env in your workflow)
|
| 305 |
+
# git add tools/.env
|
| 306 |
|
| 307 |
# Commit with descriptive message
|
| 308 |
git commit -m "Add UD ${NEW_VER} data with Parquet format
|
|
|
|
| 487 |
|
| 488 |
Before marking the release as complete:
|
| 489 |
|
| 490 |
+
- [ ] Version passed explicitly via flags (`--ud-ver` / `--rev`) or `.env` updated
|
| 491 |
- [ ] Metadata files generated (`citation-{VER}`, `description-{VER}`, `codes_and_flags-{VER}.yaml`)
|
| 492 |
- [ ] UD snapshot downloaded and `UD_repos` symlink points to `ud-treebanks-v{VER}`
|
| 493 |
- [ ] `metadata-{VER}.json` generated with blocked treebank info
|
tools/00_fetch_ud_clarin-dspace_metadata.py
CHANGED
|
@@ -56,6 +56,8 @@ parser = argparse.ArgumentParser(description=__doc__,
|
|
| 56 |
formatter_class=argparse.RawDescriptionHelpFormatter)
|
| 57 |
parser.add_argument('-o', '--override', action='store_true',
|
| 58 |
help='override output file if it already exists')
|
|
|
|
|
|
|
| 59 |
parser.add_argument('-v', '--verbose', action='count', default=0,
|
| 60 |
help='increase verbosity level')
|
| 61 |
args = parser.parse_args()
|
|
@@ -73,6 +75,12 @@ try:
|
|
| 73 |
except (OSError, ValueError) as e:
|
| 74 |
raise SystemExit(f"Failed to load release-handle mapping from {release_handle_map_file}: {e}")
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
| 77 |
|
| 78 |
# Iterate over the URL postfixes
|
|
|
|
| 56 |
formatter_class=argparse.RawDescriptionHelpFormatter)
|
| 57 |
parser.add_argument('-o', '--override', action='store_true',
|
| 58 |
help='override output file if it already exists')
|
| 59 |
+
parser.add_argument('-r', '--rev',
|
| 60 |
+
help='only fetch one UD version (e.g. 2.17)')
|
| 61 |
parser.add_argument('-v', '--verbose', action='count', default=0,
|
| 62 |
help='increase verbosity level')
|
| 63 |
args = parser.parse_args()
|
|
|
|
| 75 |
except (OSError, ValueError) as e:
|
| 76 |
raise SystemExit(f"Failed to load release-handle mapping from {release_handle_map_file}: {e}")
|
| 77 |
|
| 78 |
+
if args.rev:
|
| 79 |
+
if args.rev not in url_postfixes:
|
| 80 |
+
known = ", ".join(sorted(url_postfixes.keys()))
|
| 81 |
+
raise SystemExit(f"Unknown UD version '{args.rev}'. Known versions: {known}")
|
| 82 |
+
url_postfixes = {args.rev: url_postfixes[args.rev]}
|
| 83 |
+
|
| 84 |
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
| 85 |
|
| 86 |
# Iterate over the URL postfixes
|
tools/01_fetch_ud_snapshot.sh
CHANGED
|
@@ -34,8 +34,8 @@ echo "Usage: $0 [-o] [-r VER] [--keep-archive] [--keep-backup]" >&2
|
|
| 34 |
Download and extract one official Universal Dependencies snapshot from:
|
| 35 |
* https://lindat.mff.cuni.cz/repository/
|
| 36 |
|
| 37 |
-
The snapshot is
|
| 38 |
-
|
| 39 |
|
| 40 |
and extracted to:
|
| 41 |
* ud-treebanks-v<VER>/
|
|
@@ -47,7 +47,7 @@ Options:
|
|
| 47 |
-h Print this help message
|
| 48 |
-o|--online Force re-download and re-extract
|
| 49 |
-r|--rev VER UD version to fetch (default: \${UD_VER} from .env)
|
| 50 |
-
--keep-archive Keep downloaded
|
| 51 |
--keep-backup Keep existing snapshot directory as timestamped backup
|
| 52 |
EOF
|
| 53 |
}
|
|
@@ -98,11 +98,74 @@ fi
|
|
| 98 |
|
| 99 |
SNAPSHOT_DIR_NAME="ud-treebanks-v${UD_VER}"
|
| 100 |
SNAPSHOT_DIR="${SCRIPT_DIR}/${SNAPSHOT_DIR_NAME}"
|
| 101 |
-
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
download_snapshot() {
|
| 105 |
-
echo "Downloading UD ${UD_VER} snapshot
|
|
|
|
| 106 |
if command -v curl >/dev/null 2>&1; then
|
| 107 |
curl -fL --retry 3 --retry-delay 1 "${SNAPSHOT_URL}" -o "${SNAPSHOT_ARCHIVE}"
|
| 108 |
elif command -v wget >/dev/null 2>&1; then
|
|
@@ -122,16 +185,30 @@ extract_snapshot() {
|
|
| 122 |
tmp_dir=$(mktemp -d)
|
| 123 |
echo "Extracting ${SNAPSHOT_ARCHIVE} into ${SNAPSHOT_DIR_NAME}"
|
| 124 |
|
| 125 |
-
if
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
|
|
|
| 129 |
import sys
|
| 130 |
import zipfile
|
| 131 |
|
| 132 |
with zipfile.ZipFile(sys.argv[1]) as zf:
|
| 133 |
zf.extractall(sys.argv[2])
|
| 134 |
PY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
fi
|
| 136 |
|
| 137 |
mapfile -t snapshot_candidates < <(find "${tmp_dir}" -mindepth 1 -maxdepth 1 -type d -name 'ud-treebanks-v*' | sort)
|
|
@@ -157,6 +234,7 @@ PY
|
|
| 157 |
}
|
| 158 |
|
| 159 |
if [[ "${ONLINE_MODE}" == true ]] || [[ ! -d "${SNAPSHOT_DIR}" ]]; then
|
|
|
|
| 160 |
if [[ "${ONLINE_MODE}" == true ]] || [[ ! -s "${SNAPSHOT_ARCHIVE}" ]]; then
|
| 161 |
download_snapshot
|
| 162 |
else
|
|
@@ -167,8 +245,8 @@ else
|
|
| 167 |
echo "Snapshot directory already exists: ${SNAPSHOT_DIR_NAME}"
|
| 168 |
fi
|
| 169 |
|
| 170 |
-
if [[ "${KEEP_ARCHIVE}" != true ]] && [[ -f "${SNAPSHOT_ARCHIVE}" ]]; then
|
| 171 |
-
echo "Removing archive ${
|
| 172 |
rm -f "${SNAPSHOT_ARCHIVE}"
|
| 173 |
fi
|
| 174 |
|
|
|
|
| 34 |
Download and extract one official Universal Dependencies snapshot from:
|
| 35 |
* https://lindat.mff.cuni.cz/repository/
|
| 36 |
|
| 37 |
+
The snapshot archive is resolved from CLARIN API for the given handle
|
| 38 |
+
and UD version (e.g., ud-treebanks-v<VER>.tgz).
|
| 39 |
|
| 40 |
and extracted to:
|
| 41 |
* ud-treebanks-v<VER>/
|
|
|
|
| 47 |
-h Print this help message
|
| 48 |
-o|--online Force re-download and re-extract
|
| 49 |
-r|--rev VER UD version to fetch (default: \${UD_VER} from .env)
|
| 50 |
+
--keep-archive Keep downloaded archive after extraction
|
| 51 |
--keep-backup Keep existing snapshot directory as timestamped backup
|
| 52 |
EOF
|
| 53 |
}
|
|
|
|
| 98 |
|
| 99 |
SNAPSHOT_DIR_NAME="ud-treebanks-v${UD_VER}"
|
| 100 |
SNAPSHOT_DIR="${SCRIPT_DIR}/${SNAPSHOT_DIR_NAME}"
|
| 101 |
+
SNAPSHOT_ARCHIVE_NAME=""
|
| 102 |
+
SNAPSHOT_ARCHIVE=""
|
| 103 |
+
SNAPSHOT_URL=""
|
| 104 |
+
|
| 105 |
+
resolve_snapshot_download() {
|
| 106 |
+
local resolved
|
| 107 |
+
resolved="$(
|
| 108 |
+
python3 - "${HANDLE}" "${UD_VER}" <<'PY'
|
| 109 |
+
import json
|
| 110 |
+
import sys
|
| 111 |
+
from urllib.parse import urlencode
|
| 112 |
+
from urllib.request import urlopen
|
| 113 |
+
|
| 114 |
+
handle = sys.argv[1]
|
| 115 |
+
ud_ver = sys.argv[2]
|
| 116 |
+
api_base = "https://lindat.mff.cuni.cz/repository/server/api/core/metadatabitstreams/search/byHandle"
|
| 117 |
+
api_url = f"{api_base}?{urlencode({'handle': handle, 'fileGrpType': 'ORIGINAL', 'size': 200})}"
|
| 118 |
+
host_prefix = "https://lindat.mff.cuni.cz"
|
| 119 |
+
target_prefix = f"ud-treebanks-v{ud_ver}."
|
| 120 |
+
|
| 121 |
+
with urlopen(api_url, timeout=30) as response:
|
| 122 |
+
payload = json.loads(response.read().decode("utf-8"))
|
| 123 |
+
|
| 124 |
+
items = payload.get("_embedded", {}).get("metadatabitstreams", [])
|
| 125 |
+
candidates = [
|
| 126 |
+
item for item in items
|
| 127 |
+
if item.get("name", "").startswith(target_prefix) and item.get("href")
|
| 128 |
+
]
|
| 129 |
+
if not candidates:
|
| 130 |
+
raise SystemExit(f"No treebanks archive found for UD {ud_ver} at handle {handle}")
|
| 131 |
+
|
| 132 |
+
def sort_key(item):
|
| 133 |
+
name = item.get("name", "").lower()
|
| 134 |
+
if name.endswith(".tgz") or name.endswith(".tar.gz"):
|
| 135 |
+
return 0
|
| 136 |
+
if name.endswith(".zip"):
|
| 137 |
+
return 1
|
| 138 |
+
return 2
|
| 139 |
+
|
| 140 |
+
selected = sorted(candidates, key=sort_key)[0]
|
| 141 |
+
bitstream_id = selected.get("id")
|
| 142 |
+
if not bitstream_id:
|
| 143 |
+
raise SystemExit(f"Missing bitstream id for UD {ud_ver} at handle {handle}")
|
| 144 |
+
url = f"{host_prefix}/repository/server/api/core/bitstreams/{bitstream_id}/content"
|
| 145 |
+
|
| 146 |
+
print(selected["name"])
|
| 147 |
+
print(url)
|
| 148 |
+
PY
|
| 149 |
+
)"
|
| 150 |
+
|
| 151 |
+
if [[ -z "${resolved}" ]]; then
|
| 152 |
+
>&2 echo "Failed to resolve snapshot archive URL for UD ${UD_VER}."
|
| 153 |
+
exit 1
|
| 154 |
+
fi
|
| 155 |
+
|
| 156 |
+
SNAPSHOT_ARCHIVE_NAME="$(printf '%s\n' "${resolved}" | sed -n '1p')"
|
| 157 |
+
SNAPSHOT_URL="$(printf '%s\n' "${resolved}" | sed -n '2p')"
|
| 158 |
+
SNAPSHOT_ARCHIVE="${SCRIPT_DIR}/${SNAPSHOT_ARCHIVE_NAME}"
|
| 159 |
+
|
| 160 |
+
if [[ -z "${SNAPSHOT_ARCHIVE_NAME}" || -z "${SNAPSHOT_URL}" ]]; then
|
| 161 |
+
>&2 echo "Failed to parse resolved archive metadata for UD ${UD_VER}."
|
| 162 |
+
exit 1
|
| 163 |
+
fi
|
| 164 |
+
}
|
| 165 |
|
| 166 |
download_snapshot() {
|
| 167 |
+
echo "Downloading UD ${UD_VER} snapshot archive (${SNAPSHOT_ARCHIVE_NAME})"
|
| 168 |
+
echo "URL: ${SNAPSHOT_URL}"
|
| 169 |
if command -v curl >/dev/null 2>&1; then
|
| 170 |
curl -fL --retry 3 --retry-delay 1 "${SNAPSHOT_URL}" -o "${SNAPSHOT_ARCHIVE}"
|
| 171 |
elif command -v wget >/dev/null 2>&1; then
|
|
|
|
| 185 |
tmp_dir=$(mktemp -d)
|
| 186 |
echo "Extracting ${SNAPSHOT_ARCHIVE} into ${SNAPSHOT_DIR_NAME}"
|
| 187 |
|
| 188 |
+
if [[ "${SNAPSHOT_ARCHIVE_NAME}" == *.zip ]]; then
|
| 189 |
+
if command -v unzip >/dev/null 2>&1; then
|
| 190 |
+
unzip -q "${SNAPSHOT_ARCHIVE}" -d "${tmp_dir}"
|
| 191 |
+
else
|
| 192 |
+
python3 - "${SNAPSHOT_ARCHIVE}" "${tmp_dir}" <<'PY'
|
| 193 |
import sys
|
| 194 |
import zipfile
|
| 195 |
|
| 196 |
with zipfile.ZipFile(sys.argv[1]) as zf:
|
| 197 |
zf.extractall(sys.argv[2])
|
| 198 |
PY
|
| 199 |
+
fi
|
| 200 |
+
else
|
| 201 |
+
if command -v tar >/dev/null 2>&1; then
|
| 202 |
+
tar -xzf "${SNAPSHOT_ARCHIVE}" -C "${tmp_dir}"
|
| 203 |
+
else
|
| 204 |
+
python3 - "${SNAPSHOT_ARCHIVE}" "${tmp_dir}" <<'PY'
|
| 205 |
+
import sys
|
| 206 |
+
import tarfile
|
| 207 |
+
|
| 208 |
+
with tarfile.open(sys.argv[1], mode="r:*") as tf:
|
| 209 |
+
tf.extractall(sys.argv[2])
|
| 210 |
+
PY
|
| 211 |
+
fi
|
| 212 |
fi
|
| 213 |
|
| 214 |
mapfile -t snapshot_candidates < <(find "${tmp_dir}" -mindepth 1 -maxdepth 1 -type d -name 'ud-treebanks-v*' | sort)
|
|
|
|
| 234 |
}
|
| 235 |
|
| 236 |
if [[ "${ONLINE_MODE}" == true ]] || [[ ! -d "${SNAPSHOT_DIR}" ]]; then
|
| 237 |
+
resolve_snapshot_download
|
| 238 |
if [[ "${ONLINE_MODE}" == true ]] || [[ ! -s "${SNAPSHOT_ARCHIVE}" ]]; then
|
| 239 |
download_snapshot
|
| 240 |
else
|
|
|
|
| 245 |
echo "Snapshot directory already exists: ${SNAPSHOT_DIR_NAME}"
|
| 246 |
fi
|
| 247 |
|
| 248 |
+
if [[ "${KEEP_ARCHIVE}" != true ]] && [[ -n "${SNAPSHOT_ARCHIVE}" ]] && [[ -f "${SNAPSHOT_ARCHIVE}" ]]; then
|
| 249 |
+
echo "Removing archive ${SNAPSHOT_ARCHIVE_NAME}"
|
| 250 |
rm -f "${SNAPSHOT_ARCHIVE}"
|
| 251 |
fi
|
| 252 |
|
tools/02_generate_metadata.py
CHANGED
|
@@ -23,16 +23,19 @@ from dotenv import load_dotenv
|
|
| 23 |
TOOLS_DIR = Path(__file__).resolve().parent
|
| 24 |
|
| 25 |
load_dotenv(TOOLS_DIR / ".env")
|
| 26 |
-
UD_VER = os.getenv('UD_VER', "2.
|
| 27 |
|
| 28 |
# Parse command line arguments
|
| 29 |
parser = argparse.ArgumentParser(description=__doc__,
|
| 30 |
formatter_class=argparse.RawDescriptionHelpFormatter)
|
| 31 |
parser.add_argument('-o', '--override', action='store_true',
|
| 32 |
help='override output file if it already exists')
|
|
|
|
|
|
|
| 33 |
parser.add_argument('-v', '--verbose', action='count', default=0,
|
| 34 |
help='increase verbosity level')
|
| 35 |
args = parser.parse_args()
|
|
|
|
| 36 |
|
| 37 |
# Set up logging
|
| 38 |
logging.basicConfig(
|
|
|
|
| 23 |
TOOLS_DIR = Path(__file__).resolve().parent
|
| 24 |
|
| 25 |
load_dotenv(TOOLS_DIR / ".env")
|
| 26 |
+
UD_VER = os.getenv('UD_VER', "2.17")
|
| 27 |
|
| 28 |
# Parse command line arguments
|
| 29 |
parser = argparse.ArgumentParser(description=__doc__,
|
| 30 |
formatter_class=argparse.RawDescriptionHelpFormatter)
|
| 31 |
parser.add_argument('-o', '--override', action='store_true',
|
| 32 |
help='override output file if it already exists')
|
| 33 |
+
parser.add_argument('--ud-ver', default=UD_VER,
|
| 34 |
+
help='UD version to process (default: UD_VER from env or 2.17)')
|
| 35 |
parser.add_argument('-v', '--verbose', action='count', default=0,
|
| 36 |
help='increase verbosity level')
|
| 37 |
args = parser.parse_args()
|
| 38 |
+
UD_VER = args.ud_ver
|
| 39 |
|
| 40 |
# Set up logging
|
| 41 |
logging.basicConfig(
|
tools/03_generate_README.py
CHANGED
|
@@ -16,16 +16,19 @@ from dotenv import load_dotenv
|
|
| 16 |
TOOLS_DIR = Path(__file__).resolve().parent
|
| 17 |
|
| 18 |
load_dotenv(TOOLS_DIR / ".env")
|
| 19 |
-
UD_VER = getenv('UD_VER', "2.
|
| 20 |
|
| 21 |
# Parse command line arguments
|
| 22 |
parser = argparse.ArgumentParser(description=__doc__,
|
| 23 |
formatter_class=argparse.RawDescriptionHelpFormatter)
|
| 24 |
parser.add_argument('-o', '--override', action='store_true',
|
| 25 |
help='override output file if it already exists')
|
|
|
|
|
|
|
| 26 |
parser.add_argument('-v', '--verbose', action='count', default=0,
|
| 27 |
help='increase verbosity level')
|
| 28 |
args = parser.parse_args()
|
|
|
|
| 29 |
|
| 30 |
# Set up logging
|
| 31 |
logging.basicConfig(
|
|
|
|
| 16 |
TOOLS_DIR = Path(__file__).resolve().parent
|
| 17 |
|
| 18 |
load_dotenv(TOOLS_DIR / ".env")
|
| 19 |
+
UD_VER = getenv('UD_VER', "2.17")
|
| 20 |
|
| 21 |
# Parse command line arguments
|
| 22 |
parser = argparse.ArgumentParser(description=__doc__,
|
| 23 |
formatter_class=argparse.RawDescriptionHelpFormatter)
|
| 24 |
parser.add_argument('-o', '--override', action='store_true',
|
| 25 |
help='override output file if it already exists')
|
| 26 |
+
parser.add_argument('--ud-ver', default=UD_VER,
|
| 27 |
+
help='UD version to process (default: UD_VER from env or 2.17)')
|
| 28 |
parser.add_argument('-v', '--verbose', action='count', default=0,
|
| 29 |
help='increase verbosity level')
|
| 30 |
args = parser.parse_args()
|
| 31 |
+
UD_VER = args.ud_ver
|
| 32 |
|
| 33 |
# Set up logging
|
| 34 |
logging.basicConfig(
|
tools/04_generate_parquet.py
CHANGED
|
@@ -11,6 +11,7 @@ Usage:
|
|
| 11 |
python 04_generate_parquet.py [OPTIONS]
|
| 12 |
|
| 13 |
Options:
|
|
|
|
| 14 |
--test Only process 3 test treebanks (fr_gsd, en_ewt, it_isdt)
|
| 15 |
--treebanks NAMES Comma-separated list of treebank names to process
|
| 16 |
--blocked-treebanks FILE Path to blocked treebanks YAML file (default: tools/blocked_treebanks.yaml)
|
|
@@ -55,13 +56,16 @@ def main():
|
|
| 55 |
)
|
| 56 |
parser.add_argument("--test", action="store_true", help="Test mode: process 3 treebanks only")
|
| 57 |
parser.add_argument("--treebanks", help="Comma-separated list of treebank names")
|
|
|
|
|
|
|
| 58 |
parser.add_argument("--blocked-treebanks", help="Path to blocked treebanks YAML file")
|
| 59 |
parser.add_argument("--overwrite", action="store_true", help="Overwrite existing parquet files")
|
| 60 |
parser.add_argument("-v", "--verbose", action="store_true", default=True, help="Verbose output")
|
| 61 |
parser.add_argument("-q", "--quiet", action="store_true", help="Quiet mode")
|
| 62 |
|
| 63 |
args = parser.parse_args()
|
| 64 |
-
|
|
|
|
| 65 |
metadata_path = versioned_metadata if versioned_metadata.exists() else PATHS.metadata_file
|
| 66 |
|
| 67 |
# Use default blocked treebanks file if not specified
|
|
|
|
| 11 |
python 04_generate_parquet.py [OPTIONS]
|
| 12 |
|
| 13 |
Options:
|
| 14 |
+
--ud-ver VERSION UD version context for selecting metadata-{VERSION}.json
|
| 15 |
--test Only process 3 test treebanks (fr_gsd, en_ewt, it_isdt)
|
| 16 |
--treebanks NAMES Comma-separated list of treebank names to process
|
| 17 |
--blocked-treebanks FILE Path to blocked treebanks YAML file (default: tools/blocked_treebanks.yaml)
|
|
|
|
| 56 |
)
|
| 57 |
parser.add_argument("--test", action="store_true", help="Test mode: process 3 treebanks only")
|
| 58 |
parser.add_argument("--treebanks", help="Comma-separated list of treebank names")
|
| 59 |
+
parser.add_argument("--ud-ver", default=UD_VER,
|
| 60 |
+
help="UD version to process (default: UD_VER from env or 2.17)")
|
| 61 |
parser.add_argument("--blocked-treebanks", help="Path to blocked treebanks YAML file")
|
| 62 |
parser.add_argument("--overwrite", action="store_true", help="Overwrite existing parquet files")
|
| 63 |
parser.add_argument("-v", "--verbose", action="store_true", default=True, help="Verbose output")
|
| 64 |
parser.add_argument("-q", "--quiet", action="store_true", help="Quiet mode")
|
| 65 |
|
| 66 |
args = parser.parse_args()
|
| 67 |
+
ud_ver = args.ud_ver
|
| 68 |
+
versioned_metadata = Path(__file__).resolve().parent / f"metadata-{ud_ver}.json"
|
| 69 |
metadata_path = versioned_metadata if versioned_metadata.exists() else PATHS.metadata_file
|
| 70 |
|
| 71 |
# Use default blocked treebanks file if not specified
|
tools/05_validate_parquet.py
CHANGED
|
@@ -15,9 +15,10 @@ Usage:
|
|
| 15 |
python 05_validate_parquet.py [OPTIONS]
|
| 16 |
|
| 17 |
Options:
|
|
|
|
| 18 |
--test Only validate 3 test treebanks (fr_gsd, en_ewt, it_isdt)
|
| 19 |
--treebanks NAMES Comma-separated list of treebank names to validate
|
| 20 |
-
--revision BRANCH HuggingFace Hub revision/branch (default:
|
| 21 |
--local Validate local parquet files instead of HuggingFace Hub
|
| 22 |
--parquet-dir DIR Path to local parquet directory (implies --local)
|
| 23 |
-v, --verbose Print progress messages (default: True)
|
|
@@ -71,7 +72,9 @@ def main():
|
|
| 71 |
)
|
| 72 |
parser.add_argument("--test", action="store_true", help="Test mode: validate 3 treebanks only")
|
| 73 |
parser.add_argument("--treebanks", help="Comma-separated list of treebank names")
|
| 74 |
-
parser.add_argument("--
|
|
|
|
|
|
|
| 75 |
parser.add_argument("--local", action="store_true", help="Validate local parquet files")
|
| 76 |
parser.add_argument("--parquet-dir", help="Path to local parquet directory (implies --local)")
|
| 77 |
parser.add_argument("--metadata", help="Path to metadata file (overrides default)")
|
|
@@ -80,7 +83,9 @@ def main():
|
|
| 80 |
parser.add_argument("-q", "--quiet", action="store_true", help="Quiet mode")
|
| 81 |
|
| 82 |
args = parser.parse_args()
|
| 83 |
-
|
|
|
|
|
|
|
| 84 |
default_metadata = versioned_metadata if versioned_metadata.exists() else PATHS.metadata_file
|
| 85 |
metadata_path = args.metadata or str(default_metadata)
|
| 86 |
|
|
@@ -99,7 +104,7 @@ def main():
|
|
| 99 |
tool_args.extend(["--parquet-dir", str(PATHS.parquet_dir)])
|
| 100 |
else:
|
| 101 |
# Remote validation
|
| 102 |
-
tool_args.extend(["--revision",
|
| 103 |
append_common_selection_args(args, tool_args)
|
| 104 |
append_common_verbosity_args(args, tool_args)
|
| 105 |
return run_ud_tools(tool_args)
|
|
|
|
| 15 |
python 05_validate_parquet.py [OPTIONS]
|
| 16 |
|
| 17 |
Options:
|
| 18 |
+
--ud-ver VERSION UD version context for metadata/revision defaults (default: 2.17)
|
| 19 |
--test Only validate 3 test treebanks (fr_gsd, en_ewt, it_isdt)
|
| 20 |
--treebanks NAMES Comma-separated list of treebank names to validate
|
| 21 |
+
--revision BRANCH HuggingFace Hub revision/branch (default: --ud-ver)
|
| 22 |
--local Validate local parquet files instead of HuggingFace Hub
|
| 23 |
--parquet-dir DIR Path to local parquet directory (implies --local)
|
| 24 |
-v, --verbose Print progress messages (default: True)
|
|
|
|
| 72 |
)
|
| 73 |
parser.add_argument("--test", action="store_true", help="Test mode: validate 3 treebanks only")
|
| 74 |
parser.add_argument("--treebanks", help="Comma-separated list of treebank names")
|
| 75 |
+
parser.add_argument("--ud-ver", default=UD_VER,
|
| 76 |
+
help="UD version context for local metadata defaults (default: UD_VER from env or 2.17)")
|
| 77 |
+
parser.add_argument("--revision", help="HuggingFace Hub revision/branch (default: --ud-ver)")
|
| 78 |
parser.add_argument("--local", action="store_true", help="Validate local parquet files")
|
| 79 |
parser.add_argument("--parquet-dir", help="Path to local parquet directory (implies --local)")
|
| 80 |
parser.add_argument("--metadata", help="Path to metadata file (overrides default)")
|
|
|
|
| 83 |
parser.add_argument("-q", "--quiet", action="store_true", help="Quiet mode")
|
| 84 |
|
| 85 |
args = parser.parse_args()
|
| 86 |
+
ud_ver = args.ud_ver
|
| 87 |
+
revision = args.revision or ud_ver
|
| 88 |
+
versioned_metadata = Path(__file__).resolve().parent / f"metadata-{ud_ver}.json"
|
| 89 |
default_metadata = versioned_metadata if versioned_metadata.exists() else PATHS.metadata_file
|
| 90 |
metadata_path = args.metadata or str(default_metadata)
|
| 91 |
|
|
|
|
| 104 |
tool_args.extend(["--parquet-dir", str(PATHS.parquet_dir)])
|
| 105 |
else:
|
| 106 |
# Remote validation
|
| 107 |
+
tool_args.extend(["--revision", revision])
|
| 108 |
append_common_selection_args(args, tool_args)
|
| 109 |
append_common_verbosity_args(args, tool_args)
|
| 110 |
return run_ud_tools(tool_args)
|
tools/README.md
CHANGED
|
@@ -8,18 +8,19 @@ Quick reference for the Universal Dependencies dataset generation pipeline.
|
|
| 8 |
# Set version
|
| 9 |
export NEW_VER=2.18
|
| 10 |
cd tools
|
| 11 |
-
|
|
|
|
| 12 |
|
| 13 |
# Fetch metadata
|
| 14 |
-
uv run 00_fetch_ud_clarin-dspace_metadata.py -o
|
| 15 |
-
./00_fetch_ud_codes_and_flags.sh -o
|
| 16 |
-
./01_fetch_ud_snapshot.sh
|
| 17 |
|
| 18 |
# Generate files
|
| 19 |
-
uv run 02_generate_metadata.py -o
|
| 20 |
-
uv run 03_generate_README.py -o
|
| 21 |
-
uv run 04_generate_parquet.py
|
| 22 |
-
uv run 05_validate_parquet.py --local --test
|
| 23 |
|
| 24 |
# Sync to root
|
| 25 |
cp README-${NEW_VER} ../README.md
|
|
@@ -37,6 +38,7 @@ git add ../parquet ../README.md ../metadata.json
|
|
| 37 |
- Downloads citation and description from LINDAT/CLARIN repository
|
| 38 |
- Creates: `etc/citation-{VER}`, `etc/description-{VER}`
|
| 39 |
- Uses: `etc/ud_release_handles.tsv` for version -> handle mapping
|
|
|
|
| 40 |
|
| 41 |
**00_fetch_ud_codes_and_flags.sh**
|
| 42 |
- Downloads language codes and flags from UD docs-automation
|
|
@@ -47,10 +49,10 @@ git add ../parquet ../README.md ../metadata.json
|
|
| 47 |
### 01 - Fetch Snapshot
|
| 48 |
|
| 49 |
**01_fetch_ud_snapshot.sh**
|
| 50 |
-
- Downloads official UD release snapshot from LINDAT/CLARIN (
|
| 51 |
- Creates: `ud-treebanks-v{VER}/`
|
| 52 |
- Creates/updates symlink: `UD_repos -> ud-treebanks-v{VER}`
|
| 53 |
-
- Options: `--online`, `--keep-archive`, `--keep-backup`
|
| 54 |
|
| 55 |
### 02 - Generate Metadata
|
| 56 |
|
|
@@ -59,6 +61,7 @@ git add ../parquet ../README.md ../metadata.json
|
|
| 59 |
- Collects: summaries, licenses, splits, statistics, blocked status
|
| 60 |
- Creates: `metadata-{VER}.json`
|
| 61 |
- Reads: `blocked_treebanks.yaml` for license restrictions
|
|
|
|
| 62 |
|
| 63 |
### 03 - Generate README
|
| 64 |
|
|
@@ -66,6 +69,7 @@ git add ../parquet ../README.md ../metadata.json
|
|
| 66 |
- Renders Jinja2 template with metadata
|
| 67 |
- Creates: `README-{VER}` (HuggingFace dataset card)
|
| 68 |
- Uses: `templates/README.tmpl`, `metadata-{VER}.json`, `etc/citation-{VER}`, `etc/description-{VER}`
|
|
|
|
| 69 |
|
| 70 |
### 04 - Generate Parquet
|
| 71 |
|
|
@@ -74,7 +78,7 @@ git add ../parquet ../README.md ../metadata.json
|
|
| 74 |
- Converts CoNLL-U files to Parquet format
|
| 75 |
- Creates: `../parquet/{treebank}/{split}.parquet`
|
| 76 |
- Uses `tools/metadata-{UD_VER}.json` when present; otherwise falls back to `../metadata.json`
|
| 77 |
-
- Options: `--test`, `--overwrite`, `--blocked-treebanks`
|
| 78 |
|
| 79 |
### 05 - Validate Parquet
|
| 80 |
|
|
@@ -82,7 +86,7 @@ git add ../parquet ../README.md ../metadata.json
|
|
| 82 |
- Wrapper script calling `ud-hf-parquet-tools` library
|
| 83 |
- Validates Parquet files against CoNLL-U source
|
| 84 |
- Uses `tools/metadata-{UD_VER}.json` when present; otherwise falls back to `../metadata.json`
|
| 85 |
-
- Options: `--local`, `--parquet-dir`, `--revision`, `--test`, `-vv`
|
| 86 |
|
| 87 |
## Directory Structure
|
| 88 |
|
|
@@ -111,10 +115,11 @@ tools/
|
|
| 111 |
|
| 112 |
## Configuration
|
| 113 |
|
| 114 |
-
**Environment Variables (.env)**
|
| 115 |
```bash
|
| 116 |
UD_VER=2.17 # Current UD version
|
| 117 |
```
|
|
|
|
| 118 |
|
| 119 |
**Blocked Treebanks (blocked_treebanks.yaml)**
|
| 120 |
```yaml
|
|
@@ -139,15 +144,15 @@ pip install ud-hf-parquet-tools pyyaml python-dotenv jinja2
|
|
| 139 |
|
| 140 |
**Test on subset:**
|
| 141 |
```bash
|
| 142 |
-
uv run ./04_generate_parquet.py --
|
| 143 |
-
uv run ./05_validate_parquet.py --
|
| 144 |
```
|
| 145 |
|
| 146 |
**Force regeneration:**
|
| 147 |
```bash
|
| 148 |
-
./02_generate_metadata.py -
|
| 149 |
-
./03_generate_README.py -o
|
| 150 |
-
uv run ./04_generate_parquet.py --overwrite
|
| 151 |
```
|
| 152 |
|
| 153 |
**Skip blocked treebanks:**
|
|
|
|
| 8 |
# Set version
|
| 9 |
export NEW_VER=2.18
|
| 10 |
cd tools
|
| 11 |
+
# Optional convenience (all scripts also support explicit version flags)
|
| 12 |
+
# echo "UD_VER=${NEW_VER}" > .env
|
| 13 |
|
| 14 |
# Fetch metadata
|
| 15 |
+
uv run 00_fetch_ud_clarin-dspace_metadata.py -o -r "${NEW_VER}"
|
| 16 |
+
./00_fetch_ud_codes_and_flags.sh -o -r "${NEW_VER}"
|
| 17 |
+
./01_fetch_ud_snapshot.sh -r "${NEW_VER}"
|
| 18 |
|
| 19 |
# Generate files
|
| 20 |
+
uv run 02_generate_metadata.py -o --ud-ver "${NEW_VER}"
|
| 21 |
+
uv run 03_generate_README.py -o --ud-ver "${NEW_VER}"
|
| 22 |
+
uv run 04_generate_parquet.py --ud-ver "${NEW_VER}"
|
| 23 |
+
uv run 05_validate_parquet.py --ud-ver "${NEW_VER}" --local --test
|
| 24 |
|
| 25 |
# Sync to root
|
| 26 |
cp README-${NEW_VER} ../README.md
|
|
|
|
| 38 |
- Downloads citation and description from LINDAT/CLARIN repository
|
| 39 |
- Creates: `etc/citation-{VER}`, `etc/description-{VER}`
|
| 40 |
- Uses: `etc/ud_release_handles.tsv` for version -> handle mapping
|
| 41 |
+
- Optional filter: `--rev {VER}` to fetch one version
|
| 42 |
|
| 43 |
**00_fetch_ud_codes_and_flags.sh**
|
| 44 |
- Downloads language codes and flags from UD docs-automation
|
|
|
|
| 49 |
### 01 - Fetch Snapshot
|
| 50 |
|
| 51 |
**01_fetch_ud_snapshot.sh**
|
| 52 |
+
- Downloads official UD release snapshot from LINDAT/CLARIN (archive resolved via API)
|
| 53 |
- Creates: `ud-treebanks-v{VER}/`
|
| 54 |
- Creates/updates symlink: `UD_repos -> ud-treebanks-v{VER}`
|
| 55 |
+
- Options: `--rev`, `--online`, `--keep-archive`, `--keep-backup`
|
| 56 |
|
| 57 |
### 02 - Generate Metadata
|
| 58 |
|
|
|
|
| 61 |
- Collects: summaries, licenses, splits, statistics, blocked status
|
| 62 |
- Creates: `metadata-{VER}.json`
|
| 63 |
- Reads: `blocked_treebanks.yaml` for license restrictions
|
| 64 |
+
- Options: `--ud-ver`, `--override`
|
| 65 |
|
| 66 |
### 03 - Generate README
|
| 67 |
|
|
|
|
| 69 |
- Renders Jinja2 template with metadata
|
| 70 |
- Creates: `README-{VER}` (HuggingFace dataset card)
|
| 71 |
- Uses: `templates/README.tmpl`, `metadata-{VER}.json`, `etc/citation-{VER}`, `etc/description-{VER}`
|
| 72 |
+
- Options: `--ud-ver`, `--override`
|
| 73 |
|
| 74 |
### 04 - Generate Parquet
|
| 75 |
|
|
|
|
| 78 |
- Converts CoNLL-U files to Parquet format
|
| 79 |
- Creates: `../parquet/{treebank}/{split}.parquet`
|
| 80 |
- Uses `tools/metadata-{UD_VER}.json` when present; otherwise falls back to `../metadata.json`
|
| 81 |
+
- Options: `--ud-ver`, `--test`, `--overwrite`, `--blocked-treebanks`
|
| 82 |
|
| 83 |
### 05 - Validate Parquet
|
| 84 |
|
|
|
|
| 86 |
- Wrapper script calling `ud-hf-parquet-tools` library
|
| 87 |
- Validates Parquet files against CoNLL-U source
|
| 88 |
- Uses `tools/metadata-{UD_VER}.json` when present; otherwise falls back to `../metadata.json`
|
| 89 |
+
- Options: `--ud-ver`, `--local`, `--parquet-dir`, `--revision`, `--test`, `-vv`
|
| 90 |
|
| 91 |
## Directory Structure
|
| 92 |
|
|
|
|
| 115 |
|
| 116 |
## Configuration
|
| 117 |
|
| 118 |
+
**Environment Variables (.env, optional)**
|
| 119 |
```bash
|
| 120 |
UD_VER=2.17 # Current UD version
|
| 121 |
```
|
| 122 |
+
You can skip `.env` and pass `--ud-ver`/`--rev` flags directly.
|
| 123 |
|
| 124 |
**Blocked Treebanks (blocked_treebanks.yaml)**
|
| 125 |
```yaml
|
|
|
|
| 144 |
|
| 145 |
**Test on subset:**
|
| 146 |
```bash
|
| 147 |
+
uv run ./04_generate_parquet.py --ud-ver 2.17 --test
|
| 148 |
+
uv run ./05_validate_parquet.py --ud-ver 2.17 --test --local
|
| 149 |
```
|
| 150 |
|
| 151 |
**Force regeneration:**
|
| 152 |
```bash
|
| 153 |
+
./02_generate_metadata.py --ud-ver 2.17 -o
|
| 154 |
+
./03_generate_README.py --ud-ver 2.17 -o
|
| 155 |
+
uv run ./04_generate_parquet.py --ud-ver 2.17 --overwrite
|
| 156 |
```
|
| 157 |
|
| 158 |
**Skip blocked treebanks:**
|
tools/metadata-2.17.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|