Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

General Purpose Trie Data Structure in Python

Project description

pythontrie : Python Implementation of Trie Data Structure

image License

image

pythontrie includes sweet implementation of our favourite data structure trie in python.

Usage:

>>> from pythontrie import trie
>>> sample_trie = trie()
>>> sample_strings = ['heyy', 'heyay', 'heyey', 'hyyy', 'yoyo', 'heeyy', 'hoeyy']
>>> for sample_string in sample_strings:
>>>     sample_trie.insert(sample_string)

Then printing suggestions is as simple as:

>>> print(sample_trie.suggestions(prefix='he')
['heyy', heyay', heyey', 'heeyy']

Current Features

  • Adding arbitrary strings into trie
  • Searching for suggestion using prefix
  • Search whether any string is present in trie or not

pythontrie right now supports all python versions

Installation

To install pythontrie, simply use all time favorite pip and type :

$ pip install pythontrie
✨🍰✨

Documentation

Coming Soon.

How to Contribute

  1. Initial plan is to integrate all necessary functionality that trie can offer into this library so that it can act as one place shot for everyone who is playing with trie.
  2. Please propose and feel free to raise an issue and submit a PR for some sensible feature. Try to elaborate the the area where this feature would be applicable so that all of us can be enlightened :).
  3. I am planning to integrate research work done on tries into this library as well so that it can provide advanced functionalities with tight algorithmic complexity bounds. Please feel free to share any paper.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pythontrie, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size pythontrie-0.3-py3-none-any.whl (7.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pythontrie-0.3.tar.gz (6.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page