Giter VIP home page Giter VIP logo

tst-1's Introduction

TST - Ternary Search Trie

A fast implementation of TST in Python. Supports flexible java glob style maching on the trie. The interface is the standard dictionary interface, so you can use these wherever you are using dictionaries. These symbol tables are as fast (or a little faster) as Python dict's on insert and little slower (1 order of magnatude) on read.

Install

via pip

pip install -e git://github.com/timtadh/tst.git#egg=tst

keeping up to date

pip install --upgrade -e git://github.com/timtadh/tst.git#egg=tst

##Usage

>>> from tst import TST
>>>
>>> t = TST()
>>> t['asdf'] = object()
>>> t
{'asdf': <object object at 0x7f659d869090>}
>>>
>>> d = {"x": 12, "y" :324, "asdf": 23423}
>>> t.update(d)
>>> t
{'y': 324, 'x': 12, 'asdf': 23423}
>>> dict(t)
{'y': 324, 'x': 12, 'asdf': 23423}
>>> type(t)
<class 'tst.TST'>
>>> type(dict(t))
<type 'dict'>

It supports a find interface but it is currently too slow to use. This is the experimental section.

>>> t.find('a*')
<generator object find at 0x7f659d897910>
>>> dict(t.find('a*'))
{'asdf': 23423}
>>>

tst-1's People

Contributors

timtadh avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.