Alvin commited on
Commit
105ea5a
·
1 Parent(s): 75d5ab7

Fix Linear B Wiktionary tr= extraction bug causing 5 wrong IPA values

Browse files

Root cause: re.search(r"|tr=([^|}]+)") matched the first tr= in the
entire wikitext, which for entries with {{quote-book}} templates was a
full tablet transliteration (e.g., "o-di-do-si du-ru-to-mo / ..."),
not the headword. This caused 5 entries (i-qo, ma-ra-tu-wo, o-do-ke,
o-di-do-si, wo-ro-ki-jo-ne-jo) to receive IPA from wrong Wiktionary
pages (po-ro, sa-sa-ma, a-re-pa, a-ko-so-ne, e-re-mo).

Fix: prefer unicode_to_translit(title) as primary transliteration,
only fall back to tr= from {{head|gmy|...}} templates. Removes 6
spurious entries created by wrong tr= extraction. Count: 2484 → 2478.

README.md CHANGED
@@ -150,7 +150,7 @@ The Gothic Bible is the primary source of Gothic text. The paper uses unsegmente
150
  |---|---|---|
151
  | `linear_b_signs.tsv` | [Unicode UCD](https://www.unicode.org/Public/UCD/latest/) | 211 signs: 88 syllabograms + 123 ideograms with Bennett numbers and IPA |
152
  | `sign_to_ipa.json` | Ventris & Chadwick (1973) | 74 syllabogram transliteration → IPA mappings |
153
- | `linear_b_words.tsv` | Multiple (see below) | 2,484 words with IPA, glosses, and source attribution |
154
 
155
  **Format:** Tab-separated values. The word list contains columns: `Word` (transliteration), `IPA`, `SCA` (sound class), `Source`, `Concept_ID`, `Cognate_Set_ID`, `Gloss`, `Word_Type`, `IPA_Source`. Words come from three CC-BY-SA compatible sources: [jhnwnstd/shannon](https://github.com/jhnwnstd/shannon) Linear B Lexicon (MIT, 2,272 entries), [Wiktionary](https://en.wiktionary.org/wiki/Category:Mycenaean_Greek_lemmas) Mycenaean Greek lemmas (CC-BY-SA, 170 entries with 46 expert IPA), and IE-CoR cognate pairs (42 entries). The sign inventory is from the Unicode Character Database.
156
 
 
150
  |---|---|---|
151
  | `linear_b_signs.tsv` | [Unicode UCD](https://www.unicode.org/Public/UCD/latest/) | 211 signs: 88 syllabograms + 123 ideograms with Bennett numbers and IPA |
152
  | `sign_to_ipa.json` | Ventris & Chadwick (1973) | 74 syllabogram transliteration → IPA mappings |
153
+ | `linear_b_words.tsv` | Multiple (see below) | 2,478 words with IPA, glosses, and source attribution |
154
 
155
  **Format:** Tab-separated values. The word list contains columns: `Word` (transliteration), `IPA`, `SCA` (sound class), `Source`, `Concept_ID`, `Cognate_Set_ID`, `Gloss`, `Word_Type`, `IPA_Source`. Words come from three CC-BY-SA compatible sources: [jhnwnstd/shannon](https://github.com/jhnwnstd/shannon) Linear B Lexicon (MIT, 2,272 entries), [Wiktionary](https://en.wiktionary.org/wiki/Category:Mycenaean_Greek_lemmas) Mycenaean Greek lemmas (CC-BY-SA, 170 entries with 46 expert IPA), and IE-CoR cognate pairs (42 entries). The sign inventory is from the Unicode Character Database.
156
 
data/linear_b/README.md CHANGED
@@ -6,7 +6,7 @@ Structured dataset for Linear B inscriptions and Mycenaean Greek vocabulary, com
6
 
7
  - `linear_b_signs.tsv` — Full sign inventory (211 signs: 88 syllabograms + 123 ideograms)
8
  - `sign_to_ipa.json` — 74 syllabogram transliterations mapped to IPA values
9
- - `linear_b_words.tsv` — 2,484 words with transliterations, IPA, glosses, and source attribution
10
  - `README.md` — This file
11
 
12
  ## Sign Inventory (`linear_b_signs.tsv`)
@@ -38,20 +38,20 @@ Columns: `Word`, `IPA`, `SCA`, `Source`, `Concept_ID`, `Cognate_Set_ID`, `Gloss`
38
 
39
  | Metric | Count |
40
  |--------|-------|
41
- | Total words | 2,484 |
42
- | Common nouns | 680 |
43
  | Anthroponyms (personal names) | 1,285 |
44
  | Toponyms (place names) | 209 |
45
  | Unknown meaning | ~250 |
46
  | Theonyms (deity names) | ~27 |
47
- | Expert IPA (Wiktionary/IE-CoR) | 77 |
48
- | Transliteration-derived IPA | 2,407 |
49
 
50
  ### IPA Sources
51
 
52
  IPA transcriptions come from three tiers of quality:
53
- 1. **Expert** (77 words): Scholarly reconstructions from Wiktionary `ts=` parameter and IE-CoR cognate pair data. Examples: `a-ke-ro` → `áŋɡelos`, `a-ku-ro` → `árguros`
54
- 2. **Transliteration conversion** (2,407 words): Systematic application of the Ventris grid IPA mapping to each syllable in the transliteration
55
  3. **IE-CoR cognate data** (42 words): 42 Mycenaean Greek words from the IE-CoR (Indo-European Cognate Relations) database with expert IPA reconstructions, linked to Concepticon concept IDs
56
 
57
  ### Word Types
@@ -81,7 +81,7 @@ IPA transcriptions come from three tiers of quality:
81
 
82
  ## Limitations
83
 
84
- 1. **IPA quality varies**: Only 77 words have expert IPA reconstructions. The remaining 2,407 use systematic transliteration conversion, which captures the syllabic structure but not phonological details like aspiration, vowel length, or accent.
85
  2. **Glosses are noisy**: The Shannon lexicon definitions contain scholarly concordance notes, not clean dictionary glosses. Parsing extracts the primary meaning but some entries retain bibliographic noise.
86
  3. **Name-heavy**: 73% of entries are proper nouns (names, places), reflecting the administrative nature of Linear B tablets (palace inventories, tax records). Only 27% are common vocabulary.
87
  4. **No tablet corpus**: The dataset includes individual words but not full tablet texts. DAMOS (CC-BY-NC-SA-4.0) and LiBER (non-profit only) provide tablet corpora but are license-incompatible.
 
6
 
7
  - `linear_b_signs.tsv` — Full sign inventory (211 signs: 88 syllabograms + 123 ideograms)
8
  - `sign_to_ipa.json` — 74 syllabogram transliterations mapped to IPA values
9
+ - `linear_b_words.tsv` — 2,478 words with transliterations, IPA, glosses, and source attribution
10
  - `README.md` — This file
11
 
12
  ## Sign Inventory (`linear_b_signs.tsv`)
 
38
 
39
  | Metric | Count |
40
  |--------|-------|
41
+ | Total words | 2,478 |
42
+ | Common nouns | 674 |
43
  | Anthroponyms (personal names) | 1,285 |
44
  | Toponyms (place names) | 209 |
45
  | Unknown meaning | ~250 |
46
  | Theonyms (deity names) | ~27 |
47
+ | Expert IPA (Wiktionary/IE-CoR) | 81 |
48
+ | Transliteration-derived IPA | 2,397 |
49
 
50
  ### IPA Sources
51
 
52
  IPA transcriptions come from three tiers of quality:
53
+ 1. **Expert** (81 words): Scholarly reconstructions from Wiktionary `ts=` parameter and IE-CoR cognate pair data. Examples: `a-ke-ro` → `áŋɡelos`, `a-ku-ro` → `árguros`
54
+ 2. **Transliteration conversion** (2,397 words): Systematic application of the Ventris grid IPA mapping to each syllable in the transliteration
55
  3. **IE-CoR cognate data** (42 words): 42 Mycenaean Greek words from the IE-CoR (Indo-European Cognate Relations) database with expert IPA reconstructions, linked to Concepticon concept IDs
56
 
57
  ### Word Types
 
81
 
82
  ## Limitations
83
 
84
+ 1. **IPA quality varies**: Only 81 words have expert IPA reconstructions. The remaining 2,397 use systematic transliteration conversion, which captures the syllabic structure but not phonological details like aspiration, vowel length, or accent.
85
  2. **Glosses are noisy**: The Shannon lexicon definitions contain scholarly concordance notes, not clean dictionary glosses. Parsing extracts the primary meaning but some entries retain bibliographic noise.
86
  3. **Name-heavy**: 73% of entries are proper nouns (names, places), reflecting the administrative nature of Linear B tablets (palace inventories, tax records). Only 27% are common vocabulary.
87
  4. **No tablet corpus**: The dataset includes individual words but not full tablet texts. DAMOS (CC-BY-NC-SA-4.0) and LiBER (non-profit only) provide tablet corpora but are license-incompatible.
data/linear_b/linear_b_words.tsv CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d1151d4b9a04b3b3e26b8f5726511b7064b5e495d417c508e20e4abc40c1a3d2
3
- size 267875
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:141571f681c6363c438c2a4a8c8323433f878290f2de176fff7096c462ad3e84
3
+ size 266984
docs/changelog/008_linear_b_dataset.md CHANGED
@@ -104,15 +104,15 @@ Random sample of 10 entries verified:
104
  |------|--------:|-----:|
105
  | `data/linear_b/linear_b_signs.tsv` | 211 | 12,875 bytes |
106
  | `data/linear_b/sign_to_ipa.json` | 74 | 1,134 bytes |
107
- | `data/linear_b/linear_b_words.tsv` | 2,484 | 276,697 bytes |
108
  | `data/linear_b/README.md` | — | documentation |
109
 
110
  ### Word List Breakdown
111
 
112
  | Category | Count | % |
113
  |----------|------:|--:|
114
- | Common nouns | 680 | 27.4% |
115
- | Anthroponyms | 1,285 | 51.7% |
116
  | Toponyms | 209 | 8.4% |
117
  | Unknown meaning | ~250 | ~10.1% |
118
  | Theonyms | ~27 | ~1.1% |
@@ -122,8 +122,8 @@ Random sample of 10 entries verified:
122
 
123
  | Source | Count | % |
124
  |--------|------:|--:|
125
- | Expert (Wiktionary/IE-CoR) | 77 | 3.1% |
126
- | Transliteration conversion | 2,407 | 96.9% |
127
 
128
  ## Limitations
129
 
 
104
  |------|--------:|-----:|
105
  | `data/linear_b/linear_b_signs.tsv` | 211 | 12,875 bytes |
106
  | `data/linear_b/sign_to_ipa.json` | 74 | 1,134 bytes |
107
+ | `data/linear_b/linear_b_words.tsv` | 2,478 | 266,984 bytes |
108
  | `data/linear_b/README.md` | — | documentation |
109
 
110
  ### Word List Breakdown
111
 
112
  | Category | Count | % |
113
  |----------|------:|--:|
114
+ | Common nouns | 674 | 27.2% |
115
+ | Anthroponyms | 1,285 | 51.9% |
116
  | Toponyms | 209 | 8.4% |
117
  | Unknown meaning | ~250 | ~10.1% |
118
  | Theonyms | ~27 | ~1.1% |
 
122
 
123
  | Source | Count | % |
124
  |--------|------:|--:|
125
+ | Expert (Wiktionary/IE-CoR) | 81 | 3.3% |
126
+ | Transliteration conversion | 2,397 | 96.7% |
127
 
128
  ## Limitations
129
 
docs/changelog/INDEX.md CHANGED
@@ -6,7 +6,7 @@ All changes to the `Nacryos/ancient-scripts-datasets` HuggingFace dataset are lo
6
 
7
  | Date | Entry | Summary |
8
  |------|-------|---------|
9
- | 2026-03-19 | [008_linear_b_dataset.md](008_linear_b_dataset.md) | Linear B (Mycenaean Greek) dataset: 211 signs, 74 IPA mappings, 2,484 words from Unicode/Shannon/Wiktionary/IE-CoR |
10
  | 2026-03-19 | [007_phono_quality_flagging.md](007_phono_quality_flagging.md) | Added `Phono_Quality` column (strong/moderate/weak/none/unscored), downgraded 27K Robbeets cross-family to "contested", fixed 2.9K Sino-Tibetan doubt markers |
11
  | 2026-03-19 | [006_tier1_cldf_ingestion.md](006_tier1_cldf_ingestion.md) | +573K expert cognate pairs from IE-CoR, Robbeets, Savelyev — 31 new ancient languages, 4-agent adversarial audit |
12
  | 2026-03-15 | [005_parquet_conversion.md](005_parquet_conversion.md) | Added Parquet files + YAML dataset card for HF `datasets` library integration |
 
6
 
7
  | Date | Entry | Summary |
8
  |------|-------|---------|
9
+ | 2026-03-19 | [008_linear_b_dataset.md](008_linear_b_dataset.md) | Linear B (Mycenaean Greek) dataset: 211 signs, 74 IPA mappings, 2,478 words from Unicode/Shannon/Wiktionary/IE-CoR |
10
  | 2026-03-19 | [007_phono_quality_flagging.md](007_phono_quality_flagging.md) | Added `Phono_Quality` column (strong/moderate/weak/none/unscored), downgraded 27K Robbeets cross-family to "contested", fixed 2.9K Sino-Tibetan doubt markers |
11
  | 2026-03-19 | [006_tier1_cldf_ingestion.md](006_tier1_cldf_ingestion.md) | +573K expert cognate pairs from IE-CoR, Robbeets, Savelyev — 31 new ancient languages, 4-agent adversarial audit |
12
  | 2026-03-15 | [005_parquet_conversion.md](005_parquet_conversion.md) | Added Parquet files + YAML dataset card for HF `datasets` library integration |
scripts/build_linear_b_dataset.py CHANGED
@@ -312,19 +312,29 @@ def parse_wiktionary_lemmas(json_path: Path) -> list[dict]:
312
  if not tr_check:
313
  continue
314
 
315
- # Extract IPA from ts= parameter
 
 
 
316
  ipa = ""
317
- ts_match = re.search(r"\|ts=([^|}]+)", wikitext)
318
- if ts_match:
319
- ipa = ts_match.group(1).strip()
320
-
321
- # Extract transliteration: prefer tr= parameter, fallback to Unicode conversion
322
- translit = ""
323
- tr_match = re.search(r"\|tr=([^|}]+)", wikitext)
324
- if tr_match:
325
- translit = tr_match.group(1).strip()
 
 
 
 
326
  if not translit:
327
- translit = title_translit
 
 
 
328
 
329
  # Clean transliteration: remove tablet context, bold markers, etc.
330
  # Wiktionary titles sometimes embed context like "'''di-wo''' u-ta-jo-jo"
 
312
  if not tr_check:
313
  continue
314
 
315
+ # Extract IPA from ts= parameter — ONLY from {{head|gmy|...}} template,
316
+ # NOT from {{quote|gmy|...}} tablet quotation contexts.
317
+ # The head template has format: {{head|gmy|noun|ts=VALUE}}
318
+ # Quote templates have format: {{quote|gmy|...|ts=FULL_SENTENCE}}
319
  ipa = ""
320
+ head_match = re.search(r"\{\{(?:head|h)\|gmy\|[^}]*\|ts=([^|}]+)", wikitext)
321
+ if head_match:
322
+ ipa = head_match.group(1).strip()
323
+ # Sanity check: headword IPA should be a single word, not a sentence
324
+ # If it contains spaces or <br>, it's a tablet quotation that leaked in
325
+ if " " in ipa or "<br>" in ipa:
326
+ ipa = ""
327
+
328
+ # Extract transliteration: prefer Unicode title conversion, fallback to tr= from head template.
329
+ # IMPORTANT: Do NOT use a global tr= search — {{quote-book}} templates contain
330
+ # tr= with full tablet transliterations (e.g., "o-di-do-si du-ru-to-mo / ..."),
331
+ # which are NOT the headword transliteration. Only use tr= from {{head|gmy|...}}.
332
+ translit = title_translit # Primary: Unicode character names → transliteration
333
  if not translit:
334
+ # Fallback: tr= from head template only
335
+ head_tr_match = re.search(r"\{\{(?:head|h)\|gmy\|[^}]*\|tr=([^|}]+)", wikitext)
336
+ if head_tr_match:
337
+ translit = head_tr_match.group(1).strip()
338
 
339
  # Clean transliteration: remove tablet context, bold markers, etc.
340
  # Wiktionary titles sometimes embed context like "'''di-wo''' u-ta-jo-jo"