How jackstanton6/alice_tokenizer works
alice_tokenizer is a Python byte-pair tokenizer with two main workflows: build a vocabulary from a text file, then encode, decode, and visualize text through the Python API or interactive CLI. Training handles optional GPT-2-style pretokenization and vocabulary saving; the CLI also offers help and sample tests. The source index identifies the built-in vocabulary as a substantial core module, but it was not excerpted, so its internal structure and loading details are not expanded here.
Main entry points: tokenisation.py Tokenizer · terminal.py Interactive terminal · train_tokeniser.py BPE training · main.py CLI entry point
Components 11
Vocabulary building
- BPE training
src/alice_tokenizer/train_tokeniser.py - Training text
- Saved vocabulary
Tokenization runtime
- Public API
src/alice_tokenizer/__init__.py - Tokenizer
src/alice_tokenizer/tokenisation.py
Interactive CLI
- Interactive terminal
src/alice_tokenizer/cli/terminal.py - CLI entry point
src/alice_tokenizer/cli/main.py
Tokenizer resources
- Built-in vocabulary
src/alice_tokenizer/util/vocab.py - Logo
src/alice_tokenizer/util/logo.py - CLI help text
src/alice_tokenizer/util/helpfile.py
Other components
- Python or CLI user
Connections 14
- Python or CLI user → Public API: calls
README.md - Public API → Tokenizer: exports
src/alice_tokenizer/__init__.py - Python or CLI user → CLI entry point: runs
README.md - CLI entry point → Interactive terminal: starts
src/alice_tokenizer/cli/main.py - CLI entry point → Tokenizer: configures
src/alice_tokenizer/cli/main.py - Interactive terminal → Tokenizer: invokes
src/alice_tokenizer/cli/terminal.py - Interactive terminal → CLI help text: prints
src/alice_tokenizer/cli/terminal.py - Interactive terminal → Logo: prints
src/alice_tokenizer/cli/terminal.py - Python or CLI user → Training text: provides
README.md - Tokenizer → Training text: reads
README.md - Tokenizer → BPE training: delegates training
src/alice_tokenizer/tokenisation.py - BPE training → Saved vocabulary: writes
README.md - Tokenizer → Built-in vocabulary: loads
src/alice_tokenizer/tokenisation.py - BPE training → Built-in vocabulary: builds merges