neuralmonkey.processors.alignment module¶
-
class
neuralmonkey.processors.alignment.
WordAlignmentPreprocessor
(source_len, target_len, dtype=<class 'numpy.float32'>, normalize=True, zero_based=True)¶ Bases:
object
A preprocessor for word alignments in a text format.
One of the following formats is expected:
s1-t1 s2-t2 …
s1:1/w1 s2:t2/w2 …
where each s and t is the index of a word in the source and target sentence, respectively, and w is the corresponding weight. If the weight is not given, it is assumend to be 1. The separators - and : are interchangeable.
The output of the preprocessor is an alignment matrix of the fixed shape (target_len, source_len) for each sentence.
-
__init__
(source_len, target_len, dtype=<class 'numpy.float32'>, normalize=True, zero_based=True)¶ Initialize self. See help(type(self)) for accurate signature.
-