code: def test_encode_text(self):
      text_1 = "He is very happy"
      text_2 = "unwanted, running"
  
      text_1_ids = self.tokenizer.map_text_to_id(text_1)
      text_2_ids = self.tokenizer.map_text_to_id(text_2)
  
      cls_token_id = self.tokenizer.map_token_to_id(
          self.tokenizer.cls_token
      )
      sep_token_id = self.tokenizer.map_token_to_id(
          self.tokenizer.sep_token
      )
  
      input_ids, segment_ids, input_mask = self.tokenizer.encode_text(
          text_1, None, 4
      )
  
      self.assertListEqual(
          input_ids, text_1_ids[:2] + [sep_token_id] + [cls_token_id]
      )
      self.assertListEqual(segment_ids, [0, 0, 0, 2])
      self.assertListEqual(input_mask, [0, 0, 0, 0])
  
      input_ids, segment_ids, input_mask = self.tokenizer.encode_text(
          text_1, text_2, 7
      )
  
      self.assertListEqual(
          input_ids,
          text_1_ids[:2]
          + [sep_token_id]
          + text_2_ids[:2]
          + [sep_token_id]
          + [cls_token_id],
      )
      self.assertListEqual(segment_ids, [0, 0, 0, 1, 1, 1, 2])
      self.assertListEqual(input_mask, [0, 0, 0, 0, 0, 0, 0])
  
imports: import os
  import pickle
  import tempfile
  import tensorflow
  from texar.tf.data.data_utils import maybe_download
  from texar.tf.data.tokenizers.xlnet_tokenizer import XLNetTokenizer, SPIECE_UNDERLINE
  from texar.tf.utils.test import pretrained_test
label_desc: Use image node_id 12 for calling the XLNetTokenizerTest obj's underlying member method code with example usage: obj.test_encode_text() without return types