Problemcore
Word alignment
Also called bilingual word alignment.
Find which words of a sentence correspond to which words of its translation, as a set of links between positions.
Word alignment is the problem of finding, for a sentence and its translation, which words of one correspond to which words of the other. The answer is a set of links between word positions. A word can have no link, one link or many links, and the links can cross, because languages order words differently. Word alignments are seldom annotated, so they are usually learned without supervision from a parallel corpus of sentence pairs, with a probabilistic model such as IBM Model 1 or the HMM alignment model trained by expectation-maximization. The links are then used to extract phrase pairs and translation lexicons. How hard it is to find the best alignment depends on the model: it is easy under Models 1 and 2 and the HMM, and NP-hard under IBM Model 3.
In plain words
Take an English sentence and its French translation. Draw a line from each French word to the English word that means the same. Some lines are simple: "maison" goes to "house". Some French words need two English words, some English words have no partner, and the lines cross when the two languages put words in a different order. Word alignment is the task of drawing these lines by computer. Usually no one gives the computer any correct lines. It sees only many pairs of sentences, and it learns that words which often appear in the same pairs are likely to be translations. Then it picks the most probable lines for each pair.
Definition
Input. A source sentence and a target sentence that translate each other, and, for the unsupervised problem, a corpus of such pairs with no links.
Output. A set of links , where means that and are translations of each other, fully or in part.
Directional form. Most models restrict the output to a function . Each source word has exactly one link, to a target word or to the null word , which stands for "no target word" (Brown et al. 1993). A target word can still have many links. The links of the function are .
Model form. Given a model , the best (Viterbi) alignment of a pair is
The quality of an output is measured against links that people made, for example by the alignment error rate.
Variants
- Direction. The function form with as source is one direction, and the function with as source is the other. Each direction can express one-to-many links only on its own side. Symmetrization combines the two into one set of links.
- One-to-one. Each word has at most one link. With a score for each word pair, this is a maximum weight bipartite matching.
- Posterior links. Instead of the Viterbi alignment, output every link whose posterior probability is above a threshold. The forward-backward algorithm gives these posteriors under the HMM model.
- Supervised alignment. A small set of pairs with gold links is used to train or tune a discriminative aligner.
- Soft alignment. A neural translation model with attention computes a weight for each pair of positions instead of discrete links.
Examples
- Monotone. For "das Haus ist klein" and "the house is small", each word links to the word at the same position: .
- Reordering. For "klein ist das Haus" (source) and "the house is small" (target), . The links cross.
- One-to-many and unaligned words. For the source "je ne vais pas" and the target "I do not go", the directional alignment is : "je" to "I", "ne" and "pas" both to "not", and "vais" to "go". The word "do" has no link. In the other direction, with "I do not go" as source, "not" can link to only one of "ne" and "pas", so neither direction alone gives the alignment that a person would draw.
- Counting. A pair with and has directional alignments with the null word and link sets.
Known algorithms
The cost is per sentence pair, with lengths and , once the model parameters are known. Training repeats an E step that sums over alignments.
| Model or method | Best alignment | Cost | Note |
|---|---|---|---|
| IBM Model 1 | exact, each word on its own | ||
| IBM Model 2, fast_align | exact, each word on its own | the score has a position factor | |
| HMM alignment model | exact, by the Viterbi algorithm | links depend on the previous link | |
| IBM Model 3 | approximate, by hill climbing | polynomial per step | exact is NP-hard |
| grow-diag-final | combines two directions | per pass | a heuristic |
| one-to-one with scores | exact, by the Hungarian algorithm | with | a matching |
Under Models 1 and 2, is a product of one factor for each source word, and each factor depends only on . So the maximum over is the product of the maxima over each . Under the HMM model the factor of also depends on , and dynamic programming over gives the exact answer.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| Fast align | Θ(n m l) worst | Θ(l) extra | deterministicnot exactofflineiterative | 1 language |
| Grow-diag-final symmetrization | O(m l (m + l)) worst | O(m l) extra | deterministicnot exactofflineiterative | 1 language |
Bounds
- Upper bounds. The table above gives for Models 1 and 2 and for the HMM model, in the real RAM model with table lookups of constant cost.
- Search space. There are directional alignments and link sets, so enumeration is exponential. The tests of the model pages use it only to check the exact algorithms.
- Hardness. For IBM Models 3, 4 and 5, finding the Viterbi alignment is NP-hard, and computing , the sum over all alignments, is #P-complete (Udupa and Maji 2006). So the best alignment has no polynomial algorithm unless P = NP, and the sum has none unless P = #P. Training these models uses the HMM model or Model 2 for a start and sums over a neighbourhood of the best alignment found by hill climbing (Brown et al. 1993).
Reductions
- Viterbi alignment to a path in a DAG. Under the HMM model, the best alignment is a longest path in a layered graph with one layer for each source word and one node for each target position, which dynamic programming on a DAG solves.
- One-to-one alignment to bipartite matching. With a score for each link and at most one link for each word, the best alignment is a maximum weight matching in the complete bipartite graph between the two sentences.
- From sentence alignment. Word alignment needs aligned sentence pairs, which sentence alignment produces from aligned documents. Sentence alignment is monotone, so a dynamic program like edit distance solves it; word alignment allows crossing links and has no such order.
Applications
- Phrase-based translation. Phrase pair extraction takes all phrase pairs that are consistent with the symmetrized links, and the phrase-based translation model scores them.
- Lexicon learning. The table that the models learn while aligning is a probabilistic bilingual dictionary.
- Analysis of neural translation. The attention weights of an encoder-decoder model can be turned into links and compared with the links of these models.
- Speech. Forced alignment is a related problem that links audio frames to words of a known transcript, also with an HMM and the Viterbi algorithm, but with monotone links.
References
- Brown, Della Pietra, Della Pietra and Mercer 1993, the definition of an alignment as a set of connections between word positions, with the empty cept, and Models 1 to 5 with their Viterbi alignments
- Och and Ney 2003, the statistical alignment models, the symmetrization of the two directions, and the evaluation with sure and possible links
- Udupa and Maji 2006, the hardness of the Viterbi alignment for IBM Models 3 to 5
- Philipp Koehn, Statistical Machine Translation, Cambridge University Press, 2010, Chapter 4 (word-based models), Section 4.5 (word alignment)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 9ECTG0 Edit this page History Report an error Markdown