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.1.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.1-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: affix_tree-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 cb547ba6983bf9ca2e4c0c78ade30ea6ff8bdad66dacbe4d3b9610731c74bcf1
MD5 baee032824689f0463a55aaffcf1f7e0
BLAKE2b-256 8cdccfb1bbaca4bed1221afd1bd80c645f944248b502d2b13cc61e362f0a98bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: affix_tree-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4f076d0a0d2739c406e9eff41cec7042359cc1201b17dea6d10461c9c5ffd218
MD5 fc46a04598e2a45c16fe13ecaff6742f
BLAKE2b-256 6ac6c566de2487c5b2c4ec2649f956e0a26e044d8ad45f5abe3322ec186d058a

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