import tensorflow as tf

        def _process_and_truncate(text, trunc, max_len):
            if data_status != compat.DataStatus.PROJECTED:
                text = self._multilingual_dp.encode(
                    text, is_processed=(data_status == compat.DataStatus.PROCESSED))
            if mode == compat.ModeKeys.TRAIN and trunc and max_len:
                if compat.is_tf_tensor(text):
                    text = tf.cond(
                        tf.less_equal(tf.size(text), max_len), lambda: text,
                        lambda: tf.concat([text[:(max_len - 1)], text[-1:]], axis=0))
                elif len(text) > max_len:
                    text = text[:(max_len - 1)] + text[-1:]
            return text

        def _process_lang(lang):
