MCPcopy Create free account
hub / github.com/M4THYOU/TokenDagger / load_tokenizer

Function load_tokenizer

tokendagger/wrapper.py:333–355  ·  view source on GitHub ↗

Load a tokenizer from files. Args: name: Name of the tokenizer vocab_file: Path to vocabulary file pattern: Regex pattern for text splitting special_tokens_file: Optional path to special tokens file Returns: Initialized Tokenizer instance

(
    name: str,
    vocab_file: str | Path,
    pattern: str,
    special_tokens_file: str | Path | None = None,
)

Source from the content-addressed store, hash-verified

331# ====================
332
333def load_tokenizer(
334 name: str,
335 vocab_file: str | Path,
336 pattern: str,
337 special_tokens_file: str | Path | None = None,
338) -> Tokenizer:
339 """Load a tokenizer from files.
340
341 Args:
342 name: Name of the tokenizer
343 vocab_file: Path to vocabulary file
344 pattern: Regex pattern for text splitting
345 special_tokens_file: Optional path to special tokens file
346
347 Returns:
348 Initialized Tokenizer instance
349 """
350 return Tokenizer(
351 name=name,
352 pattern=pattern,
353 vocab_file=vocab_file,
354 special_tokens_file=special_tokens_file,
355 )
356
357
358def create_tokenizer(

Callers

nothing calls this directly

Calls 1

TokenizerClass · 0.85

Tested by

no test coverage detected