makron_oga.md: tail hotspot = misplaced silver marks after lunate sigma (grc_utils.only_bases drops ϲ)
Browse files- analysis/makron_oga.md +68 -1
- analysis/scripts/hf_rows_to_works.py +28 -0
analysis/makron_oga.md
CHANGED
|
@@ -40,7 +40,7 @@ Counts are per dichronon (`analysis/makron_oga_summary.json`):
|
|
| 40 |
`Δα^υί_δ`. This points to a mark-placement bug in grc-macronizer.
|
| 41 |
- The 60 most frequent changed forms are in `analysis/makron_oga_changed_forms_top60.tsv`.
|
| 42 |
- The last 100k rows (2.0M–2.1M) change 4.0% of their silver marks, against 0.6–1.0%
|
| 43 |
-
elsewhere
|
| 44 |
|
| 45 |
## 2. Case study: ἂν/ἄν
|
| 46 |
|
|
@@ -120,3 +120,70 @@ p is the share Makron got right in the sample:
|
|
| 120 |
- The judgments come from a single annotator.
|
| 121 |
- **To tighten the estimate:** judge a sample of the κ long → short cell, and enlarge the
|
| 122 |
two large samples.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
`Δα^υί_δ`. This points to a mark-placement bug in grc-macronizer.
|
| 41 |
- The 60 most frequent changed forms are in `analysis/makron_oga_changed_forms_top60.tsv`.
|
| 42 |
- The last 100k rows (2.0M–2.1M) change 4.0% of their silver marks, against 0.6–1.0%
|
| 43 |
+
elsewhere; see section 3.
|
| 44 |
|
| 45 |
## 2. Case study: ἂν/ἄν
|
| 46 |
|
|
|
|
| 120 |
- The judgments come from a single annotator.
|
| 121 |
- **To tighten the estimate:** judge a sample of the κ long → short cell, and enlarge the
|
| 122 |
two large samples.
|
| 123 |
+
|
| 124 |
+
## 3. The tail hotspot is a lunate-sigma bug in the silver data
|
| 125 |
+
|
| 126 |
+
**Mapping rows to works.** `analysis/scripts/hf_rows_to_works.py` maps every HF row to its
|
| 127 |
+
OGA work. It walks the macronizer parts in order alongside the rows; cleaning only removed
|
| 128 |
+
lines. All 2,096,720 rows matched, and the 138,034 source lines skipped equal the lines
|
| 129 |
+
cleaning removed (934 + 137,071 + 29). The mapping is in
|
| 130 |
+
`makron-seed1-5d737f8/row_to_work.tsv` on flash.
|
| 131 |
+
|
| 132 |
+
**Which works.** The last 100k rows hold 7 works. 86,894 of the rows are the Suda
|
| 133 |
+
(tlg9010.tlg001). In the tail:
|
| 134 |
+
|
| 135 |
+
| | count | share of silver marks |
|
| 136 |
+
|---|---:|---:|
|
| 137 |
+
| silver marks | 228,628 | |
|
| 138 |
+
| flips | 532 | 0.23%, same as the corpus |
|
| 139 |
+
| drops | 8,062 | 3.53% |
|
| 140 |
+
|
| 141 |
+
Of the drops, 8,334 changes come from the Suda alone. The other works with the highest
|
| 142 |
+
rates of changes are also printed with lunate sigma:
|
| 143 |
+
|
| 144 |
+
| work | drops |
|
| 145 |
+
|---|---:|
|
| 146 |
+
| pta9999.pta006–014 | 3–6% |
|
| 147 |
+
| tlg2806.tlg001 | 5.2% |
|
| 148 |
+
| tlg0087.tlg001/013 (Apollonius Dyscolus) | 2.9–4.0% |
|
| 149 |
+
| tlg0565.tlg001 | 3.3% |
|
| 150 |
+
| tlg2034.tlg014 | 3.3% |
|
| 151 |
+
|
| 152 |
+
**The silver mark sits after the ϲ instead of on the vowel.** In the Suda, 7,704 of 7,909
|
| 153 |
+
dropped marks are in words containing ϲ. Examples:
|
| 154 |
+
|
| 155 |
+
| silver | Makron |
|
| 156 |
+
|---|---|
|
| 157 |
+
| `ἄνδραϲ^` | `ἄ^νδρα^ϲ` |
|
| 158 |
+
| `πάνταϲ^` | `πά^ντα^ϲ` |
|
| 159 |
+
| `βαρβά^ροιϲ^` | |
|
| 160 |
+
| `Ἀβί^αϲ^` | |
|
| 161 |
+
|
| 162 |
+
Corpus-wide, 14,197 silver marks sit directly after a lunate sigma, in 47 works; 7,670 of
|
| 163 |
+
them are in the Suda.
|
| 164 |
+
|
| 165 |
+
**Cause.** `grc_utils.only_bases` deletes ϲ: `only_bases('ἄνδραϲ') == 'ανδρα'` and
|
| 166 |
+
`only_bases('βαρβάροιϲ') == 'βαρβαροι'`. Rules that test the ending of `only_bases(word)`
|
| 167 |
+
then see a word ending in a vowel and append the mark to the end of the token. In
|
| 168 |
+
`nominal_forms.py`, for example, `masc_and_neutre_short_alpha` returns `word + "^"` and
|
| 169 |
+
`dative_short_iota` does the same; `accent_rules` places marks in the same way. In the Suda
|
| 170 |
+
traces of run 5715083 (chunks 0–2), the marks after ϲ are credited as follows:
|
| 171 |
+
|
| 172 |
+
| module | marks after ϲ |
|
| 173 |
+
|---|---:|
|
| 174 |
+
| nominal_forms | 89 |
|
| 175 |
+
| accent_rules | 33 |
|
| 176 |
+
| prefix | 5 |
|
| 177 |
+
| verbal_forms | 2 |
|
| 178 |
+
| none credited | 16 |
|
| 179 |
+
|
| 180 |
+
**Consequences.**
|
| 181 |
+
- The marks are misplaced, not wrong lengths: the intended vowel goes unmarked and an
|
| 182 |
+
ineligible position gets the mark.
|
| 183 |
+
- Makron's training encoder only keeps labels at eligible dichrona, so these marks were
|
| 184 |
+
dropped in training rather than learned.
|
| 185 |
+
- Makron's flips in the same works are at the corpus rate, so the hotspot says nothing
|
| 186 |
+
about the model.
|
| 187 |
+
- grc-macronizer PR #13, which normalizes ϲ → σ/ς before the cascade and restores the
|
| 188 |
+
spelling afterwards, should remove the bug, since the modules then see ordinary sigmas.
|
| 189 |
+
This has not yet been verified on the Suda.
|
analysis/scripts/hf_rows_to_works.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Map each row of the HF data (final/data, file order) to its OGA work by walking the
|
| 2 |
+
macronizer parts (parts/*.txt, sorted, = the order of oga_macronized.txt) in step with the
|
| 3 |
+
rows; cleaning only removed lines, so a greedy in-order match is exact.
|
| 4 |
+
Usage: python3 hf_rows_to_works.py PARTS_DIR HF_DATA_DIR OUT_TSV"""
|
| 5 |
+
import glob, os, sys
|
| 6 |
+
import pyarrow.parquet as pq
|
| 7 |
+
parts, data, out = sys.argv[1:4]
|
| 8 |
+
rows = []
|
| 9 |
+
for f in sorted(glob.glob(os.path.join(data, "*.parquet"))):
|
| 10 |
+
rows += pq.read_table(f, columns=["macronized"]).column("macronized").to_pylist()
|
| 11 |
+
def stream():
|
| 12 |
+
for f in sorted(glob.glob(os.path.join(parts, "*.txt"))):
|
| 13 |
+
w = os.path.basename(f).split(".tok01")[0]
|
| 14 |
+
for l in open(f, encoding="utf-8"):
|
| 15 |
+
l = l.rstrip("\n")
|
| 16 |
+
if l.strip():
|
| 17 |
+
yield w, l
|
| 18 |
+
it = stream(); skipped = 0
|
| 19 |
+
with open(out, "w", encoding="utf-8") as fh:
|
| 20 |
+
fh.write("idx\twork\n")
|
| 21 |
+
for i, r in enumerate(rows):
|
| 22 |
+
for w, l in it:
|
| 23 |
+
if l == r:
|
| 24 |
+
fh.write(f"{i}\t{w}\n"); break
|
| 25 |
+
skipped += 1
|
| 26 |
+
else:
|
| 27 |
+
sys.exit(f"ran out of source lines at row {i}")
|
| 28 |
+
print(f"rows {len(rows)} matched, source lines skipped {skipped}")
|