Skip to main content

Poe[Trie]s

Description

Poetries provides a thread-safe implementation of a Trie. While not limited, but the most common use case of a Trie is in implementing auto-completion. The collection type exposes APIs to perform the following operationsadd, find and get_all_words_with_prefix.

Dependencies

Python 3

Installation

pip install --upgrade poetries

Usage

from poetries.trie import Trie


trie = Trie()
trie.add('foobar')              # Adds 'foobar' to the trie
trie.find('foo')                # Returns False since the word is not present.
trie.add('bar')                 # Adds 'bar' to the trie
trie.find('bar')                # Returns True
trie.add('foob')                # Adds 'foob' to the trie
trie.add('foof')                # Adds 'foof' to the trie
arr = list(trie.prefix('foo'))  # Returns the list of words beginning with foo in a list form, ['foobar', 'foo', 'foob', 'foof']

License

MIT

Changelog

Download files

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

Source Distribution

poetries-1.0.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poetries-1.0.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file poetries-1.0.0.tar.gz.

File metadata

  • Download URL: poetries-1.0.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for poetries-1.0.0.tar.gz
Algorithm Hash digest
SHA256 667924709cc7bb66e0fee6152094cb1988812323b3ca6726a04a963dc1529bf7
MD5 ec77b67837426064c48cf07625c3ded2
BLAKE2b-256 c0b9d5f50d57cd1a1b1d89131c9755cbb4955be69cfb2873beb905c6117d8e0b

See more details on using hashes here.

File details

Details for the file poetries-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: poetries-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for poetries-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 316dbb5004194fbbd21e03f93a756bcba842bcc30deedd4a911dcc7f5392ab08
MD5 51b7ba1c5776401bc58fe75463832f6b
BLAKE2b-256 e70b3b217ecccb3a21792006a1cabdfa0acbe01849247a3d3459eb8ef7daf236

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page