-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Needs find-longest key method #14
Comments
Not sure if I want the same thing, but it sounds like it - given
|
I'm not sure if this is possible using the public API of |
When I originally posted that, I for some reason didn't realize 'prefixes' returned them in order (duh), so what I needed was basically already implemented satisfactorily. What you stuaxo want is something else. I'm not completely sure what you want though... |
In the end, I implemented this using a different library, + what I needed turned out to be slightly different - I needed something like this: t = Trie([u'some.long.name', u'some.short.name']) t.longest_unique_prefixes()
u['some.'] t = Trie([u'some.long.name', u'some.short.name', 'blah.1', 'blah.2']) t.longest_unique_prefixes()
u['some.', 'blah.'] |
^ I guess what I |
Or we could just call it a "longest" method - or "prefix" method (singular). Is there an efficient way to find the longest key that is a prefix of a string that I'm overlooking? It could be done with the current implementation by simply using prefixes, then finding the longest match, but there should be a much more efficient way possible by taking advantage of the Trie properties.
I can give it a go if you like - unless it's already implemented and I'm simply missing it.
The text was updated successfully, but these errors were encountered: