concept
Whitespace tokenization with NFC
Casefold, normalize to NFC, then split on Unicode whitespace. Retains punctuation, does not merge Persian letter variants, and is not a model tokenizer. Empty or whitespace-only input yields an empty list.
Formal Syntax & Structure
artificial-intelligence syntaxartificial-intelligence
tokens(text)Working Example
Example Snippetartificial-intelligence
import unicodedata
def tokens(text): text = unicodedata.normalize("NFC", text.casefold()) return text.split()
print(tokens("Red bike RED"))print(tokens("bike, bike!"))print(tokens("Cafe\u0301") == tokens("Caf\u00e9"))print(tokens(" "))