WordReplacement
- class opennmt.data.WordReplacement(probability, filler='<unk>')[source]
Randomly replaces words.
Example
>>> noise = opennmt.data.WordReplacement(0.5) >>> words = tf.constant(["a", "b", "c"]) >>> noise(words).numpy() array([b'a', b'<unk>', b'c'], dtype=object)
Inherits from:
opennmt.data.Noise