Datasets:
Tasks:
Text Classification
Formats:
parquet
Languages:
Ancient Greek (to 1453)
Size:
100K - 1M
License:
Add Sphregis 0.1 beta dataset
Browse files- .gitignore +2 -0
- CHANGELOG.md +12 -0
- LICENSES.md +29 -0
- README.md +178 -0
- SOURCES.md +42 -0
- data/prose/test-00000-of-00001.parquet +3 -0
- data/prose/train-00000-of-00001.parquet +3 -0
- data/prose/validation-00000-of-00001.parquet +3 -0
- data/verse_metre/test-00000-of-00001.parquet +3 -0
- data/verse_metre/train-00000-of-00001.parquet +3 -0
- data/verse_metre/validation-00000-of-00001.parquet +3 -0
- data/verse_sentence/test-00000-of-00001.parquet +3 -0
- data/verse_sentence/train-00000-of-00001.parquet +3 -0
- data/verse_sentence/validation-00000-of-00001.parquet +3 -0
- metadata/build_report.json +465 -0
- metadata/source_revisions.json +66 -0
- requirements-build.txt +1 -0
- scripts/build_dataset.py +1016 -0
- scripts/validate_dataset.py +148 -0
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
*.py[cod]
|
CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Changelog
|
| 2 |
+
|
| 3 |
+
## 0.1.0-beta — 2026-08-17
|
| 4 |
+
|
| 5 |
+
- Added fixed `prose`, `verse_sentence`, and `verse_metre` configurations.
|
| 6 |
+
- Added sentence-level CoNLL-U conversion for licensed native XML treebanks.
|
| 7 |
+
- Added exact normalized prose deduplication with merged provenance.
|
| 8 |
+
- Added exact full-line alignment between human syntax and updated Hypotactic
|
| 9 |
+
metrical HTML.
|
| 10 |
+
- Added deterministic 80/10/10 train/validation/test splits stratified by
|
| 11 |
+
author and work; paired verse rows always share their parent's split.
|
| 12 |
+
- Added per-row source revisions, licenses and annotation provenance.
|
LICENSES.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Upstream licenses
|
| 2 |
+
|
| 3 |
+
Sphregis is an aggregation of independently licensed annotations. The license
|
| 4 |
+
for every contributing record is stored in `source_records`, and the distinct
|
| 5 |
+
licenses governing a row are repeated in `licenses`.
|
| 6 |
+
|
| 7 |
+
| Source | Annotation/data license used by this beta |
|
| 8 |
+
|---|---|
|
| 9 |
+
| Ancient Greek Dependency Treebank 2.1 | CC BY-SA 3.0 US |
|
| 10 |
+
| UD Ancient Greek–Perseus | CC BY-NC-SA 2.5 |
|
| 11 |
+
| UD Ancient Greek–PROIEL | CC BY-NC-SA 3.0 |
|
| 12 |
+
| UD Ancient Greek–PTNK | CC BY-SA 4.0 |
|
| 13 |
+
| Gorman Greek Dependency Trees | CC BY-NC-SA 4.0, conservatively interpreted |
|
| 14 |
+
| Pedalion Trees | CC BY-SA 4.0 |
|
| 15 |
+
| Harrington Trees | CC BY-SA 4.0 |
|
| 16 |
+
| Hypotactic metrical annotation | CC BY 4.0 |
|
| 17 |
+
|
| 18 |
+
The Gorman repository is internally inconsistent: its README says
|
| 19 |
+
CC BY-NC-SA 4.0, while its bundled license text says CC BY-SA 4.0. Sphregis
|
| 20 |
+
uses the more restrictive interpretation pending clarification.
|
| 21 |
+
|
| 22 |
+
Aphthonius' *Progymnasmata* is not redistributed because its upstream
|
| 23 |
+
repository specifies no license. Pedalion's mixed-author example collections
|
| 24 |
+
and papyri are also omitted because they cannot be assigned reliable author
|
| 25 |
+
labels at sentence level.
|
| 26 |
+
|
| 27 |
+
This repository's build scripts and original documentation are released under
|
| 28 |
+
CC BY 4.0. That does not replace or relax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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: Sphregis
|
| 3 |
+
language:
|
| 4 |
+
- grc
|
| 5 |
+
license: other
|
| 6 |
+
task_categories:
|
| 7 |
+
- text-classification
|
| 8 |
+
tags:
|
| 9 |
+
- authorship-attribution
|
| 10 |
+
- ancient-greek
|
| 11 |
+
- conllu
|
| 12 |
+
- dependency-parsing
|
| 13 |
+
- metre
|
| 14 |
+
- scansion
|
| 15 |
+
configs:
|
| 16 |
+
- config_name: prose
|
| 17 |
+
data_files:
|
| 18 |
+
- split: train
|
| 19 |
+
path: data/prose/train-*
|
| 20 |
+
- split: validation
|
| 21 |
+
path: data/prose/validation-*
|
| 22 |
+
- split: test
|
| 23 |
+
path: data/prose/test-*
|
| 24 |
+
- config_name: verse_sentence
|
| 25 |
+
data_files:
|
| 26 |
+
- split: train
|
| 27 |
+
path: data/verse_sentence/train-*
|
| 28 |
+
- split: validation
|
| 29 |
+
path: data/verse_sentence/validation-*
|
| 30 |
+
- split: test
|
| 31 |
+
path: data/verse_sentence/test-*
|
| 32 |
+
- config_name: verse_metre
|
| 33 |
+
data_files:
|
| 34 |
+
- split: train
|
| 35 |
+
path: data/verse_metre/train-*
|
| 36 |
+
- split: validation
|
| 37 |
+
path: data/verse_metre/validation-*
|
| 38 |
+
- split: test
|
| 39 |
+
path: data/verse_metre/test-*
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
# Sphregis
|
| 43 |
+
|
| 44 |
+
Sphregis is a provenance-preserving benchmark for Ancient Greek authorship
|
| 45 |
+
attribution. Beta 0.1 combines licensed, human-annotated dependency treebanks
|
| 46 |
+
and the metrically annotated [Hypotactic](https://github.com/Urdatorn/hypotactic)
|
| 47 |
+
corpus. It supplies fixed train, validation and test splits.
|
| 48 |
+
|
| 49 |
+
This is a beta release intended to make the data inspectable before final
|
| 50 |
+
author/work selection and benchmark protocol design.
|
| 51 |
+
|
| 52 |
+
## Configurations
|
| 53 |
+
|
| 54 |
+
| Configuration | Unit | Train | Validation | Test | Total |
|
| 55 |
+
|---|---|---:|---:|---:|---:|
|
| 56 |
+
| `prose` | One deduplicated treebank sentence | 45,573 | 5,696 | 5,696 | 56,965 |
|
| 57 |
+
| `verse_sentence` | One treebank sentence containing at least one complete scanned line | 11,995 | 1,500 | 1,500 | 14,995 |
|
| 58 |
+
| `verse_metre` | One complete scanned line contained in a single treebank sentence | 22,264 | 2,841 | 2,752 | 27,857 |
|
| 59 |
+
|
| 60 |
+
The verse configurations are paired: every `verse_metre` row contains a
|
| 61 |
+
`parent_sentence_id`, and parent and child always occur in the same split.
|
| 62 |
+
|
| 63 |
+
```python
|
| 64 |
+
from datasets import load_dataset
|
| 65 |
+
|
| 66 |
+
prose = load_dataset("Urdatorn/sphregis", "prose")
|
| 67 |
+
verse_syntax = load_dataset("Urdatorn/sphregis", "verse_sentence")
|
| 68 |
+
verse_metre = load_dataset("Urdatorn/sphregis", "verse_metre")
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## Inclusion rule for verse
|
| 72 |
+
|
| 73 |
+
A verse line is included only if:
|
| 74 |
+
|
| 75 |
+
1. the current Hypotactic HTML provides its complete text and metrical scan;
|
| 76 |
+
2. its complete normalized text occurs within one human-annotated treebank
|
| 77 |
+
sentence; and
|
| 78 |
+
3. that sentence has been converted to CoNLL-U without discarding the native
|
| 79 |
+
dependency tree.
|
| 80 |
+
|
| 81 |
+
Alignment first consults CTS and line references, then verifies full textual
|
| 82 |
+
containment. When editions disagree about line numbering, an exact containment
|
| 83 |
+
search over the work is used. Fuzzy matches and lines divided between two
|
| 84 |
+
treebank sentences are excluded.
|
| 85 |
+
|
| 86 |
+
The resulting verse material covers the *Iliad*, *Odyssey*, *Hymn to Demeter*,
|
| 87 |
+
the three Hesiodic works, Aeschylus' *Persians*, *Prometheus Bound* and *Seven
|
| 88 |
+
Against Thebes*, the *Batrachomyomachia*, Semonides, and Theocritus fragments.
|
| 89 |
+
|
| 90 |
+
## Splits
|
| 91 |
+
|
| 92 |
+
Splits are deterministic and stratified within each author/work group:
|
| 93 |
+
approximately 80% train, 10% validation and 10% test. Groups with 3–9 rows
|
| 94 |
+
receive one validation and one test row; groups with fewer than three rows stay
|
| 95 |
+
in training. This beta deliberately provides sentence-level splits as
|
| 96 |
+
requested. A stricter work-held-out evaluation can be added as a later
|
| 97 |
+
benchmark track.
|
| 98 |
+
|
| 99 |
+
## Principal columns
|
| 100 |
+
|
| 101 |
+
All configurations contain:
|
| 102 |
+
|
| 103 |
+
- `id`, `author`, `work`, `work_id`, `genre`, `text`;
|
| 104 |
+
- `conllu`, `cts_urn`, `passage`, `treebank_source`;
|
| 105 |
+
- `source_records`: JSON containing every contributing upstream record,
|
| 106 |
+
revision, URL, license, annotation provenance and syntax scheme;
|
| 107 |
+
- `licenses`, `dedup_key`, and `split`.
|
| 108 |
+
|
| 109 |
+
`verse_sentence` additionally contains a JSON list of complete
|
| 110 |
+
`metrical_lines`. `verse_metre` contains `parent_sentence_id`, `book`,
|
| 111 |
+
`line_number`, raw Hypotactic `metre`, `scansion`, syllable-level annotations,
|
| 112 |
+
and the originating Hypotactic filename.
|
| 113 |
+
|
| 114 |
+
`genre` has exactly three values in this release: `prose`, `verse_sentence`,
|
| 115 |
+
and `verse_metre`.
|
| 116 |
+
|
| 117 |
+
## Dependency representation
|
| 118 |
+
|
| 119 |
+
Existing UD data is retained verbatim. Native AGDT/Arethusa trees are
|
| 120 |
+
serialized as CoNLL-U while preserving heads and native relations. A
|
| 121 |
+
best-effort UPOS and feature conversion is included, but native relations are
|
| 122 |
+
not misrepresented as manually annotated UD relations: they appear as valid
|
| 123 |
+
`dep:<native>` subtypes. `NativeRel` and `NativeHead` in MISC preserve the
|
| 124 |
+
source values. Repairs required after removing artificial ellipsis nodes—or to
|
| 125 |
+
break an upstream beta self-loop/cycle—are explicitly marked `HeadRepair=Yes`.
|
| 126 |
+
|
| 127 |
+
## Deduplication
|
| 128 |
+
|
| 129 |
+
Prose input comprised 72,336 sentences. Exact normalization-based
|
| 130 |
+
deduplication removed 14,203 repeated rows. A further 1,168 rows in 289 exact
|
| 131 |
+
text groups were omitted because their author labels conflict, leaving 56,965
|
| 132 |
+
rows. Normalization lowercases, maps final sigma, removes diacritics and
|
| 133 |
+
retains letters only. The chosen parse follows a deterministic source
|
| 134 |
+
priority, while all exact-source provenance is merged into `source_records`.
|
| 135 |
+
|
| 136 |
+
This is aggressive exact deduplication, not passage-level fuzzy
|
| 137 |
+
deduplication. Segmentation or edition differences can therefore leave near
|
| 138 |
+
duplicates for future review.
|
| 139 |
+
|
| 140 |
+
## Sources and licensing
|
| 141 |
+
|
| 142 |
+
The corpus draws on [AGDT 2.1](https://github.com/PerseusDL/treebank_data),
|
| 143 |
+
[UD Perseus](https://github.com/UniversalDependencies/UD_Ancient_Greek-Perseus),
|
| 144 |
+
[UD PROIEL](https://github.com/UniversalDependencies/UD_Ancient_Greek-PROIEL),
|
| 145 |
+
[UD PTNK](https://github.com/UniversalDependencies/UD_Ancient_Greek-PTNK),
|
| 146 |
+
[Gorman's Greek Dependency Trees](https://github.com/vgorman1/Greek-Dependency-Trees),
|
| 147 |
+
[Pedalion](https://github.com/perseids-publications/pedalion-trees),
|
| 148 |
+
[Harrington Trees](https://github.com/perseids-publications/harrington-trees),
|
| 149 |
+
and [Hypotactic](https://github.com/Urdatorn/hypotactic).
|
| 150 |
+
|
| 151 |
+
This is a mixed-license dataset, including NonCommercial and ShareAlike data.
|
| 152 |
+
Consult [LICENSES.md](LICENSES.md) and the licenses recorded on every row.
|
| 153 |
+
Source commits for this release are frozen in
|
| 154 |
+
[`metadata/source_revisions.json`](metadata/source_revisions.json).
|
| 155 |
+
|
| 156 |
+
Aphthonius is not redistributed because its repository does not specify a
|
| 157 |
+
license. Mixed-author Pedalion example collections and papyri are omitted
|
| 158 |
+
because they cannot be given reliable author labels at sentence level. A Latin
|
| 159 |
+
Cicero file incorrectly stored under Harrington's `grctb` path is also omitted.
|
| 160 |
+
|
| 161 |
+
## Authorship caveat
|
| 162 |
+
|
| 163 |
+
`author` records conventional or received attribution, not a universal claim
|
| 164 |
+
about historical authorship. Labels such as Homer, Pseudo-Homer, anonymous
|
| 165 |
+
Septuagint material and traditionally attributed New Testament books require
|
| 166 |
+
appropriate philological interpretation.
|
| 167 |
+
|
| 168 |
+
## Reproduction
|
| 169 |
+
|
| 170 |
+
```bash
|
| 171 |
+
python -m pip install -r requirements-build.txt
|
| 172 |
+
python scripts/build_dataset.py --sources /path/to/frozen/checkouts
|
| 173 |
+
python scripts/validate_dataset.py --data data
|
| 174 |
+
```
|
| 175 |
+
|
| 176 |
+
See [SOURCES.md](SOURCES.md) for conversion and alignment details and
|
| 177 |
+
[`metadata/build_report.json`](metadata/build_report.json) for machine-readable
|
| 178 |
+
counts, exclusions, alignment yields and validation results.
|
SOURCES.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Sources and provenance
|
| 2 |
+
|
| 3 |
+
Exact source revisions used for the published files are recorded in
|
| 4 |
+
`metadata/source_revisions.json`. Each row also contains a JSON-encoded
|
| 5 |
+
`source_records` field with source project, file, sentence/line identifier,
|
| 6 |
+
revision, URL, annotation provenance, syntax scheme and license.
|
| 7 |
+
|
| 8 |
+
The beta integrates:
|
| 9 |
+
|
| 10 |
+
- Ancient Greek Dependency Treebank 2.1;
|
| 11 |
+
- UD Ancient Greek–Perseus r2.17;
|
| 12 |
+
- UD Ancient Greek–PROIEL r2.17;
|
| 13 |
+
- UD Ancient Greek–PTNK r2.17;
|
| 14 |
+
- Gorman's Greek Dependency Trees;
|
| 15 |
+
- Pedalion Trees;
|
| 16 |
+
- Harrington Trees;
|
| 17 |
+
- the current Hypotactic Greek metrical HTML corpus.
|
| 18 |
+
|
| 19 |
+
Non-UD dependency trees are serialized as valid CoNLL-U without claiming that
|
| 20 |
+
their relations have been manually reannotated as Universal Dependencies.
|
| 21 |
+
Heads are preserved, a best-effort UPOS/features conversion is supplied,
|
| 22 |
+
native relations are represented as `dep:<native-relation>`, and the original
|
| 23 |
+
relation and head are retained as `NativeRel` and `NativeHead` in MISC. Empty
|
| 24 |
+
and artificial ellipsis nodes are omitted. If this would leave no surface root,
|
| 25 |
+
or if an upstream beta tree contains a self-loop/cycle, the smallest necessary
|
| 26 |
+
repair is marked `HeadRepair=Yes`.
|
| 27 |
+
|
| 28 |
+
Exact prose duplicates are identified by lowercasing, converting final sigma,
|
| 29 |
+
removing diacritics, and retaining letters only. One syntactic representation
|
| 30 |
+
is retained according to the documented source priority, while provenance for
|
| 31 |
+
all exact duplicates is merged into `source_records`.
|
| 32 |
+
|
| 33 |
+
If the same normalized sentence occurs under more than one author label, all
|
| 34 |
+
instances are omitted rather than assigning the text arbitrarily. Counts and
|
| 35 |
+
examples of these conflicts are recorded in `metadata/build_report.json`.
|
| 36 |
+
|
| 37 |
+
Verse alignment is intentionally conservative. A scanned line is admitted
|
| 38 |
+
only when its complete normalized text is contained in a single human-
|
| 39 |
+
annotated treebank sentence. CTS/line references narrow candidate lines when
|
| 40 |
+
they agree; exact full-line containment is still required. If two editions use
|
| 41 |
+
different line numbering, the aligner falls back to exact containment over the
|
| 42 |
+
work. There are no fuzzy alignments in beta 0.1.
|
data/prose/test-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d8c7e62c136529b94d3be16d7ecfdadd9ffbfa7e59b73bb95561ee6d36851a02
|
| 3 |
+
size 2704492
|
data/prose/train-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:89056e3b52ba69f587d36ca6eaf13700903d88b81f140d5e3ef72c64b9f07a4c
|
| 3 |
+
size 21016593
|
data/prose/validation-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5ee29667af8f692ff3edeb6dba605321b84143bd23322eaa373f202e8ecf23cb
|
| 3 |
+
size 2716790
|
data/verse_metre/test-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e0f9b93a8007e828aa561a86e3454c9f9f186c75e6aeb5150cf649ce13651d63
|
| 3 |
+
size 860145
|
data/verse_metre/train-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4b38b4ff763789184cf09656afa404c41145de310bfb8cf435acf4eae6c71e8e
|
| 3 |
+
size 6332010
|
data/verse_metre/validation-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7b5fc4e1d88d1596457c5620847f689703e9a462e98c31715a02a3be1968f3c1
|
| 3 |
+
size 878469
|
data/verse_sentence/test-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:81cad0c179f836d283955d85e3ca055846bfad65ed9d584b140e521e0d14334b
|
| 3 |
+
size 853071
|
data/verse_sentence/train-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2fe8bb3d4d73c28027623655a85ba337334bc557e72f0f45f8f9889c0150f6e9
|
| 3 |
+
size 6208052
|
data/verse_sentence/validation-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:26cd6f38c821e3ddc6c9a5c9da6699f3930b3aeaf3872ae8235dc127eac4329f
|
| 3 |
+
size 872785
|
metadata/build_report.json
ADDED
|
@@ -0,0 +1,465 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alignment": {
|
| 3 |
+
"pedalion:batracho.xml": {
|
| 4 |
+
"matched_lines": 102,
|
| 5 |
+
"matched_sentences": 67,
|
| 6 |
+
"sentences": 166
|
| 7 |
+
},
|
| 8 |
+
"pedalion:semonides.xml": {
|
| 9 |
+
"matched_lines": 69,
|
| 10 |
+
"matched_sentences": 39,
|
| 11 |
+
"sentences": 58
|
| 12 |
+
},
|
| 13 |
+
"pedalion:theoc.xml": {
|
| 14 |
+
"matched_lines": 17,
|
| 15 |
+
"matched_sentences": 11,
|
| 16 |
+
"sentences": 18
|
| 17 |
+
},
|
| 18 |
+
"tlg0012.tlg001": {
|
| 19 |
+
"matched_lines": 13547,
|
| 20 |
+
"matched_sentences": 7138,
|
| 21 |
+
"sentences": 8415
|
| 22 |
+
},
|
| 23 |
+
"tlg0012.tlg002": {
|
| 24 |
+
"matched_lines": 10454,
|
| 25 |
+
"matched_sentences": 5657,
|
| 26 |
+
"sentences": 6721
|
| 27 |
+
},
|
| 28 |
+
"tlg0013.tlg002": {
|
| 29 |
+
"matched_lines": 418,
|
| 30 |
+
"matched_sentences": 192,
|
| 31 |
+
"sentences": 255
|
| 32 |
+
},
|
| 33 |
+
"tlg0020.tlg001": {
|
| 34 |
+
"matched_lines": 688,
|
| 35 |
+
"matched_sentences": 336,
|
| 36 |
+
"sentences": 437
|
| 37 |
+
},
|
| 38 |
+
"tlg0020.tlg002": {
|
| 39 |
+
"matched_lines": 607,
|
| 40 |
+
"matched_sentences": 357,
|
| 41 |
+
"sentences": 490
|
| 42 |
+
},
|
| 43 |
+
"tlg0020.tlg003": {
|
| 44 |
+
"matched_lines": 261,
|
| 45 |
+
"matched_sentences": 163,
|
| 46 |
+
"sentences": 255
|
| 47 |
+
},
|
| 48 |
+
"tlg0085.tlg002": {
|
| 49 |
+
"matched_lines": 602,
|
| 50 |
+
"matched_sentences": 330,
|
| 51 |
+
"sentences": 480
|
| 52 |
+
},
|
| 53 |
+
"tlg0085.tlg003": {
|
| 54 |
+
"matched_lines": 575,
|
| 55 |
+
"matched_sentences": 373,
|
| 56 |
+
"sentences": 590
|
| 57 |
+
},
|
| 58 |
+
"tlg0085.tlg004": {
|
| 59 |
+
"matched_lines": 572,
|
| 60 |
+
"matched_sentences": 332,
|
| 61 |
+
"sentences": 515
|
| 62 |
+
}
|
| 63 |
+
},
|
| 64 |
+
"data_files": {
|
| 65 |
+
"prose": {
|
| 66 |
+
"test": 5696,
|
| 67 |
+
"train": 45573,
|
| 68 |
+
"validation": 5696
|
| 69 |
+
},
|
| 70 |
+
"verse_metre": {
|
| 71 |
+
"test": 2752,
|
| 72 |
+
"train": 22264,
|
| 73 |
+
"validation": 2841
|
| 74 |
+
},
|
| 75 |
+
"verse_sentence": {
|
| 76 |
+
"test": 1500,
|
| 77 |
+
"train": 11995,
|
| 78 |
+
"validation": 1500
|
| 79 |
+
}
|
| 80 |
+
},
|
| 81 |
+
"deduplication": {
|
| 82 |
+
"conflict_examples": [
|
| 83 |
+
{
|
| 84 |
+
"authors": [
|
| 85 |
+
"Dionysius of Halicarnassus",
|
| 86 |
+
"Plutarch"
|
| 87 |
+
],
|
| 88 |
+
"dedup_key": "ef2f6aaa4ea144c2cb1cbd159c1ce28db11a070c2cf4974eb5e0b59af8b4e5a4",
|
| 89 |
+
"normalized_length": 11,
|
| 90 |
+
"sources": [
|
| 91 |
+
"agdt",
|
| 92 |
+
"gorman",
|
| 93 |
+
"ud_perseus"
|
| 94 |
+
]
|
| 95 |
+
},
|
| 96 |
+
{
|
| 97 |
+
"authors": [
|
| 98 |
+
"Plutarch",
|
| 99 |
+
"Xenophon"
|
| 100 |
+
],
|
| 101 |
+
"dedup_key": "74adb07c15882d295c2185206fd6063f68d901044dbff7f8b16a9d4196d0334e",
|
| 102 |
+
"normalized_length": 11,
|
| 103 |
+
"sources": [
|
| 104 |
+
"agdt",
|
| 105 |
+
"gorman",
|
| 106 |
+
"ud_perseus"
|
| 107 |
+
]
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"authors": [
|
| 111 |
+
"Plutarch",
|
| 112 |
+
"Xenophon"
|
| 113 |
+
],
|
| 114 |
+
"dedup_key": "d66d4852420ec9d50e806d5e095ced0ee1a701eb0955dd53f3ed249043e703ea",
|
| 115 |
+
"normalized_length": 18,
|
| 116 |
+
"sources": [
|
| 117 |
+
"agdt",
|
| 118 |
+
"gorman",
|
| 119 |
+
"ud_perseus"
|
| 120 |
+
]
|
| 121 |
+
},
|
| 122 |
+
{
|
| 123 |
+
"authors": [
|
| 124 |
+
"Athenaeus",
|
| 125 |
+
"Xenophon"
|
| 126 |
+
],
|
| 127 |
+
"dedup_key": "a58f7ce0af7bad72f1a6a3a5856e0fb89b8274eb99dc6bdda01a2ea46a47af1f",
|
| 128 |
+
"normalized_length": 84,
|
| 129 |
+
"sources": [
|
| 130 |
+
"agdt",
|
| 131 |
+
"gorman",
|
| 132 |
+
"ud_perseus"
|
| 133 |
+
]
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"authors": [
|
| 137 |
+
"Athenaeus",
|
| 138 |
+
"Xenophon"
|
| 139 |
+
],
|
| 140 |
+
"dedup_key": "cd3c1ca5491d1e2074d8ca47ba86ac8352c39979b5d8d422ba59ff2bb725ff41",
|
| 141 |
+
"normalized_length": 36,
|
| 142 |
+
"sources": [
|
| 143 |
+
"agdt",
|
| 144 |
+
"gorman",
|
| 145 |
+
"ud_perseus"
|
| 146 |
+
]
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
"authors": [
|
| 150 |
+
"Athenaeus",
|
| 151 |
+
"Xenophon"
|
| 152 |
+
],
|
| 153 |
+
"dedup_key": "ab825b299c33a1a097021efd1a4b42767a434f1c89739d38e949b4091155ef55",
|
| 154 |
+
"normalized_length": 42,
|
| 155 |
+
"sources": [
|
| 156 |
+
"agdt",
|
| 157 |
+
"gorman",
|
| 158 |
+
"ud_perseus"
|
| 159 |
+
]
|
| 160 |
+
},
|
| 161 |
+
{
|
| 162 |
+
"authors": [
|
| 163 |
+
"Athenaeus",
|
| 164 |
+
"Chariton"
|
| 165 |
+
],
|
| 166 |
+
"dedup_key": "a4df924ee56cfcdcfea2ff670f57d46e8273afe5e16e3d17b44056767f40b4c7",
|
| 167 |
+
"normalized_length": 14,
|
| 168 |
+
"sources": [
|
| 169 |
+
"agdt",
|
| 170 |
+
"gorman",
|
| 171 |
+
"pedalion",
|
| 172 |
+
"ud_perseus"
|
| 173 |
+
]
|
| 174 |
+
},
|
| 175 |
+
{
|
| 176 |
+
"authors": [
|
| 177 |
+
"Athenaeus",
|
| 178 |
+
"Plato"
|
| 179 |
+
],
|
| 180 |
+
"dedup_key": "c9dd7f4a9c0c3aff029800ba0a1453bff595b729b286af1430345ffb09d98f51",
|
| 181 |
+
"normalized_length": 5,
|
| 182 |
+
"sources": [
|
| 183 |
+
"agdt",
|
| 184 |
+
"gorman",
|
| 185 |
+
"pedalion",
|
| 186 |
+
"ud_perseus"
|
| 187 |
+
]
|
| 188 |
+
},
|
| 189 |
+
{
|
| 190 |
+
"authors": [
|
| 191 |
+
"Athenaeus",
|
| 192 |
+
"Plato"
|
| 193 |
+
],
|
| 194 |
+
"dedup_key": "34f9df46bc85c3c50e5b6ad7a98d6174a028b5ee7acc04cb315951ddd67aa54a",
|
| 195 |
+
"normalized_length": 4,
|
| 196 |
+
"sources": [
|
| 197 |
+
"agdt",
|
| 198 |
+
"gorman",
|
| 199 |
+
"pedalion",
|
| 200 |
+
"ud_perseus"
|
| 201 |
+
]
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
"authors": [
|
| 205 |
+
"Athenaeus",
|
| 206 |
+
"Lysias"
|
| 207 |
+
],
|
| 208 |
+
"dedup_key": "e4af215095814693762f9993a1620a265e24cc9edeff07d680c846d8562995de",
|
| 209 |
+
"normalized_length": 27,
|
| 210 |
+
"sources": [
|
| 211 |
+
"agdt",
|
| 212 |
+
"gorman",
|
| 213 |
+
"ud_perseus"
|
| 214 |
+
]
|
| 215 |
+
},
|
| 216 |
+
{
|
| 217 |
+
"authors": [
|
| 218 |
+
"Diodorus Siculus",
|
| 219 |
+
"Polybius"
|
| 220 |
+
],
|
| 221 |
+
"dedup_key": "62a8d7ea990027b7b26cdb4a9990d79688b648c505ad1c307df1a4abc07421de",
|
| 222 |
+
"normalized_length": 18,
|
| 223 |
+
"sources": [
|
| 224 |
+
"agdt",
|
| 225 |
+
"gorman",
|
| 226 |
+
"ud_perseus"
|
| 227 |
+
]
|
| 228 |
+
},
|
| 229 |
+
{
|
| 230 |
+
"authors": [
|
| 231 |
+
"Herodotus",
|
| 232 |
+
"Xenophon"
|
| 233 |
+
],
|
| 234 |
+
"dedup_key": "9643413d02440657dc9431f34eec218cb047c4c2b31413c9f589967d87f21080",
|
| 235 |
+
"normalized_length": 7,
|
| 236 |
+
"sources": [
|
| 237 |
+
"gorman",
|
| 238 |
+
"ud_proiel"
|
| 239 |
+
]
|
| 240 |
+
},
|
| 241 |
+
{
|
| 242 |
+
"authors": [
|
| 243 |
+
"Luke (traditional)",
|
| 244 |
+
"Mark (traditional)"
|
| 245 |
+
],
|
| 246 |
+
"dedup_key": "72c2af7ece94a0563e4ad76366320deb13bb6335b128c299010b90156484d410",
|
| 247 |
+
"normalized_length": 37,
|
| 248 |
+
"sources": [
|
| 249 |
+
"ud_proiel"
|
| 250 |
+
]
|
| 251 |
+
},
|
| 252 |
+
{
|
| 253 |
+
"authors": [
|
| 254 |
+
"Luke (traditional)",
|
| 255 |
+
"Mark (traditional)"
|
| 256 |
+
],
|
| 257 |
+
"dedup_key": "32cbae49e112c7d613d27b316a48c2a4e353da24406d90e94c641752f7c6bcfd",
|
| 258 |
+
"normalized_length": 13,
|
| 259 |
+
"sources": [
|
| 260 |
+
"ud_proiel"
|
| 261 |
+
]
|
| 262 |
+
},
|
| 263 |
+
{
|
| 264 |
+
"authors": [
|
| 265 |
+
"John (traditional)",
|
| 266 |
+
"Luke (traditional)",
|
| 267 |
+
"Mark (traditional)",
|
| 268 |
+
"Matthew (traditional)"
|
| 269 |
+
],
|
| 270 |
+
"dedup_key": "29b7d494fa478f295de9297ae2d07642c49f1c765475aeaa4fc1e48c21fb9e6d",
|
| 271 |
+
"normalized_length": 12,
|
| 272 |
+
"sources": [
|
| 273 |
+
"ud_proiel"
|
| 274 |
+
]
|
| 275 |
+
},
|
| 276 |
+
{
|
| 277 |
+
"authors": [
|
| 278 |
+
"Luke (traditional)",
|
| 279 |
+
"Mark (traditional)"
|
| 280 |
+
],
|
| 281 |
+
"dedup_key": "df0165a9e00acc71bff5fd94f8ab08b71b5edf223e52a82e5fad0f8cab8b09f1",
|
| 282 |
+
"normalized_length": 18,
|
| 283 |
+
"sources": [
|
| 284 |
+
"ud_proiel"
|
| 285 |
+
]
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"authors": [
|
| 289 |
+
"Luke (traditional)",
|
| 290 |
+
"Mark (traditional)",
|
| 291 |
+
"Matthew (traditional)"
|
| 292 |
+
],
|
| 293 |
+
"dedup_key": "22f08ab66dc8fa8a5a787d971aee364b127f6fa1b067256857eaf6f34fb585d4",
|
| 294 |
+
"normalized_length": 12,
|
| 295 |
+
"sources": [
|
| 296 |
+
"ud_proiel"
|
| 297 |
+
]
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"authors": [
|
| 301 |
+
"Luke (traditional)",
|
| 302 |
+
"Mark (traditional)",
|
| 303 |
+
"Matthew (traditional)"
|
| 304 |
+
],
|
| 305 |
+
"dedup_key": "8035454856be0ae19075064cf04c7a883fe286a0186d375e629ceb0eb5c0bb43",
|
| 306 |
+
"normalized_length": 26,
|
| 307 |
+
"sources": [
|
| 308 |
+
"ud_proiel"
|
| 309 |
+
]
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
"authors": [
|
| 313 |
+
"Anonymous (Septuagint)",
|
| 314 |
+
"John of Patmos",
|
| 315 |
+
"Luke (traditional)",
|
| 316 |
+
"Mark (traditional)"
|
| 317 |
+
],
|
| 318 |
+
"dedup_key": "0f4ac3810e8c5f0294e25297c940d50ce54ab8450a937abccdf055ac50b2cee6",
|
| 319 |
+
"normalized_length": 7,
|
| 320 |
+
"sources": [
|
| 321 |
+
"pedalion",
|
| 322 |
+
"ud_proiel"
|
| 323 |
+
]
|
| 324 |
+
},
|
| 325 |
+
{
|
| 326 |
+
"authors": [
|
| 327 |
+
"Mark (traditional)",
|
| 328 |
+
"Matthew (traditional)"
|
| 329 |
+
],
|
| 330 |
+
"dedup_key": "0c88d0c7bd0dad89a1fd1a6647d11adab482878948817a764e3baa917741265b",
|
| 331 |
+
"normalized_length": 17,
|
| 332 |
+
"sources": [
|
| 333 |
+
"ud_proiel"
|
| 334 |
+
]
|
| 335 |
+
},
|
| 336 |
+
{
|
| 337 |
+
"authors": [
|
| 338 |
+
"John (traditional)",
|
| 339 |
+
"Mark (traditional)"
|
| 340 |
+
],
|
| 341 |
+
"dedup_key": "be586edd2ca7760629d437da1dbe05606f931591a714e437de6eae005cbd5ca6",
|
| 342 |
+
"normalized_length": 6,
|
| 343 |
+
"sources": [
|
| 344 |
+
"ud_proiel"
|
| 345 |
+
]
|
| 346 |
+
},
|
| 347 |
+
{
|
| 348 |
+
"authors": [
|
| 349 |
+
"Luke (traditional)",
|
| 350 |
+
"Matthew (traditional)"
|
| 351 |
+
],
|
| 352 |
+
"dedup_key": "739abaad18b93483543e3dd6336e5f5c7b3cf8644571e52ceca69bb99189a6ed",
|
| 353 |
+
"normalized_length": 31,
|
| 354 |
+
"sources": [
|
| 355 |
+
"ud_proiel"
|
| 356 |
+
]
|
| 357 |
+
},
|
| 358 |
+
{
|
| 359 |
+
"authors": [
|
| 360 |
+
"Luke (traditional)",
|
| 361 |
+
"Mark (traditional)",
|
| 362 |
+
"Matthew (traditional)"
|
| 363 |
+
],
|
| 364 |
+
"dedup_key": "02d77ceefff126956c97f7d55932b3978a12d3b7e25e691df81c68b08bbe6d0d",
|
| 365 |
+
"normalized_length": 4,
|
| 366 |
+
"sources": [
|
| 367 |
+
"ud_proiel"
|
| 368 |
+
]
|
| 369 |
+
},
|
| 370 |
+
{
|
| 371 |
+
"authors": [
|
| 372 |
+
"Luke (traditional)",
|
| 373 |
+
"Mark (traditional)",
|
| 374 |
+
"Matthew (traditional)"
|
| 375 |
+
],
|
| 376 |
+
"dedup_key": "60d9d5fe3ed2f9f00d6ab0b496198447d8910e58772d97026ce621e25199c237",
|
| 377 |
+
"normalized_length": 11,
|
| 378 |
+
"sources": [
|
| 379 |
+
"ud_proiel"
|
| 380 |
+
]
|
| 381 |
+
},
|
| 382 |
+
{
|
| 383 |
+
"authors": [
|
| 384 |
+
"Luke (traditional)",
|
| 385 |
+
"Mark (traditional)"
|
| 386 |
+
],
|
| 387 |
+
"dedup_key": "384457f99bd6c8b79b397c4401a1937d38a742611621288886c74323a9b01924",
|
| 388 |
+
"normalized_length": 7,
|
| 389 |
+
"sources": [
|
| 390 |
+
"ud_proiel"
|
| 391 |
+
]
|
| 392 |
+
}
|
| 393 |
+
],
|
| 394 |
+
"conflicting_author_groups_removed": 289,
|
| 395 |
+
"conflicting_author_rows_removed": 1168,
|
| 396 |
+
"duplicate_groups": 8578,
|
| 397 |
+
"input_rows": 72336,
|
| 398 |
+
"output_rows": 56965,
|
| 399 |
+
"removed_exact_duplicates": 14203
|
| 400 |
+
},
|
| 401 |
+
"excluded": {
|
| 402 |
+
"aphthonius": "No redistribution license is specified upstream.",
|
| 403 |
+
"harrington_grctb_805": "File declares xml:lang=lat and contains Cicero despite its grctb path.",
|
| 404 |
+
"pedalion_mixed": [
|
| 405 |
+
"chilia-sentences.xml",
|
| 406 |
+
"example-sentences.xml",
|
| 407 |
+
"external_examplesentences.xml",
|
| 408 |
+
"papyri.xml"
|
| 409 |
+
]
|
| 410 |
+
},
|
| 411 |
+
"validation": {
|
| 412 |
+
"checks": {
|
| 413 |
+
"prose_exact_text_unique": true,
|
| 414 |
+
"unique_ids": true,
|
| 415 |
+
"verse_parent_split_consistency": true
|
| 416 |
+
},
|
| 417 |
+
"prose": {
|
| 418 |
+
"authors": 51,
|
| 419 |
+
"rows": 56965,
|
| 420 |
+
"sources": {
|
| 421 |
+
"agdt": 1114,
|
| 422 |
+
"gorman": 24795,
|
| 423 |
+
"harrington": 1012,
|
| 424 |
+
"pedalion": 8783,
|
| 425 |
+
"ud_perseus": 4464,
|
| 426 |
+
"ud_proiel": 15221,
|
| 427 |
+
"ud_ptnk": 1576
|
| 428 |
+
},
|
| 429 |
+
"splits": {
|
| 430 |
+
"test": 5696,
|
| 431 |
+
"train": 45573,
|
| 432 |
+
"validation": 5696
|
| 433 |
+
},
|
| 434 |
+
"works": 110
|
| 435 |
+
},
|
| 436 |
+
"verse_metre": {
|
| 437 |
+
"authors": 6,
|
| 438 |
+
"rows": 27857,
|
| 439 |
+
"sources": {
|
| 440 |
+
"agdt": 27671,
|
| 441 |
+
"pedalion": 186
|
| 442 |
+
},
|
| 443 |
+
"splits": {
|
| 444 |
+
"test": 2752,
|
| 445 |
+
"train": 22264,
|
| 446 |
+
"validation": 2841
|
| 447 |
+
},
|
| 448 |
+
"works": 12
|
| 449 |
+
},
|
| 450 |
+
"verse_sentence": {
|
| 451 |
+
"authors": 6,
|
| 452 |
+
"rows": 14995,
|
| 453 |
+
"sources": {
|
| 454 |
+
"agdt": 14878,
|
| 455 |
+
"pedalion": 117
|
| 456 |
+
},
|
| 457 |
+
"splits": {
|
| 458 |
+
"test": 1500,
|
| 459 |
+
"train": 11995,
|
| 460 |
+
"validation": 1500
|
| 461 |
+
},
|
| 462 |
+
"works": 12
|
| 463 |
+
}
|
| 464 |
+
}
|
| 465 |
+
}
|
metadata/source_revisions.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"agdt": {
|
| 3 |
+
"directory": "treebank_data",
|
| 4 |
+
"url": "https://github.com/PerseusDL/treebank_data",
|
| 5 |
+
"license": "CC-BY-SA-3.0-US",
|
| 6 |
+
"annotation": "manual syntax; Morpheus-assisted morphology; normalized in AGDT 2.1",
|
| 7 |
+
"scheme": "AGDT/ALDT",
|
| 8 |
+
"revision": "bf4334f0af5e13d16b04c1cccd6237e683ac6f5f"
|
| 9 |
+
},
|
| 10 |
+
"ud_perseus": {
|
| 11 |
+
"directory": "perseus",
|
| 12 |
+
"url": "https://github.com/UniversalDependencies/UD_Ancient_Greek-Perseus",
|
| 13 |
+
"license": "CC-BY-NC-SA-2.5",
|
| 14 |
+
"annotation": "UD conversion of manually annotated AGDT syntax",
|
| 15 |
+
"scheme": "Universal Dependencies 2",
|
| 16 |
+
"revision": "37837c7a3c592c9563f8c51cc63344b87247f8a5"
|
| 17 |
+
},
|
| 18 |
+
"ud_proiel": {
|
| 19 |
+
"directory": "proiel",
|
| 20 |
+
"url": "https://github.com/UniversalDependencies/UD_Ancient_Greek-PROIEL",
|
| 21 |
+
"license": "CC-BY-NC-SA-3.0",
|
| 22 |
+
"annotation": "UD conversion of manually annotated PROIEL data",
|
| 23 |
+
"scheme": "Universal Dependencies 2",
|
| 24 |
+
"revision": "1e801c6eeda66797e749245c78a045e7d136c99c"
|
| 25 |
+
},
|
| 26 |
+
"ud_ptnk": {
|
| 27 |
+
"directory": "ptnk",
|
| 28 |
+
"url": "https://github.com/UniversalDependencies/UD_Ancient_Greek-PTNK",
|
| 29 |
+
"license": "CC-BY-SA-4.0",
|
| 30 |
+
"annotation": "cross-lingual projection with automatic and manual correction",
|
| 31 |
+
"scheme": "Universal Dependencies 2",
|
| 32 |
+
"revision": "df0b550c9c6b52a568a0184bfcf190279ffe501a"
|
| 33 |
+
},
|
| 34 |
+
"gorman": {
|
| 35 |
+
"directory": "gorman",
|
| 36 |
+
"url": "https://github.com/vgorman1/Greek-Dependency-Trees",
|
| 37 |
+
"license": "CC-BY-NC-SA-4.0 (conservative; upstream files conflict)",
|
| 38 |
+
"annotation": "hand annotated, or hand corrected after preparsing",
|
| 39 |
+
"scheme": "AGDT/Arethusa",
|
| 40 |
+
"revision": "d823e96d253277bc1872b83ff5ac8c393a0f830a"
|
| 41 |
+
},
|
| 42 |
+
"pedalion": {
|
| 43 |
+
"directory": "pedalion",
|
| 44 |
+
"url": "https://github.com/perseids-publications/pedalion-trees",
|
| 45 |
+
"license": "CC-BY-SA-4.0",
|
| 46 |
+
"annotation": "human corrected after automatic preparsing; beta annotations",
|
| 47 |
+
"scheme": "AGDT/Arethusa",
|
| 48 |
+
"revision": "112c106b86b865ddde4be7e5f3e409d9c42689f9"
|
| 49 |
+
},
|
| 50 |
+
"harrington": {
|
| 51 |
+
"directory": "harrington",
|
| 52 |
+
"url": "https://github.com/perseids-publications/harrington-trees",
|
| 53 |
+
"license": "CC-BY-SA-4.0",
|
| 54 |
+
"annotation": "student annotation edited by J. Matthew Harrington",
|
| 55 |
+
"scheme": "Harrington/Arethusa",
|
| 56 |
+
"revision": "bef859dc41fd5e62104a6752d979770035468fd2"
|
| 57 |
+
},
|
| 58 |
+
"hypotactic": {
|
| 59 |
+
"directory": "hypotactic",
|
| 60 |
+
"url": "https://github.com/Urdatorn/hypotactic",
|
| 61 |
+
"license": "CC-BY-4.0",
|
| 62 |
+
"annotation": "human metrical annotation by David Chamberlain; NLP repackaging by Urdatorn",
|
| 63 |
+
"scheme": "Hypotactic scansion HTML",
|
| 64 |
+
"revision": "9f478ac82db30d6c16f7dfe7fa49056147ed1785"
|
| 65 |
+
}
|
| 66 |
+
}
|
requirements-build.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pyarrow>=21,<22
|
scripts/build_dataset.py
ADDED
|
@@ -0,0 +1,1016 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Build the Sphregis beta dataset from frozen Ancient Greek treebanks.
|
| 3 |
+
|
| 4 |
+
The build is deliberately source-driven: source repositories are not vendored in
|
| 5 |
+
the dataset repository. Pass their checkout root with ``--sources``. Every
|
| 6 |
+
published row records the exact upstream commit used by the build.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
from __future__ import annotations
|
| 10 |
+
|
| 11 |
+
import argparse
|
| 12 |
+
import hashlib
|
| 13 |
+
import html
|
| 14 |
+
import json
|
| 15 |
+
import re
|
| 16 |
+
import subprocess
|
| 17 |
+
import unicodedata
|
| 18 |
+
import xml.etree.ElementTree as ET
|
| 19 |
+
from collections import Counter, defaultdict
|
| 20 |
+
from dataclasses import dataclass, field
|
| 21 |
+
from html.parser import HTMLParser
|
| 22 |
+
from pathlib import Path
|
| 23 |
+
from typing import Iterable
|
| 24 |
+
|
| 25 |
+
import pyarrow as pa
|
| 26 |
+
import pyarrow.parquet as pq
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
SOURCE_INFO = {
|
| 30 |
+
"agdt": {
|
| 31 |
+
"directory": "treebank_data",
|
| 32 |
+
"url": "https://github.com/PerseusDL/treebank_data",
|
| 33 |
+
"license": "CC-BY-SA-3.0-US",
|
| 34 |
+
"annotation": "manual syntax; Morpheus-assisted morphology; normalized in AGDT 2.1",
|
| 35 |
+
"scheme": "AGDT/ALDT",
|
| 36 |
+
},
|
| 37 |
+
"ud_perseus": {
|
| 38 |
+
"directory": "perseus",
|
| 39 |
+
"url": "https://github.com/UniversalDependencies/UD_Ancient_Greek-Perseus",
|
| 40 |
+
"license": "CC-BY-NC-SA-2.5",
|
| 41 |
+
"annotation": "UD conversion of manually annotated AGDT syntax",
|
| 42 |
+
"scheme": "Universal Dependencies 2",
|
| 43 |
+
},
|
| 44 |
+
"ud_proiel": {
|
| 45 |
+
"directory": "proiel",
|
| 46 |
+
"url": "https://github.com/UniversalDependencies/UD_Ancient_Greek-PROIEL",
|
| 47 |
+
"license": "CC-BY-NC-SA-3.0",
|
| 48 |
+
"annotation": "UD conversion of manually annotated PROIEL data",
|
| 49 |
+
"scheme": "Universal Dependencies 2",
|
| 50 |
+
},
|
| 51 |
+
"ud_ptnk": {
|
| 52 |
+
"directory": "ptnk",
|
| 53 |
+
"url": "https://github.com/UniversalDependencies/UD_Ancient_Greek-PTNK",
|
| 54 |
+
"license": "CC-BY-SA-4.0",
|
| 55 |
+
"annotation": "cross-lingual projection with automatic and manual correction",
|
| 56 |
+
"scheme": "Universal Dependencies 2",
|
| 57 |
+
},
|
| 58 |
+
"gorman": {
|
| 59 |
+
"directory": "gorman",
|
| 60 |
+
"url": "https://github.com/vgorman1/Greek-Dependency-Trees",
|
| 61 |
+
# The README says NC; the bundled license text omits NC. Use the
|
| 62 |
+
# conservative interpretation until the maintainer resolves it.
|
| 63 |
+
"license": "CC-BY-NC-SA-4.0 (conservative; upstream files conflict)",
|
| 64 |
+
"annotation": "hand annotated, or hand corrected after preparsing",
|
| 65 |
+
"scheme": "AGDT/Arethusa",
|
| 66 |
+
},
|
| 67 |
+
"pedalion": {
|
| 68 |
+
"directory": "pedalion",
|
| 69 |
+
"url": "https://github.com/perseids-publications/pedalion-trees",
|
| 70 |
+
"license": "CC-BY-SA-4.0",
|
| 71 |
+
"annotation": "human corrected after automatic preparsing; beta annotations",
|
| 72 |
+
"scheme": "AGDT/Arethusa",
|
| 73 |
+
},
|
| 74 |
+
"harrington": {
|
| 75 |
+
"directory": "harrington",
|
| 76 |
+
"url": "https://github.com/perseids-publications/harrington-trees",
|
| 77 |
+
"license": "CC-BY-SA-4.0",
|
| 78 |
+
"annotation": "student annotation edited by J. Matthew Harrington",
|
| 79 |
+
"scheme": "Harrington/Arethusa",
|
| 80 |
+
},
|
| 81 |
+
"hypotactic": {
|
| 82 |
+
"directory": "hypotactic",
|
| 83 |
+
"url": "https://github.com/Urdatorn/hypotactic",
|
| 84 |
+
"license": "CC-BY-4.0",
|
| 85 |
+
"annotation": "human metrical annotation by David Chamberlain; NLP repackaging by Urdatorn",
|
| 86 |
+
"scheme": "Hypotactic scansion HTML",
|
| 87 |
+
},
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
AGDT_WORKS = {
|
| 92 |
+
"tlg0003.tlg001": ("Thucydides", "Histories, Book 1", "prose"),
|
| 93 |
+
"tlg0007.tlg004": ("Plutarch", "Lycurgus", "prose"),
|
| 94 |
+
"tlg0007.tlg015": ("Plutarch", "Alcibiades", "prose"),
|
| 95 |
+
"tlg0008.tlg001": ("Athenaeus", "Deipnosophists, Books 12–13", "prose"),
|
| 96 |
+
"tlg0011.tlg001": ("Sophocles", "Trachiniae", "verse"),
|
| 97 |
+
"tlg0011.tlg002": ("Sophocles", "Antigone", "verse"),
|
| 98 |
+
"tlg0011.tlg003": ("Sophocles", "Ajax", "verse"),
|
| 99 |
+
"tlg0011.tlg004": ("Sophocles", "Oedipus Tyrannus", "verse"),
|
| 100 |
+
"tlg0011.tlg005": ("Sophocles", "Electra", "verse"),
|
| 101 |
+
"tlg0012.tlg001": ("Homer", "Iliad", "verse"),
|
| 102 |
+
"tlg0012.tlg002": ("Homer", "Odyssey", "verse"),
|
| 103 |
+
"tlg0013.tlg002": ("Pseudo-Homer", "Hymn to Demeter", "verse"),
|
| 104 |
+
"tlg0016.tlg001": ("Herodotus", "Histories, Book 1", "prose"),
|
| 105 |
+
"tlg0020.tlg001": ("Hesiod", "Theogony", "verse"),
|
| 106 |
+
"tlg0020.tlg002": ("Hesiod", "Works and Days", "verse"),
|
| 107 |
+
"tlg0020.tlg003": ("Hesiod", "Shield of Heracles", "verse"),
|
| 108 |
+
"tlg0059.tlg001": ("Plato", "Euthyphro", "prose"),
|
| 109 |
+
"tlg0060.tlg001": ("Diodorus Siculus", "Library, Book 11", "prose"),
|
| 110 |
+
"tlg0085.tlg001": ("Aeschylus", "Suppliants", "verse"),
|
| 111 |
+
"tlg0085.tlg002": ("Aeschylus", "Persians", "verse"),
|
| 112 |
+
"tlg0085.tlg003": ("Aeschylus", "Prometheus Bound", "verse"),
|
| 113 |
+
"tlg0085.tlg004": ("Aeschylus", "Seven Against Thebes", "verse"),
|
| 114 |
+
"tlg0085.tlg005": ("Aeschylus", "Agamemnon", "verse"),
|
| 115 |
+
"tlg0085.tlg006": ("Aeschylus", "Libation Bearers", "verse"),
|
| 116 |
+
"tlg0085.tlg007": ("Aeschylus", "Eumenides", "verse"),
|
| 117 |
+
"tlg0096.tlg002": ("Aesop", "Fables 1–50", "prose"),
|
| 118 |
+
"tlg0540.tlg001": ("Lysias", "On the Murder of Eratosthenes", "prose"),
|
| 119 |
+
"tlg0540.tlg014": ("Lysias", "Against Alcibiades 1", "prose"),
|
| 120 |
+
"tlg0540.tlg015": ("Lysias", "Against Alcibiades 2", "prose"),
|
| 121 |
+
"tlg0540.tlg023": ("Lysias", "Against Pancleon", "prose"),
|
| 122 |
+
"tlg0543.tlg001": ("Polybius", "Histories, Book 1", "prose"),
|
| 123 |
+
"tlg0548.tlg001": ("Pseudo-Apollodorus", "Library 1.1.1–1.4.1", "prose"),
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
# Hypotactic file stems aligned to human treebanks. Booked works expand below.
|
| 128 |
+
VERSE_LINKS = {
|
| 129 |
+
"tlg0012.tlg001": {"files": [f"iliad{i}" for i in range(1, 25)]},
|
| 130 |
+
"tlg0012.tlg002": {"files": [f"odyssey{i}" for i in range(1, 25)]},
|
| 131 |
+
"tlg0013.tlg002": {"files": ["HHDemeter"]},
|
| 132 |
+
"tlg0020.tlg001": {"files": ["theogony"]},
|
| 133 |
+
"tlg0020.tlg002": {"files": ["worksanddays"]},
|
| 134 |
+
"tlg0020.tlg003": {"files": ["scutum"]},
|
| 135 |
+
"tlg0085.tlg002": {"files": ["persians"]},
|
| 136 |
+
"tlg0085.tlg003": {"files": ["prometheus"]},
|
| 137 |
+
"tlg0085.tlg004": {"files": ["seven"]},
|
| 138 |
+
"pedalion:batracho.xml": {"files": ["batmumach"]},
|
| 139 |
+
"pedalion:semonides.xml": {"files": ["semonides"]},
|
| 140 |
+
"pedalion:theoc.xml": {"files": ["theoc1", "theoc2", "theoc3", "theoc4"]},
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
PEDALION_VERSE = {
|
| 145 |
+
"achar.xml",
|
| 146 |
+
"thesmo.xml",
|
| 147 |
+
"euripides_medea.xml",
|
| 148 |
+
"ez.xml",
|
| 149 |
+
"batracho.xml",
|
| 150 |
+
"menander_dyskolos.xml",
|
| 151 |
+
"sappho.xml",
|
| 152 |
+
"semonides.xml",
|
| 153 |
+
"theoc.xml",
|
| 154 |
+
"mimn.xml",
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
PEDALION_EXCLUDE = {
|
| 158 |
+
"papyri.xml",
|
| 159 |
+
"example-sentences.xml",
|
| 160 |
+
"external_examplesentences.xml",
|
| 161 |
+
"chilia-sentences.xml",
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
GORMAN_AUTHOR_PATTERNS = [
|
| 166 |
+
(r"^Aeschines", "Aeschines"), (r"^Andocides", "Andocides"),
|
| 167 |
+
(r"^[Aa]ntiphon", "Antiphon"), (r"^Appian", "Appian"),
|
| 168 |
+
(r"^Aristotle", "Aristotle"), (r"^[Dd]em", "Demosthenes"),
|
| 169 |
+
(r"^Isaeus", "Isaeus"), (r"^Isocrates", "Isocrates"),
|
| 170 |
+
(r"^[Ll]ysias", "Lysias"), (r"^[Pp]lato", "Plato"),
|
| 171 |
+
(r"^[Pp]lut", "Plutarch"), (r"^[Pp]olybius", "Polybius"),
|
| 172 |
+
(r"^[Xx]en", "Xenophon"), (r"^[Aa]then", "Athenaeus"),
|
| 173 |
+
(r"^[Dd]iod", "Diodorus Siculus"), (r"^[Dd]ion hal", "Dionysius of Halicarnassus"),
|
| 174 |
+
(r"^[Hh]dt", "Herodotus"), (r"^[Jj]osephus", "Josephus"),
|
| 175 |
+
(r"^[Tt]huc", "Thucydides"), (r"^ps xen", "Pseudo-Xenophon"),
|
| 176 |
+
]
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
NT_BOOKS = {
|
| 180 |
+
"MATT": ("Matthew (traditional)", "Gospel of Matthew"),
|
| 181 |
+
"MARK": ("Mark (traditional)", "Gospel of Mark"),
|
| 182 |
+
"LUKE": ("Luke (traditional)", "Gospel of Luke"),
|
| 183 |
+
"ACTS": ("Luke (traditional)", "Acts"),
|
| 184 |
+
"JOHN": ("John (traditional)", "Gospel of John"),
|
| 185 |
+
"ROM": ("Paul (traditional)", "Romans"),
|
| 186 |
+
"GAL": ("Paul", "Galatians"), "EPH": ("Paul (traditional)", "Ephesians"),
|
| 187 |
+
"PHIL": ("Paul", "Philippians"), "COL": ("Paul (traditional)", "Colossians"),
|
| 188 |
+
"TIT": ("Paul (traditional)", "Titus"), "PHILEM": ("Paul", "Philemon"),
|
| 189 |
+
"HEB": ("Anonymous", "Hebrews"), "JAS": ("James (traditional)", "James"),
|
| 190 |
+
"JUDE": ("Jude (traditional)", "Jude"), "REV": ("John of Patmos", "Revelation"),
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
POS_MAP = {
|
| 195 |
+
"n": "NOUN", "v": "VERB", "a": "ADJ", "d": "ADV", "c": "SCONJ",
|
| 196 |
+
"r": "ADP", "p": "PRON", "l": "DET", "g": "PART", "b": "CCONJ",
|
| 197 |
+
"m": "NUM", "i": "INTJ", "u": "PUNCT", "e": "X", "x": "X",
|
| 198 |
+
"-": "X", "t": "VERB", "q": "ADV",
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
FEATURE_MAPS = [
|
| 202 |
+
("Person", {"1": "1", "2": "2", "3": "3"}),
|
| 203 |
+
("Number", {"s": "Sing", "p": "Plur", "d": "Dual"}),
|
| 204 |
+
("Tense", {"p": "Pres", "i": "Past", "r": "Past", "l": "Past", "t": "Past", "f": "Fut", "a": "Past"}),
|
| 205 |
+
("Mood", {"i": "Ind", "s": "Sub", "o": "Opt", "m": "Imp", "n": "Inf", "p": "Part", "g": "Ger"}),
|
| 206 |
+
("Voice", {"a": "Act", "m": "Mid", "p": "Pass", "e": "Mid"}),
|
| 207 |
+
("Gender", {"m": "Masc", "f": "Fem", "n": "Neut", "c": "Com"}),
|
| 208 |
+
("Case", {"n": "Nom", "g": "Gen", "d": "Dat", "a": "Acc", "v": "Voc", "l": "Loc"}),
|
| 209 |
+
("Degree", {"c": "Cmp", "s": "Sup", "p": "Pos"}),
|
| 210 |
+
]
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
@dataclass
|
| 214 |
+
class Sentence:
|
| 215 |
+
source: str
|
| 216 |
+
source_file: str
|
| 217 |
+
source_sentence_id: str
|
| 218 |
+
author: str
|
| 219 |
+
work: str
|
| 220 |
+
work_id: str
|
| 221 |
+
text: str
|
| 222 |
+
conllu: str
|
| 223 |
+
cts_urn: str = ""
|
| 224 |
+
passage: str = ""
|
| 225 |
+
genre: str = "prose"
|
| 226 |
+
native_cites: list[str] = field(default_factory=list)
|
| 227 |
+
priority: int = 50
|
| 228 |
+
source_records: list[dict] = field(default_factory=list)
|
| 229 |
+
|
| 230 |
+
@property
|
| 231 |
+
def normalized(self) -> str:
|
| 232 |
+
return normalize(self.text)
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
def normalize(text: str) -> str:
|
| 236 |
+
text = text.lower().replace("ς", "σ")
|
| 237 |
+
text = "".join(
|
| 238 |
+
char for char in unicodedata.normalize("NFD", text)
|
| 239 |
+
if unicodedata.category(char) != "Mn"
|
| 240 |
+
)
|
| 241 |
+
return "".join(char for char in text if char.isalpha())
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
def slug(text: str) -> str:
|
| 245 |
+
value = unicodedata.normalize("NFKD", text).encode("ascii", "ignore").decode().lower()
|
| 246 |
+
value = re.sub(r"[^a-z0-9]+", "-", value).strip("-")
|
| 247 |
+
return value or "unknown"
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
def canonical_author(author: str) -> str:
|
| 251 |
+
return {
|
| 252 |
+
"Aesopus": "Aesop",
|
| 253 |
+
"Anon.": "Anonymous (Septuagint)",
|
| 254 |
+
"Lucianus": "Lucian",
|
| 255 |
+
"Pseudo-Lucianus": "Pseudo-Lucian",
|
| 256 |
+
"(Pseudo-Homer)": "Pseudo-Homer",
|
| 257 |
+
"Ezechiël": "Ezechiel",
|
| 258 |
+
}.get(author.strip(), author.strip() or "Unknown")
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
def stable_id(*parts: str, length: int = 20) -> str:
|
| 262 |
+
return hashlib.sha256("\x1f".join(parts).encode()).hexdigest()[:length]
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
def git_revision(path: Path) -> str:
|
| 266 |
+
return subprocess.check_output(["git", "-C", str(path), "rev-parse", "HEAD"], text=True).strip()
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
def source_record(source: str, revisions: dict[str, str], source_file: str, sentence_id: str) -> dict:
|
| 270 |
+
info = SOURCE_INFO[source]
|
| 271 |
+
return {
|
| 272 |
+
"source": source,
|
| 273 |
+
"source_file": source_file,
|
| 274 |
+
"source_sentence_id": sentence_id,
|
| 275 |
+
"url": info["url"],
|
| 276 |
+
"revision": revisions[source],
|
| 277 |
+
"license": info["license"],
|
| 278 |
+
"annotation_provenance": info["annotation"],
|
| 279 |
+
"syntax_scheme": info["scheme"],
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
def infer_cts(value: str) -> str:
|
| 284 |
+
match = re.search(r"urn:cts:[^\s]+", value or "")
|
| 285 |
+
if not match:
|
| 286 |
+
return ""
|
| 287 |
+
return match.group(0).removesuffix(".tb")
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
def cts_key(value: str) -> str:
|
| 291 |
+
match = re.search(r"(tlg\d+\.tlg\d+)", value)
|
| 292 |
+
return match.group(1) if match else ""
|
| 293 |
+
|
| 294 |
+
|
| 295 |
+
def morph_features(postag: str) -> str:
|
| 296 |
+
tag = (postag or "---------").ljust(9, "-")[:9]
|
| 297 |
+
values = []
|
| 298 |
+
for index, (name, mapping) in enumerate(FEATURE_MAPS, 1):
|
| 299 |
+
if tag[index] in mapping:
|
| 300 |
+
values.append(f"{name}={mapping[tag[index]]}")
|
| 301 |
+
return "|".join(sorted(values)) or "_"
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
def misc_field(values: dict[str, str]) -> str:
|
| 305 |
+
fields = []
|
| 306 |
+
for key, value in values.items():
|
| 307 |
+
if value:
|
| 308 |
+
clean = str(value).replace("|", ",").replace(" ", "_")
|
| 309 |
+
fields.append(f"{key}={clean}")
|
| 310 |
+
return "|".join(fields) or "_"
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
def smart_text(forms: Iterable[str]) -> str:
|
| 314 |
+
result = ""
|
| 315 |
+
no_space_before = set(",.;··:!?;)]}»”")
|
| 316 |
+
no_space_after = set("([{«“")
|
| 317 |
+
for form in forms:
|
| 318 |
+
if not result:
|
| 319 |
+
result = form
|
| 320 |
+
elif form and form[0] in no_space_before:
|
| 321 |
+
result += form
|
| 322 |
+
elif result[-1] in no_space_after:
|
| 323 |
+
result += form
|
| 324 |
+
else:
|
| 325 |
+
result += " " + form
|
| 326 |
+
return result
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
def xml_sentence_to_conllu(sentence: ET.Element, metadata: dict[str, str]) -> tuple[str, str, list[str]]:
|
| 330 |
+
words = list(sentence.findall("word"))
|
| 331 |
+
real = [
|
| 332 |
+
word for word in words
|
| 333 |
+
if not word.get("artificial")
|
| 334 |
+
and (word.get("form") or "").strip() not in {"", "[0]", "_"}
|
| 335 |
+
]
|
| 336 |
+
id_map = {word.get("id", ""): index for index, word in enumerate(real, 1)}
|
| 337 |
+
by_old_id = {word.get("id", ""): word for word in words}
|
| 338 |
+
|
| 339 |
+
def resolved_head(word: ET.Element) -> int:
|
| 340 |
+
head = word.get("head", "0")
|
| 341 |
+
seen = set()
|
| 342 |
+
while head not in id_map and head not in {"", "0", None} and head not in seen:
|
| 343 |
+
seen.add(head)
|
| 344 |
+
parent = by_old_id.get(head)
|
| 345 |
+
head = parent.get("head", "0") if parent is not None else "0"
|
| 346 |
+
return id_map.get(head, 0)
|
| 347 |
+
|
| 348 |
+
forms = [word.get("form", "_") for word in real]
|
| 349 |
+
text = smart_text(forms)
|
| 350 |
+
lines = [
|
| 351 |
+
f"# sent_id = {metadata['sent_id']}",
|
| 352 |
+
f"# text = {text}",
|
| 353 |
+
f"# source = {metadata['source']}",
|
| 354 |
+
]
|
| 355 |
+
if metadata.get("cts"):
|
| 356 |
+
lines.append(f"# cts = {metadata['cts']}")
|
| 357 |
+
if metadata.get("passage"):
|
| 358 |
+
lines.append(f"# passage = {metadata['passage']}")
|
| 359 |
+
|
| 360 |
+
initial_heads = [resolved_head(word) for word in real]
|
| 361 |
+
root_candidates = [
|
| 362 |
+
index for index, (word, head) in enumerate(zip(real, initial_heads), 1)
|
| 363 |
+
if head == 0 and not word.get("postag", "").startswith("u")
|
| 364 |
+
]
|
| 365 |
+
primary_root = root_candidates[0] if root_candidates else 1
|
| 366 |
+
final_heads = list(initial_heads)
|
| 367 |
+
for index, head in enumerate(final_heads, 1):
|
| 368 |
+
if index == primary_root:
|
| 369 |
+
final_heads[index - 1] = 0
|
| 370 |
+
elif head in {0, index}:
|
| 371 |
+
final_heads[index - 1] = primary_root
|
| 372 |
+
# A few beta trees contain cycles. Break each cycle at one node while
|
| 373 |
+
# retaining all other original heads; record provenance still points back
|
| 374 |
+
# to the source tree for audit.
|
| 375 |
+
for token_id in range(1, len(final_heads) + 1):
|
| 376 |
+
trail = []
|
| 377 |
+
cursor = token_id
|
| 378 |
+
while cursor:
|
| 379 |
+
if cursor in trail:
|
| 380 |
+
cycle = trail[trail.index(cursor):]
|
| 381 |
+
break_id = min(cycle)
|
| 382 |
+
final_heads[break_id - 1] = 0 if break_id == primary_root else primary_root
|
| 383 |
+
break
|
| 384 |
+
trail.append(cursor)
|
| 385 |
+
cursor = final_heads[cursor - 1]
|
| 386 |
+
cites = []
|
| 387 |
+
for new_id, word in enumerate(real, 1):
|
| 388 |
+
postag = word.get("postag", "---------")
|
| 389 |
+
head = final_heads[new_id - 1]
|
| 390 |
+
relation = word.get("relation", "dep")
|
| 391 |
+
if head == 0:
|
| 392 |
+
dep = "root"
|
| 393 |
+
elif postag.startswith("u"):
|
| 394 |
+
dep = "punct"
|
| 395 |
+
else:
|
| 396 |
+
dep = "dep:" + re.sub(r"[^a-z0-9]+", "", relation.lower())
|
| 397 |
+
if dep == "dep:":
|
| 398 |
+
dep = "dep"
|
| 399 |
+
cite = word.get("cite", "") or word.get("ref", "")
|
| 400 |
+
if cite:
|
| 401 |
+
cites.append(cite)
|
| 402 |
+
row = [
|
| 403 |
+
str(new_id), word.get("form", "_"), word.get("lemma", "_"),
|
| 404 |
+
POS_MAP.get(postag[:1].lower(), "X"), postag or "_", morph_features(postag),
|
| 405 |
+
str(head), dep, "_", misc_field({
|
| 406 |
+
"NativeRel": relation,
|
| 407 |
+
"NativeHead": word.get("head", ""),
|
| 408 |
+
"HeadRepair": "Yes" if head != initial_heads[new_id - 1] else "",
|
| 409 |
+
"Cite": cite,
|
| 410 |
+
}),
|
| 411 |
+
]
|
| 412 |
+
lines.append("\t".join(row))
|
| 413 |
+
return text, "\n".join(lines) + "\n", cites
|
| 414 |
+
|
| 415 |
+
|
| 416 |
+
def parse_agdt(root: Path, revisions: dict[str, str]) -> tuple[list[Sentence], list[Sentence]]:
|
| 417 |
+
prose, verse = [], []
|
| 418 |
+
text_root = root / "v2.1" / "Greek" / "texts"
|
| 419 |
+
for path in sorted(text_root.glob("*.xml")):
|
| 420 |
+
tree = ET.parse(path)
|
| 421 |
+
xml_root = tree.getroot()
|
| 422 |
+
key = cts_key(xml_root.get("cts", "") or path.name)
|
| 423 |
+
if key not in AGDT_WORKS:
|
| 424 |
+
continue
|
| 425 |
+
author, work, genre = AGDT_WORKS[key]
|
| 426 |
+
cts = infer_cts(xml_root.get("cts", "")) or f"urn:cts:greekLit:{key}"
|
| 427 |
+
for index, sent in enumerate(xml_root.iter("sentence"), 1):
|
| 428 |
+
sid = sent.get("id", str(index))
|
| 429 |
+
passage = sent.get("subdoc", "")
|
| 430 |
+
text, conllu, cites = xml_sentence_to_conllu(sent, {
|
| 431 |
+
"sent_id": f"agdt:{key}:{sid}", "source": path.name,
|
| 432 |
+
"cts": cts, "passage": passage,
|
| 433 |
+
})
|
| 434 |
+
if not normalize(text):
|
| 435 |
+
continue
|
| 436 |
+
row = Sentence(
|
| 437 |
+
source="agdt", source_file=path.name, source_sentence_id=sid,
|
| 438 |
+
author=author, work=work, work_id=key, text=text, conllu=conllu,
|
| 439 |
+
cts_urn=cts, passage=passage, genre=genre, native_cites=cites,
|
| 440 |
+
priority=10,
|
| 441 |
+
)
|
| 442 |
+
row.source_records = [source_record("agdt", revisions, path.name, sid)]
|
| 443 |
+
(verse if genre == "verse" else prose).append(row)
|
| 444 |
+
return prose, verse
|
| 445 |
+
|
| 446 |
+
|
| 447 |
+
def conllu_blocks(path: Path) -> Iterable[dict]:
|
| 448 |
+
for raw in path.read_text(encoding="utf8").strip().split("\n\n"):
|
| 449 |
+
comments = {}
|
| 450 |
+
token_rows = []
|
| 451 |
+
for line in raw.splitlines():
|
| 452 |
+
if line.startswith("# ") and " = " in line:
|
| 453 |
+
key, value = line[2:].split(" = ", 1)
|
| 454 |
+
comments[key] = value
|
| 455 |
+
elif line and not line.startswith("#"):
|
| 456 |
+
fields = line.split("\t")
|
| 457 |
+
if len(fields) == 10:
|
| 458 |
+
token_rows.append(fields)
|
| 459 |
+
if token_rows:
|
| 460 |
+
yield {"comments": comments, "tokens": token_rows, "conllu": raw + "\n"}
|
| 461 |
+
|
| 462 |
+
|
| 463 |
+
def ud_identity(source: str, block: dict) -> tuple[str, str, str, str, str]:
|
| 464 |
+
comments, tokens = block["comments"], block["tokens"]
|
| 465 |
+
sent_id = comments.get("sent_id", "")
|
| 466 |
+
if source == "ud_perseus":
|
| 467 |
+
doc = sent_id.split("@", 1)[0]
|
| 468 |
+
key = cts_key(doc)
|
| 469 |
+
author, work, genre = AGDT_WORKS.get(key, ("Unknown", doc, "prose"))
|
| 470 |
+
return author, work, key or doc, genre, infer_cts(doc)
|
| 471 |
+
refs = [row[9] for row in tokens]
|
| 472 |
+
if source == "ud_ptnk":
|
| 473 |
+
joined = "|".join(refs)
|
| 474 |
+
book = "Ruth" if "Septuagint-Ruth" in joined else "Genesis"
|
| 475 |
+
return "Anonymous (Septuagint)", book, f"septuagint-{book.lower()}", "prose", ""
|
| 476 |
+
# PROIEL: Herodotus refs are numeric; New Testament refs carry a book prefix.
|
| 477 |
+
for misc in refs:
|
| 478 |
+
match = re.search(r"(?:^|\|)Ref=([A-Z]+)_", misc)
|
| 479 |
+
if match:
|
| 480 |
+
code = match.group(1)
|
| 481 |
+
author, work = NT_BOOKS.get(code, (f"Unknown ({code})", code))
|
| 482 |
+
return author, work, f"proiel-{code.lower()}", "prose", ""
|
| 483 |
+
return "Herodotus", "Histories (PROIEL selections)", "tlg0016.tlg001", "prose", "urn:cts:greekLit:tlg0016.tlg001"
|
| 484 |
+
|
| 485 |
+
|
| 486 |
+
def parse_ud(source: str, root: Path, revisions: dict[str, str]) -> tuple[list[Sentence], list[Sentence]]:
|
| 487 |
+
prose, verse = [], []
|
| 488 |
+
for path in sorted(root.glob("*.conllu")):
|
| 489 |
+
for block in conllu_blocks(path):
|
| 490 |
+
comments = block["comments"]
|
| 491 |
+
author, work, work_id, genre, cts = ud_identity(source, block)
|
| 492 |
+
sid = comments.get("sent_id", stable_id(block["conllu"]))
|
| 493 |
+
text = comments.get("text") or smart_text(
|
| 494 |
+
row[1] for row in block["tokens"] if re.fullmatch(r"\d+", row[0])
|
| 495 |
+
)
|
| 496 |
+
if not normalize(text):
|
| 497 |
+
continue
|
| 498 |
+
cites = []
|
| 499 |
+
for token in block["tokens"]:
|
| 500 |
+
match = re.search(r"(?:^|\|)Ref=([^|]+)", token[9])
|
| 501 |
+
if match:
|
| 502 |
+
cites.append(match.group(1))
|
| 503 |
+
row = Sentence(
|
| 504 |
+
source=source, source_file=path.name, source_sentence_id=sid,
|
| 505 |
+
author=author, work=work, work_id=work_id, text=text,
|
| 506 |
+
conllu=block["conllu"], cts_urn=cts,
|
| 507 |
+
passage=comments.get("source", ""), genre=genre, native_cites=cites,
|
| 508 |
+
priority=0,
|
| 509 |
+
)
|
| 510 |
+
row.source_records = [source_record(source, revisions, path.name, sid)]
|
| 511 |
+
(verse if genre == "verse" else prose).append(row)
|
| 512 |
+
return prose, verse
|
| 513 |
+
|
| 514 |
+
|
| 515 |
+
def gorman_author(filename: str) -> str:
|
| 516 |
+
for pattern, author in GORMAN_AUTHOR_PATTERNS:
|
| 517 |
+
if re.search(pattern, filename, re.I if pattern.startswith("^") else 0):
|
| 518 |
+
return author
|
| 519 |
+
return "Unknown"
|
| 520 |
+
|
| 521 |
+
|
| 522 |
+
def parse_native_collection(
|
| 523 |
+
source: str,
|
| 524 |
+
files: Iterable[Path],
|
| 525 |
+
revisions: dict[str, str],
|
| 526 |
+
metadata: dict[str, tuple[str, str]] | None = None,
|
| 527 |
+
verse_files: set[str] | None = None,
|
| 528 |
+
) -> tuple[list[Sentence], list[Sentence]]:
|
| 529 |
+
prose, verse = [], []
|
| 530 |
+
metadata = metadata or {}
|
| 531 |
+
verse_files = verse_files or set()
|
| 532 |
+
for path in sorted(files):
|
| 533 |
+
try:
|
| 534 |
+
tree = ET.parse(path)
|
| 535 |
+
except ET.ParseError:
|
| 536 |
+
continue
|
| 537 |
+
xml_root = tree.getroot()
|
| 538 |
+
if xml_root.get("{http://www.w3.org/XML/1998/namespace}lang") == "lat":
|
| 539 |
+
continue
|
| 540 |
+
first = next(xml_root.iter("sentence"), None)
|
| 541 |
+
if first is None:
|
| 542 |
+
continue
|
| 543 |
+
if source == "gorman":
|
| 544 |
+
author, work = gorman_author(path.name), path.stem
|
| 545 |
+
else:
|
| 546 |
+
author, work = metadata.get(path.name, (first.get("Author", "") or "Unknown", path.stem))
|
| 547 |
+
author = canonical_author(author)
|
| 548 |
+
genre = "verse" if path.name in verse_files else "prose"
|
| 549 |
+
doc = first.get("document_id", "")
|
| 550 |
+
cts = infer_cts(doc)
|
| 551 |
+
work_id = cts_key(doc) or f"{source}:{slug(author)}:{slug(work)}"
|
| 552 |
+
for index, sent in enumerate(xml_root.iter("sentence"), 1):
|
| 553 |
+
sid = sent.get("id", str(index))
|
| 554 |
+
passage = sent.get("subdoc", "")
|
| 555 |
+
text, conllu, cites = xml_sentence_to_conllu(sent, {
|
| 556 |
+
"sent_id": f"{source}:{slug(path.stem)}:{sid}", "source": path.name,
|
| 557 |
+
"cts": cts, "passage": passage,
|
| 558 |
+
})
|
| 559 |
+
if not normalize(text):
|
| 560 |
+
continue
|
| 561 |
+
row = Sentence(
|
| 562 |
+
source=source, source_file=path.name, source_sentence_id=sid,
|
| 563 |
+
author=author, work=work, work_id=work_id, text=text, conllu=conllu,
|
| 564 |
+
cts_urn=cts, passage=passage, genre=genre, native_cites=cites,
|
| 565 |
+
priority={"gorman": 5, "harrington": 15, "pedalion": 20}.get(source, 20),
|
| 566 |
+
)
|
| 567 |
+
row.source_records = [source_record(source, revisions, path.name, sid)]
|
| 568 |
+
(verse if genre == "verse" else prose).append(row)
|
| 569 |
+
return prose, verse
|
| 570 |
+
|
| 571 |
+
|
| 572 |
+
def publication_metadata(config_path: Path) -> dict[str, tuple[str, str]]:
|
| 573 |
+
config = json.loads(config_path.read_text())
|
| 574 |
+
result = {}
|
| 575 |
+
|
| 576 |
+
def visit(value):
|
| 577 |
+
if isinstance(value, dict):
|
| 578 |
+
if "author" in value and "work" in value:
|
| 579 |
+
for section in value.get("sections", []):
|
| 580 |
+
xml = section.get("xml", "")
|
| 581 |
+
if xml:
|
| 582 |
+
result[Path(xml).name] = (value["author"], value["work"])
|
| 583 |
+
for child in value.values():
|
| 584 |
+
visit(child)
|
| 585 |
+
elif isinstance(value, list):
|
| 586 |
+
for child in value:
|
| 587 |
+
visit(child)
|
| 588 |
+
|
| 589 |
+
visit(config)
|
| 590 |
+
return result
|
| 591 |
+
|
| 592 |
+
|
| 593 |
+
class HypotacticParser(HTMLParser):
|
| 594 |
+
def __init__(self, stem: str):
|
| 595 |
+
super().__init__(convert_charrefs=True)
|
| 596 |
+
self.stem = stem
|
| 597 |
+
self.container = {}
|
| 598 |
+
self.depth = 0
|
| 599 |
+
self.line_depth = None
|
| 600 |
+
self.line = None
|
| 601 |
+
self.word_depth = None
|
| 602 |
+
self.word_text = []
|
| 603 |
+
self.syll_depth = None
|
| 604 |
+
self.syllable = None
|
| 605 |
+
self.lines = []
|
| 606 |
+
|
| 607 |
+
def handle_starttag(self, tag, attrs):
|
| 608 |
+
self.depth += 1
|
| 609 |
+
attrs = dict(attrs)
|
| 610 |
+
classes = set(attrs.get("class", "").split())
|
| 611 |
+
if tag == "div" and self.line is None and "line" not in classes:
|
| 612 |
+
for key in ("data-author", "data-work", "data-book", "data-metre"):
|
| 613 |
+
if key in attrs and key not in self.container:
|
| 614 |
+
self.container[key] = attrs[key]
|
| 615 |
+
if tag == "div" and "line" in classes:
|
| 616 |
+
self.line_depth = self.depth
|
| 617 |
+
self.line = {
|
| 618 |
+
"number": attrs.get("data-number", ""),
|
| 619 |
+
"metre": attrs.get("data-metre", self.container.get("data-metre", "")),
|
| 620 |
+
"speaker": attrs.get("data-speaker", ""),
|
| 621 |
+
"words": [], "syllables": [],
|
| 622 |
+
}
|
| 623 |
+
elif self.line is not None and tag == "span" and "word" in classes:
|
| 624 |
+
self.word_depth = self.depth
|
| 625 |
+
self.word_text = []
|
| 626 |
+
if self.line is not None and tag == "span" and "syll" in classes:
|
| 627 |
+
quantity = "long" if "long" in classes else "short" if "short" in classes else "anceps" if "anceps" in classes else "unknown"
|
| 628 |
+
self.syll_depth = self.depth
|
| 629 |
+
self.syllable = {
|
| 630 |
+
"text": "", "quantity": quantity,
|
| 631 |
+
"features": sorted(classes - {"syll", "long", "short", "anceps"}),
|
| 632 |
+
}
|
| 633 |
+
|
| 634 |
+
def handle_data(self, data):
|
| 635 |
+
if self.word_depth is not None:
|
| 636 |
+
self.word_text.append(data)
|
| 637 |
+
if self.syllable is not None:
|
| 638 |
+
self.syllable["text"] += data
|
| 639 |
+
|
| 640 |
+
def handle_endtag(self, tag):
|
| 641 |
+
if self.syll_depth == self.depth and self.syllable is not None:
|
| 642 |
+
self.line["syllables"].append(self.syllable)
|
| 643 |
+
self.syllable = None
|
| 644 |
+
self.syll_depth = None
|
| 645 |
+
if self.word_depth == self.depth and tag == "span":
|
| 646 |
+
word = "".join(self.word_text).strip()
|
| 647 |
+
if word:
|
| 648 |
+
self.line["words"].append(word)
|
| 649 |
+
self.word_depth = None
|
| 650 |
+
self.word_text = []
|
| 651 |
+
if self.line_depth == self.depth and tag == "div":
|
| 652 |
+
self.line["text"] = " ".join(self.line.pop("words"))
|
| 653 |
+
symbols = {"long": "–", "short": "⏑", "anceps": "×", "unknown": "?"}
|
| 654 |
+
self.line["scansion"] = "".join(symbols[s["quantity"]] for s in self.line["syllables"])
|
| 655 |
+
self.line["hypotactic_file"] = self.stem + ".html"
|
| 656 |
+
self.line.update({
|
| 657 |
+
"hypotactic_author": self.container.get("data-author", ""),
|
| 658 |
+
"hypotactic_work": self.container.get("data-work", ""),
|
| 659 |
+
"book": self.container.get("data-book", ""),
|
| 660 |
+
})
|
| 661 |
+
if self.line["text"] and self.line["number"]:
|
| 662 |
+
self.lines.append(self.line)
|
| 663 |
+
self.line = None
|
| 664 |
+
self.line_depth = None
|
| 665 |
+
self.depth -= 1
|
| 666 |
+
|
| 667 |
+
|
| 668 |
+
def parse_hypotactic_file(path: Path) -> list[dict]:
|
| 669 |
+
parser = HypotacticParser(path.stem)
|
| 670 |
+
parser.feed(path.read_text(encoding="utf8"))
|
| 671 |
+
# Older files do not carry book metadata; recover it from their stem.
|
| 672 |
+
book_match = re.match(r"(?:iliad|odyssey|dionysiaca|qsmyrnaeus)(\d+)$", path.stem)
|
| 673 |
+
for line in parser.lines:
|
| 674 |
+
if not line["book"] and book_match:
|
| 675 |
+
line["book"] = book_match.group(1)
|
| 676 |
+
line["normalized"] = normalize(line["text"])
|
| 677 |
+
return parser.lines
|
| 678 |
+
|
| 679 |
+
|
| 680 |
+
def load_hypotactic(root: Path) -> dict[str, list[dict]]:
|
| 681 |
+
html_root = root / "hypotactic_htmls_greek"
|
| 682 |
+
needed = sorted({stem for link in VERSE_LINKS.values() for stem in link["files"]})
|
| 683 |
+
return {stem: parse_hypotactic_file(html_root / f"{stem}.html") for stem in needed}
|
| 684 |
+
|
| 685 |
+
|
| 686 |
+
def line_reference_index(lines: list[dict]) -> dict[str, list[dict]]:
|
| 687 |
+
index = defaultdict(list)
|
| 688 |
+
for line in lines:
|
| 689 |
+
index[line["number"]].append(line)
|
| 690 |
+
if line["book"]:
|
| 691 |
+
index[f"{line['book']}.{line['number']}"].append(line)
|
| 692 |
+
return index
|
| 693 |
+
|
| 694 |
+
|
| 695 |
+
def candidate_lines(
|
| 696 |
+
sentence: Sentence,
|
| 697 |
+
lines: list[dict],
|
| 698 |
+
reference_index: dict[str, list[dict]] | None = None,
|
| 699 |
+
) -> list[dict]:
|
| 700 |
+
sentence_norm = sentence.normalized
|
| 701 |
+
if not sentence_norm:
|
| 702 |
+
return []
|
| 703 |
+
cited = set()
|
| 704 |
+
for cite in sentence.native_cites:
|
| 705 |
+
ref = cite.rsplit(":", 1)[-1]
|
| 706 |
+
cited.add(ref)
|
| 707 |
+
if ref.startswith("1.") and sentence.work_id.startswith("tlg0020"):
|
| 708 |
+
cited.add(ref[2:])
|
| 709 |
+
candidates = lines
|
| 710 |
+
if cited:
|
| 711 |
+
reference_index = reference_index or line_reference_index(lines)
|
| 712 |
+
selected = []
|
| 713 |
+
seen = set()
|
| 714 |
+
for ref in cited:
|
| 715 |
+
for line in reference_index.get(ref, []):
|
| 716 |
+
marker = (line["hypotactic_file"], line["number"])
|
| 717 |
+
if marker not in seen:
|
| 718 |
+
seen.add(marker)
|
| 719 |
+
selected.append(line)
|
| 720 |
+
if selected:
|
| 721 |
+
candidates = selected
|
| 722 |
+
found = [
|
| 723 |
+
line for line in candidates
|
| 724 |
+
if line["normalized"] and line["normalized"] in sentence_norm
|
| 725 |
+
]
|
| 726 |
+
if found or candidates is lines:
|
| 727 |
+
return found
|
| 728 |
+
# Some original CTS citations use a different line numbering from the
|
| 729 |
+
# Hypotactic edition (Prometheus Bound is the conspicuous case). Exact
|
| 730 |
+
# full-line containment remains safe, so fall back to all lines.
|
| 731 |
+
return [
|
| 732 |
+
line for line in lines
|
| 733 |
+
if line["normalized"] and line["normalized"] in sentence_norm
|
| 734 |
+
]
|
| 735 |
+
|
| 736 |
+
|
| 737 |
+
def align_verse(verse_sentences: list[Sentence], hyp: dict[str, list[dict]], revisions: dict[str, str]) -> tuple[list[dict], list[dict], dict]:
|
| 738 |
+
sentence_rows, metre_rows = [], []
|
| 739 |
+
alignment_stats = defaultdict(lambda: Counter(sentences=0, matched_sentences=0, matched_lines=0))
|
| 740 |
+
seen_lines = set()
|
| 741 |
+
line_cache = {}
|
| 742 |
+
index_cache = {}
|
| 743 |
+
for link_key, link in VERSE_LINKS.items():
|
| 744 |
+
lines = [line for stem in link["files"] for line in hyp[stem]]
|
| 745 |
+
line_cache[link_key] = lines
|
| 746 |
+
index_cache[link_key] = line_reference_index(lines)
|
| 747 |
+
for sentence in verse_sentences:
|
| 748 |
+
link_key = sentence.work_id
|
| 749 |
+
if sentence.source == "pedalion":
|
| 750 |
+
link_key = f"pedalion:{sentence.source_file}"
|
| 751 |
+
link = VERSE_LINKS.get(link_key)
|
| 752 |
+
if not link:
|
| 753 |
+
continue
|
| 754 |
+
lines = line_cache[link_key]
|
| 755 |
+
stats = alignment_stats[link_key]
|
| 756 |
+
stats["sentences"] += 1
|
| 757 |
+
matched = candidate_lines(sentence, lines, index_cache[link_key])
|
| 758 |
+
if not matched:
|
| 759 |
+
continue
|
| 760 |
+
stats["matched_sentences"] += 1
|
| 761 |
+
stats["matched_lines"] += len(matched)
|
| 762 |
+
row_id = "vs-" + stable_id(sentence.source, sentence.source_file, sentence.source_sentence_id)
|
| 763 |
+
lines_by_file = defaultdict(list)
|
| 764 |
+
for line in matched:
|
| 765 |
+
lines_by_file[line["hypotactic_file"]].append(line)
|
| 766 |
+
source_records = list(sentence.source_records) + [
|
| 767 |
+
source_record(
|
| 768 |
+
"hypotactic", revisions, source_file,
|
| 769 |
+
",".join(f"{line['book']}:{line['number']}" for line in file_lines),
|
| 770 |
+
)
|
| 771 |
+
for source_file, file_lines in sorted(lines_by_file.items())
|
| 772 |
+
]
|
| 773 |
+
sentence_rows.append({
|
| 774 |
+
"id": row_id, "author": sentence.author, "work": sentence.work,
|
| 775 |
+
"work_id": sentence.work_id, "genre": "verse_sentence", "text": sentence.text,
|
| 776 |
+
"conllu": sentence.conllu, "cts_urn": sentence.cts_urn, "passage": sentence.passage,
|
| 777 |
+
"metre": sorted({line["metre"] for line in matched}),
|
| 778 |
+
"metrical_lines": json.dumps([{k: v for k, v in line.items() if k != "normalized"} for line in matched], ensure_ascii=False),
|
| 779 |
+
"treebank_source": sentence.source,
|
| 780 |
+
"source_records": json.dumps(source_records, ensure_ascii=False, sort_keys=True),
|
| 781 |
+
"licenses": sorted({record["license"] for record in source_records}),
|
| 782 |
+
"dedup_key": hashlib.sha256(sentence.normalized.encode()).hexdigest(),
|
| 783 |
+
})
|
| 784 |
+
for line in matched:
|
| 785 |
+
logical_line = (sentence.work_id, line["hypotactic_file"], line["number"])
|
| 786 |
+
if logical_line in seen_lines:
|
| 787 |
+
continue
|
| 788 |
+
seen_lines.add(logical_line)
|
| 789 |
+
line_source_records = list(sentence.source_records) + [source_record(
|
| 790 |
+
"hypotactic", revisions, line["hypotactic_file"],
|
| 791 |
+
f"{line['book']}:{line['number']}",
|
| 792 |
+
)]
|
| 793 |
+
metre_rows.append({
|
| 794 |
+
"id": "vm-" + stable_id(*logical_line), "parent_sentence_id": row_id,
|
| 795 |
+
"author": sentence.author, "work": sentence.work, "work_id": sentence.work_id,
|
| 796 |
+
"genre": "verse_metre", "text": line["text"], "conllu": sentence.conllu,
|
| 797 |
+
"cts_urn": sentence.cts_urn, "passage": sentence.passage,
|
| 798 |
+
"book": line["book"], "line_number": line["number"], "metre": line["metre"],
|
| 799 |
+
"scansion": line["scansion"],
|
| 800 |
+
"syllables": json.dumps(line["syllables"], ensure_ascii=False),
|
| 801 |
+
"hypotactic_file": line["hypotactic_file"], "treebank_source": sentence.source,
|
| 802 |
+
"source_records": json.dumps(line_source_records, ensure_ascii=False, sort_keys=True),
|
| 803 |
+
"licenses": sorted({record["license"] for record in line_source_records}),
|
| 804 |
+
"dedup_key": hashlib.sha256(line["normalized"].encode()).hexdigest(),
|
| 805 |
+
})
|
| 806 |
+
return sentence_rows, metre_rows, {key: dict(value) for key, value in alignment_stats.items()}
|
| 807 |
+
|
| 808 |
+
|
| 809 |
+
def deduplicate_prose(rows: list[Sentence]) -> tuple[list[dict], dict]:
|
| 810 |
+
groups = defaultdict(list)
|
| 811 |
+
for row in rows:
|
| 812 |
+
if row.normalized:
|
| 813 |
+
groups[hashlib.sha256(row.normalized.encode()).hexdigest()].append(row)
|
| 814 |
+
output = []
|
| 815 |
+
duplicate_groups = 0
|
| 816 |
+
duplicate_rows = 0
|
| 817 |
+
conflicting_author_groups = 0
|
| 818 |
+
conflicting_author_rows = 0
|
| 819 |
+
conflict_examples = []
|
| 820 |
+
for key, members in groups.items():
|
| 821 |
+
authors = {canonical_author(member.author) for member in members}
|
| 822 |
+
if len(authors) > 1:
|
| 823 |
+
conflicting_author_groups += 1
|
| 824 |
+
conflicting_author_rows += len(members)
|
| 825 |
+
if len(conflict_examples) < 25:
|
| 826 |
+
conflict_examples.append({
|
| 827 |
+
"dedup_key": key,
|
| 828 |
+
"authors": sorted(authors),
|
| 829 |
+
"normalized_length": len(members[0].normalized),
|
| 830 |
+
"sources": sorted({member.source for member in members}),
|
| 831 |
+
})
|
| 832 |
+
continue
|
| 833 |
+
members.sort(key=lambda row: (row.priority, row.source, row.source_file, row.source_sentence_id))
|
| 834 |
+
chosen = members[0]
|
| 835 |
+
source_records = []
|
| 836 |
+
seen = set()
|
| 837 |
+
for member in members:
|
| 838 |
+
for record in member.source_records:
|
| 839 |
+
record_key = (record["source"], record["source_file"], record["source_sentence_id"])
|
| 840 |
+
if record_key not in seen:
|
| 841 |
+
seen.add(record_key)
|
| 842 |
+
source_records.append(record)
|
| 843 |
+
if len(members) > 1:
|
| 844 |
+
duplicate_groups += 1
|
| 845 |
+
duplicate_rows += len(members) - 1
|
| 846 |
+
output.append({
|
| 847 |
+
"id": "p-" + stable_id(chosen.source, chosen.source_file, chosen.source_sentence_id),
|
| 848 |
+
"author": chosen.author, "work": chosen.work, "work_id": chosen.work_id,
|
| 849 |
+
"genre": "prose", "text": chosen.text, "conllu": chosen.conllu,
|
| 850 |
+
"cts_urn": chosen.cts_urn, "passage": chosen.passage,
|
| 851 |
+
"treebank_source": chosen.source,
|
| 852 |
+
"source_records": json.dumps(source_records, ensure_ascii=False, sort_keys=True),
|
| 853 |
+
"licenses": sorted({record["license"] for record in source_records}),
|
| 854 |
+
"dedup_key": key,
|
| 855 |
+
})
|
| 856 |
+
output.sort(key=lambda row: row["id"])
|
| 857 |
+
return output, {
|
| 858 |
+
"input_rows": len(rows), "output_rows": len(output),
|
| 859 |
+
"duplicate_groups": duplicate_groups, "removed_exact_duplicates": duplicate_rows,
|
| 860 |
+
"conflicting_author_groups_removed": conflicting_author_groups,
|
| 861 |
+
"conflicting_author_rows_removed": conflicting_author_rows,
|
| 862 |
+
"conflict_examples": conflict_examples,
|
| 863 |
+
}
|
| 864 |
+
|
| 865 |
+
|
| 866 |
+
def assign_splits(rows: list[dict], parent_splits: dict[str, str] | None = None) -> None:
|
| 867 |
+
if parent_splits is not None:
|
| 868 |
+
for row in rows:
|
| 869 |
+
row["split"] = parent_splits[row["parent_sentence_id"]]
|
| 870 |
+
return
|
| 871 |
+
groups = defaultdict(list)
|
| 872 |
+
for row in rows:
|
| 873 |
+
groups[(row["author"], row["work_id"])].append(row)
|
| 874 |
+
for group_rows in groups.values():
|
| 875 |
+
group_rows.sort(key=lambda row: hashlib.sha256(row["id"].encode()).hexdigest())
|
| 876 |
+
n = len(group_rows)
|
| 877 |
+
if n < 3:
|
| 878 |
+
n_val = n_test = 0
|
| 879 |
+
elif n < 10:
|
| 880 |
+
n_val = n_test = 1
|
| 881 |
+
else:
|
| 882 |
+
n_val = max(1, round(n * 0.1))
|
| 883 |
+
n_test = max(1, round(n * 0.1))
|
| 884 |
+
for index, row in enumerate(group_rows):
|
| 885 |
+
row["split"] = "validation" if index < n_val else "test" if index < n_val + n_test else "train"
|
| 886 |
+
|
| 887 |
+
|
| 888 |
+
def write_parquet(rows: list[dict], output_root: Path, config: str) -> dict:
|
| 889 |
+
stats = {}
|
| 890 |
+
config_root = output_root / config
|
| 891 |
+
config_root.mkdir(parents=True, exist_ok=True)
|
| 892 |
+
for split in ("train", "validation", "test"):
|
| 893 |
+
split_rows = [row for row in rows if row["split"] == split]
|
| 894 |
+
table = pa.Table.from_pylist(split_rows)
|
| 895 |
+
path = config_root / f"{split}-00000-of-00001.parquet"
|
| 896 |
+
pq.write_table(table, path, compression="zstd", compression_level=9)
|
| 897 |
+
stats[split] = len(split_rows)
|
| 898 |
+
return stats
|
| 899 |
+
|
| 900 |
+
|
| 901 |
+
def validate(rows_by_config: dict[str, list[dict]]) -> dict:
|
| 902 |
+
report = {}
|
| 903 |
+
for config, rows in rows_by_config.items():
|
| 904 |
+
ids = [row["id"] for row in rows]
|
| 905 |
+
dedup = [row["dedup_key"] for row in rows]
|
| 906 |
+
assert len(ids) == len(set(ids)), f"duplicate ids in {config}"
|
| 907 |
+
assert all(row["genre"] == config for row in rows)
|
| 908 |
+
assert all(row["text"] and row["author"] and row["work"] for row in rows)
|
| 909 |
+
assert all(row["split"] in {"train", "validation", "test"} for row in rows)
|
| 910 |
+
if config == "prose":
|
| 911 |
+
assert len(dedup) == len(set(dedup)), "prose exact-text deduplication failed"
|
| 912 |
+
report[config] = {
|
| 913 |
+
"rows": len(rows),
|
| 914 |
+
"authors": len({row["author"] for row in rows}),
|
| 915 |
+
"works": len({row["work_id"] for row in rows}),
|
| 916 |
+
"sources": dict(Counter(row["treebank_source"] for row in rows)),
|
| 917 |
+
"splits": dict(Counter(row["split"] for row in rows)),
|
| 918 |
+
}
|
| 919 |
+
parent_splits = {row["id"]: row["split"] for row in rows_by_config["verse_sentence"]}
|
| 920 |
+
assert all(parent_splits[row["parent_sentence_id"]] == row["split"] for row in rows_by_config["verse_metre"])
|
| 921 |
+
report["checks"] = {
|
| 922 |
+
"unique_ids": True, "prose_exact_text_unique": True,
|
| 923 |
+
"verse_parent_split_consistency": True,
|
| 924 |
+
}
|
| 925 |
+
return report
|
| 926 |
+
|
| 927 |
+
|
| 928 |
+
def main() -> None:
|
| 929 |
+
parser = argparse.ArgumentParser()
|
| 930 |
+
parser.add_argument("--sources", type=Path, required=True)
|
| 931 |
+
parser.add_argument("--output", type=Path, default=Path("data"))
|
| 932 |
+
parser.add_argument("--metadata", type=Path, default=Path("metadata"))
|
| 933 |
+
args = parser.parse_args()
|
| 934 |
+
|
| 935 |
+
revisions = {
|
| 936 |
+
key: git_revision(args.sources / info["directory"])
|
| 937 |
+
for key, info in SOURCE_INFO.items()
|
| 938 |
+
}
|
| 939 |
+
|
| 940 |
+
agdt_prose, agdt_verse = parse_agdt(args.sources / "treebank_data", revisions)
|
| 941 |
+
ud_perseus_prose, _ = parse_ud("ud_perseus", args.sources / "perseus", revisions)
|
| 942 |
+
proiel_prose, _ = parse_ud("ud_proiel", args.sources / "proiel", revisions)
|
| 943 |
+
ptnk_prose, _ = parse_ud("ud_ptnk", args.sources / "ptnk", revisions)
|
| 944 |
+
|
| 945 |
+
gorman_prose, _ = parse_native_collection(
|
| 946 |
+
"gorman", (args.sources / "gorman" / "xml versions").glob("*.xml"), revisions,
|
| 947 |
+
)
|
| 948 |
+
pedalion_meta = publication_metadata(args.sources / "pedalion" / "src" / "config.json")
|
| 949 |
+
# The Pedalion card groups these three files under "diverse authors";
|
| 950 |
+
# restore the file-level attributions encoded in the XML.
|
| 951 |
+
pedalion_meta.update({
|
| 952 |
+
"semonides.xml": ("Semonides", "Typology of Women"),
|
| 953 |
+
"theoc.xml": ("Theocritus", "Fragments"),
|
| 954 |
+
"mimn.xml": ("Mimnermus", "Fragments"),
|
| 955 |
+
})
|
| 956 |
+
pedalion_files = [
|
| 957 |
+
path for path in (args.sources / "pedalion" / "public" / "xml").glob("*.xml")
|
| 958 |
+
if path.name not in PEDALION_EXCLUDE
|
| 959 |
+
]
|
| 960 |
+
pedalion_prose, pedalion_verse = parse_native_collection(
|
| 961 |
+
"pedalion", pedalion_files, revisions, pedalion_meta, PEDALION_VERSE,
|
| 962 |
+
)
|
| 963 |
+
harrington_meta = publication_metadata(args.sources / "harrington" / "src" / "config.json")
|
| 964 |
+
harrington_prose, _ = parse_native_collection(
|
| 965 |
+
"harrington",
|
| 966 |
+
(args.sources / "harrington" / "public" / "xml" / "CITE_TREEBANK_XML" / "perseus" / "grctb").rglob("*.xml"),
|
| 967 |
+
revisions, harrington_meta,
|
| 968 |
+
)
|
| 969 |
+
|
| 970 |
+
prose_input = (
|
| 971 |
+
ud_perseus_prose + proiel_prose + ptnk_prose + agdt_prose + gorman_prose
|
| 972 |
+
+ pedalion_prose + harrington_prose
|
| 973 |
+
)
|
| 974 |
+
prose, dedup_stats = deduplicate_prose(prose_input)
|
| 975 |
+
assign_splits(prose)
|
| 976 |
+
|
| 977 |
+
hyp = load_hypotactic(args.sources / "hypotactic")
|
| 978 |
+
verse_sentence, verse_metre, alignment_stats = align_verse(
|
| 979 |
+
agdt_verse + pedalion_verse, hyp, revisions,
|
| 980 |
+
)
|
| 981 |
+
assign_splits(verse_sentence)
|
| 982 |
+
parent_splits = {row["id"]: row["split"] for row in verse_sentence}
|
| 983 |
+
assign_splits(verse_metre, parent_splits)
|
| 984 |
+
|
| 985 |
+
rows_by_config = {
|
| 986 |
+
"prose": prose, "verse_sentence": verse_sentence, "verse_metre": verse_metre,
|
| 987 |
+
}
|
| 988 |
+
validation = validate(rows_by_config)
|
| 989 |
+
|
| 990 |
+
data_stats = {
|
| 991 |
+
config: write_parquet(rows, args.output, config)
|
| 992 |
+
for config, rows in rows_by_config.items()
|
| 993 |
+
}
|
| 994 |
+
args.metadata.mkdir(parents=True, exist_ok=True)
|
| 995 |
+
(args.metadata / "source_revisions.json").write_text(
|
| 996 |
+
json.dumps({
|
| 997 |
+
key: {**SOURCE_INFO[key], "revision": revision}
|
| 998 |
+
for key, revision in revisions.items()
|
| 999 |
+
}, indent=2, ensure_ascii=False) + "\n"
|
| 1000 |
+
)
|
| 1001 |
+
(args.metadata / "build_report.json").write_text(json.dumps({
|
| 1002 |
+
"data_files": data_stats,
|
| 1003 |
+
"deduplication": dedup_stats,
|
| 1004 |
+
"alignment": alignment_stats,
|
| 1005 |
+
"validation": validation,
|
| 1006 |
+
"excluded": {
|
| 1007 |
+
"aphthonius": "No redistribution license is specified upstream.",
|
| 1008 |
+
"pedalion_mixed": sorted(PEDALION_EXCLUDE),
|
| 1009 |
+
"harrington_grctb_805": "File declares xml:lang=lat and contains Cicero despite its grctb path.",
|
| 1010 |
+
},
|
| 1011 |
+
}, indent=2, ensure_ascii=False, sort_keys=True) + "\n")
|
| 1012 |
+
print(json.dumps(validation, indent=2, ensure_ascii=False))
|
| 1013 |
+
|
| 1014 |
+
|
| 1015 |
+
if __name__ == "__main__":
|
| 1016 |
+
main()
|
scripts/validate_dataset.py
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Independent validation for the published Sphregis Parquet files."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import argparse
|
| 7 |
+
import json
|
| 8 |
+
import re
|
| 9 |
+
import unicodedata
|
| 10 |
+
from collections import Counter
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
|
| 13 |
+
import pyarrow.parquet as pq
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
CONFIGS = ("prose", "verse_sentence", "verse_metre")
|
| 17 |
+
SPLITS = ("train", "validation", "test")
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
LIGHT_COLUMNS = [
|
| 21 |
+
"id", "parent_sentence_id", "author", "work", "genre", "text",
|
| 22 |
+
"dedup_key", "split",
|
| 23 |
+
]
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def read_config(root: Path, config: str) -> list[dict]:
|
| 27 |
+
rows = []
|
| 28 |
+
for split in SPLITS:
|
| 29 |
+
path = root / config / f"{split}-00000-of-00001.parquet"
|
| 30 |
+
assert path.is_file(), f"missing {path}"
|
| 31 |
+
parquet = pq.ParquetFile(path)
|
| 32 |
+
columns = [name for name in LIGHT_COLUMNS if name in parquet.schema.names]
|
| 33 |
+
part = parquet.read(columns=columns, use_threads=False).to_pylist()
|
| 34 |
+
assert all(row["split"] == split for row in part), f"split label mismatch in {path}"
|
| 35 |
+
rows.extend(part)
|
| 36 |
+
return rows
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def normalize(text: str) -> str:
|
| 40 |
+
text = text.lower().replace("ς", "σ")
|
| 41 |
+
text = "".join(
|
| 42 |
+
char for char in unicodedata.normalize("NFD", text)
|
| 43 |
+
if unicodedata.category(char) != "Mn"
|
| 44 |
+
)
|
| 45 |
+
return "".join(char for char in text if char.isalpha())
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def validate_provenance_and_verse(root: Path, parent_texts: dict[str, str]) -> int:
|
| 49 |
+
checked_lines = 0
|
| 50 |
+
required_record_fields = {
|
| 51 |
+
"source", "source_file", "source_sentence_id", "url", "revision",
|
| 52 |
+
"license", "annotation_provenance", "syntax_scheme",
|
| 53 |
+
}
|
| 54 |
+
for config in CONFIGS:
|
| 55 |
+
for split in SPLITS:
|
| 56 |
+
path = root / config / f"{split}-00000-of-00001.parquet"
|
| 57 |
+
columns = ["source_records", "licenses"]
|
| 58 |
+
if config == "verse_sentence":
|
| 59 |
+
columns += ["text", "metrical_lines"]
|
| 60 |
+
elif config == "verse_metre":
|
| 61 |
+
columns += [
|
| 62 |
+
"parent_sentence_id", "text", "metre", "scansion",
|
| 63 |
+
"syllables", "hypotactic_file",
|
| 64 |
+
]
|
| 65 |
+
parquet = pq.ParquetFile(path)
|
| 66 |
+
for batch in parquet.iter_batches(columns=columns, batch_size=256, use_threads=False):
|
| 67 |
+
for row in batch.to_pylist():
|
| 68 |
+
records = json.loads(row["source_records"])
|
| 69 |
+
assert records and all(required_record_fields <= record.keys() for record in records)
|
| 70 |
+
assert all(re.fullmatch(r"[0-9a-f]{40}", record["revision"]) for record in records)
|
| 71 |
+
assert sorted(row["licenses"]) == sorted({record["license"] for record in records})
|
| 72 |
+
if config == "verse_sentence":
|
| 73 |
+
lines = json.loads(row["metrical_lines"])
|
| 74 |
+
sentence_text = normalize(row["text"])
|
| 75 |
+
assert lines and all(normalize(line["text"]) in sentence_text for line in lines)
|
| 76 |
+
assert all(line["metre"] and line["scansion"] and line["syllables"] for line in lines)
|
| 77 |
+
elif config == "verse_metre":
|
| 78 |
+
assert normalize(row["text"]) in normalize(parent_texts[row["parent_sentence_id"]])
|
| 79 |
+
syllables = json.loads(row["syllables"])
|
| 80 |
+
assert row["metre"] and row["scansion"] and syllables
|
| 81 |
+
hyp_records = [record for record in records if record["source"] == "hypotactic"]
|
| 82 |
+
assert len(hyp_records) == 1
|
| 83 |
+
assert hyp_records[0]["source_file"] == row["hypotactic_file"]
|
| 84 |
+
checked_lines += 1
|
| 85 |
+
return checked_lines
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def validate_conllu(root: Path) -> int:
|
| 89 |
+
checked = 0
|
| 90 |
+
for config in ("prose", "verse_sentence"):
|
| 91 |
+
for split in SPLITS:
|
| 92 |
+
path = root / config / f"{split}-00000-of-00001.parquet"
|
| 93 |
+
parquet = pq.ParquetFile(path)
|
| 94 |
+
for batch in parquet.iter_batches(columns=["conllu"], batch_size=256, use_threads=False):
|
| 95 |
+
for conllu in batch.column(0).to_pylist():
|
| 96 |
+
token_rows = [
|
| 97 |
+
line.split("\t") for line in conllu.splitlines()
|
| 98 |
+
if line and not line.startswith("#") and re.fullmatch(r"\d+", line.split("\t", 1)[0])
|
| 99 |
+
]
|
| 100 |
+
assert token_rows and all(len(row) == 10 for row in token_rows)
|
| 101 |
+
ids = [int(row[0]) for row in token_rows]
|
| 102 |
+
assert ids == list(range(1, len(ids) + 1))
|
| 103 |
+
heads = [int(row[6]) for row in token_rows]
|
| 104 |
+
assert all(0 <= head <= len(ids) for head in heads)
|
| 105 |
+
assert all(token_id != head for token_id, head in zip(ids, heads))
|
| 106 |
+
assert sum(head == 0 for head in heads) == 1
|
| 107 |
+
assert sum(row[7] == "root" for row in token_rows) == 1
|
| 108 |
+
assert all((head == 0) == (row[7] == "root") for row, head in zip(token_rows, heads))
|
| 109 |
+
for token_id in ids:
|
| 110 |
+
visited = set()
|
| 111 |
+
cursor = token_id
|
| 112 |
+
while cursor:
|
| 113 |
+
assert cursor not in visited, "dependency cycle"
|
| 114 |
+
visited.add(cursor)
|
| 115 |
+
cursor = heads[cursor - 1]
|
| 116 |
+
checked += 1
|
| 117 |
+
return checked
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
def main() -> None:
|
| 121 |
+
parser = argparse.ArgumentParser()
|
| 122 |
+
parser.add_argument("--data", type=Path, default=Path("data"))
|
| 123 |
+
args = parser.parse_args()
|
| 124 |
+
configs = {config: read_config(args.data, config) for config in CONFIGS}
|
| 125 |
+
for config, rows in configs.items():
|
| 126 |
+
ids = [row["id"] for row in rows]
|
| 127 |
+
assert len(ids) == len(set(ids)), f"duplicate IDs in {config}"
|
| 128 |
+
assert all(row["genre"] == config for row in rows)
|
| 129 |
+
assert all(row["text"] and row["author"] and row["work"] for row in rows)
|
| 130 |
+
if config == "prose":
|
| 131 |
+
keys = [row["dedup_key"] for row in rows]
|
| 132 |
+
assert len(keys) == len(set(keys)), "prose is not exactly deduplicated"
|
| 133 |
+
print(config, len(rows), dict(Counter(row["split"] for row in rows)))
|
| 134 |
+
sentence_splits = {row["id"]: row["split"] for row in configs["verse_sentence"]}
|
| 135 |
+
assert all(
|
| 136 |
+
sentence_splits[row["parent_sentence_id"]] == row["split"]
|
| 137 |
+
for row in configs["verse_metre"]
|
| 138 |
+
), "verse sentence/metre split leakage"
|
| 139 |
+
parent_texts = {row["id"]: row["text"] for row in configs["verse_sentence"]}
|
| 140 |
+
checked_lines = validate_provenance_and_verse(args.data, parent_texts)
|
| 141 |
+
checked = validate_conllu(args.data)
|
| 142 |
+
print("validated aligned metrical lines", checked_lines)
|
| 143 |
+
print("validated CoNLL-U sentences", checked)
|
| 144 |
+
print("all checks passed")
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
if __name__ == "__main__":
|
| 148 |
+
main()
|