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,
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
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
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
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()
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
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
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
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...
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()
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')
11 matches
Mail list logo