class_docstr: Invertible `TextEncoder` using word pieces with a byte-level fallback.
  
  Encoding is fully invertible because all out-of-vocab wordpieces are
  byte-encoded.
  
  The vocabulary is "trained" on a corpus and all wordpieces are stored in a
  vocabulary file. To generate a vocabulary from a corpus, use
  `tfds.deprecated.text.SubwordTextEncoder.build_from_corpus`.
  
  Typical usage:
  
  ```
  # Build
  encoder = tfds.deprecated.text.SubwordTextEncoder.build_from_corpus(
      corpus_generator, target_vocab_size=2**15)
  encoder.save_to_file(vocab_fname)
  
  # Load
  encoder = tfds.deprecated.text.SubwordTextEncoder.load_from_file(vocab_fname)
  ids = encoder.encode("hello world")
  text = encoder.decode([1, 2, 3, 4])
  ```
docstr: Constructs a SubwordTextEncoder from a vocabulary list.
  
  Note: To generate a vocabulary from a corpus, use
  `tfds.deprecated.text.SubwordTextEncoder.build_from_corpus`.
  
  Args:
    vocab_list: `list<str>`, list of subwords for the vocabulary. Note that an
      underscore at the end of a subword indicates the end of the word (i.e. a
      space will be inserted afterwards when decoding). Underscores in the
      interior of subwords are disallowed and should use the underscore escape
      sequence.
docstr_tok: ["Constructs","a","SubwordTextEncoder","from","a","vocabulary","list",".","Note",":","To","generate","a","vocabulary","from","a","corpus",",","use","`","tfds.deprecated.text.SubwordTextEncoder.build_from_corpus","`",".","Args",":","vocab_list",":","`","list","<","str",">","`",",","list","of","subwords","for","the","vocabulary",".","Note","that","an","underscore","at","the","end","of","a","subword","indicates","the","end","of","the","word","(","i.e",".","a","space","will","be","inserted","afterwards","when","decoding",")",".","Underscores","in","the","interior","of","subwords","are","disallowed","and","should","use","the","underscore","escape","sequence","."]
code: def __init__(self, vocab_list=None):
      r"""Constructs a SubwordTextEncoder from a vocabulary list.
  
      Note: To generate a vocabulary from a corpus, use
      `tfds.deprecated.text.SubwordTextEncoder.build_from_corpus`.
  
      Args:
        vocab_list: `list<str>`, list of subwords for the vocabulary. Note that an
          underscore at the end of a subword indicates the end of the word (i.e. a
          space will be inserted afterwards when decoding). Underscores in the
          interior of subwords are disallowed and should use the underscore escape
          sequence.
      """
      self._init_from_list(vocab_list)
  
imports: from __future__ import unicode_literals
  import collections
  from absl import logging
  from tensorflow_datasets.core.deprecated.text import text_encoder
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 1 to create a new SubwordTextEncoder object from inherited base classes: text_encoder with example: obj = SubwordTextEncoder(vocab_list)