# A typical bot reply in 5 forms, GPT-4 (cl100k_base) and GPT-4o (o200k_base)
import tiktoken
c = tiktoken.get_encoding("cl100k_base"); o = tiktoken.get_encoding("o200k_base")
S = [("English", "Your order has been shipped. It will reach you tomorrow by 6 PM."),
     ("Tamil", "உங்கள் ஆர்டர் அனுப்பப்பட்டது. நாளை மாலை 6 மணிக்குள் உங்களுக்கு வந்து சேரும்."),
     ("Tanglish", "Unga order ship aayiduchu. Naalai saayangalam 6 manikulla vandhudum."),
     ("Telugu", "మీ ఆర్డర్ పంపబడింది. రేపు సాయంత్రం 6 గంటలకు మీకు చేరుతుంది."),
     ("Hindi", "आपका ऑर्डर भेज दिया गया है। यह कल शाम 6 बजे तक आप तक पहुँच जाएगा।")]
for k, s in S:
    print(f"{k:9} chars={len(s):3} bytes={len(s.encode()):3} gpt4={len(c.encode(s)):3} gpt4o={len(o.encode(s)):3}")
# max_tokens cut: what survives of the Tamil reply at the English reply's token count
en = len(c.encode(S[0][1])); ta = c.encode(S[1][1])
cut = c.decode(ta[:en], errors="replace")
print("English reply tokens:", en, "| Tamil reply cut at", en, "tokens ->", cut)
print("vocab sizes:", c.n_vocab, o.n_vocab)
