class_docstr: Tests Vocabulary lookup table operations.
class_docstr_tok: ["Tests","Vocabulary","lookup","table","operations","."]
code: def test_with_counts(self):
      vocab_list = ["Hello", ".", "笑"]
      vocab_counts = [100, 200, 300]
      vocab_file = test_utils.create_temporary_vocab_file(
          vocab_list, vocab_counts
      )
  
      (
          vocab_to_id_table,
          id_to_vocab_table,
          word_to_count_table,
          vocab_size,
      ) = vocab.create_vocabulary_lookup_table(vocab_file.name)
  
      self.assertEqual(vocab_size, 6)
  
      with self.test_session() as sess:
          sess.run(tf.global_variables_initializer())
          sess.run(tf.local_variables_initializer())
          sess.run(tf.tables_initializer())
  
          ids = vocab_to_id_table.lookup(
              tf.convert_to_tensor(["Hello", ".", "笑", "??", "xxx"])
          )
          ids = sess.run(ids)
          np.testing.assert_array_equal(ids, [0, 1, 2, 3, 3])
  
          words = id_to_vocab_table.lookup(
              tf.convert_to_tensor([0, 1, 2, 3], dtype=tf.int64)
          )
          words = sess.run(words)
          np.testing.assert_array_equal(
              np.char.decode(words.astype("S"), "utf-8"),
              ["Hello", ".", "笑", "UNK"],
          )
  
          counts = word_to_count_table.lookup(
              tf.convert_to_tensor(["Hello", ".", "笑", "??", "xxx"])
          )
          counts = sess.run(counts)
          np.testing.assert_array_equal(counts, [100, 200, 300, -1, -1])
  
file_path: seq2seq/seq2seq/test/vocab_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import tensorflow
  import numpy
  from seq2seq.data import vocab
  from seq2seq.test import utils
label_desc: Use image node_id 2 for calling the CreateVocabularyLookupTableTest obj's underlying member method code with example usage: obj.test_with_counts() without return types