Time series tokenization and detokenization library using tapper patterns.
Project description
TSTokenizer
Time series tokenization library. Converts numeric sequences into discrete tokens composed of a spatial pattern (a tapper-pattern ID on a 5×5 grid) and a magnitude vector (absolute deltas, optionally log-scaled).
Installation
pip install taptoken
From source:
git clone https://github.com/fechad/TSTokenizer.git
cd TSTokenizer
pip install -e .
Quick start
from taptoken import tokenize, detokenize
series = [10.0, 12.5, 11.0, 14.0, 13.5, 16.0, 15.0]
tokens = tokenize(series)
# → [(pattern_id, [bias, delta, delta, ...]), ...]
reconstructed = detokenize(tokens, expected_length=len(series))
API
tokenize(values, vocabulary_type="base10", use_log_scale=True)
| Parameter | Type | Description |
|---|---|---|
values |
list[float] |
Input time series |
vocabulary_type |
"base10" | "base6" |
Key type for pattern IDs (int vs str) |
use_log_scale |
bool |
Apply log1p to magnitude deltas |
Returns list[tuple[pattern_id, list[float]]].
detokenize(tokens, vocabulary_type="base10", use_log_scale=True, overlap_size=1, expected_length=None)
| Parameter | Type | Description |
|---|---|---|
tokens |
output of tokenize |
Token list to reconstruct |
vocabulary_type |
"base10" | "base6" |
Must match the value used in tokenize |
use_log_scale |
bool |
Must match the value used in tokenize |
overlap_size |
int |
Overlap between chunks (default 1, matches encoder) |
expected_length |
int | None |
Trim output to this length |
Returns list[float].
Vocabulary types
| Type | Pattern ID | Example key |
|---|---|---|
base10 |
int |
42 |
base6 |
str |
"01215" |
Both vocabularies encode the same set of tapper patterns; only the key format differs.
Development
pip install -e .
pytest tests/test_taptoken.py -v
Publishing a new version is handled by the Publish to PyPI GitHub Actions workflow (workflow_dispatch). Select a version bump (patch / minor / major / skip) and the workflow bumps, builds, and uploads automatically. Requires a PYPI_API_TOKEN repository secret.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file taptoken-0.1.1.tar.gz.
File metadata
- Download URL: taptoken-0.1.1.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48a58dc341e23bb3c45369c4b4d7b10f779ae86a12a63b4968c1a222fd40960f
|
|
| MD5 |
ffdf0cb3c9a42d3eb8ccfde4476371bc
|
|
| BLAKE2b-256 |
91a87b9e36e392b8632bcbb2c4528635f024642c33c93ab6883f74eb8137756f
|
Provenance
The following attestation bundles were made for taptoken-0.1.1.tar.gz:
Publisher:
publish.yml on fechad/TSTokenizer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
taptoken-0.1.1.tar.gz -
Subject digest:
48a58dc341e23bb3c45369c4b4d7b10f779ae86a12a63b4968c1a222fd40960f - Sigstore transparency entry: 1799546933
- Sigstore integration time:
-
Permalink:
fechad/TSTokenizer@d742d97b54d245a7ba1fd768c86049802b1bef79 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/fechad
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d742d97b54d245a7ba1fd768c86049802b1bef79 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file taptoken-0.1.1-py3-none-any.whl.
File metadata
- Download URL: taptoken-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bf5e1b873549fb871a3d2186c6b28953f62d2587513cc422d0d09a1f7aea5cf
|
|
| MD5 |
1cfdf517a3a0d70e3d6440fa921fa9f9
|
|
| BLAKE2b-256 |
4374acf5adc0330cdd3d43b9359e8582d3f630d11e7e9065f2b8e5119d2f29ac
|
Provenance
The following attestation bundles were made for taptoken-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on fechad/TSTokenizer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
taptoken-0.1.1-py3-none-any.whl -
Subject digest:
9bf5e1b873549fb871a3d2186c6b28953f62d2587513cc422d0d09a1f7aea5cf - Sigstore transparency entry: 1799547059
- Sigstore integration time:
-
Permalink:
fechad/TSTokenizer@d742d97b54d245a7ba1fd768c86049802b1bef79 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/fechad
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d742d97b54d245a7ba1fd768c86049802b1bef79 -
Trigger Event:
workflow_dispatch
-
Statement type: