Noise

class opennmt.data.Noise[source]

Base class for noise modules.

Inherits from: abc.ABC

Extended by:

__call__(words)[source]

Applies noise on a sequence of words.

Parameters

words – The sequence of words as a string tf.Tensor. If it has 2 dimensions, each row represents a word that possibly contains multiple tokens.

Returns

A noisy version of words.

Raises

ValueError – if words has a rank greater than 2.