docling-project / docling-project/docling
Ligature Glyphs generate spaces and break text - Need a built-in ligature-aware text normalization
- Dominant language
- Python
- Stars
- 66.4k
- Forks
- 4.8k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 84
Description
### Bug
The PDF's embedded font encoding maps ligature glyphs (fi, fl, ff, ffi, ffl) to separate characters with spaces. Both Docling's layout model and native backend produce identical broken text — Docling just passes through what the PDF gives it.
...
### Steps to reproduce
Text with ligature glyphs is processed by Docling.
Docling produces text with space separated characters
Examples:
Ligature Pattern
fi veri fi cation → verification
fl in fl ammation → inflammation
ff a ff ect → affect
ffi a ffi nity → affinity
ffl wa ffl e → waffle
Apostrophe Virchow ' s → Virchow's
En-dash T cell e mediated → T cell–mediated
Word join Humoralimmunity.Naïve → Humoralimmunity. Naïve
# Standard PDF ligatures and their Unicode points
LIGATURE_MAP = {
"\ufb00": "ff", # ff ligature
"\ufb01": "fi", # fi ligature
"\ufb02": "fl", # fl ligature
"\ufb03": "ffi", # ffi ligature
"\ufb04": "ffl", # ffl ligature
"\ufb05": "ft", # ft ligature (rare)
"\ufb06": "st", # st ligature (rare)
"\u2013": "–", # en-dash
"\u2014": "—", # em-dash
"\u2019": "'", # right single quote (apostrophe)
}
...
### Docling version
v2.93.0
...
### Python version
Python 3.13.13
...
### Possible solution
A built-in ligature-aware text normalization
Contributor guide
Assessment
This issue has not been assessed yet.