Kurdish OCR: Turning Scans into Searchable Text
Kurdish OCR for archives, schools and offices: how to capture good scans, test Sorani engines, check accuracy and store searchable results.
Ali-K to Unicode: why old Kurdish documents break on phones, web and search, and a step-by-step way to convert, normalise and spell-check them safely.

Many offices, universities and ministries in the Kurdistan Region hold years of letters, transcripts and reports typed in Ali-K fonts. They look fine in Word on the old office PC. Paste the same text into WhatsApp, a website, a database or an AI tool, though, and it turns into broken words that nobody can search. In my view, moving these files from Ali-K to Unicode is one of the cheapest and most useful digitalisation jobs an organisation can do. Here is a practical way to do it without breaking formatting or leaking documents.
Ali-K fonts were developed by Abas Majid in 1997, and Dylan fonts by Dylan Saleh at KurdSoft in 2001. Both solved a real problem at the time. Kurdish letters were not easy to type, so these fonts drew Kurdish shapes on top of ordinary Arabic characters.
The result is that the stored text is not really Kurdish. The AsoSoft Library gives a clear example. The Ali-K text "خويَندكار بة طوَرِانكاريية" becomes, in proper Unicode, "خوێندکار بە گۆڕانکارییە".
When the font is present, you see the second version. When it is missing, which is the case on most phones, browsers and AI tools, you get the first. A search for گۆڕانکاری will never find it.
The problem has not gone away. Typing with Ali fonts remains popular because it does not need a Kurdish keyboard layout, so organisations keep producing new legacy files.
Do not start with a converter. Start with a list.
Sort the results into groups: Ali-K, Ali-Web, Dylan, scanned images, and text that is already Unicode but messy. Each group needs a different treatment.
There are good free options now:
pip install asosoft, Python 3.8+, MIT licence), with converters for Ali-K, Ali-Web and Dylan plus a normaliser.There is also Kurd.AI, which I founded. It includes an Ali-K to Unicode converter alongside a Kurdish spelling checker and keyboard. It is handy for staff who need to fix a paragraph of non-sensitive text quickly.
The information-security point matters here. Online converters are fine for public text such as news items or published course descriptions. For HR records, student files, medical letters or legal documents, use an offline library on a controlled machine. Uploading a confidential file to any website, however convenient, is a data transfer you need to be able to justify.
A common mistake is to convert the entire document. That damages English, Arabic and numbers that were never in a legacy font. The safer approach is to convert only the text runs set in legacy fonts, then switch those runs to a Unicode font.
Here is a short Python sketch using python-docx and the asosoft package. Treat it as an example. Check the function names against the package README, save old .doc files as .docx first, keep a backup, and always write to a new file.
# Example only: back up first, write to a new file, never overwrite the original.
from docx import Document
from docx.oxml.ns import qn
import asosoft # pip install asosoft
# Adjust to the exact font names your files show in Word.
LEGACY_HINTS = ("ali_k", "ali-k", "alik")
UNICODE_FONT = "Tahoma"
def cs_font(run):
rpr = run._element.rPr
if rpr is not None and rpr.rFonts is not None:
return rpr.rFonts.get(qn("w:cs")) or run.font.name or ""
return run.font.name or ""
def convert_runs(paragraphs):
for para in paragraphs:
for run in para.runs:
name = cs_font(run).lower().replace(" ", "_")
if run.text and any(h in name for h in LEGACY_HINTS):
run.text = asosoft.AliK2Unicode(run.text)
run.font.name = UNICODE_FONT
run._element.rPr.rFonts.set(qn("w:cs"), UNICODE_FONT)
doc = Document("archive/letter-2009.docx")
convert_runs(doc.paragraphs)
for table in doc.tables:
for row in table.rows:
for cell in row.cells:
convert_runs(cell.paragraphs)
doc.save("converted/letter-2009.docx")
This only catches fonts set directly on runs. If your templates set the legacy font in a style, handle the styles too. Tahoma is one of several Windows fonts that display Unicode Kurdish, alongside Arial and Times New Roman. The Bahij Kurdish standard fonts are another option.
Conversion is only half the job. AsoSoft's normaliser does four things:
Run it on converted text and on text that was already Unicode but messy.
Stray zero-width non-joiners deserve attention. They are often left behind by earlier poor conversions and break words in search.
Then choose a house standard and write it down. The main decision is the letter for /h/. The Kurdish keyboard layouts project uses ه (U+0647) rather than ھ (U+06BE), following the KRG Department of Information Technology's standard. Whichever you pick, apply the same rule to stored text and to search queries, or searches will miss.
KLPT, the Kurdish Language Processing Toolkit, covers preprocessing, tokenisation and spell-checking for Sorani and Kurmanji. Use it to flag likely errors, then have a person review a sample. Typical problems are wrong ڕ or ڵ, missing ێ or ۆ, and words split around zero-width characters.
A scanned PDF contains pictures, not text, so no font converter can help. Here the tooling is improving. A new open-source project, Kurdish-OCR, has had its first public release. It offers a REST API built on Laravel and Tesseract 5, with a custom-trained Sorani model.
Be realistic. Accurate Kurdish OCR is still limited, so expect manual correction. Normalise the OCR output, and store the original scan alongside the text as the authoritative record.
Use this table to route each group of files:
| Source | Tool | Watch out for |
|---|---|---|
| Ali-K | AliK2Unicode | Samik and Traditional also exist in Ali-Web; test a sample |
| Ali-Web | AliWeb2Unicode | Same font-name overlap with Ali-K |
| Dylan | Dylan2Unicode | Confirm font names in the file first |
| Scanned | OCR (Tesseract with a Sorani model) | Manual correction; keep the original scan |
| Already Unicode but messy | Normalize | Stray zero-width characters, presentation forms, look-alike letters |
Before you sign off a batch:
Then close the tap:
If older web systems need rebuilding or cleaning up as part of this work, my company Standing can help through its web and app development and IT services. The steps above are the same whoever does it.
The takeaway is simple: legacy Kurdish text is invisible to phones, search and AI until it becomes real Unicode. Inventory first, convert only what needs converting, normalise to one written standard, and make sure no new Ali-K files are created tomorrow.
🤖 Researched and drafted with AI assistance, guided by my editorial standards. Spotted something wrong? Tell me.