WordDropout

class opennmt.data.WordDropout(dropout)[source]

Randomly drops words in a sequence.

Example

>>> noise = opennmt.data.WordDropout(0.5)
>>> words = tf.constant(["a", "b", "c"])
>>> noise(words).numpy()
array([b'a', b'b'], dtype=object)

Inherits from: opennmt.data.Noise

__init__(dropout)[source]

Initializes the noise module.

Parameters

dropout – The probability to drop word.