Readd the TextProcessor js function

I reupload it for save purpose, but the whole logic will be rewritten,

For now a much more simpler function is used to test the efficiency of the concurency state machine