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
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
affix_tree-0.1.0.tar.gz
(1.8 kB
view details)
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85324f8af0d5ce812fa3edcd7da8c3444b8e74a758472d0907fcd5c20db86bfc
|
|
| MD5 |
95753beedf55e57a68f1f98c28dca02e
|
|
| BLAKE2b-256 |
cdabcf9a4861a9d8327ffe30cc9977e515e6298fbfc2a45d0bdcfd4214765cc0
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6029812d862eb355c85e5dca36c8ca50266668202581382ccbe3993607b14ac4
|
|
| MD5 |
32471f0d1ddf7d95c3fba908c5382c1e
|
|
| BLAKE2b-256 |
35cc3e03ef37e9aa1ee3452e14c7459e4956b49b51269708dd1f39e608b66163
|