1

I'm looking for suffix tree implementation having this friendly API that mimics python dictionary:

import SubstringDict
d = SubstringDict.SubstringDict()
d['foobar'] = 1  
d['barfoo'] = 2
d['forget'] = 3
d['arfbag'] = 4
d['a']
>>> [1, 2, 4]
d['arf']
>>> [2, 4]
d['oo']
>>> [1, 2]
d['food']
>>> []

I took this example from this website: Suffix Trees in Python You may ask: "Why don't you use the implementation from the website?" Well, apparently it has some memory leaks in python bindings so I can't using it with my large (1.2 million strings, about 200 MB) data set.

I would be even happy with C++ implementation (I can write python bindings on my own) with the following API:

SuffixTree<int> sf = SuffixTrie<int>();
sf['foobar'] = 1;
sf['barfoo'] = 2;
sf['forget'] = 3;

assetTrue(sf.find('a')==std::vector<int>({1,2}))

Any hints?

The Unfun Cat
  • 29,987
  • 31
  • 114
  • 156
mnowotka
  • 16,430
  • 18
  • 88
  • 134
  • Something looks wrong in your example code, `>>>` in the wrong place maybe? – aquavitae Nov 21 '12 at 10:12
  • 1
    @aquavitae: Each `>>>` line above is the result of the previous instruction. It's been added to precisely the wrong lines to represent a Python interactive session. – Steve Jessop Nov 21 '12 at 10:44
  • @SteveJessop: Yes, that's what I meant. – aquavitae Nov 21 '12 at 10:54
  • Is [this](http://stackoverflow.com/questions/8996137/suffix-tree-implementation-in-python) something? – RickyA Nov 21 '12 at 11:03
  • @RickyA - no, definitely not. I know this related answers, I went through all libraries listed there and there is nothing really good (stable, scaling, with well defined API) there. – mnowotka Nov 21 '12 at 11:19
  • @aquavitae - if you like to point that sort of things (complain about my convention everyone else understands), please go somewhere else. – mnowotka Nov 21 '12 at 11:22
  • Ok,ok sorry.... Dont kill me please. – RickyA Nov 21 '12 at 11:28

0 Answers0