MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / clean_token

Function clean_token

scripts/extract_nomic_vectors.py:97–106  ·  view source on GitHub ↗

Normalize a BPE token to the form our runtime tokenizer produces.

(token_str: str)

Source from the content-addressed store, hash-verified

95
96
97def clean_token(token_str: str) -> str:
98 """Normalize a BPE token to the form our runtime tokenizer produces."""
99 s = token_str.strip()
100 # Strip BPE space markers
101 s = s.lstrip("\u0120\u2581")
102 # Strip leading/trailing underscores
103 s = s.strip("_")
104 # Lowercase (our runtime tokenizer lowercases)
105 s = s.lower()
106 return s
107
108
109# ── Simulated attention ──────────────────────────────────────────────

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected