BlogTranslation7 min read

Prepare an OCR'd Arabic Word file for memoQ or Trados: fewer tags

Tag soup in a CAT tool usually comes from the Word file, not the tool: OCR splits Arabic text into many small runs with slightly different formatting, and breaks sentences across lines. Count the runs, join broken lines, clear direct formatting you don't need, then use the import options that ignore minor formatting, and test on a sample before quoting.

You receive a Word file converted from a scanned Arabic book, contract or report. It looks clean in Word. Then you add it to memoQ or Trados Studio and every second word sits between tags, sentences are cut in half at the end of each printed line, and the word count looks wrong. Translating it like that is slow, tag errors can block the export, and the time is hard to bill.

The cause is almost always inside the Word file. This guide shows how to measure the problem before you quote, how to clean the file without losing formatting that matters, and which import options help. It is written for translators, project managers and DTP staff who receive converted files, and for whoever prepares them.

Why OCR'd Word files turn into tag soup

A Word paragraph is stored as a series of runs: stretches of text that share the same character formatting. A CAT tool shows a change of formatting inside a segment as a tag. Typed documents have few runs per paragraph. Converted documents often have many, because the converter tries to reproduce the printed page:

  • Tiny formatting differences. Character spacing, baseline shifts, font size changes of half a point or condensed text, applied word by word to match the scan.
  • Script and language attributes. Arabic runs carry right-to-left and complex-script properties, and Word adds "font hint" attributes. Mixed Arabic, Latin and digits in one line produce extra runs at every switch.
  • Line-by-line layout. Each printed line becomes its own paragraph or ends in a manual line break, so the CAT tool segments in the middle of sentences.
  • Text boxes and frames. Headings, marginal notes or whole pages placed in text boxes may import out of order, or not where you expect.
  • Page furniture in the body. Running heads and page numbers sitting in the text, which then become segments to translate.

None of this is visible at normal zoom, which is why "it opened fine" tells you nothing.

Step 1: measure before you quote

Work on a copy; keep the delivered file untouched. Then take two quick readings.

Formatting marks. On the Home tab, turn on Show/Hide ¶. If a ¶ or ↵ appears at the end of almost every line, rather than at the end of paragraphs, segmentation will break mid-sentence.

Runs per paragraph. A .docx file is a zip archive, and the body text lives in word/document.xml. This short Python script counts runs per paragraph:

import re, sys, zipfile
xml = zipfile.ZipFile(sys.argv[1]).read("word/document.xml").decode("utf-8")
paras = re.findall(r"<w:p[ >].*?</w:p>", xml, flags=re.S)
counts = [len(re.findall(r"<w:r[ >]", p)) for p in paras]
counts = [c for c in counts if c]
print("paragraphs with text:", len(counts))
print("runs:", sum(counts), "average per paragraph:", round(sum(counts) / len(counts), 1))
print("paragraphs with 10+ runs:", sum(c >= 10 for c in counts))

Run it as python3 runs.py file.docx. We checked it in this session on two small test files we built ourselves: one Arabic paragraph stored as a single run, and the same paragraph split word by word with varying character spacing. It reported 1 and 11 runs. It does not predict an exact tag count, since CAT tools merge some runs and add tags for other things, but a high average, or many paragraphs with ten or more runs, means you should clean the file or price the extra work before you accept it.

The most reliable reading is a pilot import: add the file to a throwaway project with your normal settings, scroll through a few pages and note how many segments carry tags and how many end mid-sentence.

Step 2: clean the Word file

Do these in order, on the copy.

  1. Resolve review traces. Accept or reject tracked changes (Review > Accept > Accept All Changes, once you have checked them) and deal with comments, so the CAT tool doesn't have to.
  2. Remove page furniture. Delete running heads and page numbers that sit in the body text, or move them into the real header and footer. Note in your delivery record that you did.
  3. Join broken lines. Rebuild paragraphs so that one paragraph in the file is one paragraph on the page. Find and Replace on paragraph marks (^p) or manual line breaks (^l) works, but run it on a selection and check each replacement: blanket replacing will also merge headings, verse lines, list items and table cells.
  4. Protect formatting that carries meaning. Before clearing anything, decide what the formatting is telling the reader. In classical editions bold or a different font may mark the base text (matn) against the commentary, or headwords in a dictionary; in contracts it may mark defined terms. Apply a named character style to those passages first, so they survive the next step and stay identifiable.
  5. Clear direct formatting in body text. Select body paragraphs and use Home > Clear All Formatting. Microsoft notes that this removes formatting you added or changed (bold, italics, colour and so on) and returns text to its default style. Then reapply your body and heading paragraph styles, and make sure Arabic paragraphs still run right to left.
  6. Bring text out of text boxes where the box is only an artefact of the page layout. Keep genuine sidebars, but know they may import as separate segments.
  7. Inspect. Run File > Info > Check for Issues > Inspect Document to find leftover comments, hidden text and personal information. Microsoft warns that removed data can't always be restored, so do this on the copy.

Measure again with the script. If the average has dropped and broken lines are gone, the file is ready.

Step 3: set the import options

Cleaning the file does most of the work. The import settings handle what is left.

In memoQ, the Microsoft Word filter settings include:

  • Ignore minor formatting changes for fewer tags. The documentation says memoQ then ignores changes such as baseline shifts, character spacing and character compression, and calls it useful for scanned documents or PDF conversions.
  • Ignore font "hints" for cleaner import. The documentation links this to translating from Arabic or Asian languages into a European one.
  • Import markup as inline tags, the recommended option, rather than legacy tags.
  • Comments are not imported unless you ask, tracked changes are accepted before import by default, and hidden text is imported only if you tick Import hidden text.
  • Exclude text by style formatting lets you leave text in a named style out of the translatable content. Style names must be typed exactly.

The memoQ documentation also notes that formatting ignored on import is missing from the exported document. That is fine for spacing and compression, but it is another reason to put meaningful formatting into styles first.

Trados Studio has its own Word file type settings, including options for how complex-script font formatting and other formatting are handled. Option names differ between versions, so check the help for the version you run, and confirm with a pilot import.

Illustrative example

Illustrative example. A translator is asked to quote for an 80-page converted Arabic report going into English. A pilot import of ten pages shows tags in most segments and sentences broken at the end of each printed line, and the run script reports many paragraphs with ten or more runs. The translator quotes in two parts: file preparation, priced by the hour, and translation. Preparation means joining lines, removing page numbers from the body, giving headings and body text styles, clearing direct formatting and re-importing with minor formatting ignored. The second pilot import has few tags and whole sentences, and the translation quote is based on that version.

Checklist before you translate or deliver

  • Working on a copy; the original converted file is kept unchanged
  • Show/Hide ¶ shows paragraph marks at paragraph ends, not at every printed line
  • Runs per paragraph measured before and after cleaning
  • Tracked changes and comments resolved
  • Running heads and page numbers removed from the body, or moved to header and footer
  • Meaningful formatting (base text, headwords, defined terms) captured in character styles
  • Direct formatting cleared in body text; paragraph styles and right-to-left direction reapplied
  • Text boxes that only reflect page layout moved into the body
  • Document Inspector run on the copy
  • Pilot import checked: few tags, whole sentences, nothing missing
  • File preparation recorded and, if billable, quoted separately

Check the content too

A file with few tags can still have wrong letters. Cleaning formatting does not fix the text itself. Before translation, run the content checks in the QA checklist for an Arabic OCR Word file, and if the source has editor's notes, rebuild them as real notes first with the footnote guide. Notes kept as plain text paragraphs become stray segments in the middle of the translation.

Limitations

  • Clearing formatting loses information. Anything not captured in a style first is gone from the copy, and from the translated file the CAT tool exports.
  • The run count is a rough guide. It does not count every tag source (fields, bookmarks, footnote references) and it is not a measure of tags in any specific tool.
  • Tool options change. The memoQ option names above come from its current documentation; older versions and Trados Studio differ. Confirm with a pilot import.
  • Some layouts resist cleaning. Dense multi-column pages, tables built from text boxes, or heavy marginalia may be quicker to rebuild than to clean.
  • Review still applies. Converted text should be checked against the scan before anyone relies on it.

If you convert the scans yourself, ScribeTools gives you an editable Arabic PDF to Word file, and for whole books see digitising Arabic books. Run the measurement above on that output too, before it goes to a translator.

Sources

  1. memoQ documentation: Microsoft Word (DOCX) filter settings
  2. Microsoft Support: Clear all text formatting
  3. Microsoft Support: Accept or reject tracked changes in Word
  4. Microsoft Support: Inspect your document for hidden data or personal information
Prepare an OCR'd Arabic Word file for memoQ or Trados: fewer tags | ScribeTools