diff --git a/evaluation/ocr/registers.csv b/evaluation/ocr/registers.csv index 5595876..0855e81 100644 --- a/evaluation/ocr/registers.csv +++ b/evaluation/ocr/registers.csv @@ -1,10 +1,19 @@ -register,label,tetrak-hy v6 (ours)_chr,tetrak-hy v6 (ours)_wrd,hye-calfa-n_chr,hye-calfa-n_wrd,hye-paddle_chr,hye-paddle_wrd,marker_chr,marker_wrd,tesseract-hye_chr,tesseract-hye_wrd -totovents-works,"Totovents, Works",0.9868,0.9683,0.9844,0.9413,0.9849,0.9405,0.8142,0.8067,0.9383,0.7394 -medical-encyclopedia,Medical encyclopedia,0.9646,0.9677,0.9753,0.8290,0.3025,0.9331,0.8882,0.9141,0.9730,0.8768 -otyan-works,"Otyan, Works",0.9872,0.9647,0.9782,0.9291,0.9812,0.9343,0.9200,0.8372,0.9230,0.7270 -baronian-vol10,"Baronian, Works",0.9863,0.9442,0.9817,0.9106,0.9834,0.9185,0.8639,0.7869,0.9425,0.7444 -faustus-1968,Faustus of Byzantium (1968),0.9699,0.9163,0.9762,0.9138,0.9271,0.9222,0.9187,0.8602,0.9286,0.7157 -tumanyan-elzh5,Tumanyan (academic edition),0.9558,0.9145,0.9503,0.9040,0.9697,0.9130,0.6584,0.7082,0.8887,0.7103 -ase-vol2,Encyclopedia (ASE vol. 2),0.9703,0.9017,0.9600,0.8426,0.3342,0.8648,0.5262,0.8358,0.9456,0.7728 -dictionary-hy-en,Dictionary (hy–en),0.8570,0.6883,0.4015,0.1092,0.4348,0.4574,0.6628,0.6781,0.3386,0.0462 -mean,Mean over registers,0.9597,0.9082,0.9010,0.7974,0.7397,0.8605,0.7816,0.8034,0.8598,0.6666 +register,label,tetrak-hy v7 (ours)_chr,tetrak-hy v7 (ours)_wrd,hye-calfa-n_chr,hye-calfa-n_wrd,marker_chr,marker_wrd,tesseract-hye_chr,tesseract-hye_wrd +totovents-works,"Totovents, Works",0.9871,0.9649,0.9844,0.9413,0.8143,0.8067,0.9383,0.7394 +khrimian-works,"Khrimian, Works",0.9813,0.9576,0.9827,0.9383,0.9161,0.8884,0.9450,0.7983 +medical-encyclopedia,Medical encyclopedia,0.9598,0.9513,0.9753,0.8290,0.8882,0.9141,0.9730,0.8768 +otyan-works,"Otyan, Works",0.9854,0.9504,0.9782,0.9291,0.9200,0.8372,0.9229,0.7270 +toranian-erkirner-ew-marder,"Toranian, Erkirner ew marder",0.9699,0.9386,0.9735,0.8380,0.9715,0.8858,0.9829,0.9014 +baronian-vol10,"Baronian, Works",0.9857,0.9373,0.9817,0.9106,0.8638,0.7869,0.9425,0.7444 +tumanyan-elzh5,Tumanyan (academic edition),0.9749,0.9366,0.9503,0.9040,0.6583,0.7082,0.8887,0.7129 +aram-manukyan-documents,"Aram Manukyan, Documents",0.9576,0.9340,0.9598,0.9240,0.9421,0.9121,0.9335,0.8006 +haykakan-tpagrutyun,Armenian printing (Teodik),0.9806,0.9269,0.9706,0.8937,0.7321,0.6753,0.8990,0.6368 +ase-vol2,Encyclopedia (ASE vol. 2),0.9713,0.9109,0.9600,0.8426,0.5262,0.8358,0.9456,0.7728 +kajaznuni-azg-ew-hayrenik,"Kajaznuni, Azg ew hayrenik",0.9743,0.9005,0.9569,0.8517,0.6658,0.5721,0.8773,0.6035 +faustus-1968,Faustus of Byzantium (1968),0.9649,0.8979,0.9762,0.9138,0.9188,0.8602,0.9286,0.7157 +baronian-azgayin-jojer,"Baronian, Azgayin jojer",0.9770,0.8880,0.9675,0.8528,0.7403,0.6847,0.8761,0.6112 +aghbalyan-criticism,"Aghbalyan, Criticism",0.8963,0.8239,0.8630,0.8010,0.7711,0.6996,0.8004,0.5864 +abovyan-vol1,"Abovyan, Works vol. 1",0.8999,0.7939,0.9199,0.8712,0.9028,0.8064,0.8320,0.6069 +khatisian-memoirs,"Khatisian, Memoirs",0.9438,0.7616,0.9002,0.7476,0.7139,0.6167,0.7574,0.3874 +dictionary-hy-en,Dictionary (hy–en),0.8234,0.6874,0.4008,0.1092,0.6628,0.6781,0.3386,0.0462 +mean,Mean over registers,0.9549,0.8919,0.9236,0.8293,0.8005,0.7746,0.8695,0.6628 diff --git a/pyproject.toml b/pyproject.toml index af9791a..9db5117 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ easyocr = ["easyocr>=1.7"] # depends on easyocr itself, so this extra pulls that in too. 0.8 ships the # v6 weights and the word list the backend decodes with (brief 013); the # backend falls back to greedy decoding on older releases. -armenian = ["tetrak-easyocr-armenian>=0.11"] +armenian = ["tetrak-easyocr-armenian>=0.12"] paddle = ["paddleocr>=3.0", "paddlepaddle>=3.0"] # PaddleOCR-VL, the document vision-language model in the same package. # The class lives in paddleocr, but the pipeline it builds needs paddlex's diff --git a/site/content/ocr/reference/engines.md b/site/content/ocr/reference/engines.md index def0bcc..56ca14e 100644 --- a/site/content/ocr/reference/engines.md +++ b/site/content/ocr/reference/engines.md @@ -94,34 +94,46 @@ It has its own registry name rather than being folded into `easyocr`, for the same reason `tesseract-auto` does: the harness scores backends, so the difference between the two is a measurement instead of a claim. -Measured on eight evaluation registers — 65 proofread pages from seven -works on Armenian Wikisource plus ten from volume 2 of the Armenian Soviet -Encyclopedia, every page held out from training. The figures are means over -the eight registers; the per-register tables are in the -[latest comparison]({{< relref "/articles/2026/10/2026-10-02-beating-the-baselines.md" >}}): +Measured on seventeen evaluation registers — 155 proofread pages from +sixteen works on Armenian Wikisource plus ten from volume 2 of the Armenian +Soviet Encyclopedia, every page held out from training. Nine of the works +are in classical orthography, the spelling of the diaspora and of +everything printed before 1922. The figures are means over the seventeen +registers; the per-register tables of the earlier, eight-register +comparison are in the +[article on beating the baselines]({{< relref "/articles/2026/10/2026-10-02-beating-the-baselines.md" >}}): {{< registers view="summary" >}} -The row labelled `tetrak-hy v6 (ours)` is `easyocr-hy` as it ships: the -recogniser, its word list, the script fold and the layout below. The table -names the recogniser rather than the backend, because the harness that -emits it scores models. Stock EasyOCR is absent because it was only ever -run on the encyclopedia pages (the 0.03 above), and the table admits only -engines measured on every register — the rule that keeps a column's mean -over the same pages as the column beside it. - -Since v6, `easyocr-hy` leads both means, and leads both metrics on most -registers. It does not lead everywhere, and the exceptions have names: - +The row labelled `tetrak-hy v7 (ours)` is `easyocr-hy` as it ships: the +recogniser, its two word lists, the script fold and the layout below. The +table names the recogniser rather than the backend, because the harness +that emits it scores models. Stock EasyOCR is absent because it was only +ever run on the encyclopedia pages (the 0.03 above), and Calfa's +`hye-paddle`, the strongest rival on the reformed-orthography registers, +has not yet been run on the classical ones; the table admits only engines +measured on every register — the rule that keeps a column's mean over the +same pages as the column beside it. + +Since v7, `easyocr-hy` leads both means, and leads word recall on fifteen +of the seventeen registers. It does not lead everywhere, and the +exceptions have names: + +- **Abovyan's collected works:** the one classical register where Calfa's + Tesseract model still reads more words. - **Faustus of Byzantium:** the index and notes are set in a bold italic - whose digits the recogniser confuses. -- **Tumanyan's academic edition:** the apparatus quotes Russian, and the - recogniser has no Cyrillic. Its Armenian pages are level with the - leaders. + whose digits the recogniser confuses, and `hye-paddle` reads it better. - **The medical encyclopedia, on character similarity:** EasyOCR's detector draws no box around the en dash its index prints between each term and its page number, so no recogniser behind it can read one. +v7 also reads the Russian that Soviet editions quote in their apparatus: +61 of the 81 Russian words on the Tumanyan pages, where v6, with no +Cyrillic in its charset, read none. On five of the eight registers v6 was +measured on it is a little behind v6 by word recall, by 0.003 to 0.018; the +trade was made knowingly for the classical registers, where it gains +between 0.04 and 0.10. + Calfa's two models are the strongest of the others. Both are CC BY-NC 4.0, so Tetrak can measure them but cannot ship or bundle either. `easyocr-hy` can be shipped commercially: its code and weights are Apache @@ -131,15 +143,20 @@ require. Three steps sit between the raw recogniser and those figures, and none is retraining: -- **A word list.** The recognition head has no language model. A word - whose reading is not in a list of Armenian words, built from proofread - Wikisource transcripts and the Nayiri Armenian Lexicon, takes the most - probable listed reading from the recogniser's own alternatives for it, - when that reading is nearly as probable. -- **A script fold.** Inside an Armenian word, the head can emit the - visually identical Latin twin of a character: `h` for `հ`, a colon for - the Armenian full stop `։`. The fold turns these back. Inside a number, - it also reads `Չ` and `շ` as the digit 2. +- **Two word lists.** The recognition head has no language model. A word + whose reading is in neither list, one built from the reformed-orthography + transcripts and one from the classical ones with the Nayiri Armenian + Lexicon, takes the most probable listed reading from the recogniser's own + alternatives for it, when that reading is nearly as probable. A spelling + in either list is accepted as written, so a classical page is never + "corrected" into reformed spelling or the reverse. +- **A script fold.** Every token is read in one script. Inside an Armenian + word, the head can emit the visually identical Latin or Cyrillic twin of + a character: `h` for `հ`, `о` for `օ`, a colon for the Armenian full + stop `։`. The fold turns these back; a token with no Armenian letter is + written in the one script, Latin or Cyrillic, it belongs to, decided by + the page around it when its own glyphs cannot say. Inside a number, it + also reads `Չ` and `շ` as the digit 2. - **Reading order.** Output is serialised through `tetrak_ocr.layout`, a recursive XY-cut that reads each column and band to its foot before starting the next, and rejoins words a line break hyphenated. On the diff --git a/src/tetrak_ocr/backends/armenian.py b/src/tetrak_ocr/backends/armenian.py index 57c8164..1becd92 100644 --- a/src/tetrak_ocr/backends/armenian.py +++ b/src/tetrak_ocr/backends/armenian.py @@ -26,8 +26,8 @@ Latin or Cyrillic, it belongs to; a token made only of glyphs the two share (`роог` for `poor`) is decided by the text around it, so each region is folded with the whole page as `context`. That needs -`tetrak-easyocr-armenian` 0.9 or later; the extra pins 0.11, the release -with the three-way script decision. +`tetrak-easyocr-armenian` 0.9 or later; the extra pins 0.12, the release +that ships the v7 weights with both word lists. **The word list.** Where the installed `tetrak-easyocr-armenian` has released one, `tetrak_hy.lexicon` corrects out-of-vocabulary words from diff --git a/uv.lock b/uv.lock index 8f414b4..d3c8bbd 100644 --- a/uv.lock +++ b/uv.lock @@ -4663,7 +4663,7 @@ requires-dist = [ { name = "sillybos", specifier = ">=5,<6" }, { name = "sphinx", marker = "extra == 'apidocs'", specifier = ">=8.0" }, { name = "sphinx-argparse", marker = "extra == 'apidocs'", specifier = ">=0.6.1" }, - { name = "tetrak-easyocr-armenian", marker = "extra == 'armenian'", specifier = ">=0.11" }, + { name = "tetrak-easyocr-armenian", marker = "extra == 'armenian'", specifier = ">=0.12" }, { name = "torch", marker = "extra == 'all'", specifier = ">=2.0" }, { name = "torch", marker = "extra == 'ocr'", specifier = ">=2.0" }, { name = "torch", marker = "extra == 'qa'", specifier = ">=2.0" }, @@ -4675,15 +4675,15 @@ provides-extras = ["all", "apidocs", "armenian", "claude", "dev", "docs", "easyo [[package]] name = "tetrak-easyocr-armenian" -version = "0.11.0" +version = "0.12.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "easyocr" }, { name = "requests" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/58/ef/59a88e409d2d78a879a81ddd0061d56885fb9f5200431536235340cd0bf9/tetrak_easyocr_armenian-0.11.0.tar.gz", hash = "sha256:41d0c57b54d99409507d71102923895c1e73c92039434a65615ec086d96ce1ca", size = 160487, upload-time = "2026-11-15T22:36:34.237Z" } +sdist = { url = "https://files.pythonhosted.org/packages/70/ab/26350e707f16b9df9cab234231e940db5e5afd3b0a2955978820091430ff/tetrak_easyocr_armenian-0.12.0.tar.gz", hash = "sha256:da72ba56035ca08ddf79a6c4f5d03b423dc4c64d9ac649f24a4fb9a62d6b7813", size = 170478, upload-time = "2026-11-16T14:01:53.693Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/19/f6/c06d8e6e9286ff8371c7d4ff1115ef7be0dad7ff2cd14fbbbb737d1799da/tetrak_easyocr_armenian-0.11.0-py3-none-any.whl", hash = "sha256:c068dd9f03c7d090c1c56bd89e12c24ef542a5424ea87fad671607f5ad7021c7", size = 28951, upload-time = "2026-11-15T22:36:32.891Z" }, + { url = "https://files.pythonhosted.org/packages/f6/34/c7e922cffd29a31d66055fc321b7323914ece6575be109fc9cff44f1a35f/tetrak_easyocr_armenian-0.12.0-py3-none-any.whl", hash = "sha256:880746de1c1e507aafc3f185b911b63dee87ecde4d598210ba2fe4f13e9569f8", size = 29689, upload-time = "2026-11-16T14:01:52.246Z" }, ] [[package]]