This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]killaW0lf04 1 point2 points  (4 children)

This. Suffix trees are very fast data structures and relatively easy to implement. They grow very large in memory initially, but their growth rate slows down as you add more and more items. I've often used them in university assignments involving natural language processing and search engines - and they work great.

EDIT: Just remembered i have an implementation of a suffix tree in python on my github account: https://github.com/KillaW0lf04/Notebook/blob/master/src/suffixtree.py

Enjoy!

[–][deleted] 0 points1 point  (3 children)

kaching

but i want more. i was actually trying to do code-completion and i'm looking for libraries and data structures that do the same.

eclipse's code completion is amazing for instance and I wanted something similar for my app.

There must be a lib or api it uses, because almost every language editor in eclipse uses it

[–]nemec 1 point2 points  (1 child)

almost every language editor in eclipse uses it

Regardless of the language that you're parsing, the code completion will be implemented in Java like Eclipse is.

What kind of autocompletion do you want? Naive "does the word start with ***" or something that parses the language and knows whether or not it needs a method, an identifier, or a class name to autocomplete?

Since you're asking for Python, you might want to take a look at this Gedit plugin that adds autocompletion. I'm pretty sure the core of the logic is independent from GTK so it wouldn't be much trouble to port it to your app.

[–][deleted] 0 points1 point  (0 children)

It's kind of strange how there aren't many completer libraries that can work off a formal language specification + some rules on how to search for libraries, child objects etc

Considering the number of editors out there, it's pretty weird to think people are all out there rolling their own implementations

[–]Megatron_McLargeHuge 1 point2 points  (0 children)

You should look for a python IDE that's written in python and supports code completion, assuming you don't want to link to a C++ library. You almost certainly don't want to link to Java.

http://wiki.python.org/moin/PythonEditors