class_docstr: Test case for SentencePieceProcessor
class_docstr_tok: ["Test","case","for","SentencePieceProcessor"]
code: def test_sampling(self):
      sp = self.sp_
  
      for out_type in [str, int, "serialized_proto", "immutable_proto"]:
          ids = defaultdict(int)
          for n in range(100):
              out = sp.encode(
                  "hello world", out_type=out_type, enable_sampling=True
              )
              if type(out) is list:
                  out = tuple(out)
              ++ids[out]
          self.assertGreater(len(ids), 1)
  
          ids2 = defaultdict(int)
          for n in range(100):
              out = sp.encode(
                  "hello world",
                  out_type=out_type,
                  enable_sampling=False,
              )
              if type(out) is list:
                  out = tuple(out)
              ++ids2[out]
          self.assertEqual(len(ids2), 1)
  
          out = sp.encode(
              ["hello world", "this is a test"],
              out_type=out_type,
              enable_sampling=True,
          )
          self.assertEqual(len(out), 2)
          out = sp.encode(
              ["hello world", "this is a test"],
              out_type=out_type,
              enable_sampling=False,
          )
          self.assertEqual(len(out), 2)
  
imports: from collections import defaultdict
  import io
  import os
  import pickle
  import sys
  import unittest
  import sentencepiece
label_desc: Use image node_id 13 for calling the TestSentencepieceProcessor obj's underlying member method code with example usage: obj.test_sampling() without return types