I am having some difficulty writing a function in python for analyzing sequences of strings found in a list of strings. This function will take as input an integer of n and an ordered list of strings, and will later output a forest of trees representing unique sequences of strings of length n (except for perhaps the last sequence).
I am not quite sure how to approach implementing this function. Any advice or resources I could refer to would be much appreciated.
Edit:
Consider the following example
strings = ['Hello', 'Tim', 'Fish', 'Fish', 'Hello', 'Tim', 'Fish']
Then the build_forest(strings, 3) would produce a forest following structure:
Hello
| ___ Tim ___ Fish
Tim
| ___ Fish ___ Fish
Fish
| ___ Fish ___ Hello
| ___ Hello ___ Tim