class_docstr: Test case for SentencePieceProcessor
class_docstr_tok: ["Test","case","for","SentencePieceProcessor"]
code: def test_train_kwargs(self):
      # suppress logging (redirect to /dev/null)
      spm.SentencePieceTrainer.train(
          input=[os.path.join(data_dir, "botchan.txt")],
          model_prefix="m",
          vocab_size=1002,
          user_defined_symbols=[
              "foo",
              "bar",
              ",",
              " ",
              "\t",
              "\b",
              "\n",
              "\r",
          ],
          logstream=open(os.devnull, "w"),
      )
      sp = spm.SentencePieceProcessor()
      sp.Load("m.model")
      with open(os.path.join(data_dir, "botchan.txt"), "r") as file:
          for line in file:
              sp.DecodePieces(sp.EncodeAsPieces(line))
              sp.DecodeIds(sp.EncodeAsIds(line))
  
      s = "hello\tworld\r\nthis\tis a \b pen"
      self.assertEqual(s, sp.decode(sp.encode(s)))
  
imports: from collections import defaultdict
  import io
  import os
  import pickle
  import sys
  import unittest
  import sentencepiece
label_desc: Use image node_id 8 for calling the TestSentencepieceProcessor obj's underlying member method code with example usage: obj.test_train_kwargs() without return types