class_docstr: Sentence piece tokenizer.
class_docstr_tok: ["Sentence","piece","tokenizer","."]
code: def tokenize(self, input_str: str) -> List[Token]:
      if (
          hasattr(self, "max_input_text_length")
          and self.max_input_text_length is not None
      ):
          input_str = input_str[: self.max_input_text_length]
      input_str = input_str.lower() if self.lowercase else input_str
  
      pieces = self.processor.EncodeAsPieces(input_str)
      tokens = []
      # calculate start and end indices of each piece.
      end = 0
      for piece in pieces:
          original_piece = piece.lstrip("\u2581")
          start = input_str.find(original_piece, end)
          end = start + len(original_piece)
          tokens.append(Token(piece, start, end))
      return tokens
  
imports: import copy
  import json
  import re
  from collections import OrderedDict
  from typing import List, NamedTuple, Optional, Union
  import torch
  from fairseq.data.encoders.gpt2_bpe import get_encoder
  from fairseq.data.encoders.gpt2_bpe_utils import Encoder
  from pytext.config import ConfigBase
  from pytext.config.component import Component, ComponentType, create_component
  from pytext.data.pickleable_gpt2bpe_encoder import PickleableGPT2BPEEncoder
  from pytext.torchscript.tokenizer import ScriptDoNothingTokenizer, ScriptWordTokenizer
  from pytext.utils.file_io import PathManager
  from pytext.utils.usage import log_class_usage
  from transformers.tokenization_bert import BasicTokenizer, WordpieceTokenizer
label_desc: Use image node_id 3 for calling the SentencePieceTokenizer obj's underlying member method code with example usage: obj.tokenize(input_str) and returns: tokens