🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

pythontrie

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pythontrie

General Purpose Trie Data Structure in Python

0.3
Maintainers
1

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

  • 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.
  • 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 :).
  • 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.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts