Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

taptoken-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file taptoken-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: taptoken-0.1.0-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

Hashes for taptoken-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 820e27998523c680aaebad196dee540afdfffb21212c1713a3f635582cf10c50
MD5 79280b678419d320e7b1030e83bf9e43
BLAKE2b-256 d266aeebc53757a43d4584066d48586792c6affa3bc152fa627426b77977a4ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for taptoken-0.1.0-py3-none-any.whl:

Publisher: publish.yml on fechad/TSTokenizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page