class_docstr: SentencePiece Unigram Tokenizer
  
  Represents the Unigram algorithm, with the pretokenization used by SentencePiece
code: def __init__(
      self,
      vocab: Optional[List[Tuple[str, float]]] = None,
      replacement: str = "▁",
      add_prefix_space: bool = True,
  ):
      if vocab is not None:
          # Let Unigram(..) fail if only one of them is None
          tokenizer = Tokenizer(Unigram(vocab))
      else:
          tokenizer = Tokenizer(Unigram())
  
      tokenizer.normalizer = normalizers.Sequence(
          [
              normalizers.Nmt(),
              normalizers.NFKC(),
              normalizers.Replace(Regex(" {2,}"), " "),
          ]
      )
      tokenizer.pre_tokenizer = pre_tokenizers.Metaspace(
          replacement=replacement, add_prefix_space=add_prefix_space
      )
      tokenizer.decoder = decoders.Metaspace(
          replacement=replacement, add_prefix_space=add_prefix_space
      )
  
      parameters = {
          "model": "SentencePieceUnigram",
          "replacement": replacement,
          "add_prefix_space": add_prefix_space,
      }
  
      super().__init__(tokenizer, parameters)
  
file_path: hf-tokenizers/bindings/python/py_src/tokenizers/implementations/sentencepiece_unigram.py
imports: import json
  import os
  from typing import Iterator, List, Optional, Union, Tuple
  from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers
  from tokenizers.models import Unigram
  from .base_tokenizer import BaseTokenizer
label_desc: Use image node_id 1 to create a new SentencePieceUnigramTokenizer object from inherited base classes: BaseTokenizer with example: obj = SentencePieceUnigramTokenizer(vocab, replacement, add_prefix_space)