WordOmission

class opennmt.data.WordOmission(count)[source]

Randomly omits words in a sequence.

This is different than opennmt.data.WordDropout as it drops a fixed number of words.

Example

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

Inherits from: opennmt.data.Noise

__init__(count)[source]

Initializes the noise module.

Parameters

count – The number of words to omit.