Skip to main content

Simple Python Trie Data Structure

Project description

TriePy
===========

A simple trie implementation in Python

This implementation utilizes a dictionary as its backing
data structure. Essentially, it is creating nested dictionaries.


Example
----------
>>> from trie import TriePy
>>> t = TriePy()
>>> t.add_word("dog")
>>> t.add_word("doggy")
>>> t.add_word("dogs")
>>> t.contains_word("dog")
True
>>> t.contains_word("dogg")
False
>>> t.root
{'d': {'o': {'g': {'\0': {'word': 'dog'}, 's': {'\0': {'word': 'dogs'}}, 'g': {'y': {'\0': {'word': 'doggy'}}}}}}}


Unit Testing
----------
nose is used for unit testing and simple unit tests
can be run with the following in the source trie directory:
`nosetests`


Installation
----------
You can install this as usual with `setup.py`.
`python setup.py install`

You can also install this via pip.
`pip install TriePy`

The usual "use virtualenv to test first" warnings apply.

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

TriePy-0.2.1.tar.gz (2.8 kB view details)

Uploaded Source

File details

Details for the file TriePy-0.2.1.tar.gz.

File metadata

  • Download URL: TriePy-0.2.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for TriePy-0.2.1.tar.gz
Algorithm Hash digest
SHA256 50bd20249a96367f7fbce62d84d2af439c9581c884925a8441d380a55c7960c1
MD5 8288e1b9f99fac462915ef2849717e74
BLAKE2b-256 f89e98b8d0d70b561611f35142bee009185a1bcba7999cba06c1f66974b49880

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page