Re: best way to align words?
> i would like to write a piece of code to help me to align some sequence > of words and suggest me the ordered common subwords of them Im not sure what you want, but in case you are guy who knows how quicksort and Djikstra algorithms work :) and wants to find out more. There are many algorithms out there, discovered on "Text algorithms" univesity course. The first one does not directly solve your problem - "edit distance" (Levenshtein distance) http://en.wikipedia.org/wiki/Levenshtein_distance I mention it here only because it is simple and shows basic idea of Dynamic Programming http://en.wikipedia.org/wiki/Dynamic_programming If you scroll down you'll see "Longest common subsequence problem" with implementation in Python for 2 sequences. If you dont understand how it works just look into "edit distance" idea and see it is exactly the same algorithm with changed rules. Oleg -- http://mail.python.org/mailman/listinfo/python-list
Re: best way to align words?
> thanks for all your replies, i'm now looking to dynamic programming... Id better warn you before you go further. "Notice that LCS is often defined to be finding all common subsequences of a maximum length. This problem inherently has higher complexity, as the number of such subsequences is exponential in the worst case" This means that if you have 10 sentences with 5 words in each there is 5^10 space and time complexity. Definitelly, there are better algorithms from dynamic programming, but you should review your needs: how many sentences, words you have. There can be easier way than dynamic programming. Oleg -- http://mail.python.org/mailman/listinfo/python-list
Re: merits of Lisp vs Python
Mark Tarver wrote: > How do you compare Python to Lisp? What specific advantages do you > think that one has over the other? > > Note I'm not a Python person and I have no axes to grind here. This is > just a question for my general education. > > Mark Im myself python programmer with C,C++,Java,Fortran background and also quite limited knowledge of Haskel, Lisp,Tcl,... . Im confused with most python answers like triple doublequotes. For me python is 'strong OOP' scripting language in first place. Inheritance, generalization and every kind of abstractions togeteher with clean and simple syntax make python perfect language for medium size "scripting" projects (ie just explore the code and add your features, no messing with compilers). Exceptions, finally/except blocks, automatic reference counts and destructors make it easy to write "robust" code. Packaging system and libraries are just fine. So, python is just C++ combined with elegancy of Java and simplicity of scripting. Again, Im not Lisp programmer, so would like to here about mentioned features, do those things work as nicely, especially OOP ones? And IMHO paren misfeature is bad, although you claim it to has some advantages. Mostly, when I copy code in python I just need to call increase-left-margin emacs macro and there are no mentioned a+b*c problem. So, I imagine my typical 1-2 page, max 4-5 nested python function with great readabilty and almost no refactoring problems and I need to add 20*2 parens to make it homogenous. :) Oleg -- http://mail.python.org/mailman/listinfo/python-list
Re: building a GUI
On Sep 23, 5:21 pm, yadin <[EMAIL PROTECTED]> wrote: > if i were up to make a GUI chich are the advantages of choosing python > over matlab or java? Haven't seen any free visual layout program for swing, swing is somewhat messy - unnecessary complex layout classes. Compile - run cycle without visual layouting is pain. Swing look is unnatural, native looks are buggy. glade + pygtk works well for me (in linux). Oleg -- http://mail.python.org/mailman/listinfo/python-list