ForHosting KIT · Developer Utilities

Expand typographic ligatures

Text copied from a PDF, journal, ebook, or professionally typeset document can contain single Unicode characters that only look like familiar letter pairs.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

A word containing fi may appear correct on screen while failing an exact search for fi. This tool expands those typographic ligatures into ordinary component letters without changing surrounding words, punctuation, spacing, or line breaks. The result is easier to search, index, compare, quote, and pass through systems that expect conventional text.

Why visually correct text can be difficult to search

Typography software sometimes substitutes a single ligature glyph for two or three adjacent letters. The substitutions are especially common for fi, fl, ff, ffi, and ffl because their shapes can collide in a carefully set font. When a PDF exposes that glyph as a Unicode presentation character, copying the page preserves the ligature rather than the letters it represents. The pasted word looks normal to a reader, but software may see a different sequence of code points. A literal search for “file” will not necessarily match a copied word beginning with the single fi character. The same mismatch can affect document indexes, duplicate detection, database lookups, command-line searches, accessibility cleanup, and text comparison. This capability resolves that narrow problem directly. It converts supported ligature characters to ordinary Latin letter sequences while retaining capitalization where the ligature has an uppercase form. It does not rewrite ordinary fi or fl sequences because those are already searchable and need no correction. It also preserves every unrelated character exactly, including accents, punctuation, tabs, spaces, and line endings.

What the expansion changes and what it preserves

Provide the source in the text field and the result returns expanded text plus a replacement count. The algorithm recognizes the Unicode presentation forms for ff, fi, fl, ffi, ffl, and the two historical st forms. It also expands the common AE and OE ligature letters in uppercase and lowercase, producing AE, ae, OE, or oe as appropriate. Each recognized character counts as one replacement even when it becomes three component letters. This makes the reported count useful for checking whether a pasted passage actually contained hidden typography. Processing is deterministic and performed in a single pass: the same input always produces the same output, and no language model guesses what the author intended. Characters outside the explicit ligature set remain byte-for-character equivalent at the JavaScript string level. The tool does not normalize accents, change quotation marks, collapse whitespace, correct spelling, or alter visual dash characters. That restraint matters when the cleaned text must remain faithful to a source. If a document has OCR mistakes rather than genuine ligature characters, those mistakes remain visible for a separate correction step.

Using the cleaned text in search and document workflows

Ligature expansion works best immediately after text extraction or clipboard capture and before indexing, comparison, or tokenization. For a one-off passage, paste the copied text and use the returned text in a search box, note, citation manager, or plain-text file. In an automated pipeline, apply the capability consistently to both stored documents and incoming search queries when either side may originate in typeset material. Consistency prevents a visually identical word from being represented differently in the index and in the query. The base API price is $0.002 per request, and one request processes one text item. Because the transformation has no network dependency and uses no probabilistic model, it is also suitable for repeatable test fixtures and archival cleanup. Review the replacement count as a simple audit signal: zero means no supported ligature character was found, while a positive number confirms that normalization changed the sequence. Keep the original source when provenance matters, since expansion intentionally changes code points even though it usually preserves the way the passage reads. For broader cleanup, run quote normalization, whitespace cleanup, OCR correction, or case folding as explicit separate operations so every transformation remains understandable and reversible at the workflow level.

Repair text copied from PDFs

Turn hidden fi, fl, ffi, and ffl presentation characters into ordinary letters before searching or quoting a passage.

Prepare documents for indexing

Normalize ligatures before adding extracted academic, legal, or publishing text to a literal-search index.

Stabilize text comparisons

Remove code-point differences caused only by typography before comparing typeset text with a plain-text source.

What does it cost?

The API costs $0.002 per request. The browser version can run the same deterministic transformation locally.

Which ligatures are expanded?

It expands ff, fi, fl, ffi, ffl, and st presentation ligatures, plus uppercase and lowercase AE and OE ligature letters.

Will ordinary fi and fl text change?

No. Separate letters are already suitable for search, so only recognized single-character ligatures are replaced.

Does it correct OCR errors?

No. It expands known ligature characters only; misrecognized letters, missing spaces, and other OCR errors are preserved.

Does it preserve formatting and line breaks?

Yes. Aside from supported ligature characters, the text is returned unchanged, including whitespace, punctuation, accents, and line breaks.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/str/expand-ligatures

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/str/expand-ligatures \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"The office file is flexible."}'
{
  "text": "The office file is flexible."
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "str.expand_ligatures",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →