New problem requiring solution and probably it is of interest to other KNIME users as well.
I have a workflow which to the above of its main task allows translation of the text with the use of Google Translate API.
Google Translate has a limit on the size of the text it translates by API, so I made a Loop which is sending the text with a limited number of characters. After I made several mistakes, e.g. it appeared that Chinese characters must be treated as two characters not like one and the text in Chinese must be 2 times shorter then in European or Arabic, I made a workflow which works almost fine. I was happy but it was a fullish happiness – I cut the text no matter boundaries of words, so mistakes appear in translation. Not too often in fact, but they are boring.
So, the question:
How to split the text with the loop to have no more then like 1000 characters to process, but in case this 1000 splits a word in half, process only the text till the end of the last complete word? Yes, obviously the next request should start not with the 1001 character but with a character following the last translated word.
Sorry for long and not very clear explanation – even in my native language it sounds a bit strange, but I hope you understand me.
Have a great day!