Re: best way to align words?

2006-12-03 Thread Robert R.
Oleg Batrashev a écrit : 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. it can be few to many,

Re: best way to align words?

2006-12-02 Thread Robert R.
Hello, thanks for all your replies, i'm now looking to dynamic programming... sorry for forgetting to say that i wanted the words to be ordered, thus : s1 = hello there dudes s2 = dudes hello there s3 = there dudes hello will not return anything while sharing all three words. Bearophile your

Re: best way to align words?

2006-12-02 Thread Oleg Batrashev
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

best way to align words?

2006-11-30 Thread Robert R.
Hello, 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 s0 = this is an example of a thing i would like to have.split() s1 = another example of something else i would like to have.split() s2 = 'and this is another

Re: best way to align words?

2006-11-30 Thread Thomas Ploch
Robert R. schrieb: Hello, 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 s0 = this is an example of a thing i would like to have.split() s1 = another example of something else i would like to have.split()

Re: best way to align words?

2006-11-30 Thread Mitja Trampus
Robert R. wrote: Hello, 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 a trouble i have if when having many different strings my results tend to be nothing while i still would like to have one of the, or

Re: best way to align words?

2006-11-30 Thread Oleg Batrashev
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

Re: best way to align words?

2006-11-30 Thread bearophileHUGS
Robert R.: 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 [...] a trouble i have if when having many different strings my results tend to be nothing while i still would like to have one of the, or maybe, all

Re: best way to align words?

2006-11-30 Thread bearophileHUGS
This is my first solution try, surely there are faster, shorter, better solutions... It creates a graph with the paths of words, then sorts the graph topologically, Beside possible inefficiencies, this solution breaks if words aren't in the correct order, the topological sort can't work...

Re: best way to align words?

2006-11-30 Thread Noah Rawlins
Robert R. wrote: Hello, 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 s0 = this is an example of a thing i would like to have.split() s1 = another example of something else i would like to have.split()

Re: best way to align words?

2006-11-30 Thread Noah Rawlins
Noah Rawlins wrote: strList = [] strList.append('this is an example of a thing i would like to have') strList.append('another example of something else i would like to have') strList.append('and this is another example but of something ; now i would still like to have')