File size: 2,225 Bytes
7300814
9bd558a
7300814
9bd558a
 
 
 
 
 
 
 
7300814
9bd558a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
language: grc
license: gpl-3.0
datasets:
- Macronizer/oga-macronized
tags:
- ancient-greek
- vowel-length
- macronization
- token-classification
- char-level
---

# grc-macronizer-char: a small char-level model for Ancient Greek vowel-length annotation

This model predicts the phonemic length (long/short/undetermined) of the three
Ancient Greek "dichrona" -- alpha (α), iota (ι), and upsilon (υ) -- whose length
is not disambiguated by the standard Greek script. It was trained on Ancient
Greek text automatically macronized by the rule-based grc-macronizer, applied to the
[Opera Graeca Adnotata](https://doi.org/10.5281/zenodo.14206061) corpus
(Celano 2024), and is intended as a complementary, corpus-general alternative
to that rule-based system.

## Architecture

A small transformer encoder (~0.9M parameters) operating over three character-level
"planes" per input position:

- **plane 1 (letter)**: which of the 24 Greek letters (final/medial sigma
  folded together), or space, or "other" (punctuation/digits/foreign chars)
- **plane 2 (diacritic)**: the combination of accent/breathing/diaeresis marks
  on that letter, if any (a small vocabulary fit from the training data)
- **target (macron)**: none / short / long -- predicted only at positions
  that are genuine ambiguous dichrona (diphthong members and circumflexed
  vowels are excluded, matching the rule-based system's own definition)

During training, the diacritic plane is randomly masked (accents stripped)
for a fraction of characters, so the model also learns to macronize
unaccented input.

## Usage

```python
import sys
sys.path.insert(0, "path/to/grc-macronizer/macron_model")  # for predict.py
from predict import MacronPredictor

predictor = MacronPredictor("path/to/downloaded/checkpoint")
macronized = predictor.macronize("ανθρωπος ανηρ")
# -> "α^νθρωπος α_νηρ"
```

`MacronPredictor` expects the checkpoint directory (containing
`config.json`/`model.safetensors`) plus a sibling or parent `diacritic_vocab.json`
(see `predict.py` for the exact lookup logic). The `predict.py`/`tokenizer.py`
source lives in [grc-macronizer/macron_model](https://anonymous.4open.science/r/grc-macronizer-68DC/macron_model/).