Skip to main content

A trie-like data structure that allows storing and searching data based on the longest matching prefix or suffix of a given string.

Project description

affix-tree

A trie-like data structure that allows storing and searching data based on the longest matching prefix or suffix of a given string.

Installation

pip install affix-tree

Usage

As a prefix tree

>>> from affix_tree import AffixTree

>>> prefix_tree: AffixTree[int] = AffixTree()
>>> prefix_tree.add('prefix', 1)
>>> prefix_tree.add('prefix-2', 2)

>>> prefix_tree.find('prefix-2-test')

2

As a suffix tree

>>> from affix_tree import AffixTree

>>> prefix_tree: AffixTree[int] = AffixTree(is_suffix_tree=True)
>>> prefix_tree.add('suffix', 1)
>>> prefix_tree.add('2-suffix', 2)

>>> prefix_tree.find('test-2-suffix')

2

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

affix_tree-0.1.0.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

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

affix_tree-0.1.0-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file affix_tree-0.1.0.tar.gz.

File metadata

  • Download URL: affix_tree-0.1.0.tar.gz
  • Upload date:
  • Size: 1.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.0 Darwin/24.3.0

File hashes

Hashes for affix_tree-0.1.0.tar.gz
Algorithm Hash digest
SHA256 85324f8af0d5ce812fa3edcd7da8c3444b8e74a758472d0907fcd5c20db86bfc
MD5 95753beedf55e57a68f1f98c28dca02e
BLAKE2b-256 cdabcf9a4861a9d8327ffe30cc9977e515e6298fbfc2a45d0bdcfd4214765cc0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: affix_tree-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.0 Darwin/24.3.0

File hashes

Hashes for affix_tree-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6029812d862eb355c85e5dca36c8ca50266668202581382ccbe3993607b14ac4
MD5 32471f0d1ddf7d95c3fba908c5382c1e
BLAKE2b-256 35cc3e03ef37e9aa1ee3452e14c7459e4956b49b51269708dd1f39e608b66163

See more details on using hashes here.

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