class_docstr: Allows training a variant of Text2textTmpdirTokens that supports copying.
  
  Handling the case where the input contains OOV tokens. Store a temporary vocab
  ID for source OOV, so that the decoder can directly copy from the input.
  Uses TokenTextEncoderOov as the vocab encoder.
class_docstr_tok: ["Allows","training","a","variant","of","Text2textTmpdirTokens","that","supports","copying",".","Handling","the","case","where","the","input","contains","OOV","tokens",".","Store","a","temporary","vocab","ID","for","source","OOV",",","so","that","the","decoder","can","directly","copy","from","the","input",".","Uses","TokenTextEncoderOov","as","the","vocab","encoder","."]
docstr: Encode Text2Text samples from the generator with the vocab.
docstr_tok: ["Encode","Text2Text","samples","from","the","generator","with","the","vocab","."]
code: def text2text_generate_encoded_oovs(
      self, sample_generator, vocab, targets_vocab=None, has_inputs=True
  ):
      """Encode Text2Text samples from the generator with the vocab."""
      targets_vocab = targets_vocab or vocab
      for sample in sample_generator:
          if has_inputs:
              (
                  sample["inputs"],
                  sample["inputs_extend"],
                  source_oovs,
                  _,
              ) = vocab.encode(sample["inputs"])
              sample["inputs"].append(text_encoder.EOS_ID)
              sample["inputs_extend"].append(text_encoder.EOS_ID)
          # need to pass the source OOV tokens to the target encoder
          (
              sample["targets"],
              sample["targets_extend"],
          ) = targets_vocab.encode_target(
              sample["targets"], source_oovs
          )
          sample["targets"].append(text_encoder.EOS_ID)
          sample["targets_extend"].append(text_encoder.EOS_ID)
          yield sample
  
file_path: tensor2tensor/tensor2tensor/data_generators/pointer_generator_word.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from tensor2tensor.data_generators import text_encoder
  from tensor2tensor.data_generators import text_problems
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 3 for calling the Text2textCopyableTokens obj's underlying member method code with example usage: obj.text2text_generate_encoded_oovs(sample_generator, vocab, targets_vocab, has_inputs) without return types