Parallel Data Mining and Quality Control › Sentence Alignment
Language AI HandbookAll chapters Mining produces candidate document pairs. Within a document pair, you still need to figure out which sentence in one language corresponds to which sentence in the other. This is sentence alignment.
Check for boilerplate, sidebars, and differences in paragraph breaks even after accepting a page pair. Pairing sentences solely by position fails when one side inserts a navigation sentence or the translation reorders sentences.
There is a deeper reason alignment is hard: translation is not a sentence-by-sentence operation, even when humans try to make it one. A translator may merge two short source sentences into one, split a long sentence into three, reorder clauses across sentence boundaries, or drop a sentence entirely because it is redundant in the target language. Alignment algorithms therefore have to consider not just one-to-one matches but many-to-many groupings, and they have to do so without knowing in advance where the boundaries are.
The next four sections compare alignment signals based on length, dictionaries, machine translation, and multilingual embeddings.
Length-based alignment (Gale-Church)
Gale and Church (1993) modeled the relationship between the character lengths of translated segments. The teaching model here conditions on the source length. For positive source and target character counts and , the model assumes:
where:
- : the length in characters of the source sentence
- : the length in characters of the target sentence
- : the average length ratio between the two languages
- : a variance parameter that scales the Gaussian noise
- : a normal distribution with mean and variance , which makes the spread of the difference grow with the source length
With fixed, the standard deviation grows like the square root of . For a given absolute residual, the quadratic penalty relative to the peak is smaller for longer source segments.
The conditional log density in this teaching model, for and , is:
The example uses as an illustrative coefficient. The original aligner estimated length and variance from its own corpus, used a pooled length in the residual normalization, and converted a two-sided normal-tail probability into a distance. The example below uses a Gaussian log density and illustrative move penalties, so its scores and decisions can differ from the original program.
The figure compares each curve to its own peak to isolate the change in width.
VisualizationOut [4]Expand

Given this model, alignment becomes a dynamic program. Let be the best score for aligning the first source sentences with the first target sentences. The recurrences are:
where:
- : the best score for aligning the first source sentences with the first target sentences
- : the set of allowed alignment patterns, where means source sentences align to target sentences
- : one allowed pattern, taking source and target sentences
- : the sum of the lengths of the source sentences in the segment
- : the sum of the lengths of the target sentences in the segment
- : the log weight for the move shape
- : the conditional log density for two nonempty segments, or zero for a gap, whose cost comes from
Set , initialize other states to minus infinity, and consider only predecessors with valid indices. With a fixed move set of bounded segment size, the DP takes time and space for documents with and sentences. Similar character counts can still produce a wrong or over-grouped alignment because the score has no lexical signal.
The set of allowed moves is where the algorithm's assumptions live. The move handles the common case. The and moves allow sentences to be dropped or inserted, which is how the aligner copes with untranslated boilerplate. The , , and moves handle merges and splits. Each move has a log weight. In the toy below, every other move has a lower weight than the one-to-one move. A split or merge can make up the difference with a better length score. A gap has no length score, so its local cost comes from its log weight.
A dynamic-programming method for sentence alignment that scores segment moves using their length relationship. The original implementation turns a two-sided normal-tail probability into a distance. Gale and Church, 1993
Lexical alignment (Hunalign)
Hunalign (Varga et al., 2005) extends the length-based approach with a dictionary. If the source and target sentences share translation pairs, the alignment gets a bonus. This disambiguates cases where multiple alignments have similar length-based scores.
Dictionary evidence can break a tie when several candidate segments have similar lengths. If one target contains a known translation of a source word and another does not, the lexical signal can distinguish otherwise similar candidates.
Hunalign can use a supplied bilingual dictionary. In its automatic dictionary-building mode it first aligns without a dictionary, induces one from its initial alignment, and aligns the sentences again with that dictionary. Hunalign documentation
The second pass can use lexical evidence that the first pass lacked. Check a sample of alignments in your domain, especially when the initial length matches are weak enough to produce misleading dictionary entries.
Translation-based alignment (Bleualign)
Bleualign (Sennrich and Volk, 2010) aligns documents using translations of one side. Bleualign paper
- Translate one side of the document with an MT system.
- Score each candidate sentence pair by BLEU between the translation and the target.
- Use high-similarity alignments as anchors, then fill gaps with BLEU-based and length-based heuristics.
The method requires translations for one side of the document. Compare its alignment quality with a length-based baseline on checked examples, particularly if the available MT system performs poorly on the language pair or domain.
A correct target may phrase the sentence differently from the MT output, and a wrong target may share many words with it. BLEU provides evidence of text overlap. Errors in the MT output or repeated phrasing can give the wrong correspondence a high score.
Embedding-based alignment (Vecalign)
Vecalign (Thompson and Koehn, 2019) scores candidate segments using embeddings and searches for a monotonic alignment. It uses a coarse-to-fine approximation to restrict the dynamic-programming search instead of comparing all sentence pairs in the document. The paper reports linear time and space in the number of sentences aligned for its procedure.
The four approaches compared here use different bilingual signals:
| Method | Signal | Input needed |
|---|---|---|
| Gale-Church | Character lengths | Segmented sentences |
| Hunalign | Length and dictionary evidence | Segmented text, optionally a bilingual dictionary |
| Bleualign | Translated-text overlap | Machine translations for one side |
| Vecalign | Segment embeddings | Bilingual sentence embeddings |
If you already have an encoder that covers both languages, compare Vecalign with a length-based baseline on some hand-aligned documents.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!