Given a n-gram word I want to get the consecutive substrings patterns from 'start to end' and 'end to start'.
For example, for the 4-gram computer supported machine translation
I should get the following substrings.
- from start to end:
computer supported
,computer supported machine
- from end to start:
machine translation
,supported machine translation
for the 3-gram natural language processing
, I should get natural language
and language processing
.
I have really large n-grams, so I am interested in knowing the quickest way of doing this!