Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fraktur: Ligatures ch, ck, ſz #102

Closed
jbarth-ubhd opened this issue Jun 14, 2018 · 34 comments
Closed

Fraktur: Ligatures ch, ck, ſz #102

jbarth-ubhd opened this issue Jun 14, 2018 · 34 comments

Comments

@jbarth-ubhd
Copy link

jbarth-ubhd commented Jun 14, 2018

Dear reader,

I've randomly selected 20 three-line-snippets zip with tiff snippets, abbyy11r8 and tesseract4 original output into tesseract, and it seems to me that tesseract4 has problems with ch/ck/ſz ligatures and sometimes misinterprets O/D and S/G.

These ligatures had been available also on fraktur typewriters(!) and occur very often in fraktur german.

here is the output of Abbyy11(r8) and Tesseract4 with errors highlighted manually:
link to odt file
use auto-wdiff.sh {directory} to show differences

@jbarth-ubhd jbarth-ubhd changed the title Gothic: Ligatures ch, ck, ſz Fraktur: Ligatures ch, ck, ſz Jun 14, 2018
@Shreeshrii
Copy link
Contributor

Shreeshrii commented Jun 14, 2018 via email

@jbarth-ubhd
Copy link
Author

Tesseract: commit 51ebf8a21e47f52761357ed43bcaef6875075a11
tessdata: commit f1d12682c0f1afe61db892f4b2bfaa7909ad7a59
Fraktur.traineddata: sha256sum=29a867a25f1b00a5e9827356582515619d5102688bc1d14015789c78941116ee

@Shreeshrii
Copy link
Contributor

Shreeshrii commented Jun 14, 2018 via email

@jbarth-ubhd
Copy link
Author

jbarth-ubhd commented Jun 14, 2018

Oops. Good to know. Will try soon.

Ok... Fraktur.traineddata from https://github.com/tesseract-ocr/tessdata/tree/3a94ddd47be01fd897cbe31f05cbd2301454cf8a/best is already sha256sum=29a867a25f1b00a5e9827356582515619d5102688bc1d14015789c78941116ee

@jbarth-ubhd
Copy link
Author

Inferred by the name, I would by assume that tessdata_fast would produce inferior results(?)

@Shreeshrii
Copy link
Contributor

Shreeshrii commented Jun 14, 2018 via email

@jbarth-ubhd
Copy link
Author

.odt file updated. ch/ck problem persists. Sometimes _fast is better than _best, sometimes worse.

@stweil
Copy link
Contributor

stweil commented Jun 15, 2018

Instead of using -l script/Fraktur, you could also try -l frk which typically gives better results for German Fraktur texts (in my tests it was more often better than worse). In addition, I suggest to always use images which include resolution information because a wrong resolution guess can also increase the number of recognition errors. Further improvements require replacing the word list which is part of the traineddata files by one which better fits your text. In addition, fine tuning of the LSTM model would probably help. Or we need a completely fresh training for Fraktur texts – ideally done by Fraktur experts.

@stweil
Copy link
Contributor

stweil commented Jun 16, 2018

@jbarth-ubhd, did you convert upper case S to lower case s in your result file? It does not include any S, neither from ABBYY nor from Tesseract. There is also no ß character in the same file. Could you provide the original ABBYY result?

@jbarth-ubhd
Copy link
Author

@stweil: edited inital comment to link with to zip containing tiff snippets (with resolution) and abbyy11+tesseract4 original output

@jbarth-ubhd
Copy link
Author

jbarth-ubhd commented Jun 18, 2018

@stweil: yes, Libreoffice did also replace ß+S to s when searching for ſ and replacing with s.

Updated zip and replaced tesseract output ſ with s (using sed), so S stays original.

@jbarth-ubhd
Copy link
Author

jbarth-ubhd commented Jun 18, 2018

@stweil: thanks for suggesting »frk«.

Without counting errors, it feels somewhat better. Still heavy problems with ch +ck ligature:

