class_docstr: Tests vocabulary related operations.
      
docstr: Test vocabulary construction.
          
docstr_tok: ["Test","vocabulary","construction","."]
code: def test_vocab_construction(self):
      """Test vocabulary construction."""
      vocab_list = ["word", "词"]
      vocab_file = tempfile.NamedTemporaryFile()
      vocab_file.write("\n".join(vocab_list).encode("utf-8"))
      vocab_file.flush()
  
      vocab = vocabulary.Vocab(vocab_file.name)
  
      self.assertEqual(vocab.size, len(vocab_list) + 4)
      self.assertEqual(
          set(vocab.token_to_id_map_py.keys()),
          set(["word", "词"] + vocab.special_tokens),
      )
  
      # Tests UNK token
      unk_token_id = vocab.token_to_id_map_py["new"]
      unk_token_text = vocab.id_to_token_map_py[unk_token_id]
      self.assertEqual(unk_token_text, vocab.unk_token)
  
imports: import tempfile
  import tensorflow
  from texar.tf.data import vocabulary
label_desc: Use image node_id 2 for calling the VocabularyTest obj's underlying member method code with example usage: obj.test_vocab_construction() without return types