This release is a pre-release and may not be stable for production use.
Sequence Tokenizer (seqtok)
A Python implementation mimicking C's strtok() behavior for generic sequences, but without global state.
Features
- Splits any sequence type (lists, tuples, strings) using separator elements
- Memory efficient (yields tokens one at a time)
- Follows C's
strtok()conventions:- Skips leading/trailing separators
- Treats consecutive separators as single delimiter
- Never returns empty tokens
- But with crucial differences:
- State is encapsulated in the generator instance (no global state)
- No thread safety concerns from global state
- Each iterator maintains independent state (safe for separate instances)
- Multiple tokenizers can operate simultaneously
- Original sequence is never modified
- Immutable tokens via COWList (Copy-On-Write List)
- State is encapsulated in the generator instance (no global state)
Installation
pip install seqtok
Examples
from seqtok import seqtok
# Tokenize a list of numbers
numbers = [1, 2, 0, 3, 4, 0, 0, 5]
for token in seqtok(numbers, {0}):
print(token)
# Output: COWList([1, 2])
# COWList([3, 4])
# COWList([5])
# Tokenize a string
text = "..Hello...world.!"
for token in seqtok(text, {'.', '!'}):
print(''.join(token))
# Output: Hello
# world
Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
This project is licensed under the MIT License.
Metadata
Release files for seqtok 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| seqtok-0.1.0a1.tar.gz | 3.3 kB | Without provenance | Details for seqtok-0.1.0a1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| seqtok-0.1.0a1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for seqtok-0.1.0a1-py2.py3-none-any.whl |
Total release size: 7.0 kB
Release files / seqtok-0.1.0a1.tar.gz
| Download URL | seqtok-0.1.0a1.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c51bb4f9683096c66f3f765c9ab97f828ede5d875c48df4ae2fdda1555b2c024
|
|
BLAKE2b-256 checksum How to use checksums |
b1056564770f57a857e8bbeef1481db46f2cef2011cec80a12d3faf5e72f75cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Release files / seqtok-0.1.0a1-py2.py3-none-any.whl
| Download URL | seqtok-0.1.0a1-py2.py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
fbe5dc5a332a96f88a6944f826bf466a528f835f701a7f6e92e1e2311cd895a2
|
|
BLAKE2b-256 checksum How to use checksums |
a1dbc57efa4cc2d29f7225acc793ac3fea2254c22012398830bb060a4f038a79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Security for seqtok 0.1.0a1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.