WordPermutation
- class opennmt.data.WordPermutation(max_distance)[source]
Randomly permutes words in a sequence with a maximum distance.
Example
>>> noise = opennmt.data.WordPermutation(3) >>> words = tf.constant(["0", "1", "2", "3", "4", "5", "6"]) >>> noise(words).numpy() array([b'1', b'0', b'2', b'4', b'3', b'6', b'5'], dtype=object)
Inherits from:
opennmt.data.Noise