code: def test_encode_decode(self):
      corpus = (
          "This is a corpus of text that provides a bunch of tokens from which "
          "to build a vocabulary. It will be used when strings are encoded "
          "with a TextEncoder subclass. The encoder was coded by a coder."
      )
      token_counts = collections.Counter(corpus.split(" "))
      alphabet = set(corpus) - {" "}
  
      original = (
          "This is a coded sentence encoded by the SubwordTextEncoder."
      )
      token_counts.update(original.split(" "))
  
      encoder = text_encoder.SubwordTextEncoder.build_to_target_size(
          100, token_counts, 2, 10
      )
  
      # Encoding should be reversible.
      encoded = encoder.encode(original)
      decoded = encoder.decode(encoded)
      self.assertEqual(original, decoded)
  
      # The substrings coded and coder are frequent enough in the corpus that
      # they should appear in the vocabulary even though they are substrings
      # of other included strings.
      subtoken_strings = {
          encoder.all_subtoken_strings[i] for i in encoded
      }
      self.assertIn("encoded_", subtoken_strings)
      self.assertIn("coded_", subtoken_strings)
      self.assertIn("TextEncoder", encoder.all_subtoken_strings)
      self.assertIn("coder", encoder.all_subtoken_strings)
  
      # Every character in the corpus should be in the encoders alphabet and
      # its subtoken vocabulary.
      self.assertTrue(alphabet.issubset(encoder._alphabet))
      for a in alphabet:
          self.assertIn(a, encoder.all_subtoken_strings)
  
imports: import collections
  import io
  import os
  import random
  import shutil
  import string
  import mock
  from six.moves import range
  import tensorflow.compat.v1
  from trax.data import text_encoder
label_desc: Use image node_id 2 for calling the SubwordTextEncoderTest obj's underlying member method code with example usage: obj.test_encode_decode() without return types