I have a doubt how the code for word segmentation will be able to segment the given example:
Input : thequickbrownfoxjumpsoverthelazydog
Output : the quick brown fox jumps over the lazy dog
because, in outer loop "j" is iterating from 0 to "input.length" and in inner loop "i" is varying from 1 to "imax"
assuming maxSegmentationWordLength is large enough and imax is alwayas taking the value (input.length - j)
so, as j is increasing imax is decreasing and the scope of substring that we take i.e. "part" will reduce. so, my concerns are
the moment j crosses (input.length / 2), "i" would always be smaller than j and "part" substring would make no sense as we are taking part = input.Substring(j, i) and j > i
other concern is strings that are at the other half of the middle index will not get segmented because they will never be assigned to "part" because of the above concern.
So, how would we be able to segment complete string.
I have not implemented the actual C# code, but wrote a python2 implementation of the same, and facing functional issues, which i have described above.
https://github.com/wolfgarbe/SymSpell/blob/8b71ac07dd64e1c9a70c12ab21c83dec6f904b80/SymSpell/SymSpell.cs#L963
I have a doubt how the code for word segmentation will be able to segment the given example:
Input : thequickbrownfoxjumpsoverthelazydog Output : the quick brown fox jumps over the lazy dog
because, in outer loop "j" is iterating from 0 to "input.length" and in inner loop "i" is varying from 1 to "imax" assuming maxSegmentationWordLength is large enough and imax is alwayas taking the value (input.length - j) so, as j is increasing imax is decreasing and the scope of substring that we take i.e. "part" will reduce. so, my concerns are
Please assist here. Thanks a lot.