# Using recursive loop

Using Recursing loop

Hi everybody !

I’m new in Knime and I can’t find the solution for one of my manipulation.

I have a tablesheet with strings of word :

 billet maniel dorin revue presse Augustin

etc

I split it into columns in order to get :

 billet maniel dorin revue presse augustin

Now, I would like to create combinations of words for each row taking into account the order of words for example :

• For row 1 combinations are:

 billet maniel billet dorin maniel dorin

In order to do that I thought about a method but I can’t find the nodes to do this:

1. I want to index my words

 billet maniel dorin 1 2 3

2.  Then, I thought about creating a loop that does pairs of words : if I call my variable “i” = my columns

I would like to do pairs by doing : for i = 1 to n-1  (n = maximal number of words, see indexation)

For j = i+1 to n

Do  i+J   (in a new columns a part)

3. Finally, I want to create other words combination with more than 2 words (pairs) . In order to do that, I would use my new pairs of words for example :

 billet maniel billet dorin maniel dorin

And concatenate with the word which index is higher than the last indexed word in my pairs . The result could be :

 Words combinations billet maniel dorin billet dorin maniel dorin Indexation for each word 1 2 3 1 3 1 3

I would like do a loop to do this manipulation with pairs but also with my new combinations of 3 words etc

Is there any suggestion, even a part of a solution for this problem ?
If you need me to give more details about it, do not hesitate to ask.

Thanks a lot !

JLoup

Hi,

please don't start multiple threads on the same question. There were four threads with the same question.

I would suggest constructing a Java Snippet for this task. I don't know how many cases you have, but a Java Snippet will be faster than doing multiple encapsulated loops.

About the loops, would you mind sharing your initial workflow? Than I can repair it for you!

Cheers, Iris