class_docstr: Wrapper around tensor2tensor SubwordTextEncoder.
  
  1 is already reserved for EOS - no need to shift.
class_docstr_tok: ["Wrapper","around","tensor2tensor","SubwordTextEncoder",".","1","is","already","reserved","for","EOS","-","no","need","to","shift","."]
docstr: Create a T2tVocabulary.
  
  Args:
    filepath: a string
docstr_tok: ["Create","a","T2tVocabulary",".","Args",":","filepath",":","a","string"]
code: def __init__(self, filepath):
      """Create a T2tVocabulary.
  
      Args:
        filepath: a string
      """
      # Only import tensor2tensor if necessary.
      from tensor2tensor.data_generators import (
          text_encoder,
      )  # pylint: disable=g-import-not-at-top
      from tensor2tensor.data_generators.ops import (
          subword_text_encoder_ops,
      )  # pylint: disable=g-import-not-at-top
  
      self._filepath = filepath
      self._subword_text_encoder = text_encoder.SubwordTextEncoder(
          filepath
      )
      self._subword_text_encoder_encode = (
          subword_text_encoder_ops.subword_text_encoder_encode
      )
  
file_path: mesh/mesh_tensorflow/transformer/t2t_vocabulary.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import gin
  from mesh_tensorflow.transformer import vocabulary
label_desc: Use image node_id 1 to create a new T2tVocabulary object from inherited base classes: vocabulary with example: obj = T2tVocabulary(filepath)