aligned-lex / README.md
larsgson's picture
aligned_lex arb: 63059 rows (fb9611c1721f)
0ecf15a verified
|
Raw
History Blame Contribute Delete
6.98 kB
---
pretty_name: Strong's-aligned lexicons (surface Strong's)
language:
- ind
tags:
- bible
- word-alignment
- strongs
- lexicon
- interlinear
task_categories:
- translation
- token-classification
license: cc0-1.0
configs:
- config_name: default
data_files:
- split: train
path: iso=*/data.parquet
---
# aligned_lex — published surface → Strong's lexicons
The attested target-word → Strong's mapping mined by the aligner, one language per partition, for
consumption by **bcv-commons** (and downstream, the `bcv-query` monorepo as external `resources/`).
> **Card metadata note:** the `language:` list above enumerates the published partitions (currently
> just `ind`); the authoritative list is always `manifest.json`. As languages are added this header
> should track it — a small `export_lex` follow-up can regenerate the front matter from the manifest
> so it never drifts.
## Layout — why the data isn't in git
Per-language lexicons are **regenerated** whenever the method/model/spine/source improves. Committing
them would bloat git history without bound at scale (thousands of languages × re-runs). So:
```
aligned_lex/
README.md # committed — this file
manifest.json # committed — per-language metadata + content hash (the durable record)
iso=<iso>/ # GIT-IGNORED — the bulk data, published out-of-band
data.parquet
```
The **Parquet partitions are published to a data channel** (a Hugging Face dataset or object
storage), keyed by the manifest's `content_sha256`. `manifest.json` is git's small, diffable record
of what exists and what it hashes to — it changes only when the data actually changes.
## Schema (per row)
| column | type | meaning |
|---|---|---|
| `surface` | string | target rendering, lowercased (content tokens; may be multi-word) |
| `lexeme` | string | **the anchor** — lexical id (MACULA lang+augmented-Strong's; `<Strong's>\|<lemma>` until the lexeme spine lands) |
| `strong` | string | Strong's number (`H####` OT / `G####` NT) — the **rollup** of `lexeme` (many lexemes → one Strong's) |
| `count` | int32 | times this (surface → lexeme) pair was aligned |
| `share` | float32 | `count / Σ count for that surface` = **P(lexeme \| surface)***which sense* |
| `hi_conf` | float32 | fraction of this pair's alignments that were intersection-backed (both eflomal directions agreed, score ≥ 0.9) — **how much to trust the alignment** |
`iso` is recovered from the Hive partition path (`iso=<iso>/`), so a dataset read yields it as a
column for free. Two orthogonal confidence axes: `share` = which Strong's; `hi_conf` = alignment
reliability. Rows are grouped by `surface`, strongest sense first. A consumer picks the argmax-`share`
Strong's and can threshold on `hi_conf`/`count` to trade coverage for precision.
## Authentication (one-time)
The push reads a **cached** Hugging Face login, so you authenticate once and every future `--publish`
(any language, any change) reuses it — no token to pass each run:
```bash
python3 -c "from huggingface_hub import login; login()" # prompts once → ~/.cache/huggingface/token
python3 -c "from huggingface_hub import HfApi; print(HfApi().whoami()['name'])" # verify
```
Use a **fine-grained token** (huggingface.co/settings/tokens) scoped to *write* on just the target
dataset/org — same convenience, minimal blast radius. Prefer this to `export HF_TOKEN=…` in your
shell profile: same persistence, but the token isn't injected into every process's environment.
Re-run `login()` only if you rotate/revoke the token.
## Regenerate / add a language
```bash
# 1. align (produces out/align_eflomal_<iso>_*.jsonl)
python3 -m strongs_aligner.run_pilot --method eflomal --ot --usj-dir <usj> --iso <iso>
# 2. export → aligned_lex/iso=<iso>/data.parquet + update manifest.json (needs the [publish] extra)
python3 -m strongs_aligner.export_lex --iso <iso> --method eflomal --lang-name <Name>
# 3. publish the partition + manifest + this card to a HF dataset (auth: see above)
python3 -m strongs_aligner.export_lex --iso <iso> --publish bcv-commons/aligned-lex --create
# (append --dry-run to preview the upload without pushing)
```
`pip install -e '.[publish]'` for the Parquet writer + HF uploader (`pyarrow`, `huggingface_hub`). Use
`--format tsv` for a plain-text partition instead. Publishing thousands of languages: keep each folder
< 10k files and squash history on the data channel (see the Hugging Face storage limits). The push
uploads only *this* language's partition plus the shared `manifest.json`/`README.md` — other languages
are untouched.
## Provenance & quality
Per-language provenance (method, min_count, testament, row/surface/Strong's counts, `hi_conf_ge_0.9`,
spine tags, content hash) lives in `manifest.json`. **Quality basis:** promoted after the gold
benchmark passed — eflomal scores **91.8% (fra) / 95.6% (hau)** token-weighted top-1 vs Clear-Bible
manual alignments (`docs/benchmark.md`). `ind` has no manual gold; it inherits trust from the method's
cross-language validation. These are **raw aligned counts**, not hand-checked — use `share`/`hi_conf`
to threshold.
## Reproducibility (content-addressed)
The statistical aligner (eflomal) seeds from `/dev/urandom`, so it is **non-deterministic by design**
regenerating a language varies ~1% run-to-run. We therefore treat this as a **content-addressed
release**, not a reproduce-from-scratch guarantee:
- the **inputs are pinned** — original spine (`uhb`/`ugnt` tags) + each source text's `sha256` (`data/pins/`);
- each published partition is fixed by its **`content_sha256`** in `manifest.json` — that hash *is* the
identity of what was released. A re-run produces a new, equally-valid partition with a new hash.
Consume a specific release by its `content_sha256`; don't expect a rebuild to match it byte-for-byte.
## License
**This catalogue is CC0-1.0** (public-domain dedication). It is *derived, factual* data — Strong's
numbers, alignment counts, `share`/`hi_conf` statistics, and a de-arranged, type-level list of word
forms. It does **not** reproduce the running text of any translation (no verse refs, no word order),
so the copyrightable expression of the sources is not present here.
Each `surface` is nonetheless an individual word form drawn from a **source translation**, and those
translations keep their **own** licenses. We do not restate those terms — that information stays with
the source. Instead every language's `manifest.json` entry carries a `source` **pointer**:
```json
"source": { "provider": "…", "edition": "…", "license_url": "https://…" }
```
Follow `license_url` for the authoritative, current licensing of that translation (maintained by
`data/sources.json`). Note that pointing to a source does not by itself grant permission to derive
from it — for any source whose terms restrict derivatives, obtain that separately.