jb@pers16:~/workspace/abbyy-vs-tesseract> perl auto-wdiff.sh tessdata_best_frk_f1d12682c0f1afe61db892f4b2bfaa7909ad7a59
=== manual/badenia1860_1862_-_354.txt ===
Und eine Stelle dieser Engpässe hat große Aehnlichkeit mit
dem [-Hiricmsprunge-] {+Hirschsprunge+} im [-Hsslenihal. "Allein-] {+Höllenthal. Allein,+} die Felsen- [-119-] {+und+}
Waldpartien sind unmalerisch [-zerrissenz-] {+zerrissen;+} das Thalbette bleibt in


=== manual/badenia1860_1862_-_491.txt ===
Die Karlsburg war ein Prachtbau im damaligen Sinne,
an welchen der Markgraf ganz bedeutende Summen [-gewendet,-] {+gewendet.+}
Gleichwohl hatte er [-no<-] {+noch+} Mittel genug, um zur völligen Her-


=== manual/boisseree1862bd1_-_175.txt ===
Da müssen nun die gleichzeitigen [-Geschichtös<hreiber,-] {+Geschichtsschreiber,+} Mathe-
[-matifer,-]
{+matiker,+} Philosophen und Dichter, von mehr als 300 Jahren zu
Rath gezogen und die Archive durchsucht werden; für die frühsten


=== manual/frauenwarte1935_1936_-_0700b.txt ===
So und [-ähnli-] {+ähnlich+} lauten Tausende begeisterte
Anerkennungen dankbarer Kundinnen. [-=--] {+-+} War-
um grämen Sie [-sic)-] {+sich+} also [-noh,-] {+noch,+} wenn auch Sie


=== manual/hnn1936_-_057_11.txt ===
eine [-Ausgleich8gebühr-] {+Ausgleichsgebühr+} von 4,50 Mark; aber gegen
Wochenende kam man [-au "hier-] {+auch hier+} meist bis auf 4 Mark
entgegen. Das [-Gleiche-] {+gleiche+} trifft [-auh.-] {+auch+} für [-Maadebura--] {+Magdeburg-+}


=== manual/hnn1936_-_069_Feierstunde_12_03.txt ===
Der Kellner brachte das Essen. Der [-Iugend
scH<me&te-] {+Jugend
schmeckte+} es. Jürgen schob Ilse die besten [-Stüke-] {+Stücke+}
zu, und sie [-sc<ob-] {+schob+} sie ihm lachend wieder [-zurüF,-] {+zurück.+} Else


=== manual/kunstwart_kulturwart26_2_-_152b.txt ===
[-„Wie-]{+"Wie+} sehr auch die Abwesenheit der Farbe die Beurteilung dieser [-Walerei-] {+Malerei+} beengt, so ist [-doch)-] {+doch+} wohl [-durc<-] {+durch+} keine [-Farbe-] {+Farbei+} eine
Wirkung derartiger [-Walerei-] {+Malerei+} denkbar, [-wel<he-] {+welche+} die Worte [-Weier=Graefes-] {+Meier-Graefes+} rechtfertigte: [-„Der Neoimpressioni8mus-] {+'Der Neoimpressionismus+} ist schöner,
größer und göttlicher selbst als die [-kir<hlihe Tradition.““-] {+kirchliche Tradition.'"+}


=== manual/malk1809_-_429.txt ===
Was singe [-im-] {+ich+} tumber von der zit,
[--Duü-]
{+Dù+} mir so kleine [-fröide gier? -
Mär-] {+froide git?
Mir+} sint die [-blümen-] {+blumen+} und der kle,


=== manual/mannheimer_anzeiger1858_-_040_01.txt ===
* In Kurhessen wiederholen [-si-] {+sich+} die [-unangenchmsten-] {+unangenehmsten+}
Verhältnisse im raschesten Wechsel ! Dem ehemaligen Obergerichts-
rath v. Haynau wurde allerhöchst die Genehmigung zum Doziren



=== manual/medaillen1737_-_00_429.txt ===
[-<ischen-]{+chischen+} Wappenschild an der [-Brust.des-] {+Brust des+} Adlers bey der sechsten medaille,
auch aus Versehen, nicht erkläret worden. [-Jh-] {+Ich+} halte aber dafür daß sel-
bige LEOPOLDUS [-1,-] {+I,+} Leopold der erste, heisen.


=== manual/meggendorfer100_-_075.txt ===
Im dritten Laden bot mir der gewandte Verkäufer
das neueste Hubersche Lexikon an. Neunzehn Bände mit
Eichenholzregal und Schnitzwerk im Stile der Antike.


=== manual/mitthdschloss1_-_201.txt ===
Item die Andre Ründung mitt den Zwelff himlischen
Zechen, so in blauen feltt gemahlt, [-vndt-] {+undt+} weisset die Tag
[-Yndt-]
{+Undt+} Nachtlenge; geht Sieben büchlein gollt drauff, duht


=== manual/mone1889bd18_-_217.txt ===
welches in der [-Stephansfkirche-] {+Stephanskirche+} in [-Karl3ruhe-] {+Karlsruhe+} sich befindet. Lotsch
ist zwar in Durlach geboren, aber er stammte von [-Gonde/Sheim-] {+Gondelsheim+} im 
Kraichgau, [-weShalb-] {+weshalb+} sein Werk hier genannt wird.



=== manual/mothes1882bd2_-_428.txt ===
gesättigt, adj. (Hütt.), heißt eine Salzsole dann, wenn
sie [-[o-] {+so+} viel Salz enthält, als das Wasser aufgelöst zu er-
halten vermag; ähnlich erklärt sich die Bezeichnung g. bei


=== manual/oab_balingen1880_-_302.txt ===
[-DA.-]{+OA.+} Spaichingen 885,6 [-m ; nD enim DB, DMV Daltingen-] {+m; und endlich Bitz, OA. Balingen+}
883,0 m. (Die angegebenen Ziffern beziehen sich [-stet8-] {+stets+} auf die
[-Erdsläche-]
{+Erdfläche+} am [-Kirc<thurm-] {+Kirchthurm+} und auf den Horizont der geognostischen


=== manual/olympia_zeitung1936_-_066.txt ===
So viele Besucher wie in diesen Tagen hat das
Reichsehrenmal wohl noch nie gesehen. Fast sind
es zu viele. Rund um den Sockel in der Mitte


=== manual/rjbkp1840_-_080.txt ===
[-«+++-]{+....+} Als wir am 14. nach Mailand kamen, begann
ein [-schreklicher Plaßregen,-] {+schrecklicher Platzregen,+} und aus dem [-Plaß--] {+Platz-+} ward ein
Land-, und das dauerte bis zu unserer Rückfahrt am 16.


=== manual/schwetzinger_wochenblatt1863_-_021_3.txt ===
Einer derselben wünschte Pulver zu kaufen; der Laden-
diener [-nahm. deShalb-] {+nahm deshalb+} den ganzen in einem kupfernen
Kessel aufbewahrten Vorrath (etwa 70 Pfd.) hervor,


=== manual/springer1886bd1_-_000_274.txt ===
Leon Battistas Liebe zur Natur ist aber nicht allein feurig,
sondern auch wahr und unmittelbar empfunden. Sie beruht auf
einer [-staunenSwerthen-] {+staunenswerthen+} Kenntniß derselben und einem [-Überaus-] {+überaus+}


=== manual/wehrmacht1936_1937_-_20_12.txt ===
[-Gofort-]{+Sofort+} nach Eintreten der Dunkelheit verließen wir
die vorderste Stellung und arbeiteten uns trotz zahl-
reicher [-feindlicßer-] {+feindlicher+} Leuchtkugeln langsam an das Un-

@Shreeshrii
Copy link
Contributor

Shreeshrii commented Jun 18, 2018 via email

@jbarth-ubhd
Copy link
Author

ground truth (manually transcripted utf8-text) is in the zip file (first comment), directory /manual/

@stweil
Copy link
Contributor

stweil commented Jun 18, 2018

@jbarth-ubhd, may we use that image extracts and text samples freely without any restrictions (CC0)? A free license is required before @Shreeshrii can add them as a test case.

@Shreeshrii
Copy link
Contributor

Shreeshrii commented Jun 19, 2018

Please see http://www.morscher.com/3r/fonts/fraktur.htm

Many Fraktur fonts are not fully unicode compliant and use non-standard mappings. For example:

"Long s" ( ſ ) is the "" key. Has ligatures: ch= "<" key, and ck=">" key.

If training was done using these fonts or using texts encoded in these fonts, that could be the cause of confusion.

@stweil
Copy link
Contributor

stweil commented Jun 19, 2018

Yes, that could explain some of the problems seen with the Fraktur traineddata. Therefore it is important to have a well documented open training process. It would be good to know at least the fonts and scripts used for training at Google.

@jbarth-ubhd
Copy link
Author

@stweil: images in zip are CC0.

@Shreeshrii
Copy link
Contributor

@jbarth-ubhd Thank you.

I looked at the manual transcription and there seem to be some differences (related to s) in it compared to the images and tesseract's OCR results. So, I can't compare it directly for accuracy - may require some correction. I will post later with an example.

@stweil
Copy link
Contributor

stweil commented Jun 19, 2018

I had made a manual transcription, too, and will compare it with that provided by @jbarth-ubhd. Making a really error-free transcription is surprisingly difficult, but the mix of our common efforts should be quite good. :-) I expect to upload it later today, maybe tomorrow.

@stweil
Copy link
Contributor

stweil commented Jun 19, 2018

Here is the delta of my transcription (with long ſ converted to lower case s):

diff --rec -u manual/frauenwarte1935_1936_-_0700b.txt gt-s/frauenwarte1935_1936_-_0700b.txt
--- manual/frauenwarte1935_1936_-_0700b.txt	2018-06-18 08:06:20.000000000 +0200
+++ gt-s/frauenwarte1935_1936_-_0700b.txt	2018-06-19 21:56:54.488689046 +0200
@@ -1,3 +1,3 @@
 So und ähnlich lauten Tausende begeisterte
-Anerkennungen dankbarer Kundinnen. - War-
+Anerkennungen dankbarer Kundinnen.–War-
 um grämen Sie sich also noch, wenn auch Sie
diff --rec -u manual/hnn1936_-_057_11.txt gt-s/hnn1936_-_057_11.txt
--- manual/hnn1936_-_057_11.txt	2018-06-18 08:06:52.000000000 +0200
+++ gt-s/hnn1936_-_057_11.txt	2018-06-19 21:52:53.508672164 +0200
@@ -1,3 +1,3 @@
 eine Ausgleichsgebühr von 4,50 Mark; aber gegen
 Wochenende kam man auch hier meist bis auf 4 Mark
-entgegen. Das gleiche trifft auch für Magdeburg-
+entgegen. Das Gleiche trifft auch für Magdeburg-
diff --rec -u manual/kunstwart_kulturwart26_2_-_152b.txt gt-s/kunstwart_kulturwart26_2_-_152b.txt
--- manual/kunstwart_kulturwart26_2_-_152b.txt	2018-06-18 08:08:34.000000000 +0200
+++ gt-s/kunstwart_kulturwart26_2_-_152b.txt	2018-06-19 21:54:15.142032907 +0200
@@ -1,3 +1,3 @@
-"Wie sehr auch die Abwesenheit der Farbe die Beurteilung dieser Malerei beengt, so ist doch wohl durch keine Farbei eine
-Wirkung derartiger Malerei denkbar, welche die Worte Meier-Graefes rechtfertigte: 'Der Neoimpressionismus ist schöner,
+„Wie sehr auch die Abwesenheit der Farbe die Beurteilung dieser Malerei beengt, so ist doch wohl durch keine Farbe eine
+Wirkung derartiger Malerei denkbar, welche die Worte Meier-Graefes rechtfertigte: ,Der Neoimpressionismus ist schöner,
 größer und göttlicher selbst als die kirchliche Tradition.'"
diff --rec -u manual/mannheimer_anzeiger1858_-_040_01.txt gt-s/mannheimer_anzeiger1858_-_040_01.txt
--- manual/mannheimer_anzeiger1858_-_040_01.txt	2018-06-19 22:06:33.162334885 +0200
+++ gt-s/mannheimer_anzeiger1858_-_040_01.txt	2018-06-19 21:54:22.406153992 +0200
@@ -1,3 +1,3 @@
 * In Kurhessen wiederholen sich die unangenehmsten
-Verhältnisse im raschesten Wechsel ! Dem ehemaligen Obergerichts-
+Verhältnisse im raschesten Wechsel! Dem ehemaligen Obergerichts-
 rath v. Haynau wurde allerhöchst die Genehmigung zum Doziren
diff --rec -u manual/medaillen1737_-_00_429.txt gt-s/medaillen1737_-_00_429.txt
--- manual/medaillen1737_-_00_429.txt	2018-06-18 08:10:52.000000000 +0200
+++ gt-s/medaillen1737_-_00_429.txt	2018-06-19 21:54:25.678208534 +0200
@@ -1,3 +1,3 @@
 chischen Wappenschild an der Brust des Adlers bey der sechsten medaille,
 auch aus Versehen, nicht erkläret worden. Ich halte aber dafür daß sel-
-bige LEOPOLDUS I, Leopold der erste, heisen.
+bige LEOPOLDUS I. Leopold der erste, heisen.
diff --rec -u manual/mitthdschloss1_-_201.txt gt-s/mitthdschloss1_-_201.txt
--- manual/mitthdschloss1_-_201.txt	2018-06-18 09:34:27.000000000 +0200
+++ gt-s/mitthdschloss1_-_201.txt	2018-06-19 22:04:18.552091083 +0200
@@ -1,3 +1,3 @@
 Item die Andre Ründung mitt den Zwelff himlischen
-Zechen, so in blauen feltt gemahlt, undt weisset die Tag
-Undt Nachtlenge; geht Sieben büchlein gollt drauff, duht
+Zechen, so in blauen feltt gemahlt, vndt weisset die Tag
+Vndt Nachtlenge; geht Sieben büchlein gollt drauff, duht

My transcription is available from https://digi.bib.uni-mannheim.de/~stweil/fraktur-gt.zip.

@Shreeshrii
Copy link
Contributor

Shreeshrii commented Jun 21, 2018 via email

@Shreeshrii
Copy link
Contributor

My testing shows better results with finetuned model at
https://github.com/Shreeshrii/tessdata_shreetest/blob/master/frk.traineddata

Please give it a try.

@jbarth-ubhd
Copy link
Author

@stweil
Copy link
Contributor

stweil commented Jun 25, 2018

Thank you @Shreeshrii. That's a good example which shows that there still is much more room for improvements of Tesseract OCR - one of the reasons why I would love to have language and script models which can be reproduced by everybody.

@Shreeshrii
Copy link
Contributor

I would love to have language and script models which can be reproduced by everybody.

So would we all :-)

Any update regarding the langdata for 4.0.0.

Also, Are the float models for the traineddata files in tessdata_fast available?

@Shreeshrii
Copy link
Contributor

I have posted the files used for finetuning the Fraktur model for German. Please see
https://github.com/Shreeshrii/tessdata_fraktur

These can be modified further by Fraktur experts.

I will run the accuracy tests again and post results later.

@Shreeshrii
Copy link
Contributor

Shreeshrii commented Jun 26, 2018

Looks like the earlier training that I had done has better results than the one posted today:

RELEASE               TestSet       CharErrors      Accuracy        WordErrors      Accuracy        NonStopWErrors  Accuracy        TimeTaken
4_shreetest_frk-frk     frk-ligatures   128             96.21%          84              84.30%          61                      79.53           103.42s

RELEASE               TestSet       CharErrors      Accuracy        WordErrors      Accuracy        NonStopWErrors  Accuracy        TimeTaken
4_shreetest_frk-Fraktur frk-ligatures   289             91.45%          129             75.89%          109                     63.42           103.95s

@Shreeshrii
Copy link
Contributor

Added a new traineddata at https://github.com/Shreeshrii/tessdata_fraktur

@stweil I have tried to add ~ and §. Please check with your testset. Thanks!

@stweil
Copy link
Contributor

stweil commented Aug 30, 2019

Jochen, a new model for Fraktur which I trained last week delivers significantly better results. Maybe you want to give it a try.

Please note that this new model currently does not include a dictionary (so you will get a warning).

@Shreeshrii
Copy link
Contributor

Related news:

https://read.transkribus.eu/2019/08/23/general-model-for-fraktur-released/

Thanks to the Library Labs of the Austrian National Library and the NewsEye project we are happy to announce the release of a free model which is capable to read German Fraktur documents especially from the 19th and 20th century in a convincing quality outperforming most standard OCR engines. The model is based on training data coming from the ANNO collection of the Austrian National Library and comprises 442.141 words. It shows a CER of 1,55% on the training set and 1,65% on the test set without any dictionary support. Note: the model is trained on German language documents. It will provide less convincing results for other languages, such as Swedish or Finnish Fraktur. However models for these languages are also in preparation and may be released in the coming months. The Fraktur model is available for every registered user in Transkribus and called: ONB _Newseye_GT_M1+. Have fun!

@stweil
Copy link
Contributor

stweil commented Aug 31, 2019

Maybe @ONB-RD can share the ground truth data which was used to train Transcribus. Then it could be used for training with Tesseract and other Open Source OCR software as well.

@stweil
Copy link
Contributor

stweil commented Oct 5, 2019

@jbarth-ubhd, these transcriptions need to be fixed (Tesseract OCR result was correct):

  • manual/hnn1936_-_057_11.txt: "Das gleiche" should be "Das Gleiche"
  • manual/kunstwart_kulturwart26_2_-_152b.txt: "keine Farbei" should be "keine Farbe"

The normalized output from my Fraktur model from August still has these differences to the fixed ground truth:

[-dzo-]{+So+} und [-ähnlich,-] {+ähnlich+} lauten Tausende begeisterte
Anerkennungen dankbarer [-Kundinnen-] {+Kundinnen.+} - War-
[-Lne-]{+eine+} Ausgleichsgebühr von [-4060-] {+4,50+} Mark; [-aber,-] {+aber+} gegen
Der Kellner brachte das Essen. Der [-Zugend-] {+Jugend+}
Wirkung derartiger Malerei denkbar, welche die Worte [-Meier-Grgefes rechtfertigte; Der Reoinipressionismus-] {+Meier-Graefes rechtfertigte: 'Der Neoimpressionismus+} ist schöner,
größer und göttlicher selbst als die kirchliche [-Träditiön.“-] {+Tradition.'"+}
[-D-]
{+Dù+} mir so kleine [-froͤide git?“-] {+froide git?+}
Mir sint die [-blümen-] {+blumen+} und der kle,
auch aus [-Verseben,-] {+Versehen,+} nicht erkläret [-worden;-] {+worden.+} Ich halte aber dafür daß sel-
bige [-LEObOLDus l. Leopoid-] {+LEOPOLDUS I, Leopold+} der erste, heisen.
Eichenholzregal und Schnitzwerk im Stile der [-Antite.-] {+Antike.+}
[-Gechen,-]
[-Vndt-]
[-gesüttigt,-]{+gesättigt,+} adj. [-(Hütt.,-] {+(Hütt.),+} heißt eine [-Salzsöle-] {+Salzsole+} dann, wenn
883,0 m. [-(SDie-] {+(Die+} angegebenen Ziffern beziehen sich stets auf die
ein schrecklicher [-Platzlegen,-] {+Platzregen,+} und aus dem Platz- ward ein
[-Gofort-]{+Sofort+} nach Eintreten der Dunkelheit verließen wir
die vorderste [-Gtellung-] {+Stellung+} und arbeiteten uns trotz zahl-
reicher feindlicher [-Leuchtkugein-] {+Leuchtkugeln+} langsam an das Un-

The OCR results "froͤide", "blümen" and "Salzsöle" are better than the manual transcription.

@stweil
Copy link
Contributor

stweil commented Dec 17, 2019

Maybe @ONB-RD can share the ground truth data which was used to train Transcribus.

That data is now available and used for Fraktur training with Tesseract. See https://github.com/tesseract-ocr/tesstrain/wiki/AustrianNewspapers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants