class AlignmentInfo(object): (source)
Constructor: AlignmentInfo(alignment, src_sentence, trg_sentence, cepts)
Helper data object for training IBM Models 3 and up
Read-only. For a source sentence and its counterpart in the target language, this class holds information about the sentence pair's alignment, cepts, and fertility.
Warning: Alignments are one-indexed here, in contrast to nltk.translate.Alignment and AlignedSent, which are zero-indexed This class is not meant to be used outside of IBM models.
Method | __eq__ |
Undocumented |
Method | __hash__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __ne__ |
Undocumented |
Method | center |
No summary |
Method | fertility |
Fertility of word in position i of the source sentence |
Method | is |
No summary |
Method | previous |
No summary |
Method | previous |
No summary |
Method | zero |
No summary |
Instance Variable | alignment |
tuple(int): Alignment function. alignment[j] is the position in the source sentence that is aligned to the position j in the target sentence. |
Instance Variable | cepts |
list(list(int)): The positions of the target words, in ascending order, aligned to a source word position. For example, cepts[4] = (2, 3, 7) means that words in positions 2, 3 and 7 of the target sentence are aligned to the word in position 4 of the source sentence... |
Instance Variable | score |
float: Optional. Probability of alignment, as defined by the IBM model that assesses this alignment |
Instance Variable | src |
tuple(str): Source sentence referred to by this object. Should include NULL token (None) in index 0. |
Instance Variable | trg |
tuple(str): Target sentence referred to by this object. Should have a dummy element in index 0 so that the first word starts from index 1. |
Returns | |
The position of the previous word that is in the same tablet as j, or None if j is the first word of the tablet |
Returns | |
list(tuple) | Zero-indexed alignment, suitable for use in external nltk.translate modules like nltk.translate.Alignment |
tuple(int): Alignment function. alignment[j] is the position in the source sentence that is aligned to the position j in the target sentence.
list(list(int)): The positions of the target words, in ascending order, aligned to a source word position. For example, cepts[4] = (2, 3, 7) means that words in positions 2, 3 and 7 of the target sentence are aligned to the word in position 4 of the source sentence