v1.4.0: aa spellings, place names, HDH as test set
Browse filesFiles changed (3)
33 unmodified lines3435363738394012 unmodified lines5354555657585960616263646566676869707125 unmodified lines97989910010110210310410510610710811 unmodified lines12012112212312412533 unmodified linesfrom huggingface_hub import hf_hub_downloadfrom pybloomfilter import BloomFilterknown = BloomFilter.open(hf_hub_download("chcaa/ocrqa-dk-unigram", "ocrqa-dyna_v1.3.1-da.bloom"))PUNCT = "„•<>!\"#%&'’()*,./:;?[]\\~_{}\xa1\xab\xb7\xbb\xbf—^`¦§£=-"TABLE = str.maketrans({c: " " for c in PUNCT} | {d: "0" for d in "0123456789"})12 unmodified lines- **Lexicons:** words that count as known whatever their frequency:- ODS full forms (1700–1950, old spelling), DDO full forms and Flexikon, all from [DSL](https://korpus.dsl.dk/resources/index.html)- COR1 / Retskrivningsordbogen 5.1 from [Dansk Sprognævn](https://ordregister.dk/)Together that's 1.77M distinct words. Words of 1–2 letters must also pass the frequency rule below. This keeps out abbreviations like *tl* and *mt*, which are also common OCR fragments.- **Corpus counts:** about 200M tokens from clean subsets of [Danish Dynaword](https://huggingface.co/datasets/danish-foundation-models/danish-dynaword):- Modern: `wikipedia`, `ft`, `tv2r`, `danske-taler`- Historical: `adl`, `grundtvig`, `kalliope`, `wikisource`, `gutenberg`, `jvj`, `relig`, `historical-danish-handwriting`, `trykkefrihedens_skrifter`Documents in German, French or English are skipped. They are found with spaCy's stop-word lists, keeping only words that belong to one language. Examples: the 115 German and French pamphlets in Trykkefrihedens Skrifter, and 1.9k Wikipedia articles that are mostly foreign titles.A word is accepted if its count is at least `max(2, 2500 / length²)`, Impresso's v2.0.0 setting. This adds 68k words.- **Older spellings:** a 1700s–1800s spelling is accepted when a rule maps it to a known word and it actually occurs:at least twice in the clean corpora, or 10 times in OCR'd Dynaword sets. The rules cover *kiøb → køb*, *huus → hus*,*jndhold → indhold*, *qv → kv*, *høyst → højst*, *øxe → økse*, *ph → f*, and similar. This adds 32.5k words.- **Storage:** the 1,871,837 words are stored as a Bloom filter (5 MB, read with `pybloomfiltermmap3`). It answers only "is this word known?" and cannot be read back as a word list. It never misses a known word, and wrongly accepts about 1 in 20,000 unknown words.Build parameters are in `ocrqa-dyna_v1.3.1-da.bloom.json`.## Evaluation25 unmodified lines- **Some 1700s–early 1800s spellings are still missing.** Clean 1700s text scores 0.95, against 0.97 for modern text. The spelling rules only cover forms that occur in the corpora.- **The model is for Danish.** German, French or English text scores low (German: about 0.4) whatever its OCR quality.- **Norwegian text scores lower**, whatever its OCR quality.- **Names and foreign words count as unknown** unless they are frequent.- **No exclusion list of known OCR errors yet.** Impresso uses one.## Versions- **1.3.1** (current): German, French and English documents are skipped when counting words, so foreign words such as *daß* and *avoit* are no longer known. Danish scores are unchanged; German text now scores about 0.4 instead of 0.65.- **1.2.0:** first release.## Credits11 unmodified linesOther sources:- Method and normalisation: the [Impresso project](https://huggingface.co/impresso-project/OCR-quality-assessment-unigram).- COR1 (Retskrivningsordbogen 5.1): Dansk Sprognævn, [ordregister.dk](https://ordregister.dk/).- Word counts: [Danish Dynaword](https://huggingface.co/datasets/danish-foundation-models/danish-dynaword)(Danish Foundation Models) and the original sources listed in its dataset cards.33 unmodified lines3435363738394012 unmodified lines53545556575859606162636465666768697071727325 unmodified lines9910010110210310410510610710810911011111 unmodified lines12312412512612712812933 unmodified linesfrom huggingface_hub import hf_hub_downloadfrom pybloomfilter import BloomFilterknown = BloomFilter.open(hf_hub_download("chcaa/ocrqa-dk-unigram", "ocrqa-dyna_v1.4.0-da.bloom"))PUNCT = "„•<>!\"#%&'’()*,./:;?[]\\~_{}\xa1\xab\xb7\xbb\xbf—^`¦§£=-"TABLE = str.maketrans({c: " " for c in PUNCT} | {d: "0" for d in "0123456789"})12 unmodified lines- **Lexicons:** words that count as known whatever their frequency:- ODS full forms (1700–1950, old spelling), DDO full forms and Flexikon, all from [DSL](https://korpus.dsl.dk/resources/index.html)- COR1 / Retskrivningsordbogen 5.1 from [Dansk Sprognævn](https://ordregister.dk/)- Danish place names from [GeoNames](https://www.geonames.org/) (5.9k names not already known; names spelled without æ/ø/å, such as *norre*, are left out because they look like OCR errors)Together that's 1.77M distinct words. Words of 1–2 letters must also pass the frequency rule below. This keeps out abbreviations like *tl* and *mt*, which are also common OCR fragments.- **Corpus counts:** about 200M tokens from clean subsets of [Danish Dynaword](https://huggingface.co/datasets/danish-foundation-models/danish-dynaword):- Modern: `wikipedia`, `ft`, `tv2r`, `danske-taler`- Historical: `adl`, `grundtvig`, `kalliope`, `wikisource`, `gutenberg`, `jvj`, `relig`, `trykkefrihedens_skrifter`Documents in German, French or English are skipped. They are found with spaCy's stop-word lists, keeping only words that belong to one language. Examples: the 115 German and French pamphlets in Trykkefrihedens Skrifter, and 1.9k Wikipedia articles that are mostly foreign titles.A word is accepted if its count is at least `max(2, 2500 / length²)`, Impresso's v2.0.0 setting. This adds 68k words.- **Older spellings:** a 1700s–1800s spelling is accepted when a rule maps it to a known word and it actually occurs:at least twice in the clean corpora, or 10 times in OCR'd Dynaword sets. The rules cover *kiøb → køb*, *huus → hus*,*jndhold → indhold*, *qv → kv*, *høyst → højst*, *øxe → økse*, *ph → f*, and similar. This adds 33k words.- **aa spellings:** every known word with *å* is also known in its pre-1948 *aa* spelling (*gård → gaard*), whether or not it is attested. This adds 23.5k words.- **Storage:** the 1,900,917 words are stored as a Bloom filter (5 MB, read with `pybloomfiltermmap3`). It answers only "is this word known?" and cannot be read back as a word list. It never misses a known word, and wrongly accepts about 1 in 20,000 unknown words.Build parameters are in `ocrqa-dyna_v1.4.0-da.bloom.json`.## Evaluation25 unmodified lines- **Some 1700s–early 1800s spellings are still missing.** Clean 1700s text scores 0.95, against 0.97 for modern text. The spelling rules only cover forms that occur in the corpora.- **The model is for Danish.** German, French or English text scores low (German: about 0.4) whatever its OCR quality.- **Norwegian text scores lower**, whatever its OCR quality.- **Personal names and foreign words count as unknown** unless they are frequent or in the dictionaries. Text full of names, such as advertisements or lists, scores lower. Place names are covered through GeoNames.- **No exclusion list of known OCR errors yet.** Impresso uses one.## Versions- **1.4.0** (current): adds aa spellings of all å-words and Danish place names from GeoNames, and no longer counts words from `historical-danish-handwriting`, which has transcription errors. *Suggested by Johan Heinsen (AAU).*- **1.3.1:** German, French and English documents are skipped when counting words, so foreign words such as *daß* and *avoit* are no longer known. Danish scores are unchanged; German text now scores about 0.4 instead of 0.65.- **1.2.0:** first release.## Credits11 unmodified linesOther sources:- Method and normalisation: the [Impresso project](https://huggingface.co/impresso-project/OCR-quality-assessment-unigram).- COR1 (Retskrivningsordbogen 5.1): Dansk Sprognævn, [ordregister.dk](https://ordregister.dk/).- Place names: [GeoNames](https://www.geonames.org/), under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).- Word counts: [Danish Dynaword](https://huggingface.co/datasets/danish-foundation-models/danish-dynaword)(Danish Foundation Models) and the original sources listed in its dataset cards.
README.md+11-7
figures/by_source.png

Large File Pointer Details
- SHA256: da13b3242dae8afdb04cf4410a9378d32f50944d094f5e78f83f6cc5c61841e3
- Pointer size: 131 Bytes
- Size of remote file: 212 kB

Large File Pointer Details
- SHA256: 2bc326c9899dec0545e73ff945f6f46ad94e15e101c9f3d82914acafaad677ca
- Pointer size: 131 Bytes
- Size of remote file: 208 kB
figures/noise_curve.png

Large File Pointer Details
- SHA256: f881c56be73997e1edc1c4a3d0e242bb8b754c21d85a7e81004e85dab6423631
- Pointer size: 131 Bytes
- Size of remote file: 125 kB

Large File Pointer Details
- SHA256: 072ca2e4d71dd3420c6b3a418182041a731042b63912da647c5435bdb964d2fd
- Pointer size: 131 Bytes
- Size of remote file: 125 kB