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: Decodes a list of integers into text.
docstr_tok: ["Decodes","a","list","of","integers","into","text","."]
code: def decode(self, ids):
      """Decodes a list of integers into text."""
      ids = text_encoder.pad_decr(ids)
      subword_ids = ids
      del ids
  
      subwords = []
  
      # Some ids correspond to bytes. Because unicode characters are composed of
      # possibly multiple bytes, we attempt to decode contiguous lists of bytes
      # all together. Invalid byte sequences are replaced with the unicode
      # replacement (i.e. unknown) character U+FFFD.
      prev_bytes = []
  
      def consume_prev_bytes():
          if prev_bytes:
              bytestr = b"".join(prev_bytes)
              bytes_text = bytestr.decode("utf-8", "replace")
              subwords.append(bytes_text)
          return []
  
      for subword_id in subword_ids:
          subword = self._id_to_subword(subword_id)
          if isinstance(subword, bytes):
              # Byte-encoded
              prev_bytes.append(subword)
          else:
              # If there were bytes previously, convert to unicode.
              prev_bytes = consume_prev_bytes()
              trimmed, add_space = _trim_underscore_and_tell(subword)
              subwords.append(trimmed)
              if add_space:
                  subwords.append(" ")
      # If there were trailing bytes, convert to unicode.
      prev_bytes = consume_prev_bytes()
  
      return tf.compat.as_text("".join(subwords))
  
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 3 for calling the SubwordTextEncoder obj's underlying member method code with example usage: obj.decode(ids) and returns: tf, list