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 Distribution

taptoken-0.1.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

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

Hashes for taptoken-0.1.1.tar.gz
Algorithm Hash digest
SHA256 48a58dc341e23bb3c45369c4b4d7b10f779ae86a12a63b4968c1a222fd40960f
MD5 ffdf0cb3c9a42d3eb8ccfde4476371bc
BLAKE2b-256 91a87b9e36e392b8632bcbb2c4528635f024642c33c93ab6883f74eb8137756f

See more details on using hashes here.

Provenance

The following attestation bundles were made for taptoken-0.1.1.tar.gz:

Publisher: publish.yml on fechad/TSTokenizer

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

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

Hashes for taptoken-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9bf5e1b873549fb871a3d2186c6b28953f62d2587513cc422d0d09a1f7aea5cf
MD5 1cfdf517a3a0d70e3d6440fa921fa9f9
BLAKE2b-256 4374acf5adc0330cdd3d43b9359e8582d3f630d11e7e9065f2b8e5119d2f29ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for taptoken-0.1.1-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