ACL 2023 · Seminar presentation

Script normalization for unconventional writing

Under-resourced languages in bilingual communities

Sina Ahmadi & Antonios Anastasopoulos · ACL 2023

01 / The problem

Same language.
Different writing conventions.

Bilingual speakers may write their own language using the script conventions of another language. The words remain in the same language; the spelling changes.

Left → right: Removed Changed Inserted
Conventional writing
One visual difference

Why this matters for NLP

Unexpected letters and word boundaries make language identification, corpus collection and translation harder.

Not translation between languages. Not ordinary typo correction.

Examples: Ahmadi & Anastasopoulos (2023), Table 1. Character examples selected for illustration.

Nastaʿlīq: see how Perso-Arabic calligraphy flows beyond the baseline →

Motivation / A familiar example

One word, three Czech varieties.

Different spoken varieties can share a written standard.

Milk in Standard Czech, Haná and Prague CzechHaná and Prague Czech both have the form mlíko. Arrows marked written lead from each to the standard mléko; arrows marked pronounced lead in the opposite direction. writtenpronouncedwrittenpronounced Standard CzechHaná dialect groupPrague / Common CzechmlékomlíkomlíkoCentral Moravianobecná čeština

What if speakers write the form they pronounce instead?

Illustrative analogy: standard spelling and regional speech are not obligatory one-to-one mappings; dialect forms can also be written, and standard pronunciation exists. Both regional varieties are attested with mlíko. Sources: Czech Linguistic Atlas, vol. 5, entry 43 · Dictionary of Standard Czech · Common Czech (CzechEncy).

02 / Language geography

Eight languages, twelve settings.

Select a regional language to highlight its influencing languages and scripts.

IRANIRAQTÜRKİYEAFGHANISTANPAKISTANINDIACASPIAN SEAARABIAN SEA
Persian influence groupKurdish settingsUrdu influence group

Highlighted map labels indicate influencing scripts in this study, not exclusive language territories. Outlined regional markers share an influencing script.

Approximate reference points, not language boundaries or exclusive territories. Basemap: Natural Earth 1:110m (public domain), simplified; language locations: Appendix A. Borders are schematic at this scale, not a political claim.

03 / Script overlap

Looks similar ≠ encoded the same.

Some characters are shared; others are missing, visually similar, or have several possible substitutes.

Unicode lookalikes
کك
U+06A9   vs   U+0643

Persian keheh and Arabic kaf are distinct code points.

One-to-many mapping · Sorani to Arabic
ز→زظضذ

A source character may have several plausible unconventional equivalents (Table 2).

Script ratio · Appendix A, Table A.1

Ratio = shared entries with unique mappings ÷ union of character inventories. Higher values imply less script interference under this definition.

Original character-overlap diagram (Figure 1)

Figure 1 / Script inventories

One script family. Different inventories.

Select languages to isolate shared and distinguishing characters. The original diagram and the interactive view use the authors’ character inventory.

Original figure · ACL 2023
Figure 1: overlapping character inventories of the ten Perso-Arabic writing systems

Figure 1 · Ahmadi & Anastasopoulos (2023). Click to open the original.

Interactive intersection
Select a character to see which inventories contain it.

Data: scripts_all.tsv. Counts are distinct entries in the published table, including diacritics and sequences; they are not normative alphabet sizes or the paper’s script ratio.

Approach / Data provenance

Where does the data come from?

Start with conventional monolingual text — not an annotated noisy/clean parallel corpus.

Clean sentences
→
Inject script noise
→
Noisy → clean
synthetic training pairs
→
Character-level
Transformer

Two separate uses of data: the vocabulary branch learns candidate correspondences; the sentence branch supplies clean targets. Paper §§3.1–3.5; repository data documentation.

Approach / Dynamic programming

How do spelling pairs become mappings?

Needleman–Wunsch aligns two whole words, preserving character order and allowing gaps.

DP matrix · source along columns / dominant along rows

Logical character order left to right, regardless of script direction. Green = optimal traceback. Select a filled cell to inspect the recurrence.

Match +1 · mismatch −1 · gap −1

Aligned characters

Tie-breaking matches the released Python: diagonal, then left, then up.

From one alignment to a character-alignment table (CAT)

Count aligned
character pairs
→
Divide by row total
→
Add 1 to
manual candidates
→
Drop scores
below 0.1
Actual released Sorani → Persian CAT row
ڤ→و▁

و: 1.6739   ·   gap: 0.2971

Rule boost makes scores exceed 1; these are not final normalized probabilities.

Code vs. paper

The paper describes synthesis from the CAT. The released synthesize.py instead passes the manual TSV map into generate(), sampling candidates uniformly. The released CAT builder and synthesis script are separate paths.

Examples from paper §§3.2–3.3, except the labeled Latin analogy. Alignment code · CAT code · Actual CAT · Synthesis code.

05 / Interactive noise

What does 60% noise mean?

Not 60% of character positions. The released generator operates on distinct character types and replaces all occurrences of each selected type.

Clean Sorani (Table 1 excerpt)
Distinct character types selected
Synthetic unconventional writing

Orange = selected input type; green = actual output changes shown in the mapping below.

Teaching simulation using a small illustrative mapping subset, a shuffled type order, and the published inclusive stopping condition (which can apply one extra mapped type). The published Python code counts all distinct characters, even spaces, and can select identity mappings; 100% need not alter every character. At 0% this demo explicitly returns clean text. Read the generator.

Why do aligned sentence counts differ? (Table C.1)

The datasets count retained noisy–clean pairs rather than a fixed number of manually aligned sentences. Generation is repeated for each noise setting. The code filters and deduplicates generated pairs; different noise can produce different unique pairs. All is the merged noise dataset, not another noise percentage.

Setting20%100%All
Sorani / Arabic1,220,3861,451,2016,663,362
Gilaki / Persian16,77916,77922,215
06 / Intrinsic results

Normalization helps — not always.

Compare the model against simply copying the noisy input.

BLEU by noise level · Table D.3
Copy baselineTransformer
At 100% noise

Each plotted setting has its own trained/tested model. All = separate merged-data model; not cross-noise evaluation.

Real-world Sorani · 100 social-media sentences, Table 3
Persian-script input

1.2 → 20.1 BLEU

Arabic-script input

0.4 → 12.7 BLEU

Model trained at 100% noise; scores before and after normalization, against manually normalized references.

07 / Downstream tasks

Better input, better NLP?

Machine translation

NLLB to English at 100% noise. Table 5 reports clean, noisy, normalized input BLEU; reproduced as published (clean scores differ between Sorani settings).

Language identification

F1 · top-1 prediction at 100% noise

Table 4: a noise-trained fastText classifier vs the pretrained fastText language ID baseline. On clean data, the baseline scores 0.69 vs 0.51. This is training on noisy data, not normalization before classification.

A qualitative Sorani example · Table D.4

Noisy input → translation

The church is divided into two parts, each of which is a mountain.

English reference

Think of the skiing route as of a similar hiking route.

After normalization: They thought of the snow-capped roller coaster route together to a similar route on the mountain.

The meaning is partly recovered, but still wrong. Kashmiri is also a counterexample: normalization lowers translation BLEU.

08 / Model examples

Inspect the actual predictions.

Published examples from Appendix D.1(a): the All model normalizes 100%-noise input.

S · Unconventional input
H · Model hypothesis
R · Clean reference

These are fixed published predictions, not generated by this page. Minor Unicode presentation forms have been rendered as base characters where appropriate.

The hosted Space may require a restart. This seminar page runs entirely locally and does not depend on that service.

Seminar / Discussion

Five questions for the class.

Discussion notes and critical observations, not additional claims by the authors.

Course question page (NPFL095) · Paper