class_docstr: Encoder based on a user-supplied vocabulary (file or list).
  
  This encoder extends over TokenTextEncoder by additionally assigning distinct
  temporary IDs to OOV tokens appearing in the source sequence. This facilitates
  decoding with the pointer-generator mechanism using word-based tokenization.
  
  NOTE: TokenTextEncoderOov does not conform to the TextEncoder API; it changes
  the signature of encode and decode.
class_docstr_tok: ["Encoder","based","on","a","user-supplied","vocabulary","(","file","or","list",")",".","This","encoder","extends","over","TokenTextEncoder","by","additionally","assigning","distinct","temporary","IDs","to","OOV","tokens","appearing","in","the","source","sequence",".","This","facilitates","decoding","with","the","pointer-generator","mechanism","using","word-based","tokenization",".","NOTE",":","TokenTextEncoderOov","does","not","conform","to","the","TextEncoder","API",";","it","changes","the","signature","of","encode","and","decode","."]
docstr: Converts a space-separated string of tokens to lists of ids.
  
  Also store a version of extened vocabulary IDs.
  For target OOVs that are in the source, encode them using the temporary
  vocab IDs.
  For target OOVs not in the source, encode them as <UNK>
  
  Args:
    target: target string
    source_oovs: source OOV words stored in dict, key is the word, value is
    the order in which they appear in the source starting from 0
  
  Returns:
    ids: list of integers
    ids_extend: list of integers including extended vocabulary IDs.
docstr_tok: ["Converts","a","space-separated","string","of","tokens","to","lists","of","ids",".","Also","store","a","version","of","extened","vocabulary","IDs",".","For","target","OOVs","that","are","in","the","source",",","encode","them","using","the","temporary","vocab","IDs",".","For","target","OOVs","not","in","the","source",",","encode","them","as","<","UNK",">","Args",":","target",":","target","string","source_oovs",":","source","OOV","words","stored","in","dict",",","key","is","the","word",",","value","is","the","order","in","which","they","appear","in","the","source","starting","from","0","Returns",":","ids",":","list","of","integers","ids_extend",":","list","of","integers","including","extended","vocabulary","IDs","."]
code: def encode_target(self, target, source_oovs):
      """Converts a space-separated string of tokens to lists of ids.
  
      Also store a version of extened vocabulary IDs.
      For target OOVs that are in the source, encode them using the temporary
      vocab IDs.
      For target OOVs not in the source, encode them as <UNK>
  
      Args:
        target: target string
        source_oovs: source OOV words stored in dict, key is the word, value is
        the order in which they appear in the source starting from 0
  
      Returns:
        ids: list of integers
        ids_extend: list of integers including extended vocabulary IDs.
      """
      tokens = target.strip().split()
      ids = []
      ids_extend = []
      for t in tokens:
          if t in self._token_to_id:
              i = self._token_to_id[t]
              ids.append(i)
              ids_extend.append(i)
          else:
              ids.append(self._token_to_id[self._replace_oov])
              if t in source_oovs:
                  vocab_idx = self.vocab_size + source_oovs[t]
                  ids_extend.append(vocab_idx)
              else:
                  ids_extend.append(
                      self._token_to_id[self._replace_oov]
                  )
      if self._reverse:
          return ids[::-1], ids_extend[::-1]
      else:
          return ids, ids_extend
  
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 2 for calling the TokenTextEncoderOov obj's underlying member method code with example usage: obj.encode_target(target, source_oovs) and returns: ids,  ids_extend, ids,  ids_extend