-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME
33 lines (26 loc) · 1.04 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
=============
CharTrie
=============
This is pure-C version of Trie data structure: http://en.wikipedia.org/wiki/Trie ,
also called "prefix tree", optimized for string keys and int values.
The current interface is the following::
class CharTrie:
def __len__(self)
def __getitem__(self, key)
def __setitem__(self, key, value)
def dumps(self)
def debug_print(self)
def find(self, key)
class FrozenCharTrie:
def __len__(self)
def __getitem__(self, key)
def loads(self, stream)
def debug_print(self)
def find(self, key) # -> value or None
def find_prefixes(trie, key) # -> [(position1, value1), (position2, value2), ...]
def find_splits(self, FrozenCharTrie suffixes, key) # -> [(position1, prefix1, suffix1), (position2, prefix2, suffix2), ...]
Please note, that len(x) returns the number of chars in the trie, not the number of nodes with values.
Also, only values >= 0 are supported (until version 0.2)
------------
Licence: BSD
------------