Skip to main content

Introduction

This is a Suffix Tree data structure lib implemented in C++, wrapped with python.

Expect for contructing the tree, this lib also provides to construct the query tree for speeding up querying strings.

Install and Build

Install from Pypi

run pip install csuffixtree

Build

You can build this either on linux or windows.

Install Python Package

  1. Build SuffixTreePyBinding solution in Windows
  2. On linux you should go to linux directory, and run make python
  3. under SuffixTreePy directory. run python setup.py install

How to use

You can construct a suffix tree in the following way.

from suffixtree import *
tree = SuffixTree(True,["abc","123","321"])
tree.addStrings(["xyz","abcd"])
print(tree.findString("1"))
print(tree.findString("a"))

If you finished inserting strings to a suffix tree, and you want the querying be very fast you can do:

# convert tree to query tree, this release a part of memory
qtree = tree.createQueryTree()
qtree.cacheNodes() # take some time to cache intermediate nodes
qtree.findString("a")

For simplicity you can also write

# do not preserve string
qtree = SuffixQueryTree(False,["abc","abcd","123","321"])
idx = qtree.findStringIdx("abc") # you cannot use findString now
print(idx)

Serialization

SuffixQueryTree can be serialized and deserialized to/from a file a bytes object. For example:

# do not preserve string
qtree = SuffixQueryTree(False,["abc","abcd","123","321"])
idx = qtree.findStringIdx("abc") # you cannot use findString now
print(idx)

Metadata

Release files for csuffixtree 0.3.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for csuffixtree 0.3.6
File Size Uploaded Provenance Actions
csuffixtree-0.3.6.tar.gz 8.2 kB Without provenance Details for csuffixtree-0.3.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for csuffixtree 0.3.6
File Interpreter ABI Platform Actions
csuffixtree-0.3.6-py3-none-any.whl Python 3 none any Details for csuffixtree-0.3.6-py3-none-any.whl

Total release size: 148.2 kB

Release files / csuffixtree-0.3.6.tar.gz

Download URL csuffixtree-0.3.6.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6e340a8a987bca601d6d177e245b63011bd55bef22401a3e320129cd9915eb11
BLAKE2b-256 checksum
How to use checksums
23ca5398b1241f1522c10cf2d599286479d37e0d0678d5ccbea41ea963adeefd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

Release files / csuffixtree-0.3.6-py3-none-any.whl

Download URL csuffixtree-0.3.6-py3-none-any.whl
Size 140.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f2ea3e969cce7e75242f4209ca567777bf1ed62ab76b659e182ca46d7d91867f
BLAKE2b-256 checksum
How to use checksums
e291cada31e06a10eedf3d8ae386dac712bdf8a40ba2a1f9fbe1748df005a2cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

Security for csuffixtree 0.3.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page