Upload folder using huggingface_hub
Browse filesFiles changed (3)
16 unmodified lines171819202122237 unmodified lines3132333435363717 unmodified lines55565758596061626364656667686970717273747576777879808 unmodified lines899091929394959697989910010116 unmodified linesA Danish attempt of Impresso's[OCR-quality-assessment-unigram](https://huggingface.co/impresso-project/OCR-quality-assessment-unigram).It is a Bloom filter of known Danish words, from the 1700s to today. A text's OCR quality score is the share of its distinctwords that are known. The file format, normalisation and score are the same as Impresso's, so Danish scores sit on the samescale as their French and German ones.## Usage7 unmodified linesfrom huggingface_hub import hf_hub_downloadfrom pybloomfilter import BloomFilterknown = BloomFilter.open(hf_hub_download("chcaa/ocrqa-dk-unigram", "ocrqa-dyna_v1.2.0-da.bloom"))PUNCT = "„•<>!\"#%&'’()*,./:;?[]\\~_{}\xa1\xab\xb7\xbb\xbf—^`¦§£=-"TABLE = str.maketrans({c: " " for c in PUNCT} | {d: "0" for d in "0123456789"})17 unmodified lines- **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`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,873,757 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.2.0-da.bloom.json`.## EvaluationScores below are on 3000-character chunks of held-out documents. Every 20th document was left out for testing.| Text | Wikipedia-only list | This model ||---|---|---|| Clean modern text | 0.88–0.94 | 0.93–0.99 || Clean historical text (1700s–1900s) | 0.67–0.84 | 0.93–0.98 || Enevældens Nyheder, 1660–1849 (OCR/HTR) | 0.71 | 0.91 || Danmarks Breve (uncorrected OCR) | 0.74 | 0.90 |With simulated OCR errors added to clean historical text, the score falls steadily with the character error rate.The simulated errors include Danish and Fraktur confusions: æ/œ, ø/ö, å/aa, ſ/f, e/c, rn/m, dropped letters and split words.8 unmodified lines## Limitations- **1700s–early 1800s spellings are still partly missing**, so text from that period scores slightly lower (clean 1700s text: 0.93, modern: 0.97). The spelling rules only cover forms that occur in the corpora.- **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.2.0:** adds attested older spellings via rules (Enevældens Nyheder 0.89 → 0.91)- **1.1.0:** 1–2 letter lexicon words must pass the frequency rule- **1.0.0:** first build16 unmodified lines1718192021222324257 unmodified lines3334353637383917 unmodified lines575859606162636465666768697071727374757677787980818283848 unmodified lines9394959697989910010110210310410510610710816 unmodified linesA Danish attempt of Impresso's[OCR-quality-assessment-unigram](https://huggingface.co/impresso-project/OCR-quality-assessment-unigram).It is a Bloom filter of known Danish words, from the 1700s to today. A text's OCR quality score is the share of its distinctwords that are known. *Note that the filter in practice measures "unknown words", not OCR errors.*The file format, normalisation and score are the same as Impresso's, so Danish scores sit on the samescale as their French and German ones.## Usage7 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"})17 unmodified lines- **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`.## EvaluationScores below are on 3000-character chunks of held-out documents. Every 20th document was left out for testing.Only Danish documents are scored. German, French and English ones are left out.| Text | Wikipedia-only list | This model ||---|---|---|| Clean modern text | 0.88–0.94 | 0.93–0.99 || Clean historical text (1700s–1900s) | 0.70–0.84 | 0.93–0.98 || Enevældens Nyheder, 1660–1849 (OCR/HTR) | 0.71 | 0.91 || Danmarks Breve (uncorrected OCR) | 0.75 | 0.90 |With simulated OCR errors added to clean historical text, the score falls steadily with the character error rate.The simulated errors include Danish and Fraktur confusions: æ/œ, ø/ö, å/aa, ſ/f, e/c, rn/m, dropped letters and split words.8 unmodified lines## Limitations- **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:** language check based on spaCy's stop-word lists, now also skipping English documents. Scores unchanged.- **1.3.0:** German and French documents are skipped when counting words. Danish scores are unchanged; German text no longer scores as known.- **1.2.0:** adds attested older spellings via rules (Enevældens Nyheder 0.89 → 0.91)- **1.1.0:** 1–2 letter lexicon words must pass the frequency rule- **1.0.0:** first build
README.md+14-7
figures/by_source.png

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

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

Large File Pointer Details
- SHA256: e272aab769fc09f8ede3982d277bc783c3197a1b028a6c7cd1999163c9960cef
- Pointer size: 131 Bytes
- Size of remote file: 124 kB

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