I have a problem at hand where I have to find all repeating patterns that exist inside a sentence.
Example : 'camel horse game camel horse gym camel horse game' # This is the sanitized string as I will cleanup anything other than words before it.
['camel horse game', 0, 3, 6] # pattern and Index where it is repeated
['camel horse', 0, 3, 6] # Another pattern, let it be a substring of the previous pattern
Suffix tree is a good solution, But I am unable to understand that how to implement it for WORDS instead of letters/characters ?
Using standard Duplicate Substringss solution
will not work as it will find patterns with chipped/half words. -> 'camel horse', 'amel hor' .... 'am h'
Which will not be of any use practically.
Thanks in advance.