nltk.Alignment.fromstring¶
-
classmethod
Alignment.
fromstring
(s)[source]¶ Read a giza-formatted string and return an Alignment object.
>>> Alignment.fromstring('0-0 2-1 9-2 21-3 10-4 7-5') Alignment([(0, 0), (2, 1), (7, 5), (9, 2), (10, 4), (21, 3)])
Parameters: s (str) – the positional alignments in giza format Return type: Alignment Returns: An Alignment object corresponding to the string representation s
